<!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>[181367] trunk</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/181367">181367</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-03-10 23:11:10 -0700 (Tue, 10 Mar 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: CSS parser errors in the console should include column numbers
https://bugs.webkit.org/show_bug.cgi?id=114313

Patch by Joseph Pecoraro &lt;pecoraro@apple.com&gt; on 2015-03-10
Reviewed by Benjamin Poulain.

Source/WebCore:

Test: inspector-protocol/console/warnings-errors.html

* css/CSSParser.h:
(WebCore::CSSParser::currentCharacterOffset):
Get the current character offset depending on the source type.
Add instance variables to track column position and start
line / column for inline stylesheets.

* css/CSSParser.cpp:
(WebCore::CSSParser::CSSParser):
(WebCore::CSSParser::parseSheet):
Initialize new instance variables.

(WebCore::CSSParser::currentLocation):
Update to include column information. Also, if we are on the first line
we may need to take into account a start column offset as well.

(WebCore::CSSParser::realLex):
When bumping the line number, reset the column offset for the next
line with the next character.

(WebCore::CSSParser::syntaxError):
(WebCore::CSSParser::logError):
Include column information.

* css/StyleSheetContents.cpp:
(WebCore::StyleSheetContents::parseAuthorStyleSheet):
(WebCore::StyleSheetContents::parseString):
(WebCore::StyleSheetContents::parseStringAtLineAndColumn):
Include column information.

* css/StyleSheetContents.h:
* dom/InlineStyleSheetOwner.cpp:
(WebCore::InlineStyleSheetOwner::InlineStyleSheetOwner):
(WebCore::InlineStyleSheetOwner::createSheet):
Save and use column information later on.

* dom/InlineStyleSheetOwner.h:
* inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyleSheet::ensureSourceData):
Updated parser signature needs starting column and no longer has optional parameters.

Source/WebInspectorUI:

* UserInterface/Views/ConsoleMessageImpl.js:
(WebInspector.ConsoleMessageImpl.prototype._linkifyLocation):
Column numbers in console messages are also 1 based and should be adjusted.

LayoutTests:

Test errors in both external and inline CSS and Scripts to ensure they have
expected line:column information.

