Remove StyleResolver::State::document()
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Nov 2017 21:26:48 +0000 (21:26 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Nov 2017 21:26:48 +0000 (21:26 +0000)
https://bugs.webkit.org/show_bug.cgi?id=179678

Reviewed by Antoine Quint.

We don't need both StyleResolver::document() and StyleResolver::State::document().

* css/StyleResolver.cpp:
(WebCore::StyleResolver::State::updateConversionData):
(WebCore::StyleResolver::resolvedVariableValue):
(WebCore::StyleResolver::colorFromPrimitiveValue const):
(WebCore::StyleResolver::createFilterOperations):
* css/StyleResolver.h:
(WebCore::StyleResolver::State::document const): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224840 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/css/StyleResolver.h

index 81894f3..24676d4 100644 (file)
@@ -1,3 +1,20 @@
+2017-11-14  Antti Koivisto  <antti@apple.com>
+
+        Remove StyleResolver::State::document()
+        https://bugs.webkit.org/show_bug.cgi?id=179678
+
+        Reviewed by Antoine Quint.
+
+        We don't need both StyleResolver::document() and StyleResolver::State::document().
+
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::State::updateConversionData):
+        (WebCore::StyleResolver::resolvedVariableValue):
+        (WebCore::StyleResolver::colorFromPrimitiveValue const):
+        (WebCore::StyleResolver::createFilterOperations):
+        * css/StyleResolver.h:
+        (WebCore::StyleResolver::State::document const): Deleted.
+
 2017-11-14  Dean Jackson  <dino@apple.com>
 
         Stub implementations of OffscreenCanvas getContext and transferToImageBitmap
index 291bbc0..5c79812 100644 (file)
@@ -319,7 +319,7 @@ StyleResolver::State::State(const Element& element, const RenderStyle* parentSty
 
 inline void StyleResolver::State::updateConversionData()
 {
-    m_cssToLengthConversionData = CSSToLengthConversionData(m_style.get(), m_rootElementStyle, m_element ? document().renderView() : nullptr);
+    m_cssToLengthConversionData = CSSToLengthConversionData(m_style.get(), m_rootElementStyle, m_element ? m_element->document().renderView() : nullptr);
 }
 
 inline void StyleResolver::State::setStyle(std::unique_ptr<RenderStyle> style)
@@ -1702,7 +1702,7 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value, SelectorChe
 
 RefPtr<CSSValue> StyleResolver::resolvedVariableValue(CSSPropertyID propID, const CSSValue& value)
 {
-    CSSParser parser(m_state.document());
+    CSSParser parser(document());
     return parser.parseValueWithVariableReferences(propID, value, m_state.style()->customProperties(), m_state.style()->direction(), m_state.style()->writingMode());
 }
 
@@ -1826,11 +1826,11 @@ Color StyleResolver::colorFromPrimitiveValue(const CSSPrimitiveValue& value, boo
     case 0:
         return Color();
     case CSSValueWebkitText:
-        return state.document().textColor();
+        return document().textColor();
     case CSSValueWebkitLink:
-        return (state.element()->isLink() && forVisitedLink) ? state.document().visitedLinkColor() : state.document().linkColor();
+        return (state.element()->isLink() && forVisitedLink) ? document().visitedLinkColor() : document().linkColor();
     case CSSValueWebkitActivelink:
-        return state.document().activeLinkColor();
+        return document().activeLinkColor();
     case CSSValueWebkitFocusRingColor:
         return RenderTheme::focusRingColor();
     case CSSValueCurrentcolor:
@@ -1928,7 +1928,7 @@ bool StyleResolver::createFilterOperations(const CSSValue& inValue, FilterOperat
                 continue;
 
             String cssUrl = primitiveValue.stringValue();
-            URL url = m_state.document().completeURL(cssUrl);
+            URL url = document().completeURL(cssUrl);
 
             RefPtr<ReferenceFilterOperation> operation = ReferenceFilterOperation::create(cssUrl, url.fragmentIdentifier());
             operations.operations().append(operation);
index 0ded1d9..25dae94 100644 (file)
@@ -348,7 +348,6 @@ public:
     public:
         void clear();
 
-        Document& document() const { return m_element->document(); }
         const Element* element() const { return m_element; }
 
         void setStyle(std::unique_ptr<RenderStyle>);