mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 14: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
|
@ -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;
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue