mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 01:22:43 +00:00 
			
		
		
		
	 ee3a73ddbb
			
		
	
	
		ee3a73ddbb
		
	
	
	
	
		
			
			This makes it much clearer what this cast actually does: it will VERIFY that the thing we're casting is a T (using is<T>()).
		
			
				
	
	
		
			32 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include <LibWeb/Layout/SVGGraphicsBox.h>
 | |
| 
 | |
| namespace Web::Layout {
 | |
| 
 | |
| SVGGraphicsBox::SVGGraphicsBox(DOM::Document& document, SVG::SVGGraphicsElement& element, NonnullRefPtr<CSS::StyleProperties> properties)
 | |
|     : SVGBox(document, element, properties)
 | |
| {
 | |
| }
 | |
| 
 | |
| void SVGGraphicsBox::before_children_paint(PaintContext& context, PaintPhase phase)
 | |
| {
 | |
|     SVGBox::before_children_paint(context, phase);
 | |
|     if (phase != PaintPhase::Foreground)
 | |
|         return;
 | |
| 
 | |
|     auto& graphics_element = verify_cast<SVG::SVGGraphicsElement>(dom_node());
 | |
| 
 | |
|     if (graphics_element.fill_color().has_value())
 | |
|         context.svg_context().set_fill_color(graphics_element.fill_color().value());
 | |
|     if (graphics_element.stroke_color().has_value())
 | |
|         context.svg_context().set_stroke_color(graphics_element.stroke_color().value());
 | |
|     if (graphics_element.stroke_width().has_value())
 | |
|         context.svg_context().set_stroke_width(graphics_element.stroke_width().value());
 | |
| }
 | |
| 
 | |
| }
 |