mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-30 19:02:44 +00:00 
			
		
		
		
	 85a0772147
			
		
	
	
		85a0772147
		
	
	
	
	
		
			
			Until now, we've internally thought of the CSS "display" property as a single-value property. In practice, "display" is a much more complex property that comes in a number of configurations. The most interesting one is the two-part format that describes the outside and inside behavior of a box. Switching our own internal representation towards this model will allow for much cleaner abstractions around layout and the various formatting contexts. Note that we don't *parse* two-part "display" yet, this is only about changing the internal representation of the property. Spec: https://drafts.csswg.org/css-display
		
			
				
	
	
		
			33 lines
		
	
	
	
		
			761 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
	
		
			761 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2020, the SerenityOS developers.
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include <LibWeb/DOM/Document.h>
 | |
| #include <LibWeb/HTML/HTMLLabelElement.h>
 | |
| #include <LibWeb/Layout/Label.h>
 | |
| 
 | |
| namespace Web::HTML {
 | |
| 
 | |
| HTMLLabelElement::HTMLLabelElement(DOM::Document& document, QualifiedName qualified_name)
 | |
|     : HTMLElement(document, move(qualified_name))
 | |
| {
 | |
| }
 | |
| 
 | |
| HTMLLabelElement::~HTMLLabelElement()
 | |
| {
 | |
| }
 | |
| 
 | |
| RefPtr<Layout::Node> HTMLLabelElement::create_layout_node()
 | |
| {
 | |
|     auto style = document().style_computer().compute_style(*this);
 | |
|     if (style->display().is_none())
 | |
|         return nullptr;
 | |
| 
 | |
|     auto layout_node = adopt_ref(*new Layout::Label(document(), this, move(style)));
 | |
|     layout_node->set_inline(true);
 | |
|     return layout_node;
 | |
| }
 | |
| 
 | |
| }
 |