mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 02:12:45 +00:00 
			
		
		
		
	 5cf1570f40
			
		
	
	
		5cf1570f40
		
	
	
	
	
		
			
			Previously, we were handling viewBoxes/viewports in a slightly hacky way, asking graphics elements to figure out what viewBox to use during layout. This does not work in all cases, and can't allow for more complex SVGs where it is possible to have nested viewports. This commit makes the SVGFormattingContext keep track of the viewport/boxes, and it now lays out each viewport recursively, where each nested `<svg>` or `<symbol>` can establish a new viewport. This fixes some previous edge cases, and starts to allow nested viewports (there's still some issues to resolve there). Fixes #22931
		
			
				
	
	
		
			21 lines
		
	
	
	
		
			414 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
	
		
			414 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2024, MacDue <macdue@dueutil.tech>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <LibWeb/SVG/AttributeParser.h>
 | |
| #include <LibWeb/SVG/ViewBox.h>
 | |
| 
 | |
| namespace Web::SVG {
 | |
| 
 | |
| class SVGViewport {
 | |
| public:
 | |
|     virtual Optional<ViewBox> view_box() const = 0;
 | |
|     virtual Optional<PreserveAspectRatio> preserve_aspect_ratio() const = 0;
 | |
|     virtual ~SVGViewport() = default;
 | |
| };
 | |
| 
 | |
| }
 |