Title: [207565] trunk/Source/WebCore
Revision
207565
Author
hy...@apple.com
Date
2016-10-19 13:34:14 -0700 (Wed, 19 Oct 2016)

Log Message

[CSS Parser] class and id parsing need to be case-insensitive in HTML quirks mode
https://bugs.webkit.org/show_bug.cgi?id=163685

Reviewed by Zalan Bujtas.

Class and ID parsing should be case-insensitive in quirks mode. Apply the same hack
that the old parser did and lowercase the class and ids in place.

* css/parser/CSSSelectorParser.cpp:
(WebCore::CSSSelectorParser::consumeId):
(WebCore::CSSSelectorParser::consumeClass):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (207564 => 207565)


--- trunk/Source/WebCore/ChangeLog	2016-10-19 20:33:23 UTC (rev 207564)
+++ trunk/Source/WebCore/ChangeLog	2016-10-19 20:34:14 UTC (rev 207565)
@@ -1,3 +1,17 @@
+2016-10-19  Dave Hyatt  <hy...@apple.com>
+
+        [CSS Parser] class and id parsing need to be case-insensitive in HTML quirks mode
+        https://bugs.webkit.org/show_bug.cgi?id=163685
+
+        Reviewed by Zalan Bujtas.
+
+        Class and ID parsing should be case-insensitive in quirks mode. Apply the same hack
+        that the old parser did and lowercase the class and ids in place.
+
+        * css/parser/CSSSelectorParser.cpp:
+        (WebCore::CSSSelectorParser::consumeId):
+        (WebCore::CSSSelectorParser::consumeClass):
+
 2016-10-19  Nan Wang  <n_w...@apple.com>
 
         AX: crash: com.apple.WebCore: WebCore::AccessibilityObject::findMatchingObjects + 600

Modified: trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp (207564 => 207565)


--- trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp	2016-10-19 20:33:23 UTC (rev 207564)
+++ trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp	2016-10-19 20:34:14 UTC (rev 207565)
@@ -30,6 +30,7 @@
 #include "config.h"
 #include "CSSSelectorParser.h"
 
+#include "CSSParserIdioms.h"
 #include "CSSParserMode.h"
 #include "CSSSelectorList.h"
 #include "StyleSheetContents.h"
@@ -356,8 +357,14 @@
         return nullptr;
     std::unique_ptr<CSSParserSelector> selector = std::unique_ptr<CSSParserSelector>(new CSSParserSelector());
     selector->setMatch(CSSSelector::Id);
-    AtomicString value = range.consume().value().toAtomicString();
-    selector->setValue(value);
+    
+    // FIXME-NEWPARSER: Avoid having to do this, but the old parser does and we need
+    // to be compatible for now.
+    StringView stringView = range.consume().value();
+    if (m_context.mode == HTMLQuirksMode)
+        convertToASCIILowercaseInPlace(stringView);
+    selector->setValue(stringView.toAtomicString());
+
     return selector;
 }
 
@@ -370,8 +377,14 @@
         return nullptr;
     std::unique_ptr<CSSParserSelector> selector = std::unique_ptr<CSSParserSelector>(new CSSParserSelector());
     selector->setMatch(CSSSelector::Class);
-    AtomicString value = range.consume().value().toAtomicString();
-    selector->setValue(value);
+    
+    // FIXME-NEWPARSER: Avoid having to do this, but the old parser does and we need
+    // to be compatible for now.
+    StringView stringView = range.consume().value();
+    if (m_context.mode == HTMLQuirksMode)
+        convertToASCIILowercaseInPlace(stringView);
+    selector->setValue(stringView.toAtomicString());
+
     return selector;
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to