mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 21:57:35 +00:00
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.
This commit is contained in:
parent
058d44dcae
commit
3d36e4d944
5 changed files with 18 additions and 18 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
|
|
@ -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) {
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue