<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[206753] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/206753">206753</a></dd>
<dt>Author</dt> <dd>antti@apple.com</dd>
<dt>Date</dt> <dd>2016-10-03 14:52:37 -0700 (Mon, 03 Oct 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Remove Document::elementSheet()
https://bugs.webkit.org/show_bug.cgi?id=162876

Reviewed by Andreas Kling.

This is a Document owned stylesheet that exists as a context for parsing element inline style.
It never contains any rules and is generally confusing.

This patch removes the requirement for a stylesheet to be present for CSSParser to operate in
the correct context. Inline style is now parsed without stylesheet and a context object is
passed instead.

* bindings/js/JSCSSStyleDeclarationCustom.cpp:
(WebCore::root):
* bindings/js/JSCSSStyleDeclarationCustom.h:
(WebCore::root): Deleted.
* css/PropertySetCSSStyleDeclaration.cpp:
(WebCore::PropertySetCSSStyleDeclaration::setCssText):
(WebCore::PropertySetCSSStyleDeclaration::setProperty):
(WebCore::PropertySetCSSStyleDeclaration::setPropertyInternal):
(WebCore::PropertySetCSSStyleDeclaration::cssParserContext):
(WebCore::StyleRuleCSSStyleDeclaration::parentStyleSheet):
(WebCore::StyleRuleCSSStyleDeclaration::cssParserContext):
(WebCore::InlineCSSStyleDeclaration::parentStyleSheet):
(WebCore::InlineCSSStyleDeclaration::cssParserContext):
* css/PropertySetCSSStyleDeclaration.h:
(WebCore::PropertySetCSSStyleDeclaration::didMutate): Deleted.
* css/StyleProperties.cpp:
(WebCore::MutableStyleProperties::setProperty):
(WebCore::MutableStyleProperties::setCustomProperty):
(WebCore::MutableStyleProperties::parseDeclaration):
* css/parser/CSSParser.cpp:
(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseCustomPropertyValue):
(WebCore::CSSParser::parseInlineStyleDeclaration):
* css/parser/CSSParser.h:
* css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::parseInlineStyleDeclaration):
* dom/Document.cpp:
(WebCore::Document::~Document):
(WebCore::Document::updateBaseURL):
(WebCore::Document::usesStyleBasedEditability):
(WebCore::Document::setHasElementUsingStyleBasedEditability):
(WebCore::Document::elementSheet): Deleted.
* dom/Document.h:
* dom/StyledElement.cpp:
(WebCore::StyledElement::setInlineStyleFromString):
(WebCore::StyledElement::invalidateStyleAttribute):

    The usesStyleBasedEditability bit used to be set via the elementSheet. Instead check for it after inline style mutations.