* inspector-protocol/console/warnings-errors-expected.txt: Added.
* inspector-protocol/console/warnings-errors.html: Added.
* inspector-protocol/resources/errors.css: Added.
* inspector-protocol/resources/errors.js: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSParsercpp">trunk/Source/WebCore/css/CSSParser.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSParserh">trunk/Source/WebCore/css/CSSParser.h</a></li>
<li><a href="#trunkSourceWebCorecssStyleSheetContentscpp">trunk/Source/WebCore/css/StyleSheetContents.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStyleSheetContentsh">trunk/Source/WebCore/css/StyleSheetContents.h</a></li>
<li><a href="#trunkSourceWebCoredomInlineStyleSheetOwnercpp">trunk/Source/WebCore/dom/InlineStyleSheetOwner.cpp</a></li>
<li><a href="#trunkSourceWebCoredomInlineStyleSheetOwnerh">trunk/Source/WebCore/dom/InlineStyleSheetOwner.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorStyleSheetcpp">trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp</a></li>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsConsoleMessageImpljs">trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageImpl.js</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsinspectorprotocolconsolewarningserrorsexpectedtxt">trunk/LayoutTests/inspector-protocol/console/warnings-errors-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorprotocolconsolewarningserrorshtml">trunk/LayoutTests/inspector-protocol/console/warnings-errors.html</a></li>
<li><a href="#trunkLayoutTestsinspectorprotocolresourceserrorscss">trunk/LayoutTests/inspector-protocol/resources/errors.css</a></li>
<li><a href="#trunkLayoutTestsinspectorprotocolresourceserrorsjs">trunk/LayoutTests/inspector-protocol/resources/errors.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (181366 => 181367)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-03-11 05:56:24 UTC (rev 181366)
+++ trunk/LayoutTests/ChangeLog        2015-03-11 06:11:10 UTC (rev 181367)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2015-03-10  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: CSS parser errors in the console should include column numbers
+        https://bugs.webkit.org/show_bug.cgi?id=114313
+
+        Reviewed by Benjamin Poulain.
+
+        Test errors in both external and inline CSS and Scripts to ensure they have
+        expected line:column information.
+
+        * inspector-protocol/console/warnings-errors-expected.txt: Added.
+        * inspector-protocol/console/warnings-errors.html: Added.
+        * inspector-protocol/resources/errors.css: Added.
+        * inspector-protocol/resources/errors.js: Added.
+
</ins><span class="cx"> 2015-03-10  Gyuyoung Kim  &lt;gyuyoung.kim@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed EFL gardening on 10th Mar.
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocolconsolewarningserrorsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector-protocol/console/warnings-errors-expected.txt (0 => 181367)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/console/warnings-errors-expected.txt                                (rev 0)
+++ trunk/LayoutTests/inspector-protocol/console/warnings-errors-expected.txt        2015-03-11 06:11:10 UTC (rev 181367)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+CONSOLE MESSAGE: line 1: error script
+CONSOLE MESSAGE: line 1: warn script
+CONSOLE MESSAGE: line 5: error script
+CONSOLE MESSAGE: line 6: warn script
+CONSOLE MESSAGE: line 15: TypeError: undefined is not an object (evaluating '[].x.x')
+CONSOLE MESSAGE: line 17: warn 1
+CONSOLE MESSAGE: line 17: error 1
+CONSOLE MESSAGE: line 18: error 2
+Tests that CSS/JavaScript errors and warnings are sent to the console with line and column information.
+{&quot;source&quot;:&quot;css&quot;,&quot;level&quot;:&quot;warning&quot;,&quot;text&quot;:&quot;Invalid CSS property declaration at: *&quot;,&quot;location&quot;:&quot;warnings-errors.html:5:20&quot;}
+{&quot;source&quot;:&quot;css&quot;,&quot;level&quot;:&quot;warning&quot;,&quot;text&quot;:&quot;Invalid CSS property declaration at: *&quot;,&quot;location&quot;:&quot;warnings-errors.html:6:14&quot;}
+{&quot;source&quot;:&quot;css&quot;,&quot;level&quot;:&quot;warning&quot;,&quot;text&quot;:&quot;Invalid CSS property declaration at: *&quot;,&quot;location&quot;:&quot;warnings-errors.html:7:7&quot;}
+{&quot;source&quot;:&quot;css&quot;,&quot;level&quot;:&quot;warning&quot;,&quot;text&quot;:&quot;Invalid CSS property declaration at: *&quot;,&quot;location&quot;:&quot;warnings-errors.html:9:8&quot;}
+{&quot;source&quot;:&quot;css&quot;,&quot;level&quot;:&quot;warning&quot;,&quot;text&quot;:&quot;Invalid CSS property declaration at: *&quot;,&quot;location&quot;:&quot;errors.css:1:7&quot;}
+{&quot;source&quot;:&quot;css&quot;,&quot;level&quot;:&quot;warning&quot;,&quot;text&quot;:&quot;Invalid CSS property declaration at: *&quot;,&quot;location&quot;:&quot;errors.css:1:29&quot;}
+{&quot;source&quot;:&quot;css&quot;,&quot;level&quot;:&quot;warning&quot;,&quot;text&quot;:&quot;Invalid CSS property declaration at: *&quot;,&quot;location&quot;:&quot;errors.css:4:5&quot;}
+{&quot;source&quot;:&quot;console-api&quot;,&quot;level&quot;:&quot;error&quot;,&quot;text&quot;:&quot;error script&quot;,&quot;location&quot;:&quot;errors.js:1:14&quot;,&quot;parameters&quot;:[{&quot;type&quot;:&quot;string&quot;}]}
+{&quot;source&quot;:&quot;console-api&quot;,&quot;level&quot;:&quot;warning&quot;,&quot;text&quot;:&quot;warn script&quot;,&quot;location&quot;:&quot;errors.js:1:44&quot;,&quot;parameters&quot;:[{&quot;type&quot;:&quot;string&quot;}]}
+{&quot;source&quot;:&quot;console-api&quot;,&quot;level&quot;:&quot;error&quot;,&quot;text&quot;:&quot;error script&quot;,&quot;location&quot;:&quot;errors.js:5:18&quot;,&quot;parameters&quot;:[{&quot;type&quot;:&quot;string&quot;}]}
+{&quot;source&quot;:&quot;console-api&quot;,&quot;level&quot;:&quot;warning&quot;,&quot;text&quot;:&quot;warn script&quot;,&quot;location&quot;:&quot;errors.js:6:17&quot;,&quot;parameters&quot;:[{&quot;type&quot;:&quot;string&quot;}]}
+{&quot;source&quot;:&quot;javascript&quot;,&quot;level&quot;:&quot;error&quot;,&quot;text&quot;:&quot;TypeError: undefined is not an object (evaluating '[].x.x')&quot;,&quot;location&quot;:&quot;warnings-errors.html:15:18&quot;}
+{&quot;source&quot;:&quot;console-api&quot;,&quot;level&quot;:&quot;warning&quot;,&quot;text&quot;:&quot;warn 1&quot;,&quot;location&quot;:&quot;warnings-errors.html:17:13&quot;,&quot;parameters&quot;:[{&quot;type&quot;:&quot;string&quot;}]}
+{&quot;source&quot;:&quot;console-api&quot;,&quot;level&quot;:&quot;error&quot;,&quot;text&quot;:&quot;error 1&quot;,&quot;location&quot;:&quot;warnings-errors.html:17:38&quot;,&quot;parameters&quot;:[{&quot;type&quot;:&quot;string&quot;}]}
+{&quot;source&quot;:&quot;console-api&quot;,&quot;level&quot;:&quot;error&quot;,&quot;text&quot;:&quot;error 2&quot;,&quot;location&quot;:&quot;warnings-errors.html:18:17&quot;,&quot;parameters&quot;:[{&quot;type&quot;:&quot;string&quot;}]}
+
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocolconsolewarningserrorshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector-protocol/console/warnings-errors.html (0 => 181367)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/console/warnings-errors.html                                (rev 0)
+++ trunk/LayoutTests/inspector-protocol/console/warnings-errors.html        2015-03-11 06:11:10 UTC (rev 181367)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;script type=&quot;text/javascript&quot; src=&quot;../../http/tests/inspector-protocol/resources/protocol-test.js&quot;&gt;&lt;/script&gt;
+&lt;link rel=&quot;stylesheet&quot; href=&quot;../resources/errors.css&quot;&gt;
+  &lt;style&gt;    div { * color: red; }&lt;/style&gt;
+&lt;style&gt;div { * color: red; }
+div { * color: red; }
+   div {
+       *
+       color:
+       red;
+   }
+&lt;/style&gt;
+&lt;script src=&quot;../resources/errors.js&quot; type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;
+  &lt;script&gt;   [].x.x   &lt;/script&gt;
+&lt;script&gt;
+console.warn(&quot;warn 1&quot;); console.error(&quot;error 1&quot;);
+   console.error(&quot;error 2&quot;);
+&lt;/script&gt;
+&lt;script&gt;
+function test()
+{
+    InspectorTest.importScript(&quot;../../../../inspector-protocol/resources/console-helper.js&quot;);
+
+    InspectorTest.sendCommand(&quot;Console.enable&quot;, {});
+
+    var consoleMessageCount = 0;
+    const expectedConsoleMessages = 15;
+
+    InspectorTest.eventHandler[&quot;Console.messageAdded&quot;] = function(messageObject)
+    {
+        var simplifiedMessage = ConsoleHelper.simplifiedConsoleMessage(messageObject);
+        InspectorTest.log(JSON.stringify(simplifiedMessage));
+
+        if (++consoleMessageCount === expectedConsoleMessages)
+            InspectorTest.completeTest();
+    }
+}
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;runTest()&quot;&gt;
+&lt;p&gt;
+Tests that CSS/JavaScript errors and warnings are sent to the console with line and column information.&lt;br&gt;
+&lt;/p&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocolresourceserrorscss"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector-protocol/resources/errors.css (0 => 181367)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/resources/errors.css                                (rev 0)
+++ trunk/LayoutTests/inspector-protocol/resources/errors.css        2015-03-11 06:11:10 UTC (rev 181367)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+div { * color: red; } div { * color: red; }
+
+div {
+    *
+    color:
+    red;
+}
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocolresourceserrorsjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector-protocol/resources/errors.js (0 => 181367)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/resources/errors.js                                (rev 0)
+++ trunk/LayoutTests/inspector-protocol/resources/errors.js        2015-03-11 06:11:10 UTC (rev 181367)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+console.error(&quot;error script&quot;); console.warn(&quot;warn script&quot;);
+
+
+function foo() {
+    console.error(&quot;error script&quot;);
+    console.warn(&quot;warn script&quot;);
+}
+
+foo();
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (181366 => 181367)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-03-11 05:56:24 UTC (rev 181366)
+++ trunk/Source/WebCore/ChangeLog        2015-03-11 06:11:10 UTC (rev 181367)
</span><span class="lines">@@ -1,3 +1,52 @@
</span><ins>+2015-03-10  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: CSS parser errors in the console should include column numbers
+        https://bugs.webkit.org/show_bug.cgi?id=114313
+
+        Reviewed by Benjamin Poulain.
+
+        Test: inspector-protocol/console/warnings-errors.html
+
+        * css/CSSParser.h:
+        (WebCore::CSSParser::currentCharacterOffset):
+        Get the current character offset depending on the source type.
+        Add instance variables to track column position and start
+        line / column for inline stylesheets.
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::CSSParser):
+        (WebCore::CSSParser::parseSheet):
+        Initialize new instance variables.
+
+        (WebCore::CSSParser::currentLocation):
+        Update to include column information. Also, if we are on the first line
+        we may need to take into account a start column offset as well.
+
+        (WebCore::CSSParser::realLex):
+        When bumping the line number, reset the column offset for the next
+        line with the next character.
+
+        (WebCore::CSSParser::syntaxError):
+        (WebCore::CSSParser::logError):
+        Include column information.
+
+        * css/StyleSheetContents.cpp:
+        (WebCore::StyleSheetContents::parseAuthorStyleSheet):
+        (WebCore::StyleSheetContents::parseString):
+        (WebCore::StyleSheetContents::parseStringAtLineAndColumn):
+        Include column information.
+
+        * css/StyleSheetContents.h:
+        * dom/InlineStyleSheetOwner.cpp:
+        (WebCore::InlineStyleSheetOwner::InlineStyleSheetOwner):
+        (WebCore::InlineStyleSheetOwner::createSheet):
+        Save and use column information later on.
+
+        * dom/InlineStyleSheetOwner.h:
+        * inspector/InspectorStyleSheet.cpp:
+        (WebCore::InspectorStyleSheet::ensureSourceData):
+        Updated parser signature needs starting column and no longer has optional parameters.
+
</ins><span class="cx"> 2015-03-10  Darin Adler  &lt;darin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Try to fix the GTK build.
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSParser.cpp (181366 => 181367)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSParser.cpp        2015-03-11 05:56:24 UTC (rev 181366)
+++ trunk/Source/WebCore/css/CSSParser.cpp        2015-03-11 06:11:10 UTC (rev 181367)
</span><span class="lines">@@ -331,6 +331,9 @@
</span><span class="cx">     , m_lineNumber(0)
</span><span class="cx">     , m_tokenStartLineNumber(0)
</span><span class="cx">     , m_lastSelectorLineNumber(0)
</span><ins>+    , m_columnOffsetForLine(0)
+    , m_sheetStartLineNumber(0)
+    , m_sheetStartColumnNumber(0)
</ins><span class="cx">     , m_allowImportRules(true)
</span><span class="cx">     , m_allowNamespaceDeclarations(true)
</span><span class="cx"> #if ENABLE(CSS_DEVICE_ADAPTATION)
</span><span class="lines">@@ -429,7 +432,7 @@
</span><span class="cx">     m_lexFunc = &amp;CSSParser::realLex&lt;UChar&gt;;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CSSParser::parseSheet(StyleSheetContents* sheet, const String&amp; string, int startLineNumber, RuleSourceDataList* ruleSourceDataResult, bool logErrors)
</del><ins>+void CSSParser::parseSheet(StyleSheetContents* sheet, const String&amp; string, int startLineNumber, int startColumnNumber, RuleSourceDataList* ruleSourceDataResult, bool logErrors)
</ins><span class="cx"> {
</span><span class="cx">     setStyleSheet(sheet);
</span><span class="cx">     m_defaultNamespace = starAtom; // Reset the default namespace.
</span><span class="lines">@@ -440,6 +443,9 @@
</span><span class="cx">     m_logErrors = logErrors &amp;&amp; sheet-&gt;singleOwnerDocument() &amp;&amp; !sheet-&gt;baseURL().isEmpty() &amp;&amp; sheet-&gt;singleOwnerDocument()-&gt;page();
</span><span class="cx">     m_ignoreErrorsInDeclaration = false;
</span><span class="cx">     m_lineNumber = startLineNumber;
</span><ins>+    m_columnOffsetForLine = 0;
+    m_sheetStartLineNumber = startLineNumber;
+    m_sheetStartColumnNumber = startColumnNumber;
</ins><span class="cx">     setupParser(&quot;&quot;, string, &quot;&quot;);
</span><span class="cx">     cssyyparse(this);
</span><span class="cx">     sheet-&gt;shrinkToFit();
</span><span class="lines">@@ -10483,10 +10489,19 @@
</span><span class="cx"> {
</span><span class="cx">     Location location;
</span><span class="cx">     location.lineNumber = m_tokenStartLineNumber;
</span><ins>+    location.columnNumber = tokenStartOffset() - m_columnOffsetForLine;
+
+    ASSERT(location.lineNumber &gt;= 0);
+    ASSERT(location.columnNumber &gt;= 0);
+
+    if (m_tokenStartLineNumber == m_sheetStartLineNumber)
+        location.columnNumber += m_sheetStartColumnNumber;
+
</ins><span class="cx">     if (is8BitSource())
</span><span class="cx">         location.token.init(tokenStart&lt;LChar&gt;(), currentCharacter&lt;LChar&gt;() - tokenStart&lt;LChar&gt;());
</span><span class="cx">     else
</span><span class="cx">         location.token.init(tokenStart&lt;UChar&gt;(), currentCharacter&lt;UChar&gt;() - tokenStart&lt;UChar&gt;());
</span><ins>+
</ins><span class="cx">     return location;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -11580,9 +11595,12 @@
</span><span class="cx">         // Might start with a '\n'.
</span><span class="cx">         --currentCharacter&lt;SrcCharacterType&gt;();
</span><span class="cx">         do {
</span><del>-            if (*currentCharacter&lt;SrcCharacterType&gt;() == '\n')
</del><ins>+            if (*currentCharacter&lt;SrcCharacterType&gt;() == '\n') {
</ins><span class="cx">                 ++m_lineNumber;
</span><del>-            ++currentCharacter&lt;SrcCharacterType&gt;();
</del><ins>+                ++currentCharacter&lt;SrcCharacterType&gt;();
+                m_columnOffsetForLine = currentCharacterOffset();
+            } else
+                ++currentCharacter&lt;SrcCharacterType&gt;();
</ins><span class="cx">         } while (*currentCharacter&lt;SrcCharacterType&gt;() &lt;= ' ' &amp;&amp; (typesOfASCIICharacters[*currentCharacter&lt;SrcCharacterType&gt;()] == CharacterWhiteSpace));
</span><span class="cx">         break;
</span><span class="cx"> 
</span><span class="lines">@@ -11650,8 +11668,12 @@
</span><span class="cx">         if (*currentCharacter&lt;SrcCharacterType&gt;() == '*') {
</span><span class="cx">             ++currentCharacter&lt;SrcCharacterType&gt;();
</span><span class="cx">             while (currentCharacter&lt;SrcCharacterType&gt;()[0] != '*' || currentCharacter&lt;SrcCharacterType&gt;()[1] != '/') {
</span><del>-                if (*currentCharacter&lt;SrcCharacterType&gt;() == '\n')
</del><ins>+                if (*currentCharacter&lt;SrcCharacterType&gt;() == '\n') {
</ins><span class="cx">                     ++m_lineNumber;
</span><ins>+                    ++currentCharacter&lt;SrcCharacterType&gt;();
+                    m_columnOffsetForLine = currentCharacterOffset();
+                    continue;
+                }
</ins><span class="cx">                 if (*currentCharacter&lt;SrcCharacterType&gt;() == '\0') {
</span><span class="cx">                     // Unterminated comments are simply ignored.
</span><span class="cx">                     currentCharacter&lt;SrcCharacterType&gt;() -= 2;
</span><span class="lines">@@ -11869,14 +11891,15 @@
</span><span class="cx"> {
</span><span class="cx">     if (!isLoggingErrors())
</span><span class="cx">         return;
</span><ins>+
</ins><span class="cx">     StringBuilder builder;
</span><span class="cx">     switch (error) {
</span><span class="cx">     case PropertyDeclarationError:
</span><span class="cx">         builder.appendLiteral(&quot;Invalid CSS property declaration at: &quot;);
</span><span class="cx">         break;
</span><del>-
</del><span class="cx">     default:
</span><span class="cx">         builder.appendLiteral(&quot;Unexpected CSS token: &quot;);
</span><ins>+        break;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (location.token.is8Bit())
</span><span class="lines">@@ -11884,7 +11907,7 @@
</span><span class="cx">     else
</span><span class="cx">         builder.append(location.token.characters16(), location.token.length());
</span><span class="cx"> 
</span><del>-    logError(builder.toString(), location.lineNumber);
</del><ins>+    logError(builder.toString(), location.lineNumber, location.columnNumber);
</ins><span class="cx"> 
</span><span class="cx">     m_ignoreErrorsInDeclaration = true;
</span><span class="cx"> }
</span><span class="lines">@@ -11894,11 +11917,10 @@
</span><span class="cx">     return m_logErrors &amp;&amp; !m_ignoreErrorsInDeclaration;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CSSParser::logError(const String&amp; message, int lineNumber)
</del><ins>+void CSSParser::logError(const String&amp; message, int lineNumber, int columnNumber)
</ins><span class="cx"> {
</span><del>-    // FIXME: &lt;http://webkit.org/b/114313&gt; CSS parser console message errors should include column numbers.
</del><span class="cx">     PageConsoleClient&amp; console = m_styleSheet-&gt;singleOwnerDocument()-&gt;page()-&gt;console();
</span><del>-    console.addMessage(MessageSource::CSS, MessageLevel::Warning, message, m_styleSheet-&gt;baseURL().string(), lineNumber + 1, 0);
</del><ins>+    console.addMessage(MessageSource::CSS, MessageLevel::Warning, message, m_styleSheet-&gt;baseURL().string(), lineNumber + 1, columnNumber + 1);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> PassRefPtr&lt;StyleRuleKeyframes&gt; CSSParser::createKeyframesRule(const String&amp; name, std::unique_ptr&lt;Vector&lt;RefPtr&lt;StyleKeyframe&gt;&gt;&gt; popKeyframes)
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSParser.h (181366 => 181367)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSParser.h        2015-03-11 05:56:24 UTC (rev 181366)
+++ trunk/Source/WebCore/css/CSSParser.h        2015-03-11 06:11:10 UTC (rev 181367)
</span><span class="lines">@@ -105,7 +105,7 @@
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT ~CSSParser();
</span><span class="cx"> 
</span><del>-    void parseSheet(StyleSheetContents*, const String&amp;, int startLineNumber = 0, RuleSourceDataList* = nullptr, bool = false);
</del><ins>+    void parseSheet(StyleSheetContents*, const String&amp;, int startLineNumber, int startColumnNumber, RuleSourceDataList*, bool logErrors);
</ins><span class="cx">     PassRefPtr&lt;StyleRuleBase&gt; parseRule(StyleSheetContents*, const String&amp;);
</span><span class="cx">     PassRefPtr&lt;StyleKeyframe&gt; parseKeyframeRule(StyleSheetContents*, const String&amp;);
</span><span class="cx">     bool parseSupportsCondition(const String&amp;);
</span><span class="lines">@@ -464,6 +464,8 @@
</span><span class="cx">     inline unsigned tokenStartOffset();
</span><span class="cx">     inline UChar tokenStartChar();
</span><span class="cx"> 
</span><ins>+    inline unsigned currentCharacterOffset();
+
</ins><span class="cx">     template &lt;typename CharacterType&gt;
</span><span class="cx">     inline bool isIdentifierStart();
</span><span class="cx"> 
</span><span class="lines">@@ -593,7 +595,11 @@
</span><span class="cx">     int m_lineNumber;
</span><span class="cx">     int m_tokenStartLineNumber;
</span><span class="cx">     int m_lastSelectorLineNumber;
</span><ins>+    int m_columnOffsetForLine;
</ins><span class="cx"> 
</span><ins>+    int m_sheetStartLineNumber;
+    int m_sheetStartColumnNumber;
+
</ins><span class="cx">     bool m_allowImportRules;
</span><span class="cx">     bool m_allowNamespaceDeclarations;
</span><span class="cx"> 
</span><span class="lines">@@ -642,7 +648,7 @@
</span><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     bool isLoggingErrors();
</span><del>-    void logError(const String&amp; message, int lineNumber);
</del><ins>+    void logError(const String&amp; message, int lineNumber, int columnNumber);
</ins><span class="cx"> 
</span><span class="cx">     bool validateCalculationUnit(ValueWithCalculation&amp;, Units);
</span><span class="cx"> 
</span><span class="lines">@@ -686,6 +692,7 @@
</span><span class="cx"> 
</span><span class="cx"> struct CSSParser::Location {
</span><span class="cx">     int lineNumber;
</span><ins>+    int columnNumber;
</ins><span class="cx">     CSSParserString token;
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -714,6 +721,13 @@
</span><span class="cx">     return m_tokenStart.ptr16 - m_dataStart16.get();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+inline unsigned CSSParser::currentCharacterOffset()
+{
+    if (is8BitSource())
+        return m_currentCharacter8 - m_dataStart8.get();
+    return m_currentCharacter16 - m_dataStart16.get();
+}
+
</ins><span class="cx"> inline UChar CSSParser::tokenStartChar()
</span><span class="cx"> {
</span><span class="cx">     if (is8BitSource())
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleSheetContentscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleSheetContents.cpp (181366 => 181367)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleSheetContents.cpp        2015-03-11 05:56:24 UTC (rev 181366)
+++ trunk/Source/WebCore/css/StyleSheetContents.cpp        2015-03-11 06:11:10 UTC (rev 181367)
</span><span class="lines">@@ -291,7 +291,7 @@
</span><span class="cx">     String sheetText = cachedStyleSheet-&gt;sheetText(&amp;hasValidMIMEType);
</span><span class="cx"> 
</span><span class="cx">     CSSParser p(parserContext());
</span><del>-    p.parseSheet(this, sheetText, 0, 0, true);
</del><ins>+    p.parseSheet(this, sheetText, 0, 0, nullptr, true);
</ins><span class="cx"> 
</span><span class="cx">     // If we're loading a stylesheet cross-origin, and the MIME type is not standard, require the CSS
</span><span class="cx">     // to at least start with a syntactically valid CSS rule.
</span><span class="lines">@@ -316,13 +316,13 @@
</span><span class="cx"> 
</span><span class="cx"> bool StyleSheetContents::parseString(const String&amp; sheetText)
</span><span class="cx"> {
</span><del>-    return parseStringAtLine(sheetText, 0, false);
</del><ins>+    return parseStringAtLineAndColumn(sheetText, 0, 0, false);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool StyleSheetContents::parseStringAtLine(const String&amp; sheetText, int startLineNumber, bool createdByParser)
</del><ins>+bool StyleSheetContents::parseStringAtLineAndColumn(const String&amp; sheetText, int startLineNumber, int startColumnNumber, bool createdByParser)
</ins><span class="cx"> {
</span><span class="cx">     CSSParser p(parserContext());
</span><del>-    p.parseSheet(this, sheetText, startLineNumber, 0, createdByParser);
</del><ins>+    p.parseSheet(this, sheetText, startLineNumber, startColumnNumber, nullptr, createdByParser);
</ins><span class="cx"> 
</span><span class="cx">     return true;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleSheetContentsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleSheetContents.h (181366 => 181367)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleSheetContents.h        2015-03-11 05:56:24 UTC (rev 181366)
+++ trunk/Source/WebCore/css/StyleSheetContents.h        2015-03-11 06:11:10 UTC (rev 181367)
</span><span class="lines">@@ -62,7 +62,7 @@
</span><span class="cx"> 
</span><span class="cx">     void parseAuthorStyleSheet(const CachedCSSStyleSheet*, const SecurityOrigin*);
</span><span class="cx">     WEBCORE_EXPORT bool parseString(const String&amp;);
</span><del>-    bool parseStringAtLine(const String&amp;, int startLineNumber, bool);
</del><ins>+    bool parseStringAtLineAndColumn(const String&amp;, int startLineNumber, int startColumnNumber, bool createdByParser);
</ins><span class="cx"> 
</span><span class="cx">     bool isCacheable() const;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomInlineStyleSheetOwnercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/InlineStyleSheetOwner.cpp (181366 => 181367)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/InlineStyleSheetOwner.cpp        2015-03-11 05:56:24 UTC (rev 181366)
+++ trunk/Source/WebCore/dom/InlineStyleSheetOwner.cpp        2015-03-11 06:11:10 UTC (rev 181367)
</span><span class="lines">@@ -35,10 +35,10 @@
</span><span class="cx"> InlineStyleSheetOwner::InlineStyleSheetOwner(Document&amp; document, bool createdByParser)
</span><span class="cx">     : m_isParsingChildren(createdByParser)
</span><span class="cx">     , m_loading(false)
</span><del>-    , m_startLineNumber(WTF::OrdinalNumber::beforeFirst())
</del><ins>+    , m_startTextPosition(WTF::OrdinalNumber::beforeFirst(), WTF::OrdinalNumber::beforeFirst())
</ins><span class="cx"> {
</span><span class="cx">     if (createdByParser &amp;&amp; document.scriptableDocumentParser() &amp;&amp; !document.isInDocumentWrite())
</span><del>-        m_startLineNumber = document.scriptableDocumentParser()-&gt;textPosition().m_line;
</del><ins>+        m_startTextPosition = document.scriptableDocumentParser()-&gt;textPosition();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> InlineStyleSheetOwner::~InlineStyleSheetOwner()
</span><span class="lines">@@ -123,7 +123,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (!isValidCSSContentType(element, m_contentType))
</span><span class="cx">         return;
</span><del>-    if (!document.contentSecurityPolicy()-&gt;allowInlineStyle(document.url(), m_startLineNumber))
</del><ins>+    if (!document.contentSecurityPolicy()-&gt;allowInlineStyle(document.url(), m_startTextPosition.m_line))
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;MediaQuerySet&gt; mediaQueries;
</span><span class="lines">@@ -144,7 +144,7 @@
</span><span class="cx">     m_sheet = CSSStyleSheet::createInline(element, URL(), document.inputEncoding());
</span><span class="cx">     m_sheet-&gt;setMediaQueries(mediaQueries.release());
</span><span class="cx">     m_sheet-&gt;setTitle(element.title());
</span><del>-    m_sheet-&gt;contents().parseStringAtLine(text, m_startLineNumber.zeroBasedInt(), m_isParsingChildren);
</del><ins>+    m_sheet-&gt;contents().parseStringAtLineAndColumn(text, m_startTextPosition.m_line.zeroBasedInt(), m_startTextPosition.m_column.zeroBasedInt(), m_isParsingChildren);
</ins><span class="cx"> 
</span><span class="cx">     m_loading = false;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomInlineStyleSheetOwnerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/InlineStyleSheetOwner.h (181366 => 181367)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/InlineStyleSheetOwner.h        2015-03-11 05:56:24 UTC (rev 181366)
+++ trunk/Source/WebCore/dom/InlineStyleSheetOwner.h        2015-03-11 06:11:10 UTC (rev 181367)
</span><span class="lines">@@ -57,7 +57,7 @@
</span><span class="cx"> 
</span><span class="cx">     bool m_isParsingChildren;
</span><span class="cx">     bool m_loading;
</span><del>-    WTF::OrdinalNumber m_startLineNumber;
</del><ins>+    WTF::TextPosition m_startTextPosition;
</ins><span class="cx">     AtomicString m_contentType;
</span><span class="cx">     AtomicString m_media;
</span><span class="cx">     RefPtr&lt;CSSStyleSheet&gt; m_sheet;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorStyleSheetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp (181366 => 181367)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp        2015-03-11 05:56:24 UTC (rev 181366)
+++ trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp        2015-03-11 06:11:10 UTC (rev 181367)
</span><span class="lines">@@ -1106,7 +1106,7 @@
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;StyleSheetContents&gt; newStyleSheet = StyleSheetContents::create();
</span><span class="cx">     auto ruleSourceDataResult = std::make_unique&lt;RuleSourceDataList&gt;();
</span><del>-    createCSSParser(m_pageStyleSheet-&gt;ownerDocument())-&gt;parseSheet(newStyleSheet.get(), m_parsedStyleSheet-&gt;text(), 0, ruleSourceDataResult.get());
</del><ins>+    createCSSParser(m_pageStyleSheet-&gt;ownerDocument())-&gt;parseSheet(newStyleSheet.get(), m_parsedStyleSheet-&gt;text(), 0, 0, ruleSourceDataResult.get(), false);
</ins><span class="cx">     m_parsedStyleSheet-&gt;setSourceData(WTF::move(ruleSourceDataResult));
</span><span class="cx">     return m_parsedStyleSheet-&gt;hasSourceData();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (181366 => 181367)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2015-03-11 05:56:24 UTC (rev 181366)
+++ trunk/Source/WebInspectorUI/ChangeLog        2015-03-11 06:11:10 UTC (rev 181367)
</span><span class="lines">@@ -1,5 +1,16 @@
</span><span class="cx"> 2015-03-10  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Web Inspector: CSS parser errors in the console should include column numbers
+        https://bugs.webkit.org/show_bug.cgi?id=114313
+
+        Reviewed by Benjamin Poulain.
+
+        * UserInterface/Views/ConsoleMessageImpl.js:
+        (WebInspector.ConsoleMessageImpl.prototype._linkifyLocation):
+        Column numbers in console messages are also 1 based and should be adjusted.
+
+2015-03-10  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
</ins><span class="cx">         Web Inspector: console.error output broken, does not produce ObjectTree
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=142554
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsConsoleMessageImpljs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageImpl.js (181366 => 181367)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageImpl.js        2015-03-11 05:56:24 UTC (rev 181366)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageImpl.js        2015-03-11 06:11:10 UTC (rev 181367)
</span><span class="lines">@@ -199,6 +199,7 @@
</span><span class="cx">     {
</span><span class="cx">         // ConsoleMessage stack trace line numbers are one-based.
</span><span class="cx">         lineNumber = lineNumber ? lineNumber - 1 : 0;
</span><ins>+        columnNumber = columnNumber ? columnNumber - 1 : 0;
</ins><span class="cx"> 
</span><span class="cx">         return WebInspector.linkifyLocation(url, lineNumber, columnNumber, &quot;console-message-url&quot;);
</span><span class="cx">     },
</span></span></pre>
</div>
</div>

</body>
</html>