Title: [181367] trunk
Revision
181367
Author
commit-qu...@webkit.org
Date
2015-03-10 23:11:10 -0700 (Tue, 10 Mar 2015)

Log Message

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 <pecor...@apple.com> 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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (181366 => 181367)


--- trunk/LayoutTests/ChangeLog	2015-03-11 05:56:24 UTC (rev 181366)
+++ trunk/LayoutTests/ChangeLog	2015-03-11 06:11:10 UTC (rev 181367)
@@ -1,3 +1,18 @@
+2015-03-10  Joseph Pecoraro  <pecor...@apple.com>
+
+        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.
+
 2015-03-10  Gyuyoung Kim  <gyuyoung....@samsung.com>
 
         Unreviewed EFL gardening on 10th Mar.

Added: trunk/LayoutTests/inspector-protocol/console/warnings-errors-expected.txt (0 => 181367)


--- 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)
@@ -0,0 +1,25 @@
+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.
+{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"warnings-errors.html:5:20"}
+{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"warnings-errors.html:6:14"}
+{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"warnings-errors.html:7:7"}
+{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"warnings-errors.html:9:8"}
+{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"errors.css:1:7"}
+{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"errors.css:1:29"}
+{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"errors.css:4:5"}
+{"source":"console-api","level":"error","text":"error script","location":"errors.js:1:14","parameters":[{"type":"string"}]}
+{"source":"console-api","level":"warning","text":"warn script","location":"errors.js:1:44","parameters":[{"type":"string"}]}
+{"source":"console-api","level":"error","text":"error script","location":"errors.js:5:18","parameters":[{"type":"string"}]}
+{"source":"console-api","level":"warning","text":"warn script","location":"errors.js:6:17","parameters":[{"type":"string"}]}
+{"source":"_javascript_","level":"error","text":"TypeError: undefined is not an object (evaluating '[].x.x')","location":"warnings-errors.html:15:18"}
+{"source":"console-api","level":"warning","text":"warn 1","location":"warnings-errors.html:17:13","parameters":[{"type":"string"}]}
+{"source":"console-api","level":"error","text":"error 1","location":"warnings-errors.html:17:38","parameters":[{"type":"string"}]}
+{"source":"console-api","level":"error","text":"error 2","location":"warnings-errors.html:18:17","parameters":[{"type":"string"}]}
+

Added: trunk/LayoutTests/inspector-protocol/console/warnings-errors.html (0 => 181367)


--- 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)
@@ -0,0 +1,46 @@
+<html>
+<head>
+<script type="text/_javascript_" src=""
+<link rel="stylesheet" href=""
+  <style>    div { * color: red; }</style>
+<style>div { * color: red; }
+div { * color: red; }
+   div {
+       *
+       color:
+       red;
+   }
+</style>
+<script src="" type="text/_javascript_" charset="utf-8"></script>
+  <script>   [].x.x   </script>
+<script>
+console.warn("warn 1"); console.error("error 1");
+   console.error("error 2");
+</script>
+<script>
+function test()
+{
+    InspectorTest.importScript("../../../../inspector-protocol/resources/console-helper.js");
+
+    InspectorTest.sendCommand("Console.enable", {});
+
+    var consoleMessageCount = 0;
+    const expectedConsoleMessages = 15;
+
+    InspectorTest.eventHandler["Console.messageAdded"] = function(messageObject)
+    {
+        var simplifiedMessage = ConsoleHelper.simplifiedConsoleMessage(messageObject);
+        InspectorTest.log(JSON.stringify(simplifiedMessage));
+
+        if (++consoleMessageCount === expectedConsoleMessages)
+            InspectorTest.completeTest();
+    }
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<p>
+Tests that CSS/_javascript_ errors and warnings are sent to the console with line and column information.<br>
+</p>
+</body>
+</html>

Added: trunk/LayoutTests/inspector-protocol/resources/errors.css (0 => 181367)


--- 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)
@@ -0,0 +1,7 @@
+div { * color: red; } div { * color: red; }
+
+div {
+    *
+    color:
+    red;
+}

Added: trunk/LayoutTests/inspector-protocol/resources/errors.js (0 => 181367)


--- 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)
@@ -0,0 +1,9 @@
+console.error("error script"); console.warn("warn script");
+
+
+function foo() {
+    console.error("error script");
+    console.warn("warn script");
+}
+
+foo();

Modified: trunk/Source/WebCore/ChangeLog (181366 => 181367)


--- 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)
@@ -1,3 +1,52 @@
+2015-03-10  Joseph Pecoraro  <pecor...@apple.com>
+
+        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.
+
 2015-03-10  Darin Adler  <da...@apple.com>
 
         Try to fix the GTK build.

Modified: trunk/Source/WebCore/css/CSSParser.cpp (181366 => 181367)


--- 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)
@@ -331,6 +331,9 @@
     , m_lineNumber(0)
     , m_tokenStartLineNumber(0)
     , m_lastSelectorLineNumber(0)
+    , m_columnOffsetForLine(0)
+    , m_sheetStartLineNumber(0)
+    , m_sheetStartColumnNumber(0)
     , m_allowImportRules(true)
     , m_allowNamespaceDeclarations(true)
 #if ENABLE(CSS_DEVICE_ADAPTATION)
@@ -429,7 +432,7 @@
     m_lexFunc = &CSSParser::realLex<UChar>;
 }
 
-void CSSParser::parseSheet(StyleSheetContents* sheet, const String& string, int startLineNumber, RuleSourceDataList* ruleSourceDataResult, bool logErrors)
+void CSSParser::parseSheet(StyleSheetContents* sheet, const String& string, int startLineNumber, int startColumnNumber, RuleSourceDataList* ruleSourceDataResult, bool logErrors)
 {
     setStyleSheet(sheet);
     m_defaultNamespace = starAtom; // Reset the default namespace.
@@ -440,6 +443,9 @@
     m_logErrors = logErrors && sheet->singleOwnerDocument() && !sheet->baseURL().isEmpty() && sheet->singleOwnerDocument()->page();
     m_ignoreErrorsInDeclaration = false;
     m_lineNumber = startLineNumber;
+    m_columnOffsetForLine = 0;
+    m_sheetStartLineNumber = startLineNumber;
+    m_sheetStartColumnNumber = startColumnNumber;
     setupParser("", string, "");
     cssyyparse(this);
     sheet->shrinkToFit();
@@ -10483,10 +10489,19 @@
 {
     Location location;
     location.lineNumber = m_tokenStartLineNumber;
+    location.columnNumber = tokenStartOffset() - m_columnOffsetForLine;
+
+    ASSERT(location.lineNumber >= 0);
+    ASSERT(location.columnNumber >= 0);
+
+    if (m_tokenStartLineNumber == m_sheetStartLineNumber)
+        location.columnNumber += m_sheetStartColumnNumber;
+
     if (is8BitSource())
         location.token.init(tokenStart<LChar>(), currentCharacter<LChar>() - tokenStart<LChar>());
     else
         location.token.init(tokenStart<UChar>(), currentCharacter<UChar>() - tokenStart<UChar>());
+
     return location;
 }
 
@@ -11580,9 +11595,12 @@
         // Might start with a '\n'.
         --currentCharacter<SrcCharacterType>();
         do {
-            if (*currentCharacter<SrcCharacterType>() == '\n')
+            if (*currentCharacter<SrcCharacterType>() == '\n') {
                 ++m_lineNumber;
-            ++currentCharacter<SrcCharacterType>();
+                ++currentCharacter<SrcCharacterType>();
+                m_columnOffsetForLine = currentCharacterOffset();
+            } else
+                ++currentCharacter<SrcCharacterType>();
         } while (*currentCharacter<SrcCharacterType>() <= ' ' && (typesOfASCIICharacters[*currentCharacter<SrcCharacterType>()] == CharacterWhiteSpace));
         break;
 
@@ -11650,8 +11668,12 @@
         if (*currentCharacter<SrcCharacterType>() == '*') {
             ++currentCharacter<SrcCharacterType>();
             while (currentCharacter<SrcCharacterType>()[0] != '*' || currentCharacter<SrcCharacterType>()[1] != '/') {
-                if (*currentCharacter<SrcCharacterType>() == '\n')
+                if (*currentCharacter<SrcCharacterType>() == '\n') {
                     ++m_lineNumber;
+                    ++currentCharacter<SrcCharacterType>();
+                    m_columnOffsetForLine = currentCharacterOffset();
+                    continue;
+                }
                 if (*currentCharacter<SrcCharacterType>() == '\0') {
                     // Unterminated comments are simply ignored.
                     currentCharacter<SrcCharacterType>() -= 2;
@@ -11869,14 +11891,15 @@
 {
     if (!isLoggingErrors())
         return;
+
     StringBuilder builder;
     switch (error) {
     case PropertyDeclarationError:
         builder.appendLiteral("Invalid CSS property declaration at: ");
         break;
-
     default:
         builder.appendLiteral("Unexpected CSS token: ");
+        break;
     }
 
     if (location.token.is8Bit())
@@ -11884,7 +11907,7 @@
     else
         builder.append(location.token.characters16(), location.token.length());
 
-    logError(builder.toString(), location.lineNumber);
+    logError(builder.toString(), location.lineNumber, location.columnNumber);
 
     m_ignoreErrorsInDeclaration = true;
 }
@@ -11894,11 +11917,10 @@
     return m_logErrors && !m_ignoreErrorsInDeclaration;
 }
 
-void CSSParser::logError(const String& message, int lineNumber)
+void CSSParser::logError(const String& message, int lineNumber, int columnNumber)
 {
-    // FIXME: <http://webkit.org/b/114313> CSS parser console message errors should include column numbers.
     PageConsoleClient& console = m_styleSheet->singleOwnerDocument()->page()->console();
-    console.addMessage(MessageSource::CSS, MessageLevel::Warning, message, m_styleSheet->baseURL().string(), lineNumber + 1, 0);
+    console.addMessage(MessageSource::CSS, MessageLevel::Warning, message, m_styleSheet->baseURL().string(), lineNumber + 1, columnNumber + 1);
 }
 
 PassRefPtr<StyleRuleKeyframes> CSSParser::createKeyframesRule(const String& name, std::unique_ptr<Vector<RefPtr<StyleKeyframe>>> popKeyframes)

Modified: trunk/Source/WebCore/css/CSSParser.h (181366 => 181367)


--- 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)
@@ -105,7 +105,7 @@
 
     WEBCORE_EXPORT ~CSSParser();
 
-    void parseSheet(StyleSheetContents*, const String&, int startLineNumber = 0, RuleSourceDataList* = nullptr, bool = false);
+    void parseSheet(StyleSheetContents*, const String&, int startLineNumber, int startColumnNumber, RuleSourceDataList*, bool logErrors);
     PassRefPtr<StyleRuleBase> parseRule(StyleSheetContents*, const String&);
     PassRefPtr<StyleKeyframe> parseKeyframeRule(StyleSheetContents*, const String&);
     bool parseSupportsCondition(const String&);
@@ -464,6 +464,8 @@
     inline unsigned tokenStartOffset();
     inline UChar tokenStartChar();
 
+    inline unsigned currentCharacterOffset();
+
     template <typename CharacterType>
     inline bool isIdentifierStart();
 
@@ -593,7 +595,11 @@
     int m_lineNumber;
     int m_tokenStartLineNumber;
     int m_lastSelectorLineNumber;
+    int m_columnOffsetForLine;
 
+    int m_sheetStartLineNumber;
+    int m_sheetStartColumnNumber;
+
     bool m_allowImportRules;
     bool m_allowNamespaceDeclarations;
 
@@ -642,7 +648,7 @@
     };
 
     bool isLoggingErrors();
-    void logError(const String& message, int lineNumber);
+    void logError(const String& message, int lineNumber, int columnNumber);
 
     bool validateCalculationUnit(ValueWithCalculation&, Units);
 
@@ -686,6 +692,7 @@
 
 struct CSSParser::Location {
     int lineNumber;
+    int columnNumber;
     CSSParserString token;
 };
 
@@ -714,6 +721,13 @@
     return m_tokenStart.ptr16 - m_dataStart16.get();
 }
 
+inline unsigned CSSParser::currentCharacterOffset()
+{
+    if (is8BitSource())
+        return m_currentCharacter8 - m_dataStart8.get();
+    return m_currentCharacter16 - m_dataStart16.get();
+}
+
 inline UChar CSSParser::tokenStartChar()
 {
     if (is8BitSource())

Modified: trunk/Source/WebCore/css/StyleSheetContents.cpp (181366 => 181367)


--- 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)
@@ -291,7 +291,7 @@
     String sheetText = cachedStyleSheet->sheetText(&hasValidMIMEType);
 
     CSSParser p(parserContext());
-    p.parseSheet(this, sheetText, 0, 0, true);
+    p.parseSheet(this, sheetText, 0, 0, nullptr, true);
 
     // If we're loading a stylesheet cross-origin, and the MIME type is not standard, require the CSS
     // to at least start with a syntactically valid CSS rule.
@@ -316,13 +316,13 @@
 
 bool StyleSheetContents::parseString(const String& sheetText)
 {
-    return parseStringAtLine(sheetText, 0, false);
+    return parseStringAtLineAndColumn(sheetText, 0, 0, false);
 }
 
-bool StyleSheetContents::parseStringAtLine(const String& sheetText, int startLineNumber, bool createdByParser)
+bool StyleSheetContents::parseStringAtLineAndColumn(const String& sheetText, int startLineNumber, int startColumnNumber, bool createdByParser)
 {
     CSSParser p(parserContext());
-    p.parseSheet(this, sheetText, startLineNumber, 0, createdByParser);
+    p.parseSheet(this, sheetText, startLineNumber, startColumnNumber, nullptr, createdByParser);
 
     return true;
 }

Modified: trunk/Source/WebCore/css/StyleSheetContents.h (181366 => 181367)


--- 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)
@@ -62,7 +62,7 @@
 
     void parseAuthorStyleSheet(const CachedCSSStyleSheet*, const SecurityOrigin*);
     WEBCORE_EXPORT bool parseString(const String&);
-    bool parseStringAtLine(const String&, int startLineNumber, bool);
+    bool parseStringAtLineAndColumn(const String&, int startLineNumber, int startColumnNumber, bool createdByParser);
 
     bool isCacheable() const;
 

Modified: trunk/Source/WebCore/dom/InlineStyleSheetOwner.cpp (181366 => 181367)


--- 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)
@@ -35,10 +35,10 @@
 InlineStyleSheetOwner::InlineStyleSheetOwner(Document& document, bool createdByParser)
     : m_isParsingChildren(createdByParser)
     , m_loading(false)
-    , m_startLineNumber(WTF::OrdinalNumber::beforeFirst())
+    , m_startTextPosition(WTF::OrdinalNumber::beforeFirst(), WTF::OrdinalNumber::beforeFirst())
 {
     if (createdByParser && document.scriptableDocumentParser() && !document.isInDocumentWrite())
-        m_startLineNumber = document.scriptableDocumentParser()->textPosition().m_line;
+        m_startTextPosition = document.scriptableDocumentParser()->textPosition();
 }
 
 InlineStyleSheetOwner::~InlineStyleSheetOwner()
@@ -123,7 +123,7 @@
 
     if (!isValidCSSContentType(element, m_contentType))
         return;
-    if (!document.contentSecurityPolicy()->allowInlineStyle(document.url(), m_startLineNumber))
+    if (!document.contentSecurityPolicy()->allowInlineStyle(document.url(), m_startTextPosition.m_line))
         return;
 
     RefPtr<MediaQuerySet> mediaQueries;
@@ -144,7 +144,7 @@
     m_sheet = CSSStyleSheet::createInline(element, URL(), document.inputEncoding());
     m_sheet->setMediaQueries(mediaQueries.release());
     m_sheet->setTitle(element.title());
-    m_sheet->contents().parseStringAtLine(text, m_startLineNumber.zeroBasedInt(), m_isParsingChildren);
+    m_sheet->contents().parseStringAtLineAndColumn(text, m_startTextPosition.m_line.zeroBasedInt(), m_startTextPosition.m_column.zeroBasedInt(), m_isParsingChildren);
 
     m_loading = false;
 

Modified: trunk/Source/WebCore/dom/InlineStyleSheetOwner.h (181366 => 181367)


--- 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)
@@ -57,7 +57,7 @@
 
     bool m_isParsingChildren;
     bool m_loading;
-    WTF::OrdinalNumber m_startLineNumber;
+    WTF::TextPosition m_startTextPosition;
     AtomicString m_contentType;
     AtomicString m_media;
     RefPtr<CSSStyleSheet> m_sheet;

Modified: trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp (181366 => 181367)


--- 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)
@@ -1106,7 +1106,7 @@
 
     RefPtr<StyleSheetContents> newStyleSheet = StyleSheetContents::create();
     auto ruleSourceDataResult = std::make_unique<RuleSourceDataList>();
-    createCSSParser(m_pageStyleSheet->ownerDocument())->parseSheet(newStyleSheet.get(), m_parsedStyleSheet->text(), 0, ruleSourceDataResult.get());
+    createCSSParser(m_pageStyleSheet->ownerDocument())->parseSheet(newStyleSheet.get(), m_parsedStyleSheet->text(), 0, 0, ruleSourceDataResult.get(), false);
     m_parsedStyleSheet->setSourceData(WTF::move(ruleSourceDataResult));
     return m_parsedStyleSheet->hasSourceData();
 }

Modified: trunk/Source/WebInspectorUI/ChangeLog (181366 => 181367)


--- 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)
@@ -1,5 +1,16 @@
 2015-03-10  Joseph Pecoraro  <pecor...@apple.com>
 
+        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  <pecor...@apple.com>
+
         Web Inspector: console.error output broken, does not produce ObjectTree
         https://bugs.webkit.org/show_bug.cgi?id=142554
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageImpl.js (181366 => 181367)


--- 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)
@@ -199,6 +199,7 @@
     {
         // ConsoleMessage stack trace line numbers are one-based.
         lineNumber = lineNumber ? lineNumber - 1 : 0;
+        columnNumber = columnNumber ? columnNumber - 1 : 0;
 
         return WebInspector.linkifyLocation(url, lineNumber, columnNumber, "console-message-url");
     },
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to