mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 12:52:44 +00:00 
			
		
		
		
	 17a6fcfde3
			
		
	
	
		17a6fcfde3
		
	
	
	
	
		
			
			If the `width` and `height` attributes are provided, we derive the intrinsic size and ratio from them. Otherwise, we trace a rectangle around the geometry elements inside the SVG and use the size of that as the intrinsic size. This is definitely far from correct, but is still a much better guess at the intrinsic size than nothing.
		
			
				
	
	
		
			28 lines
		
	
	
	
		
			733 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
	
		
			733 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <LibWeb/Layout/ReplacedBox.h>
 | |
| #include <LibWeb/SVG/SVGSVGElement.h>
 | |
| 
 | |
| namespace Web::Layout {
 | |
| 
 | |
| class SVGSVGBox final : public ReplacedBox {
 | |
| public:
 | |
|     SVGSVGBox(DOM::Document&, SVG::SVGSVGElement&, NonnullRefPtr<CSS::StyleProperties>);
 | |
|     virtual ~SVGSVGBox() override = default;
 | |
| 
 | |
|     SVG::SVGSVGElement& dom_node() { return verify_cast<SVG::SVGSVGElement>(ReplacedBox::dom_node()); }
 | |
| 
 | |
|     virtual bool can_have_children() const override { return true; }
 | |
| 
 | |
|     virtual RefPtr<Painting::Paintable> create_paintable() const override;
 | |
| 
 | |
|     virtual void prepare_for_replaced_layout() override;
 | |
| };
 | |
| 
 | |
| }
 |