<!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>[209304] 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/209304">209304</a></dd>
<dt>Author</dt> <dd>hyatt@apple.com</dd>
<dt>Date</dt> <dd>2016-12-03 13:22:49 -0800 (Sat, 03 Dec 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[CSS Parser] Remove line numbers from StyleRule.
https://bugs.webkit.org/show_bug.cgi?id=165361

Reviewed by Simon Fraser.

StyleRules have a concept of a source line that is eventually passed
to the inspector. This was only ever used by normal rules, i.e., ones with
selectors, and set to 0 for all other rules. This line was set to the line number
at which the end of the selector text occurred.

Because Inspector already computes the start and end range for the selector
text, storing a source line on StyleRule ends up being redundant. This patch
gets rid of the source line and uses the end line of the selector text
instead.

* css/CSSGrammar.y.in:
Remove the code that updates the last seen selector line.

* css/CSSKeyframeRule.cpp:
(WebCore::StyleKeyframe::StyleKeyframe):
* css/CSSKeyframesRule.cpp:
(WebCore::StyleRuleKeyframes::StyleRuleKeyframes):
No longer need to pass in a 0 line number.

* css/StyleRule.cpp:
(WebCore::StyleRule::StyleRule):
(WebCore::StyleRule::create):
(WebCore::StyleRule::splitIntoMultipleRulesWithMaximumSelectorComponentCount):
(WebCore::StyleRuleFontFace::StyleRuleFontFace):
(WebCore::StyleRuleGroup::StyleRuleGroup):
(WebCore::StyleRuleCharset::StyleRuleCharset):
(WebCore::StyleRuleNamespace::StyleRuleNamespace):
* css/StyleRule.h:
(WebCore::StyleRuleBase::StyleRuleBase):
(WebCore::StyleRuleBase::sourceLine): Deleted.
* css/StyleRuleImport.cpp:
(WebCore::StyleRuleImport::StyleRuleImport):
Remove m_sourceLine and change the create methods and constructors to not
require a line number.

* css/parser/CSSParser.cpp:
(WebCore::CSSParser::createStyleRule):
Line number no longer needed.

(WebCore::CSSParser::updateLastSelectorLineAndPosition): Deleted.
* css/parser/CSSParser.h:
Got rid of the function that tracks and updates the last seen selector line.

* css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::consumeStyleRule):
Fix the rule creation in the new parser to not pass in a 0 line number.

