mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 17:52:45 +00:00 
			
		
		
		
	LibWeb: Rename StyleDeclaration => CSSStyleDeclaration to match CSSOM
This commit is contained in:
		
							parent
							
								
									e44fbbe5c0
								
							
						
					
					
						commit
						0759f54bd3
					
				
					 10 changed files with 25 additions and 25 deletions
				
			
		|  | @ -11,6 +11,7 @@ set(SOURCES | ||||||
|     Bindings/Wrappable.cpp |     Bindings/Wrappable.cpp | ||||||
|     CSS/CSSImportRule.cpp |     CSS/CSSImportRule.cpp | ||||||
|     CSS/CSSRule.cpp |     CSS/CSSRule.cpp | ||||||
|  |     CSS/CSSStyleDeclaration.cpp | ||||||
|     CSS/CSSStyleRule.cpp |     CSS/CSSStyleRule.cpp | ||||||
|     CSS/CSSStyleSheet.cpp |     CSS/CSSStyleSheet.cpp | ||||||
|     CSS/DefaultStyleSheetSource.cpp |     CSS/DefaultStyleSheetSource.cpp | ||||||
|  | @ -24,7 +25,6 @@ set(SOURCES | ||||||
|     CSS/QuirksModeStyleSheetSource.cpp |     CSS/QuirksModeStyleSheetSource.cpp | ||||||
|     CSS/Selector.cpp |     CSS/Selector.cpp | ||||||
|     CSS/SelectorEngine.cpp |     CSS/SelectorEngine.cpp | ||||||
|     CSS/StyleDeclaration.cpp |  | ||||||
|     CSS/StyleInvalidator.cpp |     CSS/StyleInvalidator.cpp | ||||||
|     CSS/StyleProperties.cpp |     CSS/StyleProperties.cpp | ||||||
|     CSS/StyleResolver.cpp |     CSS/StyleResolver.cpp | ||||||
|  |  | ||||||
|  | @ -28,8 +28,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <AK/RefCounted.h> | #include <AK/RefCounted.h> | ||||||
| #include <AK/String.h> | #include <AK/String.h> | ||||||
|  | #include <LibWeb/CSS/CSSStyleDeclaration.h> | ||||||
| #include <LibWeb/CSS/Selector.h> | #include <LibWeb/CSS/Selector.h> | ||||||
| #include <LibWeb/CSS/StyleDeclaration.h> |  | ||||||
| 
 | 
 | ||||||
| namespace Web::CSS { | namespace Web::CSS { | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -24,16 +24,16 @@ | ||||||
|  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include <LibWeb/CSS/StyleDeclaration.h> | #include <LibWeb/CSS/CSSStyleDeclaration.h> | ||||||
| 
 | 
 | ||||||
| namespace Web::CSS { | namespace Web::CSS { | ||||||
| 
 | 
 | ||||||
| StyleDeclaration::StyleDeclaration(Vector<StyleProperty>&& properties) | CSSStyleDeclaration::CSSStyleDeclaration(Vector<StyleProperty>&& properties) | ||||||
|     : m_properties(move(properties)) |     : m_properties(move(properties)) | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| StyleDeclaration::~StyleDeclaration() | CSSStyleDeclaration::~CSSStyleDeclaration() | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -38,19 +38,19 @@ struct StyleProperty { | ||||||
|     bool important { false }; |     bool important { false }; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| class StyleDeclaration : public RefCounted<StyleDeclaration> { | class CSSStyleDeclaration : public RefCounted<CSSStyleDeclaration> { | ||||||
| public: | public: | ||||||
|     static NonnullRefPtr<StyleDeclaration> create(Vector<StyleProperty>&& properties) |     static NonnullRefPtr<CSSStyleDeclaration> create(Vector<StyleProperty>&& properties) | ||||||
|     { |     { | ||||||
|         return adopt(*new StyleDeclaration(move(properties))); |         return adopt(*new CSSStyleDeclaration(move(properties))); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     ~StyleDeclaration(); |     ~CSSStyleDeclaration(); | ||||||
| 
 | 
 | ||||||
|     const Vector<StyleProperty>& properties() const { return m_properties; } |     const Vector<StyleProperty>& properties() const { return m_properties; } | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     explicit StyleDeclaration(Vector<StyleProperty>&&); |     explicit CSSStyleDeclaration(Vector<StyleProperty>&&); | ||||||
| 
 | 
 | ||||||
|     Vector<StyleProperty> m_properties; |     Vector<StyleProperty> m_properties; | ||||||
| }; | }; | ||||||
|  | @ -28,7 +28,7 @@ | ||||||
| 
 | 
 | ||||||
| namespace Web::CSS { | namespace Web::CSS { | ||||||
| 
 | 
 | ||||||
| CSSStyleRule::CSSStyleRule(Vector<Selector>&& selectors, NonnullRefPtr<StyleDeclaration>&& declaration) | CSSStyleRule::CSSStyleRule(Vector<Selector>&& selectors, NonnullRefPtr<CSSStyleDeclaration>&& declaration) | ||||||
|     : m_selectors(move(selectors)) |     : m_selectors(move(selectors)) | ||||||
|     , m_declaration(move(declaration)) |     , m_declaration(move(declaration)) | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -29,8 +29,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <AK/NonnullRefPtrVector.h> | #include <AK/NonnullRefPtrVector.h> | ||||||
| #include <LibWeb/CSS/CSSRule.h> | #include <LibWeb/CSS/CSSRule.h> | ||||||
|  | #include <LibWeb/CSS/CSSStyleDeclaration.h> | ||||||
| #include <LibWeb/CSS/Selector.h> | #include <LibWeb/CSS/Selector.h> | ||||||
| #include <LibWeb/CSS/StyleDeclaration.h> |  | ||||||
| 
 | 
 | ||||||
| namespace Web::CSS { | namespace Web::CSS { | ||||||
| 
 | 
 | ||||||
|  | @ -39,7 +39,7 @@ class CSSStyleRule : public CSSRule { | ||||||
|     AK_MAKE_NONMOVABLE(CSSStyleRule); |     AK_MAKE_NONMOVABLE(CSSStyleRule); | ||||||
| 
 | 
 | ||||||
| public: | public: | ||||||
|     static NonnullRefPtr<CSSStyleRule> create(Vector<Selector>&& selectors, NonnullRefPtr<StyleDeclaration>&& declaration) |     static NonnullRefPtr<CSSStyleRule> create(Vector<Selector>&& selectors, NonnullRefPtr<CSSStyleDeclaration>&& declaration) | ||||||
|     { |     { | ||||||
|         return adopt(*new CSSStyleRule(move(selectors), move(declaration))); |         return adopt(*new CSSStyleRule(move(selectors), move(declaration))); | ||||||
|     } |     } | ||||||
|  | @ -47,16 +47,16 @@ public: | ||||||
|     ~CSSStyleRule(); |     ~CSSStyleRule(); | ||||||
| 
 | 
 | ||||||
|     const Vector<Selector>& selectors() const { return m_selectors; } |     const Vector<Selector>& selectors() const { return m_selectors; } | ||||||
|     const StyleDeclaration& declaration() const { return m_declaration; } |     const CSSStyleDeclaration& declaration() const { return m_declaration; } | ||||||
| 
 | 
 | ||||||
|     virtual StringView class_name() const { return "CSSStyleRule"; }; |     virtual StringView class_name() const { return "CSSStyleRule"; }; | ||||||
|     virtual Type type() const { return Type::Style; }; |     virtual Type type() const { return Type::Style; }; | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     CSSStyleRule(Vector<Selector>&&, NonnullRefPtr<StyleDeclaration>&&); |     CSSStyleRule(Vector<Selector>&&, NonnullRefPtr<CSSStyleDeclaration>&&); | ||||||
| 
 | 
 | ||||||
|     Vector<Selector> m_selectors; |     Vector<Selector> m_selectors; | ||||||
|     NonnullRefPtr<StyleDeclaration> m_declaration; |     NonnullRefPtr<CSSStyleDeclaration> m_declaration; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -808,7 +808,7 @@ public: | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         rules.append(CSS::CSSStyleRule::create(move(current_rule.selectors), CSS::StyleDeclaration::create(move(current_rule.properties)))); |         rules.append(CSS::CSSStyleRule::create(move(current_rule.selectors), CSS::CSSStyleDeclaration::create(move(current_rule.properties)))); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     Optional<String> parse_string() |     Optional<String> parse_string() | ||||||
|  | @ -947,7 +947,7 @@ public: | ||||||
|         return CSS::CSSStyleSheet::create(move(rules)); |         return CSS::CSSStyleSheet::create(move(rules)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     RefPtr<CSS::StyleDeclaration> parse_standalone_declaration() |     RefPtr<CSS::CSSStyleDeclaration> parse_standalone_declaration() | ||||||
|     { |     { | ||||||
|         consume_whitespace_or_comments(); |         consume_whitespace_or_comments(); | ||||||
|         for (;;) { |         for (;;) { | ||||||
|  | @ -958,7 +958,7 @@ public: | ||||||
|             if (!peek()) |             if (!peek()) | ||||||
|                 break; |                 break; | ||||||
|         } |         } | ||||||
|         return CSS::StyleDeclaration::create(move(current_rule.properties)); |         return CSS::CSSStyleDeclaration::create(move(current_rule.properties)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|  | @ -993,10 +993,10 @@ RefPtr<CSS::CSSStyleSheet> parse_css(const CSS::ParsingContext& context, const S | ||||||
|     return parser.parse_sheet(); |     return parser.parse_sheet(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| RefPtr<CSS::StyleDeclaration> parse_css_declaration(const CSS::ParsingContext& context, const StringView& css) | RefPtr<CSS::CSSStyleDeclaration> parse_css_declaration(const CSS::ParsingContext& context, const StringView& css) | ||||||
| { | { | ||||||
|     if (css.is_empty()) |     if (css.is_empty()) | ||||||
|         return CSS::StyleDeclaration::create({}); |         return CSS::CSSStyleDeclaration::create({}); | ||||||
|     CSSParser parser(context, css); |     CSSParser parser(context, css); | ||||||
|     return parser.parse_standalone_declaration(); |     return parser.parse_standalone_declaration(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -49,7 +49,7 @@ private: | ||||||
| namespace Web { | namespace Web { | ||||||
| 
 | 
 | ||||||
| RefPtr<CSS::CSSStyleSheet> parse_css(const CSS::ParsingContext&, const StringView&); | RefPtr<CSS::CSSStyleSheet> parse_css(const CSS::ParsingContext&, const StringView&); | ||||||
| RefPtr<CSS::StyleDeclaration> parse_css_declaration(const CSS::ParsingContext&, const StringView&); | RefPtr<CSS::CSSStyleDeclaration> parse_css_declaration(const CSS::ParsingContext&, const StringView&); | ||||||
| RefPtr<CSS::StyleValue> parse_css_value(const CSS::ParsingContext&, const StringView&, CSS::PropertyID property_id = CSS::PropertyID::Invalid); | RefPtr<CSS::StyleValue> parse_css_value(const CSS::ParsingContext&, const StringView&, CSS::PropertyID property_id = CSS::PropertyID::Invalid); | ||||||
| Optional<CSS::Selector> parse_selector(const CSS::ParsingContext&, const StringView&); | Optional<CSS::Selector> parse_selector(const CSS::ParsingContext&, const StringView&); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -90,7 +90,7 @@ public: | ||||||
|     const CSS::StyleProperties* specified_css_values() const { return m_specified_css_values.ptr(); } |     const CSS::StyleProperties* specified_css_values() const { return m_specified_css_values.ptr(); } | ||||||
|     NonnullRefPtr<CSS::StyleProperties> computed_style(); |     NonnullRefPtr<CSS::StyleProperties> computed_style(); | ||||||
| 
 | 
 | ||||||
|     const CSS::StyleDeclaration* inline_style() const { return m_inline_style; } |     const CSS::CSSStyleDeclaration* inline_style() const { return m_inline_style; } | ||||||
| 
 | 
 | ||||||
|     // FIXME: innerHTML also appears on shadow roots. https://w3c.github.io/DOM-Parsing/#dom-innerhtml
 |     // FIXME: innerHTML also appears on shadow roots. https://w3c.github.io/DOM-Parsing/#dom-innerhtml
 | ||||||
|     String inner_html() const; |     String inner_html() const; | ||||||
|  | @ -116,7 +116,7 @@ private: | ||||||
|     QualifiedName m_qualified_name; |     QualifiedName m_qualified_name; | ||||||
|     Vector<Attribute> m_attributes; |     Vector<Attribute> m_attributes; | ||||||
| 
 | 
 | ||||||
|     RefPtr<CSS::StyleDeclaration> m_inline_style; |     RefPtr<CSS::CSSStyleDeclaration> m_inline_style; | ||||||
| 
 | 
 | ||||||
|     RefPtr<CSS::StyleProperties> m_specified_css_values; |     RefPtr<CSS::StyleProperties> m_specified_css_values; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -30,11 +30,11 @@ | ||||||
| namespace Web::CSS { | namespace Web::CSS { | ||||||
| class CSSRule; | class CSSRule; | ||||||
| class CSSImportRule; | class CSSImportRule; | ||||||
|  | class CSSStyleDeclaration; | ||||||
| class CSSStyleRule; | class CSSStyleRule; | ||||||
| class CSSStyleSheet; | class CSSStyleSheet; | ||||||
| class Length; | class Length; | ||||||
| class Selector; | class Selector; | ||||||
| class StyleDeclaration; |  | ||||||
| class StyleProperties; | class StyleProperties; | ||||||
| class StyleResolver; | class StyleResolver; | ||||||
| class StyleSheet; | class StyleSheet; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling