mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 17:22:43 +00:00 
			
		
		
		
	 0264ae23bc
			
		
	
	
		0264ae23bc
		
	
	
	
	
		
			
			Instead of doing layout synchronously whenever something changes, we now use a basic event loop timer to defer and coalesce relayouts. If you did something that requires a relayout of the page, make sure to call Document::set_needs_layout() and it will get coalesced with all the other layout updates. There's lots of room for improvement here, but this already makes many web pages significantly snappier. :^) Also, note that this exposes a number of layout bugs where we have been relying on multiple relayouts to calculate the correct dimensions for things. Now that we only do a single layout in many cases, these kind of problems are much more noticeable. That should also make them easier to figure out and fix. :^)
		
			
				
	
	
		
			30 lines
		
	
	
	
		
			531 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
	
		
			531 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include <LibWeb/DOM/CharacterData.h>
 | |
| #include <LibWeb/DOM/Document.h>
 | |
| 
 | |
| namespace Web::DOM {
 | |
| 
 | |
| CharacterData::CharacterData(Document& document, NodeType type, const String& data)
 | |
|     : Node(document, type)
 | |
|     , m_data(data)
 | |
| {
 | |
| }
 | |
| 
 | |
| CharacterData::~CharacterData()
 | |
| {
 | |
| }
 | |
| 
 | |
| void CharacterData::set_data(String data)
 | |
| {
 | |
|     if (m_data == data)
 | |
|         return;
 | |
|     m_data = move(data);
 | |
|     set_needs_style_update(true);
 | |
| }
 | |
| 
 | |
| }
 |