mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:12:45 +00:00 
			
		
		
		
	 b91c49364d
			
		
	
	
		b91c49364d
		
	
	
	
	
		
			
			This makes it more symmetrical with adopt_own() (which is used to create a NonnullOwnPtr from the result of a naked new.)
		
			
				
	
	
		
			44 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
 | |
|  * Copyright (c) 2021, Tobias Christiansen <tobi@tobyase.de>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include <LibWeb/Layout/ListItemBox.h>
 | |
| #include <LibWeb/Layout/ListItemMarkerBox.h>
 | |
| 
 | |
| namespace Web::Layout {
 | |
| 
 | |
| ListItemBox::ListItemBox(DOM::Document& document, DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style)
 | |
|     : Layout::BlockBox(document, &element, move(style))
 | |
| {
 | |
| }
 | |
| 
 | |
| ListItemBox::~ListItemBox()
 | |
| {
 | |
| }
 | |
| 
 | |
| void ListItemBox::layout_marker()
 | |
| {
 | |
|     if (m_marker) {
 | |
|         remove_child(*m_marker);
 | |
|         m_marker = nullptr;
 | |
|     }
 | |
| 
 | |
|     if (computed_values().list_style_type() == CSS::ListStyleType::None)
 | |
|         return;
 | |
| 
 | |
|     if (!m_marker) {
 | |
|         int child_index = parent()->index_of_child<ListItemBox>(*this).value();
 | |
|         m_marker = adopt_ref(*new ListItemMarkerBox(document(), computed_values().list_style_type(), child_index + 1));
 | |
|         if (first_child())
 | |
|             m_marker->set_inline(first_child()->is_inline());
 | |
|         append_child(*m_marker);
 | |
|     }
 | |
| 
 | |
|     m_marker->set_offset(-8, 0);
 | |
|     m_marker->set_size(4, line_height());
 | |
| }
 | |
| 
 | |
| }
 |