mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 08:52:44 +00:00 
			
		
		
		
	 ad7e6878fe
			
		
	
	
		ad7e6878fe
		
	
	
	
	
		
			
			This makes them cheap to move around, since we can store them in a NonnullOwnPtr instead of memcopying 2584(!) bytes. Drastically reduces the chance of stack overflow while building the layout tree for deeply nested DOMs (since tree building was putting these things on the stack). This change also exposed a completely unnecessary ComputedValues deep copy in block layout.
		
			
				
	
	
		
			34 lines
		
	
	
	
		
			916 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
	
		
			916 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2018-2022, Andreas Kling <kling@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include <LibWeb/Layout/BlockContainer.h>
 | |
| #include <LibWeb/Painting/PaintableBox.h>
 | |
| 
 | |
| namespace Web::Layout {
 | |
| 
 | |
| BlockContainer::BlockContainer(DOM::Document& document, DOM::Node* node, NonnullRefPtr<CSS::StyleProperties> style)
 | |
|     : Box(document, node, move(style))
 | |
| {
 | |
| }
 | |
| 
 | |
| BlockContainer::BlockContainer(DOM::Document& document, DOM::Node* node, NonnullOwnPtr<CSS::ComputedValues> computed_values)
 | |
|     : Box(document, node, move(computed_values))
 | |
| {
 | |
| }
 | |
| 
 | |
| BlockContainer::~BlockContainer() = default;
 | |
| 
 | |
| Painting::PaintableWithLines const* BlockContainer::paintable_with_lines() const
 | |
| {
 | |
|     return static_cast<Painting::PaintableWithLines const*>(Box::paintable_box());
 | |
| }
 | |
| 
 | |
| JS::GCPtr<Painting::Paintable> BlockContainer::create_paintable() const
 | |
| {
 | |
|     return Painting::PaintableWithLines::create(*this);
 | |
| }
 | |
| 
 | |
| }
 |