mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:47:37 +00:00
LibWeb: Rename CSS::StyleResolver => StyleComputer
Resolved style is a spec concept that refers to the weird mix of computed style and used style reflected by getComputedStyle(). The purpose of this class is to produce the *computed* style for a given element, so let's call it StyleComputer.
This commit is contained in:
parent
3dc6f0bc47
commit
f8dd3e14ba
22 changed files with 59 additions and 59 deletions
|
@ -15,7 +15,7 @@
|
|||
#include <LibJS/Runtime/FunctionObject.h>
|
||||
#include <LibWeb/Bindings/MainThreadVM.h>
|
||||
#include <LibWeb/Bindings/WindowObject.h>
|
||||
#include <LibWeb/CSS/StyleResolver.h>
|
||||
#include <LibWeb/CSS/StyleComputer.h>
|
||||
#include <LibWeb/Cookie/ParsedCookie.h>
|
||||
#include <LibWeb/DOM/Comment.h>
|
||||
#include <LibWeb/DOM/DOMException.h>
|
||||
|
@ -59,7 +59,7 @@ namespace Web::DOM {
|
|||
|
||||
Document::Document(const AK::URL& url)
|
||||
: ParentNode(*this, NodeType::DOCUMENT_NODE)
|
||||
, m_style_resolver(make<CSS::StyleResolver>(*this))
|
||||
, m_style_computer(make<CSS::StyleComputer>(*this))
|
||||
, m_style_sheets(CSS::StyleSheetList::create(*this))
|
||||
, m_url(url)
|
||||
, m_window(Window::create_with_document(*this))
|
||||
|
@ -451,7 +451,7 @@ void Document::update_style()
|
|||
|
||||
RefPtr<Layout::Node> Document::create_layout_node()
|
||||
{
|
||||
return adopt_ref(*new Layout::InitialContainingBlock(*this, style_resolver().create_document_style()));
|
||||
return adopt_ref(*new Layout::InitialContainingBlock(*this, style_computer().create_document_style()));
|
||||
}
|
||||
|
||||
void Document::set_link_color(Color color)
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <LibWeb/Bindings/ScriptExecutionContext.h>
|
||||
#include <LibWeb/Bindings/WindowObject.h>
|
||||
#include <LibWeb/CSS/CSSStyleSheet.h>
|
||||
#include <LibWeb/CSS/StyleResolver.h>
|
||||
#include <LibWeb/CSS/StyleComputer.h>
|
||||
#include <LibWeb/CSS/StyleSheetList.h>
|
||||
#include <LibWeb/Cookie/Cookie.h>
|
||||
#include <LibWeb/DOM/DOMImplementation.h>
|
||||
|
@ -74,8 +74,8 @@ public:
|
|||
|
||||
AK::URL parse_url(String const&) const;
|
||||
|
||||
CSS::StyleResolver& style_resolver() { return *m_style_resolver; }
|
||||
const CSS::StyleResolver& style_resolver() const { return *m_style_resolver; }
|
||||
CSS::StyleComputer& style_computer() { return *m_style_computer; }
|
||||
const CSS::StyleComputer& style_computer() const { return *m_style_computer; }
|
||||
|
||||
CSS::StyleSheetList& style_sheets() { return *m_style_sheets; }
|
||||
const CSS::StyleSheetList& style_sheets() const { return *m_style_sheets; }
|
||||
|
@ -314,7 +314,7 @@ private:
|
|||
|
||||
unsigned m_referencing_node_count { 0 };
|
||||
|
||||
OwnPtr<CSS::StyleResolver> m_style_resolver;
|
||||
OwnPtr<CSS::StyleComputer> m_style_computer;
|
||||
RefPtr<CSS::StyleSheetList> m_style_sheets;
|
||||
RefPtr<Node> m_hovered_node;
|
||||
RefPtr<Node> m_inspected_node;
|
||||
|
|
|
@ -103,7 +103,7 @@ bool Element::has_class(const FlyString& class_name, CaseSensitivity case_sensit
|
|||
|
||||
RefPtr<Layout::Node> Element::create_layout_node()
|
||||
{
|
||||
auto style = document().style_resolver().resolve_style(*this);
|
||||
auto style = document().style_computer().compute_style(*this);
|
||||
const_cast<Element&>(*this).m_specified_css_values = style;
|
||||
auto display = style->display();
|
||||
|
||||
|
@ -203,7 +203,7 @@ void Element::recompute_style()
|
|||
set_needs_style_update(false);
|
||||
VERIFY(parent());
|
||||
auto old_specified_css_values = m_specified_css_values;
|
||||
auto new_specified_css_values = document().style_resolver().resolve_style(*this);
|
||||
auto new_specified_css_values = document().style_computer().compute_style(*this);
|
||||
m_specified_css_values = new_specified_css_values;
|
||||
if (!layout_node()) {
|
||||
if (new_specified_css_values->display() == CSS::Display::None)
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <AK/FlyString.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibWeb/CSS/CSSStyleDeclaration.h>
|
||||
#include <LibWeb/CSS/StyleResolver.h>
|
||||
#include <LibWeb/CSS/StyleComputer.h>
|
||||
#include <LibWeb/DOM/Attribute.h>
|
||||
#include <LibWeb/DOM/ExceptionOr.h>
|
||||
#include <LibWeb/DOM/NonDocumentTypeChildNode.h>
|
||||
|
@ -95,11 +95,11 @@ public:
|
|||
const ShadowRoot* shadow_root() const { return m_shadow_root; }
|
||||
void set_shadow_root(RefPtr<ShadowRoot>);
|
||||
|
||||
Optional<CSS::StyleResolver::CustomPropertyResolutionTuple> resolve_custom_property(const String& custom_property_name) const
|
||||
Optional<CSS::StyleComputer::CustomPropertyResolutionTuple> resolve_custom_property(const String& custom_property_name) const
|
||||
{
|
||||
return m_custom_properties.get(custom_property_name);
|
||||
}
|
||||
void add_custom_property(const String& custom_property_name, CSS::StyleResolver::CustomPropertyResolutionTuple style_property)
|
||||
void add_custom_property(const String& custom_property_name, CSS::StyleComputer::CustomPropertyResolutionTuple style_property)
|
||||
{
|
||||
m_custom_properties.set(custom_property_name, style_property);
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ private:
|
|||
RefPtr<CSS::CSSStyleDeclaration> m_inline_style;
|
||||
|
||||
RefPtr<CSS::StyleProperties> m_specified_css_values;
|
||||
HashMap<String, CSS::StyleResolver::CustomPropertyResolutionTuple> m_custom_properties;
|
||||
HashMap<String, CSS::StyleComputer::CustomPropertyResolutionTuple> m_custom_properties;
|
||||
|
||||
Vector<FlyString> m_classes;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue