Changeset 207565 in webkit


Ignore:
Timestamp:
Oct 19, 2016 1:34:14 PM (8 years ago)
Author:
hyatt@apple.com
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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r207564 r207565  
     12016-10-19  Dave Hyatt  <hyatt@apple.com>
     2
     3        [CSS Parser] class and id parsing need to be case-insensitive in HTML quirks mode
     4        https://bugs.webkit.org/show_bug.cgi?id=163685
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        Class and ID parsing should be case-insensitive in quirks mode. Apply the same hack
     9        that the old parser did and lowercase the class and ids in place.
     10
     11        * css/parser/CSSSelectorParser.cpp:
     12        (WebCore::CSSSelectorParser::consumeId):
     13        (WebCore::CSSSelectorParser::consumeClass):
     14
    1152016-10-19  Nan Wang  <n_wang@apple.com>
    216
  • trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp

    r207536 r207565  
    3131#include "CSSSelectorParser.h"
    3232
     33#include "CSSParserIdioms.h"
    3334#include "CSSParserMode.h"
    3435#include "CSSSelectorList.h"
     
    357358    std::unique_ptr<CSSParserSelector> selector = std::unique_ptr<CSSParserSelector>(new CSSParserSelector());
    358359    selector->setMatch(CSSSelector::Id);
    359     AtomicString value = range.consume().value().toAtomicString();
    360     selector->setValue(value);
     360   
     361    // FIXME-NEWPARSER: Avoid having to do this, but the old parser does and we need
     362    // to be compatible for now.
     363    StringView stringView = range.consume().value();
     364    if (m_context.mode == HTMLQuirksMode)
     365        convertToASCIILowercaseInPlace(stringView);
     366    selector->setValue(stringView.toAtomicString());
     367
    361368    return selector;
    362369}
     
    371378    std::unique_ptr<CSSParserSelector> selector = std::unique_ptr<CSSParserSelector>(new CSSParserSelector());
    372379    selector->setMatch(CSSSelector::Class);
    373     AtomicString value = range.consume().value().toAtomicString();
    374     selector->setValue(value);
     380   
     381    // FIXME-NEWPARSER: Avoid having to do this, but the old parser does and we need
     382    // to be compatible for now.
     383    StringView stringView = range.consume().value();
     384    if (m_context.mode == HTMLQuirksMode)
     385        convertToASCIILowercaseInPlace(stringView);
     386    selector->setValue(stringView.toAtomicString());
     387
    375388    return selector;
    376389}
Note: See TracChangeset for help on using the changeset viewer.