* inspector/InspectorStyleSheet.cpp:
(WebCore::buildSourceRangeObject):
(WebCore::InspectorStyleSheet::buildObjectForSelectorList):
(WebCore::InspectorStyleSheet::buildObjectForRule):
* inspector/InspectorStyleSheet.h:
Patch the methods that build up the selector range to return the end line
information for selector text so that it can be set as the source line
for the rule (thus eliminating the need to store the line number on the style
rule itself).</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSGrammaryin">trunk/Source/WebCore/css/CSSGrammar.y.in</a></li>
<li><a href="#trunkSourceWebCorecssCSSKeyframeRulecpp">trunk/Source/WebCore/css/CSSKeyframeRule.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSKeyframesRulecpp">trunk/Source/WebCore/css/CSSKeyframesRule.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStyleRulecpp">trunk/Source/WebCore/css/StyleRule.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStyleRuleh">trunk/Source/WebCore/css/StyleRule.h</a></li>
<li><a href="#trunkSourceWebCorecssStyleRuleImportcpp">trunk/Source/WebCore/css/StyleRuleImport.cpp</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="#trunkSourceWebCoreinspectorInspectorStyleSheetcpp">trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorStyleSheeth">trunk/Source/WebCore/inspector/InspectorStyleSheet.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (209303 => 209304)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-12-03 20:22:43 UTC (rev 209303)
+++ trunk/Source/WebCore/ChangeLog        2016-12-03 21:22:49 UTC (rev 209304)
</span><span class="lines">@@ -1,3 +1,67 @@
</span><ins>+2016-12-03  Dave Hyatt  &lt;hyatt@apple.com&gt;
+
+        [CSS Parser] Remove line numbers from StyleRule.
+        https://bugs.webkit.org/show_bug.cgi?id=165361
+
+        Reviewed by Simon Fraser.
+
+        StyleRules have a concept of a source line that is eventually passed
+        to the inspector. This was only ever used by normal rules, i.e., ones with
+        selectors, and set to 0 for all other rules. This line was set to the line number
+        at which the end of the selector text occurred.
+
+        Because Inspector already computes the start and end range for the selector
+        text, storing a source line on StyleRule ends up being redundant. This patch
+        gets rid of the source line and uses the end line of the selector text
+        instead.
+
+        * css/CSSGrammar.y.in:
+        Remove the code that updates the last seen selector line.
+
+        * css/CSSKeyframeRule.cpp:
+        (WebCore::StyleKeyframe::StyleKeyframe):
+        * css/CSSKeyframesRule.cpp:
+        (WebCore::StyleRuleKeyframes::StyleRuleKeyframes):
+        No longer need to pass in a 0 line number.
+
+        * css/StyleRule.cpp:
+        (WebCore::StyleRule::StyleRule):
+        (WebCore::StyleRule::create):
+        (WebCore::StyleRule::splitIntoMultipleRulesWithMaximumSelectorComponentCount):
+        (WebCore::StyleRuleFontFace::StyleRuleFontFace):
+        (WebCore::StyleRuleGroup::StyleRuleGroup):
+        (WebCore::StyleRuleCharset::StyleRuleCharset):
+        (WebCore::StyleRuleNamespace::StyleRuleNamespace):
+        * css/StyleRule.h:
+        (WebCore::StyleRuleBase::StyleRuleBase):
+        (WebCore::StyleRuleBase::sourceLine): Deleted.
+        * css/StyleRuleImport.cpp:
+        (WebCore::StyleRuleImport::StyleRuleImport):
+        Remove m_sourceLine and change the create methods and constructors to not
+        require a line number.
+
+        * css/parser/CSSParser.cpp:
+        (WebCore::CSSParser::createStyleRule):
+        Line number no longer needed.
+
+        (WebCore::CSSParser::updateLastSelectorLineAndPosition): Deleted.
+        * css/parser/CSSParser.h:
+        Got rid of the function that tracks and updates the last seen selector line.
+
+        * css/parser/CSSParserImpl.cpp:
+        (WebCore::CSSParserImpl::consumeStyleRule):
+        Fix the rule creation in the new parser to not pass in a 0 line number.
+
+        * inspector/InspectorStyleSheet.cpp:
+        (WebCore::buildSourceRangeObject):
+        (WebCore::InspectorStyleSheet::buildObjectForSelectorList):
+        (WebCore::InspectorStyleSheet::buildObjectForRule):
+        * inspector/InspectorStyleSheet.h:
+        Patch the methods that build up the selector range to return the end line
+        information for selector text so that it can be set as the source line
+        for the rule (thus eliminating the need to store the line number on the style
+        rule itself).
+
</ins><span class="cx"> 2016-12-02  Sam Weinig  &lt;sam@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         optional sequence values not handled correctly by binding generator
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSGrammaryin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSGrammar.y.in (209303 => 209304)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSGrammar.y.in        2016-12-03 20:22:43 UTC (rev 209303)
+++ trunk/Source/WebCore/css/CSSGrammar.y.in        2016-12-03 21:22:49 UTC (rev 209304)
</span><span class="lines">@@ -1048,7 +1048,6 @@
</span><span class="cx">         if ($1) {
</span><span class="cx">             $$ = parser-&gt;createSelectorVector().release();
</span><span class="cx">             $$-&gt;append(std::unique_ptr&lt;CSSParserSelector&gt;($1));
</span><del>-            parser-&gt;updateLastSelectorLineAndPosition();
</del><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     | selector_list at_selector_end ',' maybe_space before_selector_group_item complex_selector %prec UNIMPORTANT_TOK {
</span><span class="lines">@@ -1058,7 +1057,6 @@
</span><span class="cx">         if (selectorList &amp;&amp; selector) {
</span><span class="cx">             $$ = selectorList.release();
</span><span class="cx">             $$-&gt;append(WTFMove(selector));
</span><del>-            parser-&gt;updateLastSelectorLineAndPosition();
</del><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     | selector_list error {
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSKeyframeRulecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSKeyframeRule.cpp (209303 => 209304)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSKeyframeRule.cpp        2016-12-03 20:22:43 UTC (rev 209303)
+++ trunk/Source/WebCore/css/CSSKeyframeRule.cpp        2016-12-03 21:22:49 UTC (rev 209304)
</span><span class="lines">@@ -34,13 +34,13 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> StyleKeyframe::StyleKeyframe(Ref&lt;StyleProperties&gt;&amp;&amp; properties)
</span><del>-    : StyleRuleBase(Keyframe, 0)
</del><ins>+    : StyleRuleBase(Keyframe)
</ins><span class="cx">     , m_properties(WTFMove(properties))
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> StyleKeyframe::StyleKeyframe(std::unique_ptr&lt;Vector&lt;double&gt;&gt; keys, Ref&lt;StyleProperties&gt;&amp;&amp; properties)
</span><del>-    : StyleRuleBase(Keyframe, 0)
</del><ins>+    : StyleRuleBase(Keyframe)
</ins><span class="cx">     , m_properties(WTFMove(properties))
</span><span class="cx">     , m_keys(*keys)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSKeyframesRulecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSKeyframesRule.cpp (209303 => 209304)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSKeyframesRule.cpp        2016-12-03 20:22:43 UTC (rev 209303)
+++ trunk/Source/WebCore/css/CSSKeyframesRule.cpp        2016-12-03 21:22:49 UTC (rev 209304)
</span><span class="lines">@@ -38,7 +38,7 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> StyleRuleKeyframes::StyleRuleKeyframes()
</span><del>-    : StyleRuleBase(Keyframes, 0)
</del><ins>+    : StyleRuleBase(Keyframes)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleRulecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleRule.cpp (209303 => 209304)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleRule.cpp        2016-12-03 20:22:43 UTC (rev 209303)
+++ trunk/Source/WebCore/css/StyleRule.cpp        2016-12-03 21:22:49 UTC (rev 209304)
</span><span class="lines">@@ -40,7 +40,7 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> struct SameSizeAsStyleRuleBase : public WTF::RefCountedBase {
</span><del>-    unsigned bitfields;
</del><ins>+    unsigned bitfields : 5;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> COMPILE_ASSERT(sizeof(StyleRuleBase) == sizeof(SameSizeAsStyleRuleBase), StyleRuleBase_should_stay_small);
</span><span class="lines">@@ -204,8 +204,8 @@
</span><span class="cx">     return sizeof(StyleRule) + sizeof(CSSSelector) + StyleProperties::averageSizeInBytes();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-StyleRule::StyleRule(int sourceLine, Ref&lt;StyleProperties&gt;&amp;&amp; properties)
-    : StyleRuleBase(Style, sourceLine)
</del><ins>+StyleRule::StyleRule(Ref&lt;StyleProperties&gt;&amp;&amp; properties)
+    : StyleRuleBase(Style)
</ins><span class="cx">     , m_properties(WTFMove(properties))
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -228,7 +228,7 @@
</span><span class="cx">     return downcast&lt;MutableStyleProperties&gt;(m_properties.get());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Ref&lt;StyleRule&gt; StyleRule::create(int sourceLine, const Vector&lt;const CSSSelector*&gt;&amp; selectors, Ref&lt;StyleProperties&gt;&amp;&amp; properties)
</del><ins>+Ref&lt;StyleRule&gt; StyleRule::create(const Vector&lt;const CSSSelector*&gt;&amp; selectors, Ref&lt;StyleProperties&gt;&amp;&amp; properties)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT_WITH_SECURITY_IMPLICATION(!selectors.isEmpty());
</span><span class="cx">     CSSSelector* selectorListArray = reinterpret_cast&lt;CSSSelector*&gt;(fastMalloc(sizeof(CSSSelector) * selectors.size()));
</span><span class="lines">@@ -235,7 +235,7 @@
</span><span class="cx">     for (unsigned i = 0; i &lt; selectors.size(); ++i)
</span><span class="cx">         new (NotNull, &amp;selectorListArray[i]) CSSSelector(*selectors.at(i));
</span><span class="cx">     selectorListArray[selectors.size() - 1].setLastInSelectorList();
</span><del>-    auto rule = StyleRule::create(sourceLine, WTFMove(properties));
</del><ins>+    auto rule = StyleRule::create(WTFMove(properties));
</ins><span class="cx">     rule.get().parserAdoptSelectorArray(selectorListArray);
</span><span class="cx">     return rule;
</span><span class="cx"> }
</span><span class="lines">@@ -253,7 +253,7 @@
</span><span class="cx">             componentsInThisSelector.append(component);
</span><span class="cx"> 
</span><span class="cx">         if (componentsInThisSelector.size() + componentsSinceLastSplit.size() &gt; maxCount &amp;&amp; !componentsSinceLastSplit.isEmpty()) {
</span><del>-            rules.append(create(sourceLine(), componentsSinceLastSplit, const_cast&lt;StyleProperties&amp;&gt;(m_properties.get())));
</del><ins>+            rules.append(create(componentsSinceLastSplit, const_cast&lt;StyleProperties&amp;&gt;(m_properties.get())));
</ins><span class="cx">             componentsSinceLastSplit.clear();
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -261,7 +261,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!componentsSinceLastSplit.isEmpty())
</span><del>-        rules.append(create(sourceLine(), componentsSinceLastSplit, const_cast&lt;StyleProperties&amp;&gt;(m_properties.get())));
</del><ins>+        rules.append(create(componentsSinceLastSplit, const_cast&lt;StyleProperties&amp;&gt;(m_properties.get())));
</ins><span class="cx"> 
</span><span class="cx">     return rules;
</span><span class="cx"> }
</span><span class="lines">@@ -291,7 +291,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> StyleRuleFontFace::StyleRuleFontFace(Ref&lt;StyleProperties&gt;&amp;&amp; properties)
</span><del>-    : StyleRuleBase(FontFace, 0)
</del><ins>+    : StyleRuleBase(FontFace)
</ins><span class="cx">     , m_properties(WTFMove(properties))
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -314,7 +314,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> StyleRuleGroup::StyleRuleGroup(Type type, Vector&lt;RefPtr&lt;StyleRuleBase&gt;&gt;&amp; adoptRule)
</span><del>-    : StyleRuleBase(type, 0)
</del><ins>+    : StyleRuleBase(type)
</ins><span class="cx"> {
</span><span class="cx">     m_childRules.swap(adoptRule);
</span><span class="cx"> }
</span><span class="lines">@@ -411,7 +411,7 @@
</span><span class="cx"> #endif // ENABLE(CSS_DEVICE_ADAPTATION)
</span><span class="cx"> 
</span><span class="cx"> StyleRuleCharset::StyleRuleCharset()
</span><del>-    : StyleRuleBase(Charset, 0)
</del><ins>+    : StyleRuleBase(Charset)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -425,7 +425,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> StyleRuleNamespace::StyleRuleNamespace(AtomicString prefix, AtomicString uri)
</span><del>-    : StyleRuleBase(Namespace, 0)
</del><ins>+    : StyleRuleBase(Namespace)
</ins><span class="cx">     , m_prefix(prefix)
</span><span class="cx">     , m_uri(uri)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleRuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleRule.h (209303 => 209304)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleRule.h        2016-12-03 20:22:43 UTC (rev 209303)
+++ trunk/Source/WebCore/css/StyleRule.h        2016-12-03 21:22:49 UTC (rev 209304)
</span><span class="lines">@@ -76,8 +76,6 @@
</span><span class="cx"> 
</span><span class="cx">     Ref&lt;StyleRuleBase&gt; copy() const;
</span><span class="cx"> 
</span><del>-    int sourceLine() const { return m_sourceLine; }
-
</del><span class="cx">     void deref()
</span><span class="cx">     {
</span><span class="cx">         if (derefBase())
</span><span class="lines">@@ -89,9 +87,15 @@
</span><span class="cx">     RefPtr&lt;CSSRule&gt; createCSSOMWrapper(CSSRule* parentRule) const;
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><del>-    StyleRuleBase(Type type, signed sourceLine = 0) : m_type(type), m_sourceLine(sourceLine) { }
-    StyleRuleBase(const StyleRuleBase&amp; o) : WTF::RefCountedBase(), m_type(o.m_type), m_sourceLine(o.m_sourceLine) { }
</del><ins>+    StyleRuleBase(Type type)
+        : m_type(type)
+        { }
</ins><span class="cx"> 
</span><ins>+    StyleRuleBase(const StyleRuleBase&amp; o)
+        : WTF::RefCountedBase()
+        , m_type(o.m_type)
+        { }
+
</ins><span class="cx">     ~StyleRuleBase() { }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="lines">@@ -100,15 +104,14 @@
</span><span class="cx">     RefPtr&lt;CSSRule&gt; createCSSOMWrapper(CSSStyleSheet* parentSheet, CSSRule* parentRule) const;
</span><span class="cx"> 
</span><span class="cx">     unsigned m_type : 5;
</span><del>-    signed m_sourceLine : 27;
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> class StyleRule final : public StyleRuleBase {
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    static Ref&lt;StyleRule&gt; create(int sourceLine, Ref&lt;StyleProperties&gt;&amp;&amp; properties)
</del><ins>+    static Ref&lt;StyleRule&gt; create(Ref&lt;StyleProperties&gt;&amp;&amp; properties)
</ins><span class="cx">     {
</span><del>-        return adoptRef(*new StyleRule(sourceLine, WTFMove(properties)));
</del><ins>+        return adoptRef(*new StyleRule(WTFMove(properties)));
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     ~StyleRule();
</span><span class="lines">@@ -128,10 +131,10 @@
</span><span class="cx">     static unsigned averageSizeInBytes();
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    StyleRule(int sourceLine, Ref&lt;StyleProperties&gt;&amp;&amp;);
</del><ins>+    StyleRule(Ref&lt;StyleProperties&gt;&amp;&amp;);
</ins><span class="cx">     StyleRule(const StyleRule&amp;);
</span><span class="cx"> 
</span><del>-    static Ref&lt;StyleRule&gt; create(int sourceLine, const Vector&lt;const CSSSelector*&gt;&amp;, Ref&lt;StyleProperties&gt;&amp;&amp;);
</del><ins>+    static Ref&lt;StyleRule&gt; create(const Vector&lt;const CSSSelector*&gt;&amp;, Ref&lt;StyleProperties&gt;&amp;&amp;);
</ins><span class="cx"> 
</span><span class="cx">     Ref&lt;StyleProperties&gt; m_properties;
</span><span class="cx">     CSSSelectorList m_selectorList;
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleRuleImportcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleRuleImport.cpp (209303 => 209304)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleRuleImport.cpp        2016-12-03 20:22:43 UTC (rev 209303)
+++ trunk/Source/WebCore/css/StyleRuleImport.cpp        2016-12-03 21:22:49 UTC (rev 209304)
</span><span class="lines">@@ -41,7 +41,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> StyleRuleImport::StyleRuleImport(const String&amp; href, Ref&lt;MediaQuerySet&gt;&amp;&amp; media)
</span><del>-    : StyleRuleBase(Import, 0)
</del><ins>+    : StyleRuleBase(Import)
</ins><span class="cx">     , m_parentStyleSheet(0)
</span><span class="cx">     , m_styleSheetClient(this)
</span><span class="cx">     , m_strHref(href)
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSParser.cpp (209303 => 209304)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSParser.cpp        2016-12-03 20:22:43 UTC (rev 209303)
+++ trunk/Source/WebCore/css/parser/CSSParser.cpp        2016-12-03 21:22:49 UTC (rev 209304)
</span><span class="lines">@@ -13042,7 +13042,7 @@
</span><span class="cx">     if (selectors) {
</span><span class="cx">         m_allowImportRules = false;
</span><span class="cx">         m_allowNamespaceDeclarations = false;
</span><del>-        rule = StyleRule::create(m_lastSelectorLineNumber, createStyleProperties());
</del><ins>+        rule = StyleRule::create(createStyleProperties());
</ins><span class="cx">         rule-&gt;parserAdoptSelectorVector(*selectors);
</span><span class="cx">         processAndAddNewRuleToSourceTreeIfNeeded();
</span><span class="cx">     } else
</span><span class="lines">@@ -13269,11 +13269,6 @@
</span><span class="cx">         m_styleSheet-&gt;setHasSyntacticallyValidCSSHeader(false);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CSSParser::updateLastSelectorLineAndPosition()
-{
-    m_lastSelectorLineNumber = m_lineNumber;
-}
-
</del><span class="cx"> void CSSParser::updateLastMediaLine(MediaQuerySet&amp; media)
</span><span class="cx"> {
</span><span class="cx">     media.setLastLine(m_lineNumber);
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSParser.h (209303 => 209304)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSParser.h        2016-12-03 20:22:43 UTC (rev 209303)
+++ trunk/Source/WebCore/css/parser/CSSParser.h        2016-12-03 21:22:49 UTC (rev 209304)
</span><span class="lines">@@ -415,7 +415,6 @@
</span><span class="cx"> 
</span><span class="cx">     void invalidBlockHit();
</span><span class="cx"> 
</span><del>-    void updateLastSelectorLineAndPosition();
</del><span class="cx">     void updateLastMediaLine(MediaQuerySet&amp;);
</span><span class="cx"> 
</span><span class="cx">     void clearProperties();
</span><span class="lines">@@ -652,7 +651,6 @@
</span><span class="cx">     int m_lineNumber { 0 };
</span><span class="cx">     int m_tokenStartLineNumber { 0 };
</span><span class="cx">     int m_tokenStartColumnNumber { 0 };
</span><del>-    int m_lastSelectorLineNumber { 0 };
</del><span class="cx">     int m_columnOffsetForLine { 0 };
</span><span class="cx"> 
</span><span class="cx">     int m_sheetStartLineNumber { 0 };
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSParserImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSParserImpl.cpp (209303 => 209304)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSParserImpl.cpp        2016-12-03 20:22:43 UTC (rev 209303)
+++ trunk/Source/WebCore/css/parser/CSSParserImpl.cpp        2016-12-03 21:22:49 UTC (rev 209304)
</span><span class="lines">@@ -689,8 +689,7 @@
</span><span class="cx"> 
</span><span class="cx">     consumeDeclarationList(block, StyleRule::Style);
</span><span class="cx"> 
</span><del>-    // FIXME-NEWPARSER: Line number is in the StyleRule constructor (gross), need to figure this out.
-    RefPtr&lt;StyleRule&gt; rule = StyleRule::create(0, createStyleProperties(m_parsedProperties, m_context.mode));
</del><ins>+    RefPtr&lt;StyleRule&gt; rule = StyleRule::create(createStyleProperties(m_parsedProperties, m_context.mode));
</ins><span class="cx">     rule-&gt;wrapperAdoptSelectorList(selectorList);
</span><span class="cx">     return rule;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorStyleSheetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp (209303 => 209304)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp        2016-12-03 20:22:43 UTC (rev 209303)
+++ trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp        2016-12-03 21:22:49 UTC (rev 209304)
</span><span class="lines">@@ -385,7 +385,7 @@
</span><span class="cx">     MediaListSourceImportRule
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-static RefPtr&lt;Inspector::Protocol::CSS::SourceRange&gt; buildSourceRangeObject(const SourceRange&amp; range, Vector&lt;size_t&gt;* lineEndings)
</del><ins>+static RefPtr&lt;Inspector::Protocol::CSS::SourceRange&gt; buildSourceRangeObject(const SourceRange&amp; range, Vector&lt;size_t&gt;* lineEndings, int* endingLine = nullptr)
</ins><span class="cx"> {
</span><span class="cx">     if (!lineEndings)
</span><span class="cx">         return nullptr;
</span><span class="lines">@@ -392,6 +392,9 @@
</span><span class="cx">     TextPosition start = ContentSearchUtilities::textPositionFromOffset(range.start, *lineEndings);
</span><span class="cx">     TextPosition end = ContentSearchUtilities::textPositionFromOffset(range.end, *lineEndings);
</span><span class="cx"> 
</span><ins>+    if (endingLine)
+        *endingLine = end.m_line.zeroBasedInt();
+
</ins><span class="cx">     return Inspector::Protocol::CSS::SourceRange::create()
</span><span class="cx">         .setStartLine(start.m_line.zeroBasedInt())
</span><span class="cx">         .setStartColumn(start.m_column.zeroBasedInt())
</span><span class="lines">@@ -1115,7 +1118,7 @@
</span><span class="cx">     return buildObjectForSelectorHelper(selector-&gt;selectorText(), *selector, element);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Ref&lt;Inspector::Protocol::CSS::SelectorList&gt; InspectorStyleSheet::buildObjectForSelectorList(CSSStyleRule* rule, Element* element)
</del><ins>+Ref&lt;Inspector::Protocol::CSS::SelectorList&gt; InspectorStyleSheet::buildObjectForSelectorList(CSSStyleRule* rule, Element* element, int&amp; endingLine)
</ins><span class="cx"> {
</span><span class="cx">     RefPtr&lt;CSSRuleSourceData&gt; sourceData;
</span><span class="cx">     if (ensureParsedDataReady())
</span><span class="lines">@@ -1138,7 +1141,7 @@
</span><span class="cx">         .setText(selectorText)
</span><span class="cx">         .release();
</span><span class="cx">     if (sourceData)
</span><del>-        result-&gt;setRange(buildSourceRangeObject(sourceData-&gt;ruleHeaderRange, lineEndings().get()));
</del><ins>+        result-&gt;setRange(buildSourceRangeObject(sourceData-&gt;ruleHeaderRange, lineEndings().get(), &amp;endingLine));
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1148,9 +1151,10 @@
</span><span class="cx">     if (!styleSheet)
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><ins>+    int endingLine = 0;
</ins><span class="cx">     auto result = Inspector::Protocol::CSS::CSSRule::create()
</span><del>-        .setSelectorList(buildObjectForSelectorList(rule, element))
-        .setSourceLine(rule-&gt;styleRule().sourceLine())
</del><ins>+        .setSelectorList(buildObjectForSelectorList(rule, element, endingLine))
+        .setSourceLine(endingLine)
</ins><span class="cx">         .setOrigin(m_origin)
</span><span class="cx">         .setStyle(buildObjectForStyle(&amp;rule-&gt;style()))
</span><span class="cx">         .release();
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorStyleSheeth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorStyleSheet.h (209303 => 209304)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorStyleSheet.h        2016-12-03 20:22:43 UTC (rev 209303)
+++ trunk/Source/WebCore/inspector/InspectorStyleSheet.h        2016-12-03 21:22:49 UTC (rev 209304)
</span><span class="lines">@@ -215,7 +215,7 @@
</span><span class="cx">     bool inlineStyleSheetText(String* result) const;
</span><span class="cx">     Ref&lt;Inspector::Protocol::Array&lt;Inspector::Protocol::CSS::CSSRule&gt;&gt; buildArrayForRuleList(CSSRuleList*);
</span><span class="cx">     Ref&lt;Inspector::Protocol::CSS::CSSSelector&gt; buildObjectForSelector(const CSSSelector*, Element*);
</span><del>-    Ref&lt;Inspector::Protocol::CSS::SelectorList&gt; buildObjectForSelectorList(CSSStyleRule*, Element*);
</del><ins>+    Ref&lt;Inspector::Protocol::CSS::SelectorList&gt; buildObjectForSelectorList(CSSStyleRule*, Element*, int&amp; endingLine);
</ins><span class="cx"> 
</span><span class="cx">     InspectorPageAgent* m_pageAgent;
</span><span class="cx">     String m_id;
</span></span></pre>
</div>
</div>

</body>
</html>