LibWeb: Relayout document on CharacterData data change

This can definitely be optimized to avoid full relayouts in many
situations, but for now let's just go for correctness.
This commit is contained in:
Andreas Kling 2021-02-10 18:32:16 +01:00
parent 29a2aac89a
commit 8743ea3149
Notes: sideshowbarker 2024-07-18 22:26:40 +09:00
2 changed files with 11 additions and 1 deletions

View file

@ -25,6 +25,7 @@
*/
#include <LibWeb/DOM/CharacterData.h>
#include <LibWeb/DOM/Document.h>
namespace Web::DOM {
@ -38,4 +39,13 @@ CharacterData::~CharacterData()
{
}
void CharacterData::set_data(String data)
{
if (m_data == data)
return;
m_data = move(data);
// FIXME: This is definitely too aggressive.
document().schedule_forced_layout();
}
}

View file

@ -41,7 +41,7 @@ public:
virtual ~CharacterData() override;
const String& data() const { return m_data; }
void set_data(const String& data) { m_data = data; }
void set_data(String);
unsigned length() const { return m_data.length(); }