(WebCore::StyledElement::setInlineStyleProperty):
(WebCore::StyledElement::addPropertyToPresentationAttributeStyle):
* dom/StyledElement.h:
(WebCore::StyledElement::invalidateStyleAttribute): Deleted.
* inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyleSheetForInlineStyle::getStyleAttributeRanges):
* svg/SVGAnimateElementBase.cpp:
(WebCore::applyCSSPropertyToTarget):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSCSSStyleDeclarationCustomcpp">trunk/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSCSSStyleDeclarationCustomh">trunk/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.h</a></li>
<li><a href="#trunkSourceWebCorecssPropertySetCSSStyleDeclarationcpp">trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp</a></li>
<li><a href="#trunkSourceWebCorecssPropertySetCSSStyleDeclarationh">trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.h</a></li>
<li><a href="#trunkSourceWebCorecssStylePropertiescpp">trunk/Source/WebCore/css/StyleProperties.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStylePropertiesh">trunk/Source/WebCore/css/StyleProperties.h</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSParsercpp">trunk/Source/WebCore/css/parser/CSSParser.cpp</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSParserh">trunk/Source/WebCore/css/parser/CSSParser.h</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSParserImplcpp">trunk/Source/WebCore/css/parser/CSSParserImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumenth">trunk/Source/WebCore/dom/Document.h</a></li>
<li><a href="#trunkSourceWebCoredomStyledElementcpp">trunk/Source/WebCore/dom/StyledElement.cpp</a></li>
<li><a href="#trunkSourceWebCoredomStyledElementh">trunk/Source/WebCore/dom/StyledElement.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorStyleSheetcpp">trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGAnimateElementBasecpp">trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (206752 => 206753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-10-03 21:51:11 UTC (rev 206752)
+++ trunk/Source/WebCore/ChangeLog        2016-10-03 21:52:37 UTC (rev 206753)
</span><span class="lines">@@ -1,3 +1,65 @@
</span><ins>+2016-10-03  Antti Koivisto  &lt;antti@apple.com&gt;
+
+        Remove Document::elementSheet()
+        https://bugs.webkit.org/show_bug.cgi?id=162876
+
+        Reviewed by Andreas Kling.
+
+        This is a Document owned stylesheet that exists as a context for parsing element inline style.
+        It never contains any rules and is generally confusing.
+
+        This patch removes the requirement for a stylesheet to be present for CSSParser to operate in
+        the correct context. Inline style is now parsed without stylesheet and a context object is
+        passed instead.
+
+        * bindings/js/JSCSSStyleDeclarationCustom.cpp:
+        (WebCore::root):
+        * bindings/js/JSCSSStyleDeclarationCustom.h:
+        (WebCore::root): Deleted.
+        * css/PropertySetCSSStyleDeclaration.cpp:
+        (WebCore::PropertySetCSSStyleDeclaration::setCssText):
+        (WebCore::PropertySetCSSStyleDeclaration::setProperty):
+        (WebCore::PropertySetCSSStyleDeclaration::setPropertyInternal):
+        (WebCore::PropertySetCSSStyleDeclaration::cssParserContext):
+        (WebCore::StyleRuleCSSStyleDeclaration::parentStyleSheet):
+        (WebCore::StyleRuleCSSStyleDeclaration::cssParserContext):
+        (WebCore::InlineCSSStyleDeclaration::parentStyleSheet):
+        (WebCore::InlineCSSStyleDeclaration::cssParserContext):
+        * css/PropertySetCSSStyleDeclaration.h:
+        (WebCore::PropertySetCSSStyleDeclaration::didMutate): Deleted.
+        * css/StyleProperties.cpp:
+        (WebCore::MutableStyleProperties::setProperty):
+        (WebCore::MutableStyleProperties::setCustomProperty):
+        (WebCore::MutableStyleProperties::parseDeclaration):
+        * css/parser/CSSParser.cpp:
+        (WebCore::CSSParser::parseValue):
+        (WebCore::CSSParser::parseCustomPropertyValue):
+        (WebCore::CSSParser::parseInlineStyleDeclaration):
+        * css/parser/CSSParser.h:
+        * css/parser/CSSParserImpl.cpp:
+        (WebCore::CSSParserImpl::parseInlineStyleDeclaration):
+        * dom/Document.cpp:
+        (WebCore::Document::~Document):
+        (WebCore::Document::updateBaseURL):
+        (WebCore::Document::usesStyleBasedEditability):
+        (WebCore::Document::setHasElementUsingStyleBasedEditability):
+        (WebCore::Document::elementSheet): Deleted.
+        * dom/Document.h:
+        * dom/StyledElement.cpp:
+        (WebCore::StyledElement::setInlineStyleFromString):
+        (WebCore::StyledElement::invalidateStyleAttribute):
+
+            The usesStyleBasedEditability bit used to be set via the elementSheet. Instead check for it after inline style mutations.
+
+        (WebCore::StyledElement::setInlineStyleProperty):
+        (WebCore::StyledElement::addPropertyToPresentationAttributeStyle):
+        * dom/StyledElement.h:
+        (WebCore::StyledElement::invalidateStyleAttribute): Deleted.
+        * inspector/InspectorStyleSheet.cpp:
+        (WebCore::InspectorStyleSheetForInlineStyle::getStyleAttributeRanges):
+        * svg/SVGAnimateElementBase.cpp:
+        (WebCore::applyCSSPropertyToTarget):
+
</ins><span class="cx"> 2016-10-03  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Avoid null dereference when changing focus in design mode.
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSCSSStyleDeclarationCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp (206752 => 206753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp        2016-10-03 21:51:11 UTC (rev 206752)
+++ trunk/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp        2016-10-03 21:52:37 UTC (rev 206753)
</span><span class="lines">@@ -29,10 +29,15 @@
</span><span class="cx"> #include &quot;CSSParser.h&quot;
</span><span class="cx"> #include &quot;CSSPrimitiveValue.h&quot;
</span><span class="cx"> #include &quot;CSSPropertyNames.h&quot;
</span><ins>+#include &quot;CSSRule.h&quot;
+#include &quot;CSSStyleDeclaration.h&quot;
+#include &quot;CSSStyleSheet.h&quot;
</ins><span class="cx"> #include &quot;CSSValue.h&quot;
</span><span class="cx"> #include &quot;HashTools.h&quot;
</span><ins>+#include &quot;JSCSSStyleDeclaration.h&quot;
</ins><span class="cx"> #include &quot;JSCSSValue.h&quot;
</span><span class="cx"> #include &quot;JSNode.h&quot;
</span><ins>+#include &quot;JSStyleSheetCustom.h&quot;
</ins><span class="cx"> #include &quot;RuntimeEnabledFeatures.h&quot;
</span><span class="cx"> #include &quot;Settings.h&quot;
</span><span class="cx"> #include &quot;StyleProperties.h&quot;
</span><span class="lines">@@ -48,6 +53,17 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+void* root(CSSStyleDeclaration* style)
+{
+    if (auto* parentRule = style-&gt;parentRule())
+        return root(parentRule);
+    if (auto* styleSheet = style-&gt;parentStyleSheet())
+        return root(styleSheet);
+    if (auto* parentElement = style-&gt;parentElement())
+        return root(parentElement);
+    return style;
+}
+
</ins><span class="cx"> void JSCSSStyleDeclaration::visitAdditionalChildren(SlotVisitor&amp; visitor)
</span><span class="cx"> {
</span><span class="cx">     visitor.addOpaqueRoot(root(&amp;wrapped()));
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSCSSStyleDeclarationCustomh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.h (206752 => 206753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.h        2016-10-03 21:51:11 UTC (rev 206752)
+++ trunk/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.h        2016-10-03 21:52:37 UTC (rev 206753)
</span><span class="lines">@@ -26,23 +26,12 @@
</span><span class="cx"> #ifndef JSCSSStyleDeclarationCustom_h
</span><span class="cx"> #define JSCSSStyleDeclarationCustom_h
</span><span class="cx"> 
</span><del>-#include &quot;CSSRule.h&quot;
-#include &quot;CSSStyleDeclaration.h&quot;
-#include &quot;CSSStyleSheet.h&quot;
-#include &quot;JSCSSStyleDeclaration.h&quot;
-#include &quot;JSStyleSheetCustom.h&quot;
-
</del><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-inline void* root(CSSStyleDeclaration* style)
-{
-    if (CSSRule* parentRule = style-&gt;parentRule())
-        return root(parentRule);
-    if (CSSStyleSheet* styleSheet = style-&gt;parentStyleSheet())
-        return root(styleSheet);
-    return style;
-}
</del><ins>+class CSSStyleDeclaration;
</ins><span class="cx"> 
</span><ins>+void* root(CSSStyleDeclaration*);
+
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif // JSCSSStyleDeclarationCustom_h
</span></span></pre></div>
<a id="trunkSourceWebCorecssPropertySetCSSStyleDeclarationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp (206752 => 206753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp        2016-10-03 21:51:11 UTC (rev 206752)
+++ trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp        2016-10-03 21:52:37 UTC (rev 206753)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include &quot;MutationObserverInterestGroup.h&quot;
</span><span class="cx"> #include &quot;MutationRecord.h&quot;
</span><span class="cx"> #include &quot;StyleProperties.h&quot;
</span><ins>+#include &quot;StyleSheetContents.h&quot;
</ins><span class="cx"> #include &quot;StyledElement.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -153,7 +154,7 @@
</span><span class="cx">     if (!willMutate())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    bool changed = m_propertySet-&gt;parseDeclaration(text, contextStyleSheet());
</del><ins>+    bool changed = m_propertySet-&gt;parseDeclaration(text, cssParserContext(), contextStyleSheet());
</ins><span class="cx"> 
</span><span class="cx">     didMutate(changed ? PropertyChanged : NoChanges);
</span><span class="cx"> 
</span><span class="lines">@@ -231,8 +232,13 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     ec = 0;
</span><del>-    bool changed = propertyID != CSSPropertyCustom ? m_propertySet-&gt;setProperty(propertyID, value, important, contextStyleSheet()) : m_propertySet-&gt;setCustomProperty(propertyName, value, important, contextStyleSheet());
</del><span class="cx"> 
</span><ins>+    bool changed;
+    if (propertyID == CSSPropertyCustom)
+        changed = m_propertySet-&gt;setCustomProperty(propertyName, value, important, cssParserContext(), contextStyleSheet());
+    else
+        changed = m_propertySet-&gt;setProperty(propertyID, value, important, cssParserContext(), contextStyleSheet());
+
</ins><span class="cx">     didMutate(changed ? PropertyChanged : NoChanges);
</span><span class="cx"> 
</span><span class="cx">     if (changed) {
</span><span class="lines">@@ -290,7 +296,7 @@
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     ec = 0;
</span><del>-    bool changed = m_propertySet-&gt;setProperty(propertyID, value, important, contextStyleSheet());
</del><ins>+    bool changed = m_propertySet-&gt;setProperty(propertyID, value, important, cssParserContext(), contextStyleSheet());
</ins><span class="cx"> 
</span><span class="cx">     didMutate(changed ? PropertyChanged : NoChanges);
</span><span class="cx"> 
</span><span class="lines">@@ -321,6 +327,11 @@
</span><span class="cx">     return cssStyleSheet ? &amp;cssStyleSheet-&gt;contents() : 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+CSSParserContext PropertySetCSSStyleDeclaration::cssParserContext() const
+{
+    return CSSParserContext(m_propertySet-&gt;cssParserMode());
+}
+
</ins><span class="cx"> Ref&lt;MutableStyleProperties&gt; PropertySetCSSStyleDeclaration::copyProperties() const
</span><span class="cx"> {
</span><span class="cx">     return m_propertySet-&gt;mutableCopy();
</span><span class="lines">@@ -373,9 +384,18 @@
</span><span class="cx"> 
</span><span class="cx"> CSSStyleSheet* StyleRuleCSSStyleDeclaration::parentStyleSheet() const
</span><span class="cx"> {
</span><del>-    return m_parentRule ? m_parentRule-&gt;parentStyleSheet() : 0;
</del><ins>+    return m_parentRule ? m_parentRule-&gt;parentStyleSheet() : nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+CSSParserContext StyleRuleCSSStyleDeclaration::cssParserContext() const
+{
+    auto* styleSheet = contextStyleSheet();
+    if (!styleSheet)
+        return PropertySetCSSStyleDeclaration::cssParserContext();
+
+    return styleSheet-&gt;parserContext();
+}
+
</ins><span class="cx"> void StyleRuleCSSStyleDeclaration::reattach(MutableStyleProperties&amp; propertySet)
</span><span class="cx"> {
</span><span class="cx">     m_propertySet-&gt;deref();
</span><span class="lines">@@ -399,7 +419,17 @@
</span><span class="cx"> 
</span><span class="cx"> CSSStyleSheet* InlineCSSStyleDeclaration::parentStyleSheet() const
</span><span class="cx"> {
</span><del>-    return m_parentElement ? &amp;m_parentElement-&gt;document().elementSheet() : 0;
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+CSSParserContext InlineCSSStyleDeclaration::cssParserContext() const
+{
+    if (!m_parentElement)
+        return PropertySetCSSStyleDeclaration::cssParserContext();
+
+    CSSParserContext context(m_parentElement-&gt;document());
+    context.mode = m_propertySet-&gt;cssParserMode();
+    return context;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecssPropertySetCSSStyleDeclarationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.h (206752 => 206753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.h        2016-10-03 21:51:11 UTC (rev 206752)
+++ trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.h        2016-10-03 21:52:37 UTC (rev 206753)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #ifndef PropertySetCSSStyleDeclaration_h
</span><span class="cx"> #define PropertySetCSSStyleDeclaration_h
</span><span class="cx"> 
</span><ins>+#include &quot;CSSParserMode.h&quot;
</ins><span class="cx"> #include &quot;CSSStyleDeclaration.h&quot;
</span><span class="cx"> #include &lt;memory&gt;
</span><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><span class="lines">@@ -75,6 +76,7 @@
</span><span class="cx">     enum MutationType { NoChanges, PropertyChanged };
</span><span class="cx">     virtual bool willMutate() WARN_UNUSED_RETURN { return true; }
</span><span class="cx">     virtual void didMutate(MutationType) { }
</span><ins>+    virtual CSSParserContext cssParserContext() const;
</ins><span class="cx"> 
</span><span class="cx">     MutableStyleProperties* m_propertySet;
</span><span class="cx">     std::unique_ptr&lt;HashMap&lt;CSSValue*, RefPtr&lt;CSSValue&gt;&gt;&gt; m_cssomCSSValueClones;
</span><span class="lines">@@ -105,6 +107,7 @@
</span><span class="cx"> 
</span><span class="cx">     bool willMutate() final WARN_UNUSED_RETURN;
</span><span class="cx">     void didMutate(MutationType) final;
</span><ins>+    CSSParserContext cssParserContext() const final;
</ins><span class="cx"> 
</span><span class="cx">     unsigned m_refCount;
</span><span class="cx">     CSSRule* m_parentRule;
</span><span class="lines">@@ -125,6 +128,7 @@
</span><span class="cx">     void clearParentElement() final { m_parentElement = 0; }
</span><span class="cx"> 
</span><span class="cx">     void didMutate(MutationType) final;
</span><ins>+    CSSParserContext cssParserContext() const final;
</ins><span class="cx"> 
</span><span class="cx">     StyledElement* m_parentElement;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCorecssStylePropertiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleProperties.cpp (206752 => 206753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleProperties.cpp        2016-10-03 21:51:11 UTC (rev 206752)
+++ trunk/Source/WebCore/css/StyleProperties.cpp        2016-10-03 21:52:37 UTC (rev 206753)
</span><span class="lines">@@ -725,7 +725,7 @@
</span><span class="cx">     return propertyAt(foundPropertyIndex).isImplicit();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool MutableStyleProperties::setProperty(CSSPropertyID propertyID, const String&amp; value, bool important, StyleSheetContents* contextStyleSheet)
</del><ins>+bool MutableStyleProperties::setProperty(CSSPropertyID propertyID, const String&amp; value, bool important, CSSParserContext parserContext, StyleSheetContents* contextStyleSheet)
</ins><span class="cx"> {
</span><span class="cx">     // Setting the value to an empty string just removes the property in both IE and Gecko.
</span><span class="cx">     // Setting it to null seems to produce less consistent results, but we treat it just the same.
</span><span class="lines">@@ -732,21 +732,30 @@
</span><span class="cx">     if (value.isEmpty())
</span><span class="cx">         return removeProperty(propertyID);
</span><span class="cx"> 
</span><ins>+    parserContext.mode = cssParserMode();
+
</ins><span class="cx">     // When replacing an existing property value, this moves the property to the end of the list.
</span><span class="cx">     // Firefox preserves the position, and MSIE moves the property to the beginning.
</span><del>-    return CSSParser::parseValue(*this, propertyID, value, important, cssParserMode(), contextStyleSheet) == CSSParser::ParseResult::Changed;
</del><ins>+    return CSSParser::parseValue(*this, propertyID, value, important, parserContext, contextStyleSheet) == CSSParser::ParseResult::Changed;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool MutableStyleProperties::setCustomProperty(const String&amp; propertyName, const String&amp; value, bool important, StyleSheetContents* contextStyleSheet)
</del><ins>+bool MutableStyleProperties::setProperty(CSSPropertyID propertyID, const String&amp; value, bool important)
</ins><span class="cx"> {
</span><ins>+    CSSParserContext parserContext(cssParserMode());
+    return setProperty(propertyID, value, important, parserContext);
+}
+
+bool MutableStyleProperties::setCustomProperty(const String&amp; propertyName, const String&amp; value, bool important, CSSParserContext parserContext, StyleSheetContents* contextStyleSheet)
+{
</ins><span class="cx">     // Setting the value to an empty string just removes the property in both IE and Gecko.
</span><span class="cx">     // Setting it to null seems to produce less consistent results, but we treat it just the same.
</span><span class="cx">     if (value.isEmpty())
</span><span class="cx">         return removeCustomProperty(propertyName);
</span><span class="cx"> 
</span><ins>+    parserContext.mode = cssParserMode();
</ins><span class="cx">     // When replacing an existing property value, this moves the property to the end of the list.
</span><span class="cx">     // Firefox preserves the position, and MSIE moves the property to the beginning.
</span><del>-    return CSSParser::parseCustomPropertyValue(*this, propertyName, value, important, cssParserMode(), contextStyleSheet) == CSSParser::ParseResult::Changed;
</del><ins>+    return CSSParser::parseCustomPropertyValue(*this, propertyName, value, important, parserContext, contextStyleSheet) == CSSParser::ParseResult::Changed;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void MutableStyleProperties::setProperty(CSSPropertyID propertyID, RefPtr&lt;CSSValue&gt;&amp;&amp; value, bool important)
</span><span class="lines">@@ -798,16 +807,13 @@
</span><span class="cx">     return setProperty(CSSProperty(propertyID, CSSValuePool::singleton().createIdentifierValue(identifier), important));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool MutableStyleProperties::parseDeclaration(const String&amp; styleDeclaration, StyleSheetContents* contextStyleSheet)
</del><ins>+bool MutableStyleProperties::parseDeclaration(const String&amp; styleDeclaration, CSSParserContext context, StyleSheetContents* contextStyleSheet)
</ins><span class="cx"> {
</span><span class="cx">     auto oldProperties = WTFMove(m_propertyVector);
</span><span class="cx">     m_propertyVector.clear();
</span><span class="cx"> 
</span><del>-    CSSParserContext context(cssParserMode());
-    if (contextStyleSheet) {
-        context = contextStyleSheet-&gt;parserContext();
-        context.mode = cssParserMode();
-    }
</del><ins>+    context.mode = cssParserMode();
+
</ins><span class="cx">     CSSParser parser(context);
</span><span class="cx">     parser.parseDeclaration(*this, styleDeclaration, 0, contextStyleSheet);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssStylePropertiesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleProperties.h (206752 => 206753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleProperties.h        2016-10-03 21:51:11 UTC (rev 206752)
+++ trunk/Source/WebCore/css/StyleProperties.h        2016-10-03 21:52:37 UTC (rev 206753)
</span><span class="lines">@@ -199,7 +199,8 @@
</span><span class="cx">     bool addParsedProperty(const CSSProperty&amp;);
</span><span class="cx"> 
</span><span class="cx">     // These expand shorthand properties into multiple properties.
</span><del>-    bool setProperty(CSSPropertyID, const String&amp; value, bool important = false, StyleSheetContents* contextStyleSheet = 0);
</del><ins>+    bool setProperty(CSSPropertyID, const String&amp; value, bool important, CSSParserContext, StyleSheetContents* = nullptr);
+    bool setProperty(CSSPropertyID, const String&amp; value, bool important = false);
</ins><span class="cx">     void setProperty(CSSPropertyID, RefPtr&lt;CSSValue&gt;&amp;&amp;, bool important = false);
</span><span class="cx"> 
</span><span class="cx">     // These do not. FIXME: This is too messy, we can do better.
</span><span class="lines">@@ -214,7 +215,7 @@
</span><span class="cx">     void mergeAndOverrideOnConflict(const StyleProperties&amp;);
</span><span class="cx"> 
</span><span class="cx">     void clear();
</span><del>-    bool parseDeclaration(const String&amp; styleDeclaration, StyleSheetContents* contextStyleSheet);
</del><ins>+    bool parseDeclaration(const String&amp; styleDeclaration, CSSParserContext, StyleSheetContents* = nullptr);
</ins><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT CSSStyleDeclaration* ensureCSSStyleDeclaration();
</span><span class="cx">     CSSStyleDeclaration* ensureInlineCSSStyleDeclaration(StyledElement* parentElement);
</span><span class="lines">@@ -225,7 +226,7 @@
</span><span class="cx">     Vector&lt;CSSProperty, 4&gt; m_propertyVector;
</span><span class="cx"> 
</span><span class="cx">     // Methods for querying and altering CSS custom properties.
</span><del>-    bool setCustomProperty(const String&amp; propertyName, const String&amp; value, bool important = false, StyleSheetContents* contextStyleSheet = 0);
</del><ins>+    bool setCustomProperty(const String&amp; propertyName, const String&amp; value, bool important, CSSParserContext, StyleSheetContents* = nullptr);
</ins><span class="cx">     bool removeCustomProperty(const String&amp; propertyName, String* returnText = nullptr);
</span><span class="cx"> 
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSParser.cpp (206752 => 206753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSParser.cpp        2016-10-03 21:51:11 UTC (rev 206752)
+++ trunk/Source/WebCore/css/parser/CSSParser.cpp        2016-10-03 21:52:37 UTC (rev 206753)
</span><span class="lines">@@ -1312,23 +1312,17 @@
</span><span class="cx">     return WTFMove(valueList);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-CSSParser::ParseResult CSSParser::parseValue(MutableStyleProperties&amp; declaration, CSSPropertyID propertyID, const String&amp; string, bool important, CSSParserMode cssParserMode, StyleSheetContents* contextStyleSheet)
</del><ins>+CSSParser::ParseResult CSSParser::parseValue(MutableStyleProperties&amp; declaration, CSSPropertyID propertyID, const String&amp; string, bool important, const CSSParserContext&amp; context, StyleSheetContents* contextStyleSheet)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(!string.isEmpty());
</span><del>-    CSSParser::ParseResult result = parseSimpleLengthValue(declaration, propertyID, string, important, cssParserMode);
</del><ins>+    CSSParser::ParseResult result = parseSimpleLengthValue(declaration, propertyID, string, important, context.mode);
</ins><span class="cx">     if (result != ParseResult::Error)
</span><span class="cx">         return result;
</span><span class="cx"> 
</span><del>-    result = parseColorValue(declaration, propertyID, string, important, cssParserMode);
</del><ins>+    result = parseColorValue(declaration, propertyID, string, important,  context.mode);
</ins><span class="cx">     if (result != ParseResult::Error)
</span><span class="cx">         return result;
</span><span class="cx"> 
</span><del>-    CSSParserContext context(cssParserMode);
-    if (contextStyleSheet) {
-        context = contextStyleSheet-&gt;parserContext();
-        context.mode = cssParserMode;
-    }
-
</del><span class="cx">     result = parseKeywordValue(declaration, propertyID, string, important, context, contextStyleSheet);
</span><span class="cx">     if (result != ParseResult::Error)
</span><span class="cx">         return result;
</span><span class="lines">@@ -1341,14 +1335,8 @@
</span><span class="cx">     return parser.parseValue(declaration, propertyID, string, important, contextStyleSheet);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-CSSParser::ParseResult CSSParser::parseCustomPropertyValue(MutableStyleProperties&amp; declaration, const AtomicString&amp; propertyName, const String&amp; string, bool important, CSSParserMode cssParserMode, StyleSheetContents* contextStyleSheet)
</del><ins>+CSSParser::ParseResult CSSParser::parseCustomPropertyValue(MutableStyleProperties&amp; declaration, const AtomicString&amp; propertyName, const String&amp; string, bool important, const CSSParserContext&amp; context, StyleSheetContents* contextStyleSheet)
</ins><span class="cx"> {
</span><del>-    CSSParserContext context(cssParserMode);
-    if (contextStyleSheet) {
-        context = contextStyleSheet-&gt;parserContext();
-        context.mode = cssParserMode;
-    }
-
</del><span class="cx">     CSSParser parser(context);
</span><span class="cx">     parser.setCustomPropertyName(propertyName);
</span><span class="cx">     return parser.parseValue(declaration, CSSPropertyCustom, string, important, contextStyleSheet);
</span><span class="lines">@@ -1447,9 +1435,9 @@
</span><span class="cx"> 
</span><span class="cx"> Ref&lt;ImmutableStyleProperties&gt; CSSParser::parseInlineStyleDeclaration(const String&amp; string, Element* element)
</span><span class="cx"> {
</span><del>-    CSSParserContext context = element-&gt;document().elementSheet().contents().parserContext();
</del><ins>+    CSSParserContext context(element-&gt;document());
</ins><span class="cx">     context.mode = strictToCSSParserMode(element-&gt;isHTMLElement() &amp;&amp; !element-&gt;document().inQuirksMode());
</span><del>-    return CSSParser(context).parseDeclaration(string, &amp;element-&gt;document().elementSheet().contents());
</del><ins>+    return CSSParser(context).parseDeclaration(string, nullptr);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Ref&lt;ImmutableStyleProperties&gt; CSSParser::parseDeclaration(const String&amp; string, StyleSheetContents* contextStyleSheet)
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSParser.h (206752 => 206753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSParser.h        2016-10-03 21:51:11 UTC (rev 206752)
+++ trunk/Source/WebCore/css/parser/CSSParser.h        2016-10-03 21:52:37 UTC (rev 206753)
</span><span class="lines">@@ -131,8 +131,8 @@
</span><span class="cx">     RefPtr&lt;StyleKeyframe&gt; parseKeyframeRule(StyleSheetContents*, const String&amp;);
</span><span class="cx">     bool parseSupportsCondition(const String&amp;);
</span><span class="cx"> 
</span><del>-    static ParseResult parseValue(MutableStyleProperties&amp;, CSSPropertyID, const String&amp;, bool important, CSSParserMode, StyleSheetContents*);
-    static ParseResult parseCustomPropertyValue(MutableStyleProperties&amp;, const AtomicString&amp; propertyName, const String&amp;, bool important, CSSParserMode, StyleSheetContents* contextStyleSheet);
</del><ins>+    static ParseResult parseValue(MutableStyleProperties&amp;, CSSPropertyID, const String&amp;, bool important, const CSSParserContext&amp;, StyleSheetContents*);
+    static ParseResult parseCustomPropertyValue(MutableStyleProperties&amp;, const AtomicString&amp; propertyName, const String&amp;, bool important, const CSSParserContext&amp;, StyleSheetContents* contextStyleSheet);
</ins><span class="cx"> 
</span><span class="cx">     static bool parseColor(RGBA32&amp; color, const String&amp;, bool strict = false);
</span><span class="cx">     static bool isValidSystemColorValue(CSSValueID);
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSParserImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSParserImpl.cpp (206752 => 206753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSParserImpl.cpp        2016-10-03 21:51:11 UTC (rev 206752)
+++ trunk/Source/WebCore/css/parser/CSSParserImpl.cpp        2016-10-03 21:52:37 UTC (rev 206753)
</span><span class="lines">@@ -135,14 +135,13 @@
</span><span class="cx"> 
</span><span class="cx"> Ref&lt;ImmutableStyleProperties&gt; CSSParserImpl::parseInlineStyleDeclaration(const String&amp; string, Element* element)
</span><span class="cx"> {
</span><del>-    Document&amp; document = element-&gt;document();
-    CSSParserContext context = CSSParserContext(document.elementSheet().contents().parserContext());
-    CSSParserMode mode = element-&gt;isHTMLElement() &amp;&amp; !document.inQuirksMode() ? HTMLStandardMode : HTMLQuirksMode;
-    context.mode = mode;
-    CSSParserImpl parser(context, &amp;document.elementSheet().contents());
</del><ins>+    CSSParserContext context(element-&gt;document());
+    context.mode = strictToCSSParserMode(element-&gt;isHTMLElement() &amp;&amp; !element-&gt;document().inQuirksMode());
+
+    CSSParserImpl parser(context);
</ins><span class="cx">     CSSTokenizer::Scope scope(string);
</span><span class="cx">     parser.consumeDeclarationList(scope.tokenRange(), StyleRule::Style);
</span><del>-    return createStyleProperties(parser.m_parsedProperties, mode);
</del><ins>+    return createStyleProperties(parser.m_parsedProperties, context.mode);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool CSSParserImpl::parseDeclarationList(MutableStyleProperties* declaration, const String&amp; string, const CSSParserContext&amp; context)
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (206752 => 206753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2016-10-03 21:51:11 UTC (rev 206752)
+++ trunk/Source/WebCore/dom/Document.cpp        2016-10-03 21:52:37 UTC (rev 206753)
</span><span class="lines">@@ -629,8 +629,6 @@
</span><span class="cx">     if (m_styleSheetList)
</span><span class="cx">         m_styleSheetList-&gt;detachFromDocument();
</span><span class="cx"> 
</span><del>-    if (m_elementSheet)
-        m_elementSheet-&gt;detachFromDocument();
</del><span class="cx">     extensionStyleSheets().detachFromDocument();
</span><span class="cx"> 
</span><span class="cx">     clearStyleResolver(); // We need to destroy CSSFontSelector before destroying m_cachedResourceLoader.
</span><span class="lines">@@ -2963,16 +2961,6 @@
</span><span class="cx">     if (!m_baseURL.isValid())
</span><span class="cx">         m_baseURL = URL();
</span><span class="cx"> 
</span><del>-    if (m_elementSheet) {
-        // Element sheet is silly. It never contains anything.
-        ASSERT(!m_elementSheet-&gt;contents().ruleCount());
-        bool usesStyleBasedEditability = m_elementSheet-&gt;contents().usesStyleBasedEditability();
-        m_elementSheet = CSSStyleSheet::createInline(*this, m_baseURL);
-        // FIXME: So we are not really the parser. The right fix is to eliminate the element sheet completely.
-        if (usesStyleBasedEditability)
-            m_elementSheet-&gt;contents().parserSetUsesStyleBasedEditability();
-    }
-
</del><span class="cx">     if (!equalIgnoringFragmentIdentifier(oldBaseURL, m_baseURL)) {
</span><span class="cx">         // Base URL change changes any relative visited links.
</span><span class="cx">         // FIXME: There are other URLs in the tree that would need to be re-evaluated on dynamic base URL change. Style should be invalidated too.
</span><span class="lines">@@ -3158,16 +3146,9 @@
</span><span class="cx">         view()-&gt;scrollToFragment(m_url);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-CSSStyleSheet&amp; Document::elementSheet()
-{
-    if (!m_elementSheet)
-        m_elementSheet = CSSStyleSheet::createInline(*this, m_baseURL);
-    return *m_elementSheet;
-}
-
</del><span class="cx"> bool Document::usesStyleBasedEditability() const
</span><span class="cx"> {
</span><del>-    if (m_elementSheet &amp;&amp; m_elementSheet-&gt;contents().usesStyleBasedEditability())
</del><ins>+    if (m_hasElementUsingStyleBasedEditability)
</ins><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="cx">     ASSERT(!m_renderView || !m_renderView-&gt;frameView().isPainting());
</span><span class="lines">@@ -3178,6 +3159,11 @@
</span><span class="cx">     return authorSheets.usesStyleBasedEditability();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void Document::setHasElementUsingStyleBasedEditability()
+{
+    m_hasElementUsingStyleBasedEditability = true;
+}
+
</ins><span class="cx"> void Document::processHttpEquiv(const String&amp; equiv, const String&amp; content, bool isInDocumentHead)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!equiv.isNull());
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.h (206752 => 206753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.h        2016-10-03 21:51:11 UTC (rev 206752)
+++ trunk/Source/WebCore/dom/Document.h        2016-10-03 21:52:37 UTC (rev 206753)
</span><span class="lines">@@ -648,8 +648,8 @@
</span><span class="cx">     bool canNavigate(Frame* targetFrame);
</span><span class="cx">     Frame* findUnsafeParentScrollPropagationBoundary();
</span><span class="cx"> 
</span><del>-    CSSStyleSheet&amp; elementSheet();
</del><span class="cx">     bool usesStyleBasedEditability() const;
</span><ins>+    void setHasElementUsingStyleBasedEditability();
</ins><span class="cx">     
</span><span class="cx">     virtual Ref&lt;DocumentParser&gt; createParser();
</span><span class="cx">     DocumentParser* parser() const { return m_parser.get(); }
</span><span class="lines">@@ -1446,7 +1446,7 @@
</span><span class="cx"> 
</span><span class="cx">     std::unique_ptr&lt;DOMImplementation&gt; m_implementation;
</span><span class="cx"> 
</span><del>-    RefPtr&lt;CSSStyleSheet&gt; m_elementSheet;
</del><ins>+    bool m_hasElementUsingStyleBasedEditability { false };
</ins><span class="cx"> 
</span><span class="cx">     bool m_printing;
</span><span class="cx">     bool m_paginatedForScreen;
</span></span></pre></div>
<a id="trunkSourceWebCoredomStyledElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/StyledElement.cpp (206752 => 206753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/StyledElement.cpp        2016-10-03 21:51:11 UTC (rev 206752)
+++ trunk/Source/WebCore/dom/StyledElement.cpp        2016-10-03 21:52:37 UTC (rev 206753)
</span><span class="lines">@@ -174,8 +174,13 @@
</span><span class="cx">     return cssomWrapper;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline void StyledElement::setInlineStyleFromString(const AtomicString&amp; newStyleString)
</del><ins>+static bool usesStyleBasedEditability(const StyleProperties&amp; properties)
</ins><span class="cx"> {
</span><ins>+    return properties.getPropertyCSSValue(CSSPropertyWebkitUserModify);
+}
+
+void StyledElement::setInlineStyleFromString(const AtomicString&amp; newStyleString)
+{
</ins><span class="cx">     RefPtr&lt;StyleProperties&gt;&amp; inlineStyle = elementData()-&gt;m_inlineStyle;
</span><span class="cx"> 
</span><span class="cx">     // Avoid redundant work if we're using shared attribute data with already parsed inline style.
</span><span class="lines">@@ -190,7 +195,10 @@
</span><span class="cx">     if (!inlineStyle)
</span><span class="cx">         inlineStyle = CSSParser::parseInlineStyleDeclaration(newStyleString, this);
</span><span class="cx">     else
</span><del>-        downcast&lt;MutableStyleProperties&gt;(*inlineStyle).parseDeclaration(newStyleString, &amp;document().elementSheet().contents());
</del><ins>+        downcast&lt;MutableStyleProperties&gt;(*inlineStyle).parseDeclaration(newStyleString, document());
+
+    if (usesStyleBasedEditability(*inlineStyle))
+        document().setHasElementUsingStyleBasedEditability();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void StyledElement::styleAttributeChanged(const AtomicString&amp; newStyleString, AttributeModificationReason reason)
</span><span class="lines">@@ -212,6 +220,15 @@
</span><span class="cx">     InspectorInstrumentation::didInvalidateStyleAttr(document(), *this);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void StyledElement::invalidateStyleAttribute()
+{
+    if (usesStyleBasedEditability(*inlineStyle()))
+        document().setHasElementUsingStyleBasedEditability();
+
+    elementData()-&gt;setStyleAttributeIsDirty(true);
+    setNeedsStyleRecalc(InlineStyleChange);
+}
+
</ins><span class="cx"> void StyledElement::inlineStyleChanged()
</span><span class="cx"> {
</span><span class="cx">     invalidateStyleAttribute();
</span><span class="lines">@@ -241,7 +258,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool StyledElement::setInlineStyleProperty(CSSPropertyID propertyID, const String&amp; value, bool important)
</span><span class="cx"> {
</span><del>-    bool changes = ensureMutableInlineStyle().setProperty(propertyID, value, important, &amp;document().elementSheet().contents());
</del><ins>+    bool changes = ensureMutableInlineStyle().setProperty(propertyID, value, important, CSSParserContext(document()));
</ins><span class="cx">     if (changes)
</span><span class="cx">         inlineStyleChanged();
</span><span class="cx">     return changes;
</span><span class="lines">@@ -376,7 +393,7 @@
</span><span class="cx">     
</span><span class="cx"> void StyledElement::addPropertyToPresentationAttributeStyle(MutableStyleProperties&amp; style, CSSPropertyID propertyID, const String&amp; value)
</span><span class="cx"> {
</span><del>-    style.setProperty(propertyID, value, false, &amp;document().elementSheet().contents());
</del><ins>+    style.setProperty(propertyID, value, false, CSSParserContext(document()));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoredomStyledElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/StyledElement.h (206752 => 206753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/StyledElement.h        2016-10-03 21:51:11 UTC (rev 206752)
+++ trunk/Source/WebCore/dom/StyledElement.h        2016-10-03 21:52:37 UTC (rev 206753)
</span><span class="lines">@@ -93,13 +93,6 @@
</span><span class="cx">     void rebuildPresentationAttributeStyle();
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-inline void StyledElement::invalidateStyleAttribute()
-{
-    ASSERT(elementData());
-    elementData()-&gt;setStyleAttributeIsDirty(true);
-    setNeedsStyleRecalc(InlineStyleChange);
-}
-
</del><span class="cx"> inline const StyleProperties* StyledElement::presentationAttributeStyle() const
</span><span class="cx"> {
</span><span class="cx">     if (!elementData())
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorStyleSheetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp (206752 => 206753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp        2016-10-03 21:51:11 UTC (rev 206752)
+++ trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp        2016-10-03 21:52:37 UTC (rev 206753)
</span><span class="lines">@@ -1366,7 +1366,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     auto tempDeclaration = MutableStyleProperties::create();
</span><del>-    createCSSParser(&amp;m_element-&gt;document())-&gt;parseDeclaration(tempDeclaration, m_styleText, result, &amp;m_element-&gt;document().elementSheet().contents());
</del><ins>+    createCSSParser(&amp;m_element-&gt;document())-&gt;parseDeclaration(tempDeclaration, m_styleText, result, nullptr);
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGAnimateElementBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp (206752 => 206753)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp        2016-10-03 21:51:11 UTC (rev 206752)
+++ trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp        2016-10-03 21:52:37 UTC (rev 206753)
</span><span class="lines">@@ -236,7 +236,7 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!targetElement.m_deletionHasBegun);
</span><span class="cx"> 
</span><del>-    if (!targetElement.ensureAnimatedSMILStyleProperties().setProperty(id, value, false, 0))
</del><ins>+    if (!targetElement.ensureAnimatedSMILStyleProperties().setProperty(id, value, false))
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     targetElement.setNeedsStyleRecalc(SyntheticStyleChange);
</span></span></pre>
</div>
</div>

</body>
</html>