mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 18:32:45 +00:00 
			
		
		
		
	 5e1499d104
			
		
	
	
		5e1499d104
		
	
	
	
	
		
			
			This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).
This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
		
	
			
		
			
				
	
	
		
			73 lines
		
	
	
	
		
			2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			73 lines
		
	
	
	
		
			2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2023, Preston Taylor <95388976+PrestonLTaylor@users.noreply.github.com>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <AK/FlyString.h>
 | |
| #include <LibGfx/Path.h>
 | |
| #include <LibWeb/DOM/DocumentObserver.h>
 | |
| #include <LibWeb/SVG/SVGAnimatedLength.h>
 | |
| #include <LibWeb/SVG/SVGGraphicsElement.h>
 | |
| 
 | |
| namespace Web::SVG {
 | |
| 
 | |
| class SVGUseElement final : public SVGGraphicsElement {
 | |
|     WEB_PLATFORM_OBJECT(SVGUseElement, SVGGraphicsElement);
 | |
|     JS_DECLARE_ALLOCATOR(SVGUseElement);
 | |
| 
 | |
| public:
 | |
|     virtual ~SVGUseElement() override = default;
 | |
| 
 | |
|     virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
 | |
| 
 | |
|     virtual void inserted() override;
 | |
| 
 | |
|     void svg_element_changed(SVGElement&);
 | |
|     void svg_element_removed(SVGElement&);
 | |
| 
 | |
|     JS::NonnullGCPtr<SVGAnimatedLength> x() const;
 | |
|     JS::NonnullGCPtr<SVGAnimatedLength> y() const;
 | |
|     JS::NonnullGCPtr<SVGAnimatedLength> width() const;
 | |
|     JS::NonnullGCPtr<SVGAnimatedLength> height() const;
 | |
| 
 | |
|     JS::GCPtr<SVGElement> instance_root() const;
 | |
|     JS::GCPtr<SVGElement> animated_instance_root() const;
 | |
| 
 | |
|     virtual Gfx::AffineTransform element_transform() const override;
 | |
| 
 | |
| private:
 | |
|     SVGUseElement(DOM::Document&, DOM::QualifiedName);
 | |
| 
 | |
|     virtual void initialize(JS::Realm&) override;
 | |
|     virtual void visit_edges(Cell::Visitor&) override;
 | |
| 
 | |
|     virtual bool is_svg_use_element() const override { return true; }
 | |
| 
 | |
|     virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
 | |
| 
 | |
|     Optional<FlyString> parse_id_from_href(ByteString const& href);
 | |
| 
 | |
|     JS::GCPtr<DOM::Element> referenced_element();
 | |
| 
 | |
|     void clone_element_tree_as_our_shadow_tree(Element* to_clone) const;
 | |
|     bool is_valid_reference_element(Element* reference_element) const;
 | |
| 
 | |
|     Optional<float> m_x;
 | |
|     Optional<float> m_y;
 | |
| 
 | |
|     Optional<FlyString> m_referenced_id;
 | |
| 
 | |
|     JS::GCPtr<DOM::DocumentObserver> m_document_observer;
 | |
| };
 | |
| 
 | |
| }
 | |
| 
 | |
| namespace Web::DOM {
 | |
| 
 | |
| template<>
 | |
| inline bool Node::fast_is<SVG::SVGUseElement>() const { return is_svg_use_element(); }
 | |
| 
 | |
| }
 |