mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 03:12:44 +00:00 
			
		
		
		
	 809c5b0b03
			
		
	
	
		809c5b0b03
		
	
	
	
	
		
			
			This patch adds basic support for the SVG `<textPath>`, so it supports placing text along a path, but none of the extra attributes for controlling the layout of the text. This is enough to correctly display the MDN example.
		
			
				
	
	
		
			30 lines
		
	
	
	
		
			877 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
	
		
			877 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2023, MacDue <macdue@dueutil.tech>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <LibWeb/Layout/SVGGraphicsBox.h>
 | |
| #include <LibWeb/SVG/SVGTextPathElement.h>
 | |
| 
 | |
| namespace Web::Layout {
 | |
| 
 | |
| class SVGTextPathBox final : public SVGGraphicsBox {
 | |
|     JS_CELL(SVGTextPathBox, SVGGraphicsBox);
 | |
| 
 | |
| public:
 | |
|     SVGTextPathBox(DOM::Document&, SVG::SVGTextPathElement&, NonnullRefPtr<CSS::StyleProperties>);
 | |
|     virtual ~SVGTextPathBox() override = default;
 | |
| 
 | |
|     SVG::SVGTextPathElement& dom_node() { return static_cast<SVG::SVGTextPathElement&>(SVGGraphicsBox::dom_node()); }
 | |
|     SVG::SVGTextPathElement const& dom_node() const { return static_cast<SVG::SVGTextPathElement const&>(SVGGraphicsBox::dom_node()); }
 | |
| 
 | |
|     virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
 | |
| 
 | |
| private:
 | |
|     CSSPixelPoint viewbox_origin() const;
 | |
| };
 | |
| 
 | |
| }
 |