summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-09-23 12:35:56 +0200
committerAndreas Kling <kling@serenityos.org>2021-09-24 15:01:49 +0200
commit3d36e4d944aead762648363c253c8d649c617422 (patch)
tree2cd288c390eeb7aae096c810b2ae8eb3575c1bc6 /Userland
parent058d44dcae2241c9e5bb0e81268275eae7eb4714 (diff)
downloadserenity-3d36e4d944aead762648363c253c8d649c617422.zip
LibWeb: Rename "Computed" CSSStyleDeclaration => "Resolved"
The original name was based on the window.getComputedStyle() API. However, "Computed" in "getComputedStyle" is actually a misnomer that the platform is stuck with due to backwards compatibility. What getComputedStyle() returns is actually a mix of computed and used values. The spec calls it the "resolved" values. So let's call this declaration subclass "ResolvedCSSStyleDeclaration" to match.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/CMakeLists.txt2
-rw-r--r--Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp (renamed from Userland/Libraries/LibWeb/CSS/ComputedCSSStyleDeclaration.cpp)16
-rw-r--r--Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.h (renamed from Userland/Libraries/LibWeb/CSS/ComputedCSSStyleDeclaration.h)10
-rw-r--r--Userland/Libraries/LibWeb/DOM/Element.cpp4
-rw-r--r--Userland/Libraries/LibWeb/DOM/Window.cpp4
5 files changed, 18 insertions, 18 deletions
diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt
index 93966a66d4..358c4a1ff3 100644
--- a/Userland/Libraries/LibWeb/CMakeLists.txt
+++ b/Userland/Libraries/LibWeb/CMakeLists.txt
@@ -17,7 +17,7 @@ set(SOURCES
CSS/CSSStyleDeclaration.cpp
CSS/CSSStyleRule.cpp
CSS/CSSStyleSheet.cpp
- CSS/ComputedCSSStyleDeclaration.cpp
+ CSS/ResolvedCSSStyleDeclaration.cpp
CSS/DefaultStyleSheetSource.cpp
CSS/Length.cpp
CSS/MediaQueryList.cpp
diff --git a/Userland/Libraries/LibWeb/CSS/ComputedCSSStyleDeclaration.cpp b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp
index fd708a6c4b..03d0b62a41 100644
--- a/Userland/Libraries/LibWeb/CSS/ComputedCSSStyleDeclaration.cpp
+++ b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp
@@ -6,28 +6,28 @@
*/
#include <AK/NonnullRefPtr.h>
-#include <LibWeb/CSS/ComputedCSSStyleDeclaration.h>
+#include <LibWeb/CSS/ResolvedCSSStyleDeclaration.h>
#include <LibWeb/CSS/StyleResolver.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Element.h>
namespace Web::CSS {
-ComputedCSSStyleDeclaration::ComputedCSSStyleDeclaration(DOM::Element& element)
+ResolvedCSSStyleDeclaration::ResolvedCSSStyleDeclaration(DOM::Element& element)
: m_element(element)
{
}
-ComputedCSSStyleDeclaration::~ComputedCSSStyleDeclaration()
+ResolvedCSSStyleDeclaration::~ResolvedCSSStyleDeclaration()
{
}
-size_t ComputedCSSStyleDeclaration::length() const
+size_t ResolvedCSSStyleDeclaration::length() const
{
return 0;
}
-String ComputedCSSStyleDeclaration::item(size_t index) const
+String ResolvedCSSStyleDeclaration::item(size_t index) const
{
(void)index;
return {};
@@ -379,7 +379,7 @@ static NonnullRefPtr<StyleValue> value_or_default(Optional<StyleProperty> proper
return default_style;
}
-RefPtr<StyleValue> ComputedCSSStyleDeclaration::style_value_for_property(Layout::NodeWithStyle const& layout_node, PropertyID property_id) const
+RefPtr<StyleValue> ResolvedCSSStyleDeclaration::style_value_for_property(Layout::NodeWithStyle const& layout_node, PropertyID property_id) const
{
switch (property_id) {
case CSS::PropertyID::Float:
@@ -550,7 +550,7 @@ RefPtr<StyleValue> ComputedCSSStyleDeclaration::style_value_for_property(Layout:
}
}
-Optional<StyleProperty> ComputedCSSStyleDeclaration::property(PropertyID property_id) const
+Optional<StyleProperty> ResolvedCSSStyleDeclaration::property(PropertyID property_id) const
{
const_cast<DOM::Document&>(m_element->document()).ensure_layout();
@@ -575,7 +575,7 @@ Optional<StyleProperty> ComputedCSSStyleDeclaration::property(PropertyID propert
};
}
-bool ComputedCSSStyleDeclaration::set_property(PropertyID, StringView)
+bool ResolvedCSSStyleDeclaration::set_property(PropertyID, StringView)
{
return false;
}
diff --git a/Userland/Libraries/LibWeb/CSS/ComputedCSSStyleDeclaration.h b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.h
index e0f8a96a91..0446160f81 100644
--- a/Userland/Libraries/LibWeb/CSS/ComputedCSSStyleDeclaration.h
+++ b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.h
@@ -10,14 +10,14 @@
namespace Web::CSS {
-class ComputedCSSStyleDeclaration final : public CSSStyleDeclaration {
+class ResolvedCSSStyleDeclaration final : public CSSStyleDeclaration {
public:
- static NonnullRefPtr<ComputedCSSStyleDeclaration> create(DOM::Element& element)
+ static NonnullRefPtr<ResolvedCSSStyleDeclaration> create(DOM::Element& element)
{
- return adopt_ref(*new ComputedCSSStyleDeclaration(element));
+ return adopt_ref(*new ResolvedCSSStyleDeclaration(element));
}
- virtual ~ComputedCSSStyleDeclaration() override;
+ virtual ~ResolvedCSSStyleDeclaration() override;
virtual size_t length() const override;
virtual String item(size_t index) const override;
@@ -25,7 +25,7 @@ public:
virtual bool set_property(PropertyID, StringView css_text) override;
private:
- explicit ComputedCSSStyleDeclaration(DOM::Element&);
+ explicit ResolvedCSSStyleDeclaration(DOM::Element&);
RefPtr<StyleValue> style_value_for_property(Layout::NodeWithStyle const&, PropertyID) const;
diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp
index 91c86d1978..a81fe67d3f 100644
--- a/Userland/Libraries/LibWeb/DOM/Element.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Element.cpp
@@ -6,9 +6,9 @@
#include <AK/AnyOf.h>
#include <AK/StringBuilder.h>
-#include <LibWeb/CSS/ComputedCSSStyleDeclaration.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/CSS/PropertyID.h>
+#include <LibWeb/CSS/ResolvedCSSStyleDeclaration.h>
#include <LibWeb/CSS/StyleInvalidator.h>
#include <LibWeb/DOM/DOMException.h>
#include <LibWeb/DOM/Document.h>
@@ -231,7 +231,7 @@ void Element::recompute_style()
NonnullRefPtr<CSS::StyleProperties> Element::computed_style()
{
- auto element_computed_style = CSS::ComputedCSSStyleDeclaration::create(*this);
+ auto element_computed_style = CSS::ResolvedCSSStyleDeclaration::create(*this);
auto properties = CSS::StyleProperties::create();
for (auto i = to_underlying(CSS::first_property_id); i <= to_underlying(CSS::last_property_id); ++i) {
diff --git a/Userland/Libraries/LibWeb/DOM/Window.cpp b/Userland/Libraries/LibWeb/DOM/Window.cpp
index 1a9e986116..c20df10444 100644
--- a/Userland/Libraries/LibWeb/DOM/Window.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Window.cpp
@@ -6,7 +6,7 @@
#include <LibGUI/DisplayLink.h>
#include <LibJS/Runtime/FunctionObject.h>
-#include <LibWeb/CSS/ComputedCSSStyleDeclaration.h>
+#include <LibWeb/CSS/ResolvedCSSStyleDeclaration.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Event.h>
#include <LibWeb/DOM/EventDispatcher.h>
@@ -252,7 +252,7 @@ Page const* Window::page() const
NonnullRefPtr<CSS::CSSStyleDeclaration> Window::get_computed_style(DOM::Element& element) const
{
- return CSS::ComputedCSSStyleDeclaration::create(element);
+ return CSS::ResolvedCSSStyleDeclaration::create(element);
}
NonnullRefPtr<CSS::MediaQueryList> Window::match_media(String media)