haikuwebkit/Source/WebCore/css/makeSelectorPseudoClassAndC...

218 lines
7.9 KiB
Python
Raw Permalink Normal View History

Start splitting CSS Selectors's pseudo types https://bugs.webkit.org/show_bug.cgi?id=130003 Reviewed by Andreas Kling. CSS Selectors pseudo types come in 3 flavors: page, pseudo class, pseudo elements. The three types are mixed together in a single enum list named PseudoType. Only some combinations of match type + pseudo type are valid, but this is implicitly defined from the code. This patch is the beginning of a refactoring to add more clear boundaries between valid and invalid combinations. First, the handling of page pseudo types is completely split from the other values. The parser use a different method for handling the value CSSParserSelector::parsePagePseudoSelector(). PagePseudo types no longer store their string in the CSSSelector either to reduce the redundancy with m_pseudoType. When we need to generate the string for those CSSSelector, we recreate the string as needed in CSSSelector::selectorText(). The remaining two types are not yet split in this patch but this introduce the preliminary clean up toward that goal. The list of parsed pseudo types is now generated at compile time from the source in SelectorPseudoTypeMap.in. * DerivedSources.make: The mapping of strings to pseudo types is generated from SelectorPseudoTypeMap.in by the new script makeSelectorPseudoTypeMap.py. * WebCore.xcodeproj/project.pbxproj: * css/CSSGrammar.y.in: Split the parsing of Pseudo Types. Pseudo page get its own method. The others will need some work. * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePagePseudoSelector): (WebCore::CSSParserSelector::setPseudoTypeValue): * css/CSSParserValues.h: * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForPage): This is an example of invalid combination that is hidden by the current code. First, Left and Right could never appear in a pseudo class match. (WebCore::CSSSelector::pseudoId): (WebCore::CSSSelector::parsePseudoType): (WebCore::appendPseudoTypeTailIfNecessary): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoType): (WebCore::CSSSelector::matchesPseudoElement): (WebCore::CSSSelector::setValue): (WebCore::CSSSelector::CSSSelector): * css/PageRuleCollector.cpp: (WebCore::checkPageSelectorComponents): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): * css/SelectorPseudoTypeMap.h: Added. * css/SelectorPseudoTypeMap.in: Added. * css/makeSelectorPseudoTypeMap.py: Added. (enumerablePseudoType): (expand_ifdef_condition): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoType): Canonical link: https://commits.webkit.org/148023@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-03-10 21:00:26 +00:00
#!/usr/bin/env python
#
# Copyright (C) 2014 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
# THE POSSIBILITY OF SUCH DAMAGE.
import os
import sys
import subprocess
Start splitting CSS Selectors's pseudo types https://bugs.webkit.org/show_bug.cgi?id=130003 Reviewed by Andreas Kling. CSS Selectors pseudo types come in 3 flavors: page, pseudo class, pseudo elements. The three types are mixed together in a single enum list named PseudoType. Only some combinations of match type + pseudo type are valid, but this is implicitly defined from the code. This patch is the beginning of a refactoring to add more clear boundaries between valid and invalid combinations. First, the handling of page pseudo types is completely split from the other values. The parser use a different method for handling the value CSSParserSelector::parsePagePseudoSelector(). PagePseudo types no longer store their string in the CSSSelector either to reduce the redundancy with m_pseudoType. When we need to generate the string for those CSSSelector, we recreate the string as needed in CSSSelector::selectorText(). The remaining two types are not yet split in this patch but this introduce the preliminary clean up toward that goal. The list of parsed pseudo types is now generated at compile time from the source in SelectorPseudoTypeMap.in. * DerivedSources.make: The mapping of strings to pseudo types is generated from SelectorPseudoTypeMap.in by the new script makeSelectorPseudoTypeMap.py. * WebCore.xcodeproj/project.pbxproj: * css/CSSGrammar.y.in: Split the parsing of Pseudo Types. Pseudo page get its own method. The others will need some work. * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePagePseudoSelector): (WebCore::CSSParserSelector::setPseudoTypeValue): * css/CSSParserValues.h: * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForPage): This is an example of invalid combination that is hidden by the current code. First, Left and Right could never appear in a pseudo class match. (WebCore::CSSSelector::pseudoId): (WebCore::CSSSelector::parsePseudoType): (WebCore::appendPseudoTypeTailIfNecessary): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoType): (WebCore::CSSSelector::matchesPseudoElement): (WebCore::CSSSelector::setValue): (WebCore::CSSSelector::CSSSelector): * css/PageRuleCollector.cpp: (WebCore::checkPageSelectorComponents): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): * css/SelectorPseudoTypeMap.h: Added. * css/SelectorPseudoTypeMap.in: Added. * css/makeSelectorPseudoTypeMap.py: Added. (enumerablePseudoType): (expand_ifdef_condition): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoType): Canonical link: https://commits.webkit.org/148023@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-03-10 21:00:26 +00:00
def enumerablePseudoType(stringPseudoType):
Rename the CSSSelector PseudoType to PseudoClassType https://bugs.webkit.org/show_bug.cgi?id=131907 Reviewed by Andreas Kling. Pseudo Elements and Page Pseudo Classes have been moved out of PseudoType in previous patches. The remaining values in the PseudoType enumeration are the pseudo classes. This patch is the final clean up, PseudoType is renamed to PseudoClassType. * css/CSSGrammar.y.in: * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePseudoClassAndCompatibilityElementSelector): * css/CSSParserValues.h: (WebCore::CSSParserSelector::pseudoClassType): (WebCore::CSSParserSelector::pseudoType): Deleted. * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForOneSelector): (WebCore::appendPseudoClassFunctionTail): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoClassType): (WebCore::CSSSelector::pseudoElementType): (WebCore::CSSSelector::pagePseudoClassType): (WebCore::pseudoClassIsRelativeToSiblings): (WebCore::CSSSelector::isSiblingSelector): (WebCore::CSSSelector::CSSSelector): (WebCore::CSSSelector::pseudoType): Deleted. * css/RuleSet.cpp: (WebCore::RuleSet::findBestRuleSetAndAdd): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): (WebCore::SelectorChecker::checkScrollbarPseudoClass): (WebCore::SelectorChecker::determineLinkMatchType): (WebCore::SelectorChecker::matchesFocusPseudoClass): * css/SelectorChecker.h: (WebCore::SelectorChecker::isCommonPseudoClassSelector): * css/SelectorCheckerFastPath.cpp: (WebCore::SelectorCheckerFastPath::commonPseudoClassSelectorMatches): * css/SelectorPseudoClassAndCompatibilityElementMap.in: * css/SelectorPseudoTypeMap.h: * css/StyleResolver.cpp: (WebCore::StyleResolver::styleForElement): * css/makeSelectorPseudoClassAndCompatibilityElementMap.py: (enumerablePseudoType): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoClassType): (WebCore::SelectorCompiler::SelectorCodeGenerator::SelectorCodeGenerator): (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementMatching): (WebCore::SelectorCompiler::addPseudoType): Deleted. * inspector/InspectorCSSAgent.cpp: (WebCore::computePseudoClassMask): (WebCore::InspectorCSSAgent::forcePseudoState): * inspector/InspectorCSSAgent.h: * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::forcePseudoStateImpl): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::forcePseudoState): Canonical link: https://commits.webkit.org/149991@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167571 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-20 20:43:35 +00:00
output = ['CSSSelector::PseudoClass']
Start splitting CSS Selectors's pseudo types https://bugs.webkit.org/show_bug.cgi?id=130003 Reviewed by Andreas Kling. CSS Selectors pseudo types come in 3 flavors: page, pseudo class, pseudo elements. The three types are mixed together in a single enum list named PseudoType. Only some combinations of match type + pseudo type are valid, but this is implicitly defined from the code. This patch is the beginning of a refactoring to add more clear boundaries between valid and invalid combinations. First, the handling of page pseudo types is completely split from the other values. The parser use a different method for handling the value CSSParserSelector::parsePagePseudoSelector(). PagePseudo types no longer store their string in the CSSSelector either to reduce the redundancy with m_pseudoType. When we need to generate the string for those CSSSelector, we recreate the string as needed in CSSSelector::selectorText(). The remaining two types are not yet split in this patch but this introduce the preliminary clean up toward that goal. The list of parsed pseudo types is now generated at compile time from the source in SelectorPseudoTypeMap.in. * DerivedSources.make: The mapping of strings to pseudo types is generated from SelectorPseudoTypeMap.in by the new script makeSelectorPseudoTypeMap.py. * WebCore.xcodeproj/project.pbxproj: * css/CSSGrammar.y.in: Split the parsing of Pseudo Types. Pseudo page get its own method. The others will need some work. * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePagePseudoSelector): (WebCore::CSSParserSelector::setPseudoTypeValue): * css/CSSParserValues.h: * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForPage): This is an example of invalid combination that is hidden by the current code. First, Left and Right could never appear in a pseudo class match. (WebCore::CSSSelector::pseudoId): (WebCore::CSSSelector::parsePseudoType): (WebCore::appendPseudoTypeTailIfNecessary): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoType): (WebCore::CSSSelector::matchesPseudoElement): (WebCore::CSSSelector::setValue): (WebCore::CSSSelector::CSSSelector): * css/PageRuleCollector.cpp: (WebCore::checkPageSelectorComponents): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): * css/SelectorPseudoTypeMap.h: Added. * css/SelectorPseudoTypeMap.in: Added. * css/makeSelectorPseudoTypeMap.py: Added. (enumerablePseudoType): (expand_ifdef_condition): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoType): Canonical link: https://commits.webkit.org/148023@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-03-10 21:00:26 +00:00
if stringPseudoType.endswith('('):
stringPseudoType = stringPseudoType[:-1]
internalPrefix = '-internal-'
if (stringPseudoType.startswith(internalPrefix)):
stringPseudoType = stringPseudoType[len(internalPrefix):]
Start splitting CSS Selectors's pseudo types https://bugs.webkit.org/show_bug.cgi?id=130003 Reviewed by Andreas Kling. CSS Selectors pseudo types come in 3 flavors: page, pseudo class, pseudo elements. The three types are mixed together in a single enum list named PseudoType. Only some combinations of match type + pseudo type are valid, but this is implicitly defined from the code. This patch is the beginning of a refactoring to add more clear boundaries between valid and invalid combinations. First, the handling of page pseudo types is completely split from the other values. The parser use a different method for handling the value CSSParserSelector::parsePagePseudoSelector(). PagePseudo types no longer store their string in the CSSSelector either to reduce the redundancy with m_pseudoType. When we need to generate the string for those CSSSelector, we recreate the string as needed in CSSSelector::selectorText(). The remaining two types are not yet split in this patch but this introduce the preliminary clean up toward that goal. The list of parsed pseudo types is now generated at compile time from the source in SelectorPseudoTypeMap.in. * DerivedSources.make: The mapping of strings to pseudo types is generated from SelectorPseudoTypeMap.in by the new script makeSelectorPseudoTypeMap.py. * WebCore.xcodeproj/project.pbxproj: * css/CSSGrammar.y.in: Split the parsing of Pseudo Types. Pseudo page get its own method. The others will need some work. * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePagePseudoSelector): (WebCore::CSSParserSelector::setPseudoTypeValue): * css/CSSParserValues.h: * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForPage): This is an example of invalid combination that is hidden by the current code. First, Left and Right could never appear in a pseudo class match. (WebCore::CSSSelector::pseudoId): (WebCore::CSSSelector::parsePseudoType): (WebCore::appendPseudoTypeTailIfNecessary): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoType): (WebCore::CSSSelector::matchesPseudoElement): (WebCore::CSSSelector::setValue): (WebCore::CSSSelector::CSSSelector): * css/PageRuleCollector.cpp: (WebCore::checkPageSelectorComponents): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): * css/SelectorPseudoTypeMap.h: Added. * css/SelectorPseudoTypeMap.in: Added. * css/makeSelectorPseudoTypeMap.py: Added. (enumerablePseudoType): (expand_ifdef_condition): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoType): Canonical link: https://commits.webkit.org/148023@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-03-10 21:00:26 +00:00
webkitPrefix = '-webkit-'
if (stringPseudoType.startswith(webkitPrefix)):
stringPseudoType = stringPseudoType[len(webkitPrefix):]
khtmlPrefix = '-khtml-'
if (stringPseudoType.startswith(khtmlPrefix)):
stringPseudoType = stringPseudoType[len(khtmlPrefix):]
substring_start = 0
next_dash_position = stringPseudoType.find('-')
while (next_dash_position != -1):
output.append(stringPseudoType[substring_start].upper())
output.append(stringPseudoType[substring_start + 1:next_dash_position])
substring_start = next_dash_position + 1
next_dash_position = stringPseudoType.find('-', substring_start)
output.append(stringPseudoType[substring_start].upper())
output.append(stringPseudoType[substring_start + 1:])
return ''.join(output)
def expand_ifdef_condition(condition):
return condition.replace('(', '_').replace(')', '')
output_file = open('SelectorPseudoClassAndCompatibilityElementMap.gperf', 'w')
Start splitting CSS Selectors's pseudo types https://bugs.webkit.org/show_bug.cgi?id=130003 Reviewed by Andreas Kling. CSS Selectors pseudo types come in 3 flavors: page, pseudo class, pseudo elements. The three types are mixed together in a single enum list named PseudoType. Only some combinations of match type + pseudo type are valid, but this is implicitly defined from the code. This patch is the beginning of a refactoring to add more clear boundaries between valid and invalid combinations. First, the handling of page pseudo types is completely split from the other values. The parser use a different method for handling the value CSSParserSelector::parsePagePseudoSelector(). PagePseudo types no longer store their string in the CSSSelector either to reduce the redundancy with m_pseudoType. When we need to generate the string for those CSSSelector, we recreate the string as needed in CSSSelector::selectorText(). The remaining two types are not yet split in this patch but this introduce the preliminary clean up toward that goal. The list of parsed pseudo types is now generated at compile time from the source in SelectorPseudoTypeMap.in. * DerivedSources.make: The mapping of strings to pseudo types is generated from SelectorPseudoTypeMap.in by the new script makeSelectorPseudoTypeMap.py. * WebCore.xcodeproj/project.pbxproj: * css/CSSGrammar.y.in: Split the parsing of Pseudo Types. Pseudo page get its own method. The others will need some work. * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePagePseudoSelector): (WebCore::CSSParserSelector::setPseudoTypeValue): * css/CSSParserValues.h: * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForPage): This is an example of invalid combination that is hidden by the current code. First, Left and Right could never appear in a pseudo class match. (WebCore::CSSSelector::pseudoId): (WebCore::CSSSelector::parsePseudoType): (WebCore::appendPseudoTypeTailIfNecessary): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoType): (WebCore::CSSSelector::matchesPseudoElement): (WebCore::CSSSelector::setValue): (WebCore::CSSSelector::CSSSelector): * css/PageRuleCollector.cpp: (WebCore::checkPageSelectorComponents): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): * css/SelectorPseudoTypeMap.h: Added. * css/SelectorPseudoTypeMap.in: Added. * css/makeSelectorPseudoTypeMap.py: Added. (enumerablePseudoType): (expand_ifdef_condition): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoType): Canonical link: https://commits.webkit.org/148023@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-03-10 21:00:26 +00:00
output_file.write("""
%{
/*
[CSS Parser] Add support for new CSS selector parsing https://bugs.webkit.org/show_bug.cgi?id=161749 Reviewed by Dean Jackson. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * contentextensions/ContentExtensionParser.cpp: (WebCore::ContentExtensions::isValidSelector): * css/CSSDefaultStyleSheets.cpp: (WebCore::parseUASheet): * css/CSSFontFaceSet.cpp: (WebCore::CSSFontFaceSet::matchingFaces): * css/CSSGrammar.y.in: * css/CSSSelector.cpp: (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: * css/DOMCSSNamespace.cpp: (WebCore::DOMCSSNamespace::supports): * css/FontFace.cpp: (WebCore::FontFace::parseString): (WebCore::FontFace::setVariant): * css/MediaList.cpp: (WebCore::MediaQuerySet::internalParse): (WebCore::MediaQuerySet::parse): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::matchRecursively): * css/SelectorFilter.cpp: (WebCore::SelectorFilter::collectIdentifierHashes): * css/SelectorPseudoClassAndCompatibilityElementMap.in: * css/SelectorPseudoTypeMap.h: * css/SourceSizeList.cpp: (WebCore::parseSizesAttribute): * css/StyleProperties.cpp: (WebCore::MutableStyleProperties::MutableStyleProperties): * css/StyleProperties.h: * css/StyleRuleImport.cpp: (WebCore::StyleRuleImport::setCSSStyleSheet): * css/StyleSheetContents.cpp: (WebCore::StyleSheetContents::StyleSheetContents): (WebCore::StyleSheetContents::parserAddNamespace): (WebCore::StyleSheetContents::namespaceURIFromPrefix): (WebCore::StyleSheetContents::determineNamespace): Deleted. * css/StyleSheetContents.h: * css/WebKitCSSMatrix.cpp: (WebCore::WebKitCSSMatrix::setMatrixValue): * css/makeSelectorPseudoClassAndCompatibilityElementMap.py: * css/parser/CSSParser.cpp: (WebCore::strictCSSParserContext): (WebCore::CSSParserContext::CSSParserContext): (WebCore::CSSParser::parseColor): (WebCore::CSSParser::shouldAcceptUnitLessValues): (WebCore::CSSParser::parseValue): (WebCore::CSSParser::parseColumnWidth): (WebCore::CSSParser::parseColumnCount): (WebCore::CSSParser::parseFontWeight): (WebCore::CSSParser::parseColorParameters): (WebCore::CSSParser::parseHSLParameters): (WebCore::CSSParser::parseShadow): (WebCore::CSSParser::parseBorderImageSlice): (WebCore::CSSParser::parseBorderImageQuad): (WebCore::CSSParser::parseDeprecatedLinearGradient): (WebCore::CSSParser::parseLinearGradient): (WebCore::CSSParser::parseTransformValue): (WebCore::CSSParser::parseBuiltinFilterArguments): (WebCore::CSSParser::determineNameInNamespace): * css/parser/CSSParser.h: (WebCore::CSSParser::inStrictMode): (WebCore::CSSParser::inQuirksMode): * css/parser/CSSParserMode.h: (WebCore::isQuirksModeBehavior): (WebCore::isUASheetBehavior): (WebCore::isUnitLessLengthParsingEnabledForMode): (WebCore::isCSSViewportParsingEnabledForMode): (WebCore::strictToCSSParserMode): (WebCore::isStrictParserMode): * css/parser/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePseudoElementSelectorFromStringView): (WebCore::CSSParserSelector::parsePseudoClassSelectorFromStringView): (WebCore::CSSParserSelector::setSelectorList): (WebCore::CSSParserSelector::appendTagHistory): (WebCore::CSSParserSelector::releaseTagHistory): (WebCore::CSSParserSelector::isHostPseudoSelector): * css/parser/CSSParserValues.h: (WebCore::CSSParserSelector::match): (WebCore::CSSParserSelector::pseudoElementType): (WebCore::CSSParserSelector::selectorList): (WebCore::CSSParserSelector::needsImplicitShadowCombinatorForMatching): * css/parser/CSSPropertyParser.h: (WebCore::CSSPropertyParser::inQuirksMode): * css/parser/CSSSelectorParser.cpp: Added. (WebCore::CSSSelectorParser::parseSelector): (WebCore::CSSSelectorParser::CSSSelectorParser): (WebCore::CSSSelectorParser::consumeComplexSelectorList): (WebCore::CSSSelectorParser::consumeCompoundSelectorList): (WebCore::CSSSelectorParser::consumeComplexSelector): (WebCore::CSSSelectorParser::consumeCompoundSelector): (WebCore::CSSSelectorParser::consumeSimpleSelector): (WebCore::CSSSelectorParser::consumeName): (WebCore::CSSSelectorParser::consumeId): (WebCore::CSSSelectorParser::consumeClass): (WebCore::CSSSelectorParser::consumeAttribute): (WebCore::CSSSelectorParser::consumePseudo): (WebCore::CSSSelectorParser::consumeCombinator): (WebCore::CSSSelectorParser::consumeAttributeMatch): (WebCore::CSSSelectorParser::consumeAttributeFlags): (WebCore::CSSSelectorParser::consumeANPlusB): (WebCore::CSSSelectorParser::defaultNamespace): (WebCore::CSSSelectorParser::determineNamespace): (WebCore::CSSSelectorParser::prependTypeSelectorIfNeeded): (WebCore::CSSSelectorParser::addSimpleSelectorToCompound): (WebCore::CSSSelectorParser::splitCompoundAtImplicitShadowCrossingCombinator): * css/parser/CSSSelectorParser.h: Added. (WebCore::CSSSelectorParser::DisallowPseudoElementsScope::DisallowPseudoElementsScope): (WebCore::CSSSelectorParser::DisallowPseudoElementsScope::~DisallowPseudoElementsScope): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::fragmentRelationForSelectorRelation): * dom/StyledElement.cpp: (WebCore::StyledElement::rebuildPresentationAttributeStyle): * svg/SVGFontFaceElement.cpp: (WebCore::SVGFontFaceElement::SVGFontFaceElement): Canonical link: https://commits.webkit.org/179919@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205660 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-08 21:09:04 +00:00
* Copyright (C) 2014-2016 Apple Inc. All rights reserved.
Start splitting CSS Selectors's pseudo types https://bugs.webkit.org/show_bug.cgi?id=130003 Reviewed by Andreas Kling. CSS Selectors pseudo types come in 3 flavors: page, pseudo class, pseudo elements. The three types are mixed together in a single enum list named PseudoType. Only some combinations of match type + pseudo type are valid, but this is implicitly defined from the code. This patch is the beginning of a refactoring to add more clear boundaries between valid and invalid combinations. First, the handling of page pseudo types is completely split from the other values. The parser use a different method for handling the value CSSParserSelector::parsePagePseudoSelector(). PagePseudo types no longer store their string in the CSSSelector either to reduce the redundancy with m_pseudoType. When we need to generate the string for those CSSSelector, we recreate the string as needed in CSSSelector::selectorText(). The remaining two types are not yet split in this patch but this introduce the preliminary clean up toward that goal. The list of parsed pseudo types is now generated at compile time from the source in SelectorPseudoTypeMap.in. * DerivedSources.make: The mapping of strings to pseudo types is generated from SelectorPseudoTypeMap.in by the new script makeSelectorPseudoTypeMap.py. * WebCore.xcodeproj/project.pbxproj: * css/CSSGrammar.y.in: Split the parsing of Pseudo Types. Pseudo page get its own method. The others will need some work. * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePagePseudoSelector): (WebCore::CSSParserSelector::setPseudoTypeValue): * css/CSSParserValues.h: * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForPage): This is an example of invalid combination that is hidden by the current code. First, Left and Right could never appear in a pseudo class match. (WebCore::CSSSelector::pseudoId): (WebCore::CSSSelector::parsePseudoType): (WebCore::appendPseudoTypeTailIfNecessary): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoType): (WebCore::CSSSelector::matchesPseudoElement): (WebCore::CSSSelector::setValue): (WebCore::CSSSelector::CSSSelector): * css/PageRuleCollector.cpp: (WebCore::checkPageSelectorComponents): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): * css/SelectorPseudoTypeMap.h: Added. * css/SelectorPseudoTypeMap.in: Added. * css/makeSelectorPseudoTypeMap.py: Added. (enumerablePseudoType): (expand_ifdef_condition): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoType): Canonical link: https://commits.webkit.org/148023@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-03-10 21:00:26 +00:00
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
// This file is automatically generated from SelectorPseudoTypeMap.in by makeprop, do not edit by hand.
#include "config.h"
#include "SelectorPseudoTypeMap.h"
#include "CSSParserSelector.h"
Reduce use of equalIgnoringCase to just ignore ASCII case https://bugs.webkit.org/show_bug.cgi?id=153266 Reviewed by Ryosuke Niwa. Source/WebCore: Changed many call sites that were using equalIgnoringCase to instead use equalLettersIgnoringASCIICase. What these all have in common is that the thing they are comparing with is a string literal that has all lowercase letters, spaces, and a few simple examples of punctuation. Not 100% sure that the new function name is just right, but it's a long name so it's easy to change it with a global replace if we come up with a better one. Or if we decide ther eis no need for the "letters" optimization, we can change these all to just use equalIgnoringASCIICase, also with a global replace. Also made a few tweaks to some code nearby and some includes. * Modules/encryptedmedia/CDMPrivateClearKey.cpp: (WebCore::CDMPrivateClearKey::supportsKeySystem): Use equalLettersIgnoringASCIICase. (WebCore::CDMPrivateClearKey::supportsKeySystemAndMimeType): Ditto. * Modules/encryptedmedia/CDMSessionClearKey.cpp: (WebCore::CDMSessionClearKey::update): Ditto. * Modules/plugins/YouTubePluginReplacement.cpp: (WebCore::YouTubePluginReplacement::supportsMimeType): Ditto. (WebCore::YouTubePluginReplacement::supportsFileExtension): Ditto. * Modules/webdatabase/DatabaseAuthorizer.cpp: (WebCore::DatabaseAuthorizer::createVTable): Ditto. (WebCore::DatabaseAuthorizer::dropVTable): Ditto. * Modules/websockets/WebSocketHandshake.cpp: (WebCore::WebSocketHandshake::readHTTPHeaders): Ditto. (WebCore::WebSocketHandshake::checkResponseHeaders): Ditto. * accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::findAriaModalNodes): Ditto. (WebCore::AXObjectCache::handleMenuItemSelected): Ditto. (WebCore::AXObjectCache::handleAriaModalChange): Ditto. (WebCore::isNodeAriaVisible): Ditto. * accessibility/AccessibilityListBoxOption.cpp: (WebCore::AccessibilityListBoxOption::isEnabled): Ditto. * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::determineAccessibilityRole): Use isColorControl instead of checking the typeAttr of the HTMLInputElement directly. (WebCore::AccessibilityNodeObject::isEnabled): Use equalLettersIgnoringASCIICase. (WebCore::AccessibilityNodeObject::isPressed): Ditto. (WebCore::AccessibilityNodeObject::isChecked): Ditto. (WebCore::AccessibilityNodeObject::isMultiSelectable): Ditto. (WebCore::AccessibilityNodeObject::isRequired): Ditto. (WebCore::shouldUseAccessibilityObjectInnerText): Ditto. (WebCore::AccessibilityNodeObject::colorValue): Ditto. * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::contentEditableAttributeIsEnabled): Use equalLettersIgnoringASCIICase. (WebCore::AccessibilityObject::ariaIsMultiline): Ditto. (WebCore::AccessibilityObject::liveRegionStatusIsEnabled): Ditto. (WebCore::AccessibilityObject::sortDirection): Ditto. (WebCore::AccessibilityObject::supportsARIAPressed): Ditto. (WebCore::AccessibilityObject::supportsExpanded): Ditto. (WebCore::AccessibilityObject::isExpanded): Ditto. (WebCore::AccessibilityObject::checkboxOrRadioValue): Ditto. (WebCore::AccessibilityObject::isARIAHidden): Ditto. * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::supportsARIADragging): Ditto. (WebCore::AccessibilityRenderObject::defaultObjectInclusion): Ditto. (WebCore::AccessibilityRenderObject::elementAttributeValue): Ditto. (WebCore::AccessibilityRenderObject::isSelected): Ditto. (WebCore::AccessibilityRenderObject::determineAccessibilityRole): Ditto. (WebCore::AccessibilityRenderObject::orientation): Ditto. (WebCore::AccessibilityRenderObject::canSetExpandedAttribute): Ditto. (WebCore::AccessibilityRenderObject::canSetValueAttribute): Ditto. (WebCore::AccessibilityRenderObject::ariaLiveRegionAtomic): Ditto. * accessibility/AccessibilityTableCell.cpp: (WebCore::AccessibilityTableCell::ariaRowSpan): Use == to compare a string with "0" since there is no need to "ignore case" when there are no letters. * css/CSSCalculationValue.cpp: (WebCore::CSSCalcValue::create): Use equalLettersIgnoringASCIICase. * css/CSSCalculationValue.h: Removed unneeded include of CSSParserValues.h. * css/CSSCustomPropertyValue.h: Ditto. * css/CSSFontFaceSrcValue.cpp: (WebCore::CSSFontFaceSrcValue::isSVGFontFaceSrc): Use equalLettersIgnoringASCIICase. * css/CSSGrammar.y.in: Use equalLettersIgnoringASCIICase. Also restructured the code a bit to have more normal formatting and reordered it slightly. * css/CSSParser.cpp: (WebCore::equal): Deleted. (WebCore::equalIgnoringCase): Deleted. (WebCore::equalLettersIgnoringASCIICase): Added. Replaces function templates named equal and equalIgnoringCase that are no longer used. (WebCore::CSSParser::parseValue): Use equalLettersIgnoringASCIICase. (WebCore::CSSParser::parseNonElementSnapPoints): Ditto. (WebCore::CSSParser::parseAlt): Ditto. (WebCore::CSSParser::parseContent): Ditto. (WebCore::CSSParser::parseFillImage): Ditto. (WebCore::CSSParser::parseAnimationName): Ditto. (WebCore::CSSParser::parseAnimationTrigger): Ditto. (WebCore::CSSParser::parseAnimationProperty): Ditto. (WebCore::CSSParser::parseKeyframeSelector): Ditto. (WebCore::CSSParser::parseAnimationTimingFunction): Ditto. (WebCore::CSSParser::parseGridTrackList): Ditto. (WebCore::CSSParser::parseGridTrackSize): Ditto. (WebCore::CSSParser::parseDashboardRegions): Ditto. (WebCore::CSSParser::parseClipShape): Ditto. (WebCore::CSSParser::parseBasicShapeInset): Ditto. (WebCore::CSSParser::parseBasicShape): Ditto. (WebCore::CSSParser::parseFontFaceSrcURI): Ditto. (WebCore::CSSParser::parseFontFaceSrc): Ditto. (WebCore::CSSParser::isCalculation): Ditto. (WebCore::CSSParser::parseColorFromValue): Ditto. (WebCore::CSSParser::parseBorderImage): Ditto. (WebCore::parseDeprecatedGradientPoint): Ditto. (WebCore::parseDeprecatedGradientColorStop): Ditto. (WebCore::CSSParser::parseDeprecatedGradient): Ditto. (WebCore::CSSParser::parseLinearGradient): Ditto. (WebCore::CSSParser::parseRadialGradient): Ditto. (WebCore::CSSParser::isGeneratedImageValue): Ditto. (WebCore::CSSParser::parseGeneratedImage): Ditto. (WebCore::filterInfoForName): Ditto. (WebCore::validFlowName): Ditto. (WebCore::CSSParser::realLex): Ditto. (WebCore::isValidNthToken): Ditto. * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePagePseudoSelector): Ditto. * css/CSSParserValues.h: (WebCore::equalLettersIgnoringASCIICase): Added. * css/CSSVariableDependentValue.h: Removed unneeded include of CSSParserValues.h. * css/MediaList.cpp: (WebCore::reportMediaQueryWarningIfNeeded): Use equalLettersIgnoringASCIICase. * css/MediaQueryEvaluator.cpp: (WebCore::MediaQueryEvaluator::mediaTypeMatch): Ditto. (WebCore::MediaQueryEvaluator::mediaTypeMatchSpecific): Ditto. (WebCore::evalResolution): Ditto. * css/SelectorPseudoTypeMap.h: Removed unneeded include of CSSParserValues.h. * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertTouchCallout): Use equalLettersIgnoringASCIICase. * css/makeSelectorPseudoClassAndCompatibilityElementMap.py: Added an include of CSSParserValues.h since it's no longer included by SelectorPseudoTypeMap.h. * dom/Document.cpp: (WebCore::setParserFeature): Use equalLettersIgnoringASCIICase. (WebCore::Document::processReferrerPolicy): Ditto. (WebCore::Document::createEvent): Ditto. (WebCore::Document::parseDNSPrefetchControlHeader): Ditto. * dom/Element.cpp: (WebCore::Element::spellcheckAttributeState): Use isNull instead of doing checking equality with nullAtom. Use isEmpty instead of equalIgnoringCase(""). Use equalLettersIgnoringASCIICase. (WebCore::Element::canContainRangeEndPoint): Ditto. * dom/InlineStyleSheetOwner.cpp: (WebCore::isValidCSSContentType): Use equalLettersIgnoringASCIICase. Added comment about peculiar behavior where we do case-sensitive processing of the MIME type if the document is XML. * dom/ScriptElement.cpp: (WebCore::ScriptElement::requestScript): Use equalLettersIgnoringASCIICase. (WebCore::ScriptElement::isScriptForEventSupported): Ditto. * dom/SecurityContext.cpp: (WebCore::SecurityContext::parseSandboxPolicy): Ditto. * dom/ViewportArguments.cpp: (WebCore::findSizeValue): Ditto. (WebCore::findScaleValue): Ditto. (WebCore::findBooleanValue): Ditto. * editing/EditorCommand.cpp: (WebCore::executeDefaultParagraphSeparator): Use equalLettersIgnoringASCIICase. (WebCore::executeInsertBacktab): Use ASCIILiteral. (WebCore::executeInsertHTML): Use emptyString. (WebCore::executeInsertLineBreak): Use ASCIILiteral. (WebCore::executeInsertNewline): Ditto. (WebCore::executeInsertTab): Ditto. (WebCore::executeJustifyCenter): Ditto. (WebCore::executeJustifyFull): Ditto. (WebCore::executeJustifyLeft): Ditto. (WebCore::executeJustifyRight): Ditto. (WebCore::executeStrikethrough): Ditto. (WebCore::executeStyleWithCSS): Use equalLettersIgnoringASCIICase. (WebCore::executeUseCSS): Ditto. (WebCore::executeSubscript): Use ASCIILiteral. (WebCore::executeSuperscript): Ditto. (WebCore::executeToggleBold): Ditto. (WebCore::executeToggleItalic): Ditto. (WebCore::executeUnderline): Ditto. (WebCore::executeUnscript): Ditto. (WebCore::stateBold): Ditto. (WebCore::stateItalic): Ditto. (WebCore::stateStrikethrough): Ditto. (WebCore::stateSubscript): Ditto. (WebCore::stateSuperscript): Ditto. (WebCore::stateUnderline): Ditto. (WebCore::stateJustifyCenter): Ditto. (WebCore::stateJustifyFull): Ditto. (WebCore::stateJustifyLeft): Ditto. (WebCore::stateJustifyRight): Ditto. (WebCore::valueFormatBlock): Use emptyString. (WebCore::Editor::Command::value): Use ASCIILiteral. * editing/TextIterator.cpp: (WebCore::isRendererReplacedElement): Use equalLettersIgnoringASCIICase. * fileapi/Blob.cpp: (WebCore::Blob::isNormalizedContentType): Use isASCIIUpper. * history/HistoryItem.cpp: (WebCore::HistoryItem::setFormInfoFromRequest): Use equalLettersIgnoringASCIICase. * html/Autocapitalize.cpp: (WebCore::valueOn): Deleted. (WebCore::valueOff): Deleted. (WebCore::valueNone): Deleted. (WebCore::valueWords): Deleted. (WebCore::valueSentences): Deleted. (WebCore::valueAllCharacters): Deleted. (WebCore::autocapitalizeTypeForAttributeValue): Use equalLettersIgnoringASCIICase. (WebCore::stringForAutocapitalizeType): Put the AtomicString globals right in the switch statement instead of in separate functions. * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::draggable): Use equalLettersIgnoringASCIICase. * html/HTMLAreaElement.cpp: (WebCore::HTMLAreaElement::parseAttribute): Ditto. * html/HTMLBRElement.cpp: (WebCore::HTMLBRElement::collectStyleForPresentationAttribute): Ditto. * html/HTMLBodyElement.cpp: (WebCore::HTMLBodyElement::collectStyleForPresentationAttribute): Ditto. * html/HTMLButtonElement.cpp: (WebCore::HTMLButtonElement::parseAttribute): Ditto. * html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::toDataURL): Use ASCIILiteral. * html/HTMLDivElement.cpp: (WebCore::HTMLDivElement::collectStyleForPresentationAttribute): Use equalLettersIgnoringASCIICase. * html/HTMLDocument.cpp: (WebCore::HTMLDocument::designMode): Use ASCIILiteral. (WebCore::HTMLDocument::setDesignMode): Use equalLettersIgnoringASCIICase. * html/HTMLElement.cpp: (WebCore::HTMLElement::nodeName): Updated comment. (WebCore::isLTROrRTLIgnoringCase): Use equalLettersIgnoringASCIICase. (WebCore::contentEditableType): Ditto. (WebCore::HTMLElement::collectStyleForPresentationAttribute): Ditto. (WebCore::toValidDirValue): Ditto. (WebCore::HTMLElement::insertAdjacent): Ditto. (WebCore::contextElementForInsertion): Ditto. (WebCore::HTMLElement::applyAlignmentAttributeToStyle): Ditto. (WebCore::HTMLElement::setContentEditable): Ditto. (WebCore::HTMLElement::draggable): Ditto. (WebCore::HTMLElement::translateAttributeMode): Ditto. (WebCore::HTMLElement::hasDirectionAuto): Ditto. (WebCore::HTMLElement::directionality): Ditto. (WebCore::HTMLElement::dirAttributeChanged): Ditto. (WebCore::HTMLElement::addHTMLColorToStyle): Ditto. * html/HTMLEmbedElement.cpp: (WebCore::HTMLEmbedElement::collectStyleForPresentationAttribute): Ditto. * html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::autocorrect): Ditto. * html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::autocorrect): Ditto. (WebCore::HTMLFormElement::shouldAutocomplete): Ditto. * html/HTMLFrameElementBase.cpp: (WebCore::HTMLFrameElementBase::parseAttribute): Ditto. * html/HTMLFrameSetElement.cpp: (WebCore::HTMLFrameSetElement::parseAttribute): Use equalLettersIgnoringASCIICase. Use == when comparing with "0" and "1" since there is no need for case folding. * html/HTMLHRElement.cpp: (WebCore::HTMLHRElement::collectStyleForPresentationAttribute): Use equalLettersIgnoringASCIICase. * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::draggable): Ditto. * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::parseAttribute): Ditto. * html/HTMLKeygenElement.cpp: (WebCore::HTMLKeygenElement::appendFormData): Ditto. * html/HTMLMarqueeElement.cpp: (WebCore::HTMLMarqueeElement::collectStyleForPresentationAttribute): Ditto. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::parseAttribute): Ditto. * html/HTMLMetaElement.cpp: (WebCore::HTMLMetaElement::process): Ditto. * html/HTMLObjectElement.cpp: (WebCore::mapDataParamToSrc): Use references, modern for loops, simplify logic to not use array indices, use ASCIILiteral and equalLettersIgnoringASCIICase. (WebCore::HTMLObjectElement::parametersForPlugin): Update to call new function. (WebCore::HTMLObjectElement::shouldAllowQuickTimeClassIdQuirk): Use equalLettersIgnoringASCIICase. (WebCore::HTMLObjectElement::containsJavaApplet): Ditto. * html/HTMLParagraphElement.cpp: (WebCore::HTMLParagraphElement::collectStyleForPresentationAttribute): Ditto. * html/HTMLParamElement.cpp: (WebCore::HTMLParamElement::isURLParameter): Ditto. * html/HTMLTableElement.cpp: (WebCore::getBordersFromFrameAttributeValue): Ditto. (WebCore::HTMLTableElement::collectStyleForPresentationAttribute): Ditto. (WebCore::HTMLTableElement::parseAttribute): Ditto. * html/HTMLTablePartElement.cpp: (WebCore::HTMLTablePartElement::collectStyleForPresentationAttribute): Ditto. * html/HTMLTextAreaElement.cpp: (WebCore::HTMLTextAreaElement::parseAttribute): Ditto. * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::setRangeText): Ditto. (WebCore::HTMLTextFormControlElement::directionForFormData): Ditto. * html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::parseAttribute): Ditto. * html/InputType.cpp: (WebCore::InputType::applyStep): Ditto. * html/LinkRelAttribute.cpp: (WebCore::LinkRelAttribute::LinkRelAttribute): Ditto. * html/MediaElementSession.cpp: (WebCore::MediaElementSession::wirelessVideoPlaybackDisabled): Ditto. * html/NumberInputType.cpp: (WebCore::NumberInputType::sizeShouldIncludeDecoration): Ditto. * html/RangeInputType.cpp: (WebCore::RangeInputType::createStepRange): Ditto. (WebCore::RangeInputType::handleKeydownEvent): Ditto. * html/StepRange.cpp: (WebCore::StepRange::parseStep): Ditto. * html/canvas/CanvasStyle.cpp: (WebCore::parseColor): Ditto. * html/parser/HTMLConstructionSite.cpp: (WebCore::HTMLConstructionSite::setCompatibilityModeFromDoctype): Ditto. * html/parser/HTMLElementStack.cpp: (WebCore::HTMLElementStack::isHTMLIntegrationPoint): Ditto. * html/parser/HTMLMetaCharsetParser.cpp: (WebCore::HTMLMetaCharsetParser::encodingFromMetaAttributes): Ditto. * html/parser/HTMLPreloadScanner.cpp: (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): Ditto. (WebCore::TokenPreloadScanner::StartTagScanner::crossOriginModeAllowsCookies): Ditto. * html/parser/HTMLTreeBuilder.cpp: (WebCore::HTMLTreeBuilder::processStartTagForInBody): Ditto. (WebCore::HTMLTreeBuilder::processStartTagForInTable): Ditto. * html/parser/XSSAuditor.cpp: (WebCore::isDangerousHTTPEquiv): Ditto. * html/track/WebVTTParser.cpp: (WebCore::WebVTTParser::hasRequiredFileIdentifier): Removed unneeded special case for empty string. * inspector/InspectorPageAgent.cpp: (WebCore::createXHRTextDecoder): Use equalLettersIgnoringASCIICase. * inspector/NetworkResourcesData.cpp: (WebCore::createOtherResourceTextDecoder): Ditto. * loader/CrossOriginAccessControl.cpp: (WebCore::isOnAccessControlSimpleRequestHeaderWhitelist): Ditto. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::continueAfterContentPolicy): Ditto. * loader/FormSubmission.cpp: (WebCore::appendMailtoPostFormDataToURL): Ditto. (WebCore::FormSubmission::Attributes::parseEncodingType): Ditto. (WebCore::FormSubmission::Attributes::parseMethodType): Ditto. * loader/FrameLoader.cpp: (WebCore::FrameLoader::shouldPerformFragmentNavigation): Ditto. (WebCore::FrameLoader::shouldTreatURLAsSrcdocDocument): Ditto. * loader/ImageLoader.cpp: (WebCore::ImageLoader::updateFromElement): Ditto. * loader/MediaResourceLoader.cpp: (WebCore::MediaResourceLoader::start): Ditto. * loader/SubframeLoader.cpp: (WebCore::SubframeLoader::createJavaAppletWidget): Ditto. * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::determineContentType): Ditto. * loader/TextTrackLoader.cpp: (WebCore::TextTrackLoader::load): Ditto. * loader/appcache/ApplicationCache.cpp: (WebCore::ApplicationCache::requestIsHTTPOrHTTPSGet): Ditto. * loader/cache/CachedCSSStyleSheet.cpp: (WebCore::CachedCSSStyleSheet::canUseSheet): Ditto. * loader/cache/CachedResource.cpp: (WebCore::shouldCacheSchemeIndefinitely): Ditto. * page/DOMSelection.cpp: (WebCore::DOMSelection::modify): Ditto. * page/EventSource.cpp: (WebCore::EventSource::didReceiveResponse): Ditto. * page/FrameView.cpp: (WebCore::FrameView::scrollToAnchor): Ditto. * page/Performance.cpp: (WebCore::Performance::webkitGetEntriesByType): Ditto. * page/PerformanceResourceTiming.cpp: (WebCore::passesTimingAllowCheck): Ditto. * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::SecurityOrigin): Use emptyString. (WebCore::SecurityOrigin::toString): Use ASCIILiteral. (WebCore::SecurityOrigin::databaseIdentifier): Ditto. * page/UserContentURLPattern.cpp: (WebCore::UserContentURLPattern::parse): Use equalLettersIgnoringASCIICase. (WebCore::UserContentURLPattern::matches): Ditto. * platform/URL.cpp: (WebCore::URL::protocolIs): Ditto. * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm: (WebCore::CDMPrivateMediaSourceAVFObjC::supportsKeySystemAndMimeType): Changed to use early exit and equalLettersIgnoringASCIICase. Added comment about inconsistency with next function. (WebCore::CDMPrivateMediaSourceAVFObjC::supportsMIMEType): Added comment about inconsistency with previous function. * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm: (WebCore::CDMSessionAVContentKeySession::generateKeyRequest): Use equalLettersIgnoringASCIICase. * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm: (WebCore::CDMSessionAVStreamSession::generateKeyRequest): Ditto. * platform/graphics/cg/ImageBufferCG.cpp: (WebCore::utiFromMIMEType): Ditto. * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::FontCache::similarFont): Changed to not use so many global variables and use equalLettersIgnoringASCIICase. * platform/graphics/ios/FontCacheIOS.mm: (WebCore::platformFontWithFamilySpecialCase): Ditto. * platform/graphics/mac/FontCustomPlatformData.cpp: (WebCore::FontCustomPlatformData::supportsFormat): Use equalLettersIgnoringASCIICase. * platform/mac/PasteboardMac.mm: (WebCore::Pasteboard::readString): Ditto. * platform/network/BlobResourceHandle.cpp: (WebCore::BlobResourceHandle::createAsync): Ditto. (WebCore::BlobResourceHandle::loadResourceSynchronously): Ditto. * platform/network/CacheValidation.cpp: (WebCore::parseCacheControlDirectives): Ditto. * platform/network/FormData.h: (WebCore::FormData::parseEncodingType): Ditto. * platform/network/HTTPParsers.cpp: (WebCore::contentDispositionType): Ditto. (WebCore::parseXFrameOptionsHeader): Ditto. * platform/network/ResourceResponseBase.cpp: (WebCore::ResourceResponseBase::isHTTP): Use protocolIsInHTTPFamily, which is both clearer and more efficient. (WebCore::ResourceResponseBase::isAttachment): Rewrite to be a bit more terse and use equalLettersIgnoringASCIICase. * platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp: (WebCore::ResourceHandleCFURLConnectionDelegate::createResourceRequest): Use equalLettersIgnoringASCIICase. * platform/network/mac/ResourceHandleMac.mm: (WebCore::ResourceHandle::willSendRequest): Ditto. * platform/sql/SQLiteDatabase.cpp: (WebCore::SQLiteDatabase::open): Ditto. * platform/sql/SQLiteStatement.cpp: (WebCore::SQLiteStatement::isColumnDeclaredAsBlob): Ditto. * platform/text/TextEncodingRegistry.cpp: (WebCore::defaultTextEncodingNameForSystemLanguage): Use ASCIILiteral and equalLettersIgnoringASCIICase. * rendering/mathml/RenderMathMLFraction.cpp: (WebCore::RenderMathMLFraction::updateFromElement): Use equalLettersIgnoringASCIICase. * svg/SVGToOTFFontConversion.cpp: (WebCore::SVGToOTFFontConverter::compareCodepointsLexicographically): Ditto. (WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter): Ditto. * testing/InternalSettings.cpp: (WebCore::InternalSettings::setEditingBehavior): Ditto. (WebCore::InternalSettings::setShouldDisplayTrackKind): Ditto. (WebCore::InternalSettings::shouldDisplayTrackKind): Ditto. * testing/Internals.cpp: (WebCore::markerTypeFrom): Ditto. (WebCore::markerTypesFrom): Ditto. (WebCore::Internals::mediaElementHasCharacteristic): Ditto. (WebCore::Internals::setCaptionDisplayMode): Ditto. (WebCore::Internals::beginMediaSessionInterruption): Ditto. (WebCore::Internals::endMediaSessionInterruption): Ditto. (WebCore::Internals::setMediaSessionRestrictions): Ditto. (WebCore::Internals::setMediaElementRestrictions): Ditto. (WebCore::Internals::postRemoteControlCommand): Ditto. (WebCore::Internals::setAudioContextRestrictions): Ditto. (WebCore::Internals::setMockMediaPlaybackTargetPickerState): Ditto. * testing/MockCDM.cpp: (WebCore::MockCDM::supportsKeySystem): Ditto. (WebCore::MockCDM::supportsKeySystemAndMimeType): Ditto. (WebCore::MockCDM::supportsMIMEType): Ditto. * xml/XMLHttpRequest.cpp: (WebCore::isSetCookieHeader): Ditto. (WebCore::XMLHttpRequest::responseXML): Ditto. (WebCore::XMLHttpRequest::isAllowedHTTPMethod): Ditto. (WebCore::XMLHttpRequest::didReceiveData): Ditto. Source/WebKit: * Storage/StorageTracker.cpp: (WebCore::StorageTracker::syncFileSystemAndTrackerDatabase): Removed extraneous unneeded ", true" in call to String::endsWith. Preparation for later removing the boolean argument. Source/WebKit/mac: * WebCoreSupport/WebFrameLoaderClient.mm: (WebFrameLoaderClient::createPlugin): Use equalLettersIgnoringASCIICase. Source/WebKit2: * UIProcess/PageLoadState.cpp: (WebKit::PageLoadState::hasOnlySecureContent): Use the protocolIs function from WebCore instead of calling startsWith. * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: (WebKit::NetscapePlugin::initialize): Use equalLettersIgnoringASCIICase. Source/WTF: * wtf/ASCIICType.h: (WTF::isASCIIAlphaCaselessEqual): Loosened the assertion in this function so it can work with ASCII spaces, numeric digits, and some punctuation. Commented that we might want to change its name later. * wtf/Assertions.cpp: (WTFInitializeLogChannelStatesFromString): Use equalLettersIgnoringASCIICase. * wtf/text/AtomicString.h: (WTF::equalLettersIgnoringASCIICase): Added. Calls the version that takes a String. * wtf/text/StringCommon.h: (WTF::equalLettersIgnoringASCIICase): Added. Takes a pointer to characters. (WTF::equalLettersIgnoringASCIICaseCommonWithoutLength): Added. (WTF::equalLettersIgnoringASCIICaseCommon): Added. * wtf/text/StringImpl.h: (WTF::equalLettersIgnoringASCIICase): Added. Calls equalLettersIgnoringASCIICaseCommon. * wtf/text/StringView.h: (WTF::equalLettersIgnoringASCIICase): Added. Calls equalLettersIgnoringASCIICaseCommon. * wtf/text/WTFString.h: Reordered/reformatted a little. (WTF::equalIgnoringASCIICase): Added. Calls the version that takes a StringImpl. Canonical link: https://commits.webkit.org/171418@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@195452 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-01-22 17:17:04 +00:00
Add IGNORE_WARNING_.* macros https://bugs.webkit.org/show_bug.cgi?id=188996 Reviewed by Michael Catanzaro. Source/JavaScriptCore: * API/JSCallbackObject.h: * API/tests/testapi.c: * assembler/LinkBuffer.h: (JSC::LinkBuffer::finalizeCodeWithDisassembly): * b3/B3LowerToAir.cpp: * b3/B3Opcode.cpp: * b3/B3Type.h: * b3/B3TypeMap.h: * b3/B3Width.h: * b3/air/AirArg.cpp: * b3/air/AirArg.h: * b3/air/AirCode.h: * bytecode/Opcode.h: (JSC::padOpcodeName): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::speculateNumber): (JSC::DFG::SpeculativeJIT::speculateMisc): * dfg/DFGSpeculativeJIT64.cpp: * ftl/FTLOutput.h: * jit/CCallHelpers.h: (JSC::CCallHelpers::calculatePokeOffset): * llint/LLIntData.cpp: * llint/LLIntSlowPaths.cpp: (JSC::LLInt::slowPathLogF): * runtime/ConfigFile.cpp: (JSC::ConfigFile::canonicalizePaths): * runtime/JSDataViewPrototype.cpp: * runtime/JSGenericTypedArrayViewConstructor.h: * runtime/JSGenericTypedArrayViewPrototype.h: * runtime/Options.cpp: (JSC::Options::setAliasedOption): * tools/CodeProfiling.cpp: * wasm/WasmSections.h: * wasm/generateWasmValidateInlinesHeader.py: Source/WebCore: * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h: * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h: * accessibility/mac/AXObjectCacheMac.mm: (WebCore::AXObjectCache::postPlatformNotification): * accessibility/mac/AccessibilityObjectMac.mm: (WebCore::AccessibilityObject::overrideAttachmentParent): (WebCore::AccessibilityObject::accessibilityIgnoreAttachment const): * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper renderWidgetChildren]): (-[WebAccessibilityObjectWrapper convertPointToScreenSpace:]): (-[WebAccessibilityObjectWrapper role]): (-[WebAccessibilityObjectWrapper roleDescription]): * bridge/objc/WebScriptObject.mm: * bridge/objc/objc_class.mm: (JSC::Bindings::ObjcClass::fieldNamed const): * crypto/CommonCryptoUtilities.cpp: (WebCore::getCommonCryptoDigestAlgorithm): * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp: (WebCore::encryptAES_GCM): (WebCore::decyptAES_GCM): * crypto/mac/SerializedCryptoKeyWrapMac.mm: (WebCore::wrapSerializedCryptoKey): (WebCore::unwrapSerializedCryptoKey): * css/makeSelectorPseudoClassAndCompatibilityElementMap.py: * css/makeSelectorPseudoElementsMap.py: * editing/TextIterator.cpp: * editing/mac/EditorMac.mm: (WebCore::Editor::pasteWithPasteboard): (WebCore::Editor::takeFindStringFromSelection): (WebCore::Editor::replaceNodeFromPasteboard): * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::sendFakeEventsAfterWidgetTracking): * page/mac/ServicesOverlayController.mm: (WebCore::ServicesOverlayController::Highlight::paintContents): * platform/LocalizedStrings.cpp: (WebCore::formatLocalizedString): * platform/ScreenProperties.h: (WebCore::ScreenData::decode): * platform/gamepad/mac/HIDGamepadProvider.cpp: (WebCore::HIDGamepadProvider::stopMonitoringInput): * platform/graphics/PlatformDisplay.cpp: (WebCore::PlatformDisplay::sharedDisplay): * platform/graphics/SurrogatePairAwareTextIterator.cpp: * platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.mm: (WebCore::MediaSelectionGroupAVFObjC::updateOptions): * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm: (WebCore::CDMSessionAVStreamSession::update): * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::setCurrentTextTrack): (WebCore::MediaPlayerPrivateAVFoundationObjC::languageOfPrimaryAudioTrack const): (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: (WebCore::IGNORE_CLANG_WARNING_END): * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h: * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: (-[WebAVSampleBufferErrorListener beginObservingRenderer:]): (-[WebAVSampleBufferErrorListener stopObservingRenderer:]): (-[WebAVSampleBufferErrorListener observeValueForKeyPath:ofObject:change:context:]): (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled): (WebCore::IGNORE_CLANG_WARNING_END): * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: (PlatformCALayer::drawLayerContents): * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp: (WebCore::FontCascade::fontForCombiningCharacterSequence const): * platform/graphics/cg/ImageDecoderCG.cpp: (WebCore::ImageDecoderCG::createFrameImageAtIndex): * platform/graphics/cocoa/GraphicsContextCocoa.mm: (WebCore::GraphicsContext::drawLineForDocumentMarker): * platform/graphics/cocoa/WebGLLayer.h: (IGNORE_CLANG_WARNING): * platform/graphics/mac/ComplexTextControllerCoreText.mm: (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): * platform/graphics/mac/IconMac.mm: (WebCore::Icon::Icon): * platform/graphics/mac/PDFDocumentImageMac.mm: (WebCore::PDFDocumentImage::drawPDFPage): * platform/graphics/mac/WebKitNSImageExtras.mm: (-[NSImage _web_lockFocusWithDeviceScaleFactor:]): * platform/ios/DragImageIOS.mm: * platform/mac/DragImageMac.mm: (WebCore::scaleDragImage): (WebCore::createDragImageForLink): * platform/mac/LegacyNSPasteboardTypes.h: * platform/mac/LocalCurrentGraphicsContext.mm: (WebCore::LocalCurrentGraphicsContext::LocalCurrentGraphicsContext): * platform/mac/PasteboardMac.mm: (WebCore::Pasteboard::createForCopyAndPaste): (WebCore::Pasteboard::createForDragAndDrop): (WebCore::setDragImageImpl): * platform/mac/PlatformEventFactoryMac.mm: (WebCore::globalPoint): * platform/mac/SSLKeyGeneratorMac.mm: * platform/mac/ScrollViewMac.mm: (WebCore::ScrollView::platformContentsToScreen const): (WebCore::ScrollView::platformScreenToContents const): * platform/mac/ThemeMac.mm: (WebCore::drawCellFocusRingWithFrameAtTime): * platform/mac/WebPlaybackControlsManager.mm: * platform/mac/WidgetMac.mm: (WebCore::Widget::paint): * platform/mediastream/RealtimeIncomingAudioSource.h: * platform/mediastream/RealtimeIncomingVideoSource.h: * platform/mediastream/RealtimeOutgoingAudioSource.h: * platform/mediastream/RealtimeOutgoingVideoSource.h: * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h: * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: * platform/mediastream/libwebrtc/LibWebRTCProvider.h: * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm: * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp: * platform/network/cf/NetworkStorageSessionCFNet.cpp: * platform/network/cf/ResourceHandleCFNet.cpp: (WebCore::ResourceHandle::createCFURLConnection): * platform/network/cf/SocketStreamHandleImplCFNet.cpp: (WebCore::SocketStreamHandleImpl::reportErrorToClient): * platform/network/create-http-header-name-table: * platform/text/TextEncoding.cpp: * testing/MockLibWebRTCPeerConnection.h: * xml/XPathGrammar.cpp: Source/WebCore/PAL: * pal/crypto/commoncrypto/CryptoDigestCommonCrypto.cpp: (PAL::CryptoDigest::create): (PAL::CryptoDigest::addBytes): (PAL::CryptoDigest::computeHash): * pal/spi/cocoa/AVKitSPI.h: * pal/spi/cocoa/NSKeyedArchiverSPI.h: (insecurelyUnarchiveObjectFromData): * pal/spi/ios/MediaPlayerSPI.h: * pal/system/mac/PopupMenu.mm: (PAL::popUpMenu): * pal/system/mac/WebPanel.mm: (-[WebPanel init]): Source/WebKit: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::statelessCookieStorage): * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::platformSyncAllCookies): * PluginProcess/mac/PluginProcessMac.mm: (WebKit::beginModal): * PluginProcess/mac/PluginProcessShim.mm: * Shared/Plugins/Netscape/NetscapePluginModule.cpp: (WebKit::NetscapePluginModule::tryLoad): * Shared/ios/ChildProcessIOS.mm: (WebKit::ChildProcess::initializeSandbox): * Shared/mac/ChildProcessMac.mm: (WebKit::compileAndApplySandboxSlowCase): * Shared/mac/ColorSpaceData.mm: (WebKit::ColorSpaceData::decode): * Shared/mac/SandboxExtensionMac.mm: (WebKit::SandboxExtensionImpl::sandboxExtensionForType): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _web_superAccessibilityAttributeValue:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: * UIProcess/API/Cocoa/_WKWebsiteDataStore.mm: * UIProcess/API/glib/WebKitWebView.cpp: (webkitWebViewRunAsModal): * UIProcess/API/mac/WKView.mm: (-[WKView _web_superAccessibilityAttributeValue:]): * UIProcess/Cocoa/DownloadClient.mm: (WebKit::DownloadClient::decideDestinationWithSuggestedFilename): * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm: (-[WKCustomProtocolLoader initWithLegacyCustomProtocolManagerProxy:customProtocolID:request:]): * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction): * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::ContextMenuClient::menuFromProposedMenu): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): * UIProcess/Cocoa/WebViewImpl.mm: (-[WKTextListTouchBarViewController initWithWebViewImpl:]): (WebKit::WebViewImpl::updateWindowAndViewFrames): (WebKit::WebViewImpl::sendDragEndToPage): (WebKit::WebViewImpl::startDrag): (WebKit::WebViewImpl::characterIndexForPoint): * UIProcess/Plugins/mac/PluginProcessProxyMac.mm: (WebKit::PluginProcessProxy::getPluginProcessSerialNumber): (WebKit::PluginProcessProxy::makePluginProcessTheFrontProcess): (WebKit::PluginProcessProxy::makeUIProcessTheFrontProcess): (WebKit::PluginProcessProxy::exitFullscreen): * UIProcess/ios/SmartMagnificationController.mm: * UIProcess/ios/WKGeolocationProviderIOS.mm: * UIProcess/ios/WKLegacyPDFView.mm: * UIProcess/ios/WKPDFPageNumberIndicator.mm: (-[WKPDFPageNumberIndicator _makeRoundedCorners]): * UIProcess/ios/forms/WKAirPlayRoutePicker.mm: * UIProcess/ios/forms/WKFileUploadPanel.mm: (-[WKFileUploadPanel _presentPopoverWithContentViewController:animated:]): * UIProcess/ios/forms/WKFormColorControl.mm: (-[WKColorPopover initWithView:]): * UIProcess/ios/forms/WKFormInputControl.mm: (-[WKDateTimePopover initWithView:datePickerMode:]): * UIProcess/ios/forms/WKFormPopover.h: * UIProcess/ios/forms/WKFormPopover.mm: * UIProcess/ios/forms/WKFormSelectPopover.mm: (-[WKSelectPopover initWithView:hasGroups:]): * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::screenToRootView): (WebKit::PageClientImpl::rootViewToScreen): * UIProcess/mac/WKFullScreenWindowController.mm: (-[WKFullScreenWindowController enterFullScreen:]): (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]): (-[WKFullScreenWindowController exitFullScreen]): (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]): (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]): (-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]): (-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]): (-[WKFullScreenWindowController _startExitFullScreenAnimationWithDuration:]): * UIProcess/mac/WKPrintingView.mm: (-[WKPrintingView _setAutodisplay:]): (-[WKPrintingView _drawPDFDocument:page:atPoint:]): (-[WKPrintingView _drawPreview:]): (-[WKPrintingView drawRect:]): * UIProcess/mac/WKTextInputWindowController.mm: (-[WKTextInputPanel _interpretKeyEvent:usingLegacyCocoaTextInput:string:]): (-[WKTextInputPanel _hasMarkedText]): * UIProcess/mac/WebPopupMenuProxyMac.mm: (WebKit::WebPopupMenuProxyMac::showPopupMenu): * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: (WebKit::initializeEventRecord): (WebKit::NetscapePlugin::sendComplexTextInput): (WebKit::makeCGLPresentLayerOpaque): (WebKit::NetscapePlugin::nullEventTimerFired): * WebProcess/Plugins/PDF/PDFPlugin.mm: (-[WKPDFPluginAccessibilityObject accessibilityFocusedUIElement]): (-[WKPDFLayerControllerDelegate writeItemsToPasteboard:withTypes:]): (WebKit::PDFPlugin::handleEditingCommand): (WebKit::PDFPlugin::setActiveAnnotation): (WebKit:: const): * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.h: * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm: (WebKit::PDFPluginChoiceAnnotation::createAnnotationElement): * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.h: * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm: (WebKit::PDFPluginTextAnnotation::createAnnotationElement): * WebProcess/WebCoreSupport/WebAlternativeTextClient.h: * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm: (WebKit::convertImageToBitmap): (WebKit::WebDragClient::declareAndWriteDragImage): * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::drawPDFPage): Source/WebKitLegacy/mac: * Carbon/CarbonUtils.m: (PoolCleaner): * Carbon/CarbonWindowAdapter.mm: (-[CarbonWindowAdapter initWithCarbonWindowRef:takingOwnership:disableOrdering:carbon:]): (-[CarbonWindowAdapter setViewsNeedDisplay:]): (-[CarbonWindowAdapter reconcileToCarbonWindowBounds]): (-[CarbonWindowAdapter _termWindowIfOwner]): (-[CarbonWindowAdapter _windowMovedToRect:]): (-[CarbonWindowAdapter setContentView:]): (-[CarbonWindowAdapter _handleRootBoundsChanged]): (-[CarbonWindowAdapter _handleContentBoundsChanged]): * Carbon/CarbonWindowFrame.m: (-[CarbonWindowFrame title]): * Carbon/HIViewAdapter.m: (+[HIViewAdapter getHIViewForNSView:]): * Carbon/HIWebView.mm: (overrideCGContext): (restoreCGContext): (Draw): * DOM/DOM.mm: * History/WebHistory.mm: (-[WebHistoryPrivate loadHistoryGutsFromURL:savedItemsCount:collectDiscardedItemsInto:error:]): * History/WebHistoryItem.mm: (-[WebHistoryItem icon]): * Misc/WebKitNSStringExtras.mm: (-[NSString _web_drawAtPoint:font:textColor:]): * Misc/WebNSImageExtras.m: (-[NSImage _web_scaleToMaxSize:]): (-[NSImage _web_dissolveToFraction:]): * Misc/WebNSPasteboardExtras.mm: (+[NSPasteboard _web_setFindPasteboardString:withOwner:]): (-[NSPasteboard _web_declareAndWriteDragImageForElement:URL:title:archive:source:]): * Panels/WebAuthenticationPanel.m: (-[WebAuthenticationPanel loadNib]): * Plugins/Hosted/NetscapePluginHostManager.mm: (WebKit::NetscapePluginHostManager::spawnPluginHost): (WebKit::NetscapePluginHostManager::didCreateWindow): * Plugins/Hosted/NetscapePluginHostProxy.mm: (WebKit::NetscapePluginHostProxy::makeCurrentProcessFrontProcess): (WebKit::NetscapePluginHostProxy::makePluginHostProcessFrontProcess const): (WebKit::NetscapePluginHostProxy::isPluginHostProcessFrontProcess const): * Plugins/Hosted/NetscapePluginInstanceProxy.mm: (WebKit::NetscapePluginInstanceProxy::mouseEvent): * Plugins/Hosted/WebHostedNetscapePluginView.mm: (-[WebHostedNetscapePluginView drawRect:]): * Plugins/Hosted/WebTextInputWindowController.m: (-[WebTextInputPanel _interpretKeyEvent:string:]): * Plugins/WebBaseNetscapePluginView.mm: (-[WebBaseNetscapePluginView convertFromX:andY:space:toX:andY:space:]): * Plugins/WebNetscapePluginPackage.mm: (-[WebNetscapePluginPackage _tryLoad]): * Plugins/WebNetscapePluginView.mm: (-[WebNetscapePluginView saveAndSetNewPortStateForUpdate:]): (-[WebNetscapePluginView sendDrawRectEvent:]): (-[WebNetscapePluginView drawRect:]): * Plugins/WebPluginController.mm: (WebKit_TSUpdateCheck_alertDidEnd_returnCode_contextInfo_): (WebKit_NSAlert_beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_): * WebCoreSupport/PopupMenuMac.mm: (PopupMenuMac::populate): * WebCoreSupport/WebAlternativeTextClient.h: * WebCoreSupport/WebDragClient.mm: (WebDragClient::startDrag): * WebCoreSupport/WebFrameLoaderClient.mm: (WebFrameLoaderClient::convertMainResourceLoadToDownload): (webGetNSImage): * WebInspector/WebNodeHighlight.mm: * WebInspector/WebNodeHighlightView.mm: (-[WebNodeHighlightView drawRect:]): * WebView/WebClipView.mm: (-[WebClipView initWithFrame:]): * WebView/WebFrame.mm: (-[WebFrame _updateBackgroundAndUpdatesWhileOffscreen]): (-[WebFrame _drawRect:contentsOnly:]): (-[WebFrame accessibilityRoot]): * WebView/WebFullScreenController.mm: (-[WebFullScreenController enterFullScreen:]): (-[WebFullScreenController finishedEnterFullScreenAnimation:]): (-[WebFullScreenController exitFullScreen]): (-[WebFullScreenController finishedExitFullScreenAnimation:]): (-[WebFullScreenController _startEnterFullScreenAnimationWithDuration:]): (-[WebFullScreenController _startExitFullScreenAnimationWithDuration:]): * WebView/WebHTMLView.mm: (-[NSWindow _web_borderView]): (-[WebHTMLView _updateMouseoverWithFakeEvent]): (-[WebHTMLView _setAsideSubviews]): (-[WebHTMLView _autoscroll]): (-[WebHTMLView drawRect:]): (-[WebHTMLView mouseDown:]): (-[WebHTMLView mouseDragged:]): (-[WebHTMLView mouseUp:]): (-[WebHTMLView _endPrintModeAndRestoreWindowAutodisplay]): (-[WebHTMLView knowsPageRange:]): (-[WebHTMLView accessibilityHitTest:]): (-[WebHTMLView _fontAttributesFromFontPasteboard]): (-[WebHTMLView _colorAsString:]): (-[WebHTMLView copyFont:]): (-[WebHTMLView _executeSavedKeypressCommands]): (-[WebHTMLView attachRootLayer:]): (-[WebHTMLView textStorage]): (-[WebHTMLView _updateSelectionForInputManager]): * WebView/WebPDFView.mm: (_applicationInfoForMIMEType): (-[WebPDFView centerSelectionInVisibleArea:]): (-[WebPDFView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]): (-[WebPDFView _recursiveDisplayAllDirtyWithLockFocus:visRect:]): (-[WebPDFView _recursive:displayRectIgnoringOpacity:inContext:topView:]): (-[WebPDFView searchFor:direction:caseSensitive:wrap:startInSelection:]): * WebView/WebTextCompletionController.mm: (-[WebTextCompletionController _buildUI]): (-[WebTextCompletionController _placePopupWindow:]): * WebView/WebVideoFullscreenController.mm: * WebView/WebVideoFullscreenHUDWindowController.mm: (createMediaUIBackgroundView): * WebView/WebView.mm: (-[WebTextListTouchBarViewController initWithWebView:]): (-[WebView _dispatchTileDidDraw:]): (-[WebView encodeWithCoder:]): (-[WebView mainFrameIcon]): (LayerFlushController::flushLayers): * WebView/WebWindowAnimation.mm: (setScaledFrameForWindow): Source/WTF: * wtf/Assertions.cpp: * wtf/Assertions.h: * wtf/Compiler.h: * wtf/MD5.cpp: (WTF::MD5::MD5): (WTF::MD5::addBytes): (WTF::MD5::checksum): * wtf/PrintStream.cpp: (WTF::PrintStream::printfVariableFormat): * wtf/SHA1.cpp: (WTF::SHA1::SHA1): (WTF::SHA1::addBytes): (WTF::SHA1::computeHash): * wtf/ThreadingPthreads.cpp: * wtf/Vector.h: (WTF::VectorBuffer::endOfBuffer): * wtf/text/WTFString.cpp: (WTF::createWithFormatAndArguments): Canonical link: https://commits.webkit.org/204515@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235935 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-12 15:09:16 +00:00
IGNORE_WARNINGS_BEGIN("implicit-fallthrough")
Start splitting CSS Selectors's pseudo types https://bugs.webkit.org/show_bug.cgi?id=130003 Reviewed by Andreas Kling. CSS Selectors pseudo types come in 3 flavors: page, pseudo class, pseudo elements. The three types are mixed together in a single enum list named PseudoType. Only some combinations of match type + pseudo type are valid, but this is implicitly defined from the code. This patch is the beginning of a refactoring to add more clear boundaries between valid and invalid combinations. First, the handling of page pseudo types is completely split from the other values. The parser use a different method for handling the value CSSParserSelector::parsePagePseudoSelector(). PagePseudo types no longer store their string in the CSSSelector either to reduce the redundancy with m_pseudoType. When we need to generate the string for those CSSSelector, we recreate the string as needed in CSSSelector::selectorText(). The remaining two types are not yet split in this patch but this introduce the preliminary clean up toward that goal. The list of parsed pseudo types is now generated at compile time from the source in SelectorPseudoTypeMap.in. * DerivedSources.make: The mapping of strings to pseudo types is generated from SelectorPseudoTypeMap.in by the new script makeSelectorPseudoTypeMap.py. * WebCore.xcodeproj/project.pbxproj: * css/CSSGrammar.y.in: Split the parsing of Pseudo Types. Pseudo page get its own method. The others will need some work. * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePagePseudoSelector): (WebCore::CSSParserSelector::setPseudoTypeValue): * css/CSSParserValues.h: * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForPage): This is an example of invalid combination that is hidden by the current code. First, Left and Right could never appear in a pseudo class match. (WebCore::CSSSelector::pseudoId): (WebCore::CSSSelector::parsePseudoType): (WebCore::appendPseudoTypeTailIfNecessary): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoType): (WebCore::CSSSelector::matchesPseudoElement): (WebCore::CSSSelector::setValue): (WebCore::CSSSelector::CSSSelector): * css/PageRuleCollector.cpp: (WebCore::checkPageSelectorComponents): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): * css/SelectorPseudoTypeMap.h: Added. * css/SelectorPseudoTypeMap.in: Added. * css/makeSelectorPseudoTypeMap.py: Added. (enumerablePseudoType): (expand_ifdef_condition): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoType): Canonical link: https://commits.webkit.org/148023@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-03-10 21:00:26 +00:00
// Older versions of gperf like to use the `register` keyword.
#define register
Start splitting CSS Selectors's pseudo types https://bugs.webkit.org/show_bug.cgi?id=130003 Reviewed by Andreas Kling. CSS Selectors pseudo types come in 3 flavors: page, pseudo class, pseudo elements. The three types are mixed together in a single enum list named PseudoType. Only some combinations of match type + pseudo type are valid, but this is implicitly defined from the code. This patch is the beginning of a refactoring to add more clear boundaries between valid and invalid combinations. First, the handling of page pseudo types is completely split from the other values. The parser use a different method for handling the value CSSParserSelector::parsePagePseudoSelector(). PagePseudo types no longer store their string in the CSSSelector either to reduce the redundancy with m_pseudoType. When we need to generate the string for those CSSSelector, we recreate the string as needed in CSSSelector::selectorText(). The remaining two types are not yet split in this patch but this introduce the preliminary clean up toward that goal. The list of parsed pseudo types is now generated at compile time from the source in SelectorPseudoTypeMap.in. * DerivedSources.make: The mapping of strings to pseudo types is generated from SelectorPseudoTypeMap.in by the new script makeSelectorPseudoTypeMap.py. * WebCore.xcodeproj/project.pbxproj: * css/CSSGrammar.y.in: Split the parsing of Pseudo Types. Pseudo page get its own method. The others will need some work. * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePagePseudoSelector): (WebCore::CSSParserSelector::setPseudoTypeValue): * css/CSSParserValues.h: * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForPage): This is an example of invalid combination that is hidden by the current code. First, Left and Right could never appear in a pseudo class match. (WebCore::CSSSelector::pseudoId): (WebCore::CSSSelector::parsePseudoType): (WebCore::appendPseudoTypeTailIfNecessary): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoType): (WebCore::CSSSelector::matchesPseudoElement): (WebCore::CSSSelector::setValue): (WebCore::CSSSelector::CSSSelector): * css/PageRuleCollector.cpp: (WebCore::checkPageSelectorComponents): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): * css/SelectorPseudoTypeMap.h: Added. * css/SelectorPseudoTypeMap.in: Added. * css/makeSelectorPseudoTypeMap.py: Added. (enumerablePseudoType): (expand_ifdef_condition): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoType): Canonical link: https://commits.webkit.org/148023@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-03-10 21:00:26 +00:00
namespace WebCore {
struct SelectorPseudoClassOrCompatibilityPseudoElementEntry {
Start splitting CSS Selectors's pseudo types https://bugs.webkit.org/show_bug.cgi?id=130003 Reviewed by Andreas Kling. CSS Selectors pseudo types come in 3 flavors: page, pseudo class, pseudo elements. The three types are mixed together in a single enum list named PseudoType. Only some combinations of match type + pseudo type are valid, but this is implicitly defined from the code. This patch is the beginning of a refactoring to add more clear boundaries between valid and invalid combinations. First, the handling of page pseudo types is completely split from the other values. The parser use a different method for handling the value CSSParserSelector::parsePagePseudoSelector(). PagePseudo types no longer store their string in the CSSSelector either to reduce the redundancy with m_pseudoType. When we need to generate the string for those CSSSelector, we recreate the string as needed in CSSSelector::selectorText(). The remaining two types are not yet split in this patch but this introduce the preliminary clean up toward that goal. The list of parsed pseudo types is now generated at compile time from the source in SelectorPseudoTypeMap.in. * DerivedSources.make: The mapping of strings to pseudo types is generated from SelectorPseudoTypeMap.in by the new script makeSelectorPseudoTypeMap.py. * WebCore.xcodeproj/project.pbxproj: * css/CSSGrammar.y.in: Split the parsing of Pseudo Types. Pseudo page get its own method. The others will need some work. * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePagePseudoSelector): (WebCore::CSSParserSelector::setPseudoTypeValue): * css/CSSParserValues.h: * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForPage): This is an example of invalid combination that is hidden by the current code. First, Left and Right could never appear in a pseudo class match. (WebCore::CSSSelector::pseudoId): (WebCore::CSSSelector::parsePseudoType): (WebCore::appendPseudoTypeTailIfNecessary): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoType): (WebCore::CSSSelector::matchesPseudoElement): (WebCore::CSSSelector::setValue): (WebCore::CSSSelector::CSSSelector): * css/PageRuleCollector.cpp: (WebCore::checkPageSelectorComponents): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): * css/SelectorPseudoTypeMap.h: Added. * css/SelectorPseudoTypeMap.in: Added. * css/makeSelectorPseudoTypeMap.py: Added. (enumerablePseudoType): (expand_ifdef_condition): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoType): Canonical link: https://commits.webkit.org/148023@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-03-10 21:00:26 +00:00
const char* name;
PseudoClassOrCompatibilityPseudoElement pseudoTypes;
Start splitting CSS Selectors's pseudo types https://bugs.webkit.org/show_bug.cgi?id=130003 Reviewed by Andreas Kling. CSS Selectors pseudo types come in 3 flavors: page, pseudo class, pseudo elements. The three types are mixed together in a single enum list named PseudoType. Only some combinations of match type + pseudo type are valid, but this is implicitly defined from the code. This patch is the beginning of a refactoring to add more clear boundaries between valid and invalid combinations. First, the handling of page pseudo types is completely split from the other values. The parser use a different method for handling the value CSSParserSelector::parsePagePseudoSelector(). PagePseudo types no longer store their string in the CSSSelector either to reduce the redundancy with m_pseudoType. When we need to generate the string for those CSSSelector, we recreate the string as needed in CSSSelector::selectorText(). The remaining two types are not yet split in this patch but this introduce the preliminary clean up toward that goal. The list of parsed pseudo types is now generated at compile time from the source in SelectorPseudoTypeMap.in. * DerivedSources.make: The mapping of strings to pseudo types is generated from SelectorPseudoTypeMap.in by the new script makeSelectorPseudoTypeMap.py. * WebCore.xcodeproj/project.pbxproj: * css/CSSGrammar.y.in: Split the parsing of Pseudo Types. Pseudo page get its own method. The others will need some work. * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePagePseudoSelector): (WebCore::CSSParserSelector::setPseudoTypeValue): * css/CSSParserValues.h: * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForPage): This is an example of invalid combination that is hidden by the current code. First, Left and Right could never appear in a pseudo class match. (WebCore::CSSSelector::pseudoId): (WebCore::CSSSelector::parsePseudoType): (WebCore::appendPseudoTypeTailIfNecessary): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoType): (WebCore::CSSSelector::matchesPseudoElement): (WebCore::CSSSelector::setValue): (WebCore::CSSSelector::CSSSelector): * css/PageRuleCollector.cpp: (WebCore::checkPageSelectorComponents): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): * css/SelectorPseudoTypeMap.h: Added. * css/SelectorPseudoTypeMap.in: Added. * css/makeSelectorPseudoTypeMap.py: Added. (enumerablePseudoType): (expand_ifdef_condition): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoType): Canonical link: https://commits.webkit.org/148023@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-03-10 21:00:26 +00:00
};
%}
%struct-type
Rename the CSSSelector PseudoType to PseudoClassType https://bugs.webkit.org/show_bug.cgi?id=131907 Reviewed by Andreas Kling. Pseudo Elements and Page Pseudo Classes have been moved out of PseudoType in previous patches. The remaining values in the PseudoType enumeration are the pseudo classes. This patch is the final clean up, PseudoType is renamed to PseudoClassType. * css/CSSGrammar.y.in: * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePseudoClassAndCompatibilityElementSelector): * css/CSSParserValues.h: (WebCore::CSSParserSelector::pseudoClassType): (WebCore::CSSParserSelector::pseudoType): Deleted. * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForOneSelector): (WebCore::appendPseudoClassFunctionTail): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoClassType): (WebCore::CSSSelector::pseudoElementType): (WebCore::CSSSelector::pagePseudoClassType): (WebCore::pseudoClassIsRelativeToSiblings): (WebCore::CSSSelector::isSiblingSelector): (WebCore::CSSSelector::CSSSelector): (WebCore::CSSSelector::pseudoType): Deleted. * css/RuleSet.cpp: (WebCore::RuleSet::findBestRuleSetAndAdd): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): (WebCore::SelectorChecker::checkScrollbarPseudoClass): (WebCore::SelectorChecker::determineLinkMatchType): (WebCore::SelectorChecker::matchesFocusPseudoClass): * css/SelectorChecker.h: (WebCore::SelectorChecker::isCommonPseudoClassSelector): * css/SelectorCheckerFastPath.cpp: (WebCore::SelectorCheckerFastPath::commonPseudoClassSelectorMatches): * css/SelectorPseudoClassAndCompatibilityElementMap.in: * css/SelectorPseudoTypeMap.h: * css/StyleResolver.cpp: (WebCore::StyleResolver::styleForElement): * css/makeSelectorPseudoClassAndCompatibilityElementMap.py: (enumerablePseudoType): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoClassType): (WebCore::SelectorCompiler::SelectorCodeGenerator::SelectorCodeGenerator): (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementMatching): (WebCore::SelectorCompiler::addPseudoType): Deleted. * inspector/InspectorCSSAgent.cpp: (WebCore::computePseudoClassMask): (WebCore::InspectorCSSAgent::forcePseudoState): * inspector/InspectorCSSAgent.h: * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::forcePseudoStateImpl): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::forcePseudoState): Canonical link: https://commits.webkit.org/149991@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167571 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-20 20:43:35 +00:00
%define initializer-suffix ,{CSSSelector::PseudoClassUnknown,CSSSelector::PseudoElementUnknown}
%define class-name SelectorPseudoClassAndCompatibilityElementMapHash
Start splitting CSS Selectors's pseudo types https://bugs.webkit.org/show_bug.cgi?id=130003 Reviewed by Andreas Kling. CSS Selectors pseudo types come in 3 flavors: page, pseudo class, pseudo elements. The three types are mixed together in a single enum list named PseudoType. Only some combinations of match type + pseudo type are valid, but this is implicitly defined from the code. This patch is the beginning of a refactoring to add more clear boundaries between valid and invalid combinations. First, the handling of page pseudo types is completely split from the other values. The parser use a different method for handling the value CSSParserSelector::parsePagePseudoSelector(). PagePseudo types no longer store their string in the CSSSelector either to reduce the redundancy with m_pseudoType. When we need to generate the string for those CSSSelector, we recreate the string as needed in CSSSelector::selectorText(). The remaining two types are not yet split in this patch but this introduce the preliminary clean up toward that goal. The list of parsed pseudo types is now generated at compile time from the source in SelectorPseudoTypeMap.in. * DerivedSources.make: The mapping of strings to pseudo types is generated from SelectorPseudoTypeMap.in by the new script makeSelectorPseudoTypeMap.py. * WebCore.xcodeproj/project.pbxproj: * css/CSSGrammar.y.in: Split the parsing of Pseudo Types. Pseudo page get its own method. The others will need some work. * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePagePseudoSelector): (WebCore::CSSParserSelector::setPseudoTypeValue): * css/CSSParserValues.h: * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForPage): This is an example of invalid combination that is hidden by the current code. First, Left and Right could never appear in a pseudo class match. (WebCore::CSSSelector::pseudoId): (WebCore::CSSSelector::parsePseudoType): (WebCore::appendPseudoTypeTailIfNecessary): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoType): (WebCore::CSSSelector::matchesPseudoElement): (WebCore::CSSSelector::setValue): (WebCore::CSSSelector::CSSSelector): * css/PageRuleCollector.cpp: (WebCore::checkPageSelectorComponents): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): * css/SelectorPseudoTypeMap.h: Added. * css/SelectorPseudoTypeMap.in: Added. * css/makeSelectorPseudoTypeMap.py: Added. (enumerablePseudoType): (expand_ifdef_condition): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoType): Canonical link: https://commits.webkit.org/148023@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-03-10 21:00:26 +00:00
%omit-struct-type
%language=C++
%readonly-tables
%global-table
%ignore-case
%compare-strncmp
%enum
struct SelectorPseudoClassOrCompatibilityPseudoElementEntry;
Start splitting CSS Selectors's pseudo types https://bugs.webkit.org/show_bug.cgi?id=130003 Reviewed by Andreas Kling. CSS Selectors pseudo types come in 3 flavors: page, pseudo class, pseudo elements. The three types are mixed together in a single enum list named PseudoType. Only some combinations of match type + pseudo type are valid, but this is implicitly defined from the code. This patch is the beginning of a refactoring to add more clear boundaries between valid and invalid combinations. First, the handling of page pseudo types is completely split from the other values. The parser use a different method for handling the value CSSParserSelector::parsePagePseudoSelector(). PagePseudo types no longer store their string in the CSSSelector either to reduce the redundancy with m_pseudoType. When we need to generate the string for those CSSSelector, we recreate the string as needed in CSSSelector::selectorText(). The remaining two types are not yet split in this patch but this introduce the preliminary clean up toward that goal. The list of parsed pseudo types is now generated at compile time from the source in SelectorPseudoTypeMap.in. * DerivedSources.make: The mapping of strings to pseudo types is generated from SelectorPseudoTypeMap.in by the new script makeSelectorPseudoTypeMap.py. * WebCore.xcodeproj/project.pbxproj: * css/CSSGrammar.y.in: Split the parsing of Pseudo Types. Pseudo page get its own method. The others will need some work. * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePagePseudoSelector): (WebCore::CSSParserSelector::setPseudoTypeValue): * css/CSSParserValues.h: * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForPage): This is an example of invalid combination that is hidden by the current code. First, Left and Right could never appear in a pseudo class match. (WebCore::CSSSelector::pseudoId): (WebCore::CSSSelector::parsePseudoType): (WebCore::appendPseudoTypeTailIfNecessary): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoType): (WebCore::CSSSelector::matchesPseudoElement): (WebCore::CSSSelector::setValue): (WebCore::CSSSelector::CSSSelector): * css/PageRuleCollector.cpp: (WebCore::checkPageSelectorComponents): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): * css/SelectorPseudoTypeMap.h: Added. * css/SelectorPseudoTypeMap.in: Added. * css/makeSelectorPseudoTypeMap.py: Added. (enumerablePseudoType): (expand_ifdef_condition): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoType): Canonical link: https://commits.webkit.org/148023@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-03-10 21:00:26 +00:00
%%
""")
webcore_defines = [i.strip() for i in sys.argv[-1].split(' ')]
longest_keyword = 0
ignore_until_endif = False
input_file = open(sys.argv[1], 'r')
for line in input_file:
line = line.strip()
if not line:
Start splitting CSS Selectors's pseudo types https://bugs.webkit.org/show_bug.cgi?id=130003 Reviewed by Andreas Kling. CSS Selectors pseudo types come in 3 flavors: page, pseudo class, pseudo elements. The three types are mixed together in a single enum list named PseudoType. Only some combinations of match type + pseudo type are valid, but this is implicitly defined from the code. This patch is the beginning of a refactoring to add more clear boundaries between valid and invalid combinations. First, the handling of page pseudo types is completely split from the other values. The parser use a different method for handling the value CSSParserSelector::parsePagePseudoSelector(). PagePseudo types no longer store their string in the CSSSelector either to reduce the redundancy with m_pseudoType. When we need to generate the string for those CSSSelector, we recreate the string as needed in CSSSelector::selectorText(). The remaining two types are not yet split in this patch but this introduce the preliminary clean up toward that goal. The list of parsed pseudo types is now generated at compile time from the source in SelectorPseudoTypeMap.in. * DerivedSources.make: The mapping of strings to pseudo types is generated from SelectorPseudoTypeMap.in by the new script makeSelectorPseudoTypeMap.py. * WebCore.xcodeproj/project.pbxproj: * css/CSSGrammar.y.in: Split the parsing of Pseudo Types. Pseudo page get its own method. The others will need some work. * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePagePseudoSelector): (WebCore::CSSParserSelector::setPseudoTypeValue): * css/CSSParserValues.h: * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForPage): This is an example of invalid combination that is hidden by the current code. First, Left and Right could never appear in a pseudo class match. (WebCore::CSSSelector::pseudoId): (WebCore::CSSSelector::parsePseudoType): (WebCore::appendPseudoTypeTailIfNecessary): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoType): (WebCore::CSSSelector::matchesPseudoElement): (WebCore::CSSSelector::setValue): (WebCore::CSSSelector::CSSSelector): * css/PageRuleCollector.cpp: (WebCore::checkPageSelectorComponents): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): * css/SelectorPseudoTypeMap.h: Added. * css/SelectorPseudoTypeMap.in: Added. * css/makeSelectorPseudoTypeMap.py: Added. (enumerablePseudoType): (expand_ifdef_condition): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoType): Canonical link: https://commits.webkit.org/148023@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-03-10 21:00:26 +00:00
continue
if line.startswith('#if '):
condition = line[4:].strip()
Start splitting CSS Selectors's pseudo types https://bugs.webkit.org/show_bug.cgi?id=130003 Reviewed by Andreas Kling. CSS Selectors pseudo types come in 3 flavors: page, pseudo class, pseudo elements. The three types are mixed together in a single enum list named PseudoType. Only some combinations of match type + pseudo type are valid, but this is implicitly defined from the code. This patch is the beginning of a refactoring to add more clear boundaries between valid and invalid combinations. First, the handling of page pseudo types is completely split from the other values. The parser use a different method for handling the value CSSParserSelector::parsePagePseudoSelector(). PagePseudo types no longer store their string in the CSSSelector either to reduce the redundancy with m_pseudoType. When we need to generate the string for those CSSSelector, we recreate the string as needed in CSSSelector::selectorText(). The remaining two types are not yet split in this patch but this introduce the preliminary clean up toward that goal. The list of parsed pseudo types is now generated at compile time from the source in SelectorPseudoTypeMap.in. * DerivedSources.make: The mapping of strings to pseudo types is generated from SelectorPseudoTypeMap.in by the new script makeSelectorPseudoTypeMap.py. * WebCore.xcodeproj/project.pbxproj: * css/CSSGrammar.y.in: Split the parsing of Pseudo Types. Pseudo page get its own method. The others will need some work. * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePagePseudoSelector): (WebCore::CSSParserSelector::setPseudoTypeValue): * css/CSSParserValues.h: * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForPage): This is an example of invalid combination that is hidden by the current code. First, Left and Right could never appear in a pseudo class match. (WebCore::CSSSelector::pseudoId): (WebCore::CSSSelector::parsePseudoType): (WebCore::appendPseudoTypeTailIfNecessary): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoType): (WebCore::CSSSelector::matchesPseudoElement): (WebCore::CSSSelector::setValue): (WebCore::CSSSelector::CSSSelector): * css/PageRuleCollector.cpp: (WebCore::checkPageSelectorComponents): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): * css/SelectorPseudoTypeMap.h: Added. * css/SelectorPseudoTypeMap.in: Added. * css/makeSelectorPseudoTypeMap.py: Added. (enumerablePseudoType): (expand_ifdef_condition): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoType): Canonical link: https://commits.webkit.org/148023@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-03-10 21:00:26 +00:00
if expand_ifdef_condition(condition) not in webcore_defines:
ignore_until_endif = True
continue
if line.startswith('#endif'):
Start splitting CSS Selectors's pseudo types https://bugs.webkit.org/show_bug.cgi?id=130003 Reviewed by Andreas Kling. CSS Selectors pseudo types come in 3 flavors: page, pseudo class, pseudo elements. The three types are mixed together in a single enum list named PseudoType. Only some combinations of match type + pseudo type are valid, but this is implicitly defined from the code. This patch is the beginning of a refactoring to add more clear boundaries between valid and invalid combinations. First, the handling of page pseudo types is completely split from the other values. The parser use a different method for handling the value CSSParserSelector::parsePagePseudoSelector(). PagePseudo types no longer store their string in the CSSSelector either to reduce the redundancy with m_pseudoType. When we need to generate the string for those CSSSelector, we recreate the string as needed in CSSSelector::selectorText(). The remaining two types are not yet split in this patch but this introduce the preliminary clean up toward that goal. The list of parsed pseudo types is now generated at compile time from the source in SelectorPseudoTypeMap.in. * DerivedSources.make: The mapping of strings to pseudo types is generated from SelectorPseudoTypeMap.in by the new script makeSelectorPseudoTypeMap.py. * WebCore.xcodeproj/project.pbxproj: * css/CSSGrammar.y.in: Split the parsing of Pseudo Types. Pseudo page get its own method. The others will need some work. * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePagePseudoSelector): (WebCore::CSSParserSelector::setPseudoTypeValue): * css/CSSParserValues.h: * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForPage): This is an example of invalid combination that is hidden by the current code. First, Left and Right could never appear in a pseudo class match. (WebCore::CSSSelector::pseudoId): (WebCore::CSSSelector::parsePseudoType): (WebCore::appendPseudoTypeTailIfNecessary): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoType): (WebCore::CSSSelector::matchesPseudoElement): (WebCore::CSSSelector::setValue): (WebCore::CSSSelector::CSSSelector): * css/PageRuleCollector.cpp: (WebCore::checkPageSelectorComponents): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): * css/SelectorPseudoTypeMap.h: Added. * css/SelectorPseudoTypeMap.in: Added. * css/makeSelectorPseudoTypeMap.py: Added. (enumerablePseudoType): (expand_ifdef_condition): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoType): Canonical link: https://commits.webkit.org/148023@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-03-10 21:00:26 +00:00
ignore_until_endif = False
continue
if ignore_until_endif:
continue
keyword_definition = line.split(',')
if len(keyword_definition) == 1:
keyword = keyword_definition[0].strip()
Split CSS Selectors pseudo class and pseudo elements https://bugs.webkit.org/show_bug.cgi?id=131295 Reviewed by Andreas Kling. Split pseudo class and pseudo element to make it clearer what pseudo types are possible for a given match type. Pseudo Element types are separated and Pseudo Class are left in place. The Pseudo Class will have to be renamed too but that will be done separately to make this change smaller. * css/CSSGrammar.y.in: * css/CSSParser.cpp: (WebCore::CSSParser::rewriteSpecifiersWithElementName): (WebCore::CSSParser::rewriteSpecifiers): Use a method isPseudoElementCueFunction() to abstract the #ifdef out of the parser. * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePseudoElementSelector): (WebCore::CSSParserSelector::parsePseudoElementCueFunctionSelector): Rename to specify this is for the pseudo element cue function, not the pseudo element cue. (WebCore::CSSParserSelector::parsePseudoClassAndCompatibilityElementSelector): (WebCore::CSSParserSelector::parsePseudoCueFunctionSelector): Deleted. * css/CSSParserValues.h: (WebCore::CSSParserSelector::isPseudoElementCueFunction): * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForOneSelector): (WebCore::CSSSelector::pseudoId): (WebCore::CSSSelector::parsePseudoElementType): (WebCore::CSSSelector::operator==): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoType): (WebCore::CSSSelector::setPseudoElementType): (WebCore::CSSSelector::pseudoElementType): (WebCore::CSSSelector::isUnknownPseudoElement): (WebCore::CSSSelector::isCustomPseudoElement): (WebCore::pseudoClassIsRelativeToSiblings): (WebCore::CSSSelector::isSiblingSelector): * css/RuleFeature.cpp: (WebCore::RuleFeatureSet::collectFeaturesFromSelector): * css/RuleSet.cpp: (WebCore::determinePropertyWhitelistType): (WebCore::RuleSet::findBestRuleSetAndAdd): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::matchRecursively): (WebCore::SelectorChecker::checkOne): (WebCore::SelectorChecker::checkScrollbarPseudoClass): (WebCore::SelectorChecker::determineLinkMatchType): * css/SelectorPseudoClassAndCompatibilityElementMap.in: * css/SelectorPseudoElementTypeMap.in: * css/SelectorPseudoTypeMap.h: * css/makeSelectorPseudoClassAndCompatibilityElementMap.py: * css/makeSelectorPseudoElementsMap.py: (enumerablePseudoType): * page/DOMWindow.cpp: (WebCore::DOMWindow::getMatchedCSSRules): * rendering/style/RenderStyleConstants.h: All the fullscreen pseudo types are pseudo class selectors. They should not have a pseudo ID. Canonical link: https://commits.webkit.org/149368@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166883 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-07 20:26:44 +00:00
output_file.write('"%s", {%s, CSSSelector::PseudoElementUnknown}\n' % (keyword, enumerablePseudoType(keyword)))
else:
output_file.write('"%s", {CSSSelector::%s, CSSSelector::%s}\n' % (keyword_definition[0].strip(), keyword_definition[1].strip(), keyword_definition[2].strip()))
Start splitting CSS Selectors's pseudo types https://bugs.webkit.org/show_bug.cgi?id=130003 Reviewed by Andreas Kling. CSS Selectors pseudo types come in 3 flavors: page, pseudo class, pseudo elements. The three types are mixed together in a single enum list named PseudoType. Only some combinations of match type + pseudo type are valid, but this is implicitly defined from the code. This patch is the beginning of a refactoring to add more clear boundaries between valid and invalid combinations. First, the handling of page pseudo types is completely split from the other values. The parser use a different method for handling the value CSSParserSelector::parsePagePseudoSelector(). PagePseudo types no longer store their string in the CSSSelector either to reduce the redundancy with m_pseudoType. When we need to generate the string for those CSSSelector, we recreate the string as needed in CSSSelector::selectorText(). The remaining two types are not yet split in this patch but this introduce the preliminary clean up toward that goal. The list of parsed pseudo types is now generated at compile time from the source in SelectorPseudoTypeMap.in. * DerivedSources.make: The mapping of strings to pseudo types is generated from SelectorPseudoTypeMap.in by the new script makeSelectorPseudoTypeMap.py. * WebCore.xcodeproj/project.pbxproj: * css/CSSGrammar.y.in: Split the parsing of Pseudo Types. Pseudo page get its own method. The others will need some work. * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePagePseudoSelector): (WebCore::CSSParserSelector::setPseudoTypeValue): * css/CSSParserValues.h: * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForPage): This is an example of invalid combination that is hidden by the current code. First, Left and Right could never appear in a pseudo class match. (WebCore::CSSSelector::pseudoId): (WebCore::CSSSelector::parsePseudoType): (WebCore::appendPseudoTypeTailIfNecessary): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoType): (WebCore::CSSSelector::matchesPseudoElement): (WebCore::CSSSelector::setValue): (WebCore::CSSSelector::CSSSelector): * css/PageRuleCollector.cpp: (WebCore::checkPageSelectorComponents): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): * css/SelectorPseudoTypeMap.h: Added. * css/SelectorPseudoTypeMap.in: Added. * css/makeSelectorPseudoTypeMap.py: Added. (enumerablePseudoType): (expand_ifdef_condition): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoType): Canonical link: https://commits.webkit.org/148023@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-03-10 21:00:26 +00:00
longest_keyword = max(longest_keyword, len(keyword))
output_file.write("""%%
static inline const SelectorPseudoClassOrCompatibilityPseudoElementEntry* parsePseudoClassAndCompatibilityElementString(const LChar* characters, unsigned length)
Start splitting CSS Selectors's pseudo types https://bugs.webkit.org/show_bug.cgi?id=130003 Reviewed by Andreas Kling. CSS Selectors pseudo types come in 3 flavors: page, pseudo class, pseudo elements. The three types are mixed together in a single enum list named PseudoType. Only some combinations of match type + pseudo type are valid, but this is implicitly defined from the code. This patch is the beginning of a refactoring to add more clear boundaries between valid and invalid combinations. First, the handling of page pseudo types is completely split from the other values. The parser use a different method for handling the value CSSParserSelector::parsePagePseudoSelector(). PagePseudo types no longer store their string in the CSSSelector either to reduce the redundancy with m_pseudoType. When we need to generate the string for those CSSSelector, we recreate the string as needed in CSSSelector::selectorText(). The remaining two types are not yet split in this patch but this introduce the preliminary clean up toward that goal. The list of parsed pseudo types is now generated at compile time from the source in SelectorPseudoTypeMap.in. * DerivedSources.make: The mapping of strings to pseudo types is generated from SelectorPseudoTypeMap.in by the new script makeSelectorPseudoTypeMap.py. * WebCore.xcodeproj/project.pbxproj: * css/CSSGrammar.y.in: Split the parsing of Pseudo Types. Pseudo page get its own method. The others will need some work. * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePagePseudoSelector): (WebCore::CSSParserSelector::setPseudoTypeValue): * css/CSSParserValues.h: * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForPage): This is an example of invalid combination that is hidden by the current code. First, Left and Right could never appear in a pseudo class match. (WebCore::CSSSelector::pseudoId): (WebCore::CSSSelector::parsePseudoType): (WebCore::appendPseudoTypeTailIfNecessary): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoType): (WebCore::CSSSelector::matchesPseudoElement): (WebCore::CSSSelector::setValue): (WebCore::CSSSelector::CSSSelector): * css/PageRuleCollector.cpp: (WebCore::checkPageSelectorComponents): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): * css/SelectorPseudoTypeMap.h: Added. * css/SelectorPseudoTypeMap.in: Added. * css/makeSelectorPseudoTypeMap.py: Added. (enumerablePseudoType): (expand_ifdef_condition): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoType): Canonical link: https://commits.webkit.org/148023@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-03-10 21:00:26 +00:00
{
return SelectorPseudoClassAndCompatibilityElementMapHash::in_word_set(reinterpret_cast<const char*>(characters), length);
Start splitting CSS Selectors's pseudo types https://bugs.webkit.org/show_bug.cgi?id=130003 Reviewed by Andreas Kling. CSS Selectors pseudo types come in 3 flavors: page, pseudo class, pseudo elements. The three types are mixed together in a single enum list named PseudoType. Only some combinations of match type + pseudo type are valid, but this is implicitly defined from the code. This patch is the beginning of a refactoring to add more clear boundaries between valid and invalid combinations. First, the handling of page pseudo types is completely split from the other values. The parser use a different method for handling the value CSSParserSelector::parsePagePseudoSelector(). PagePseudo types no longer store their string in the CSSSelector either to reduce the redundancy with m_pseudoType. When we need to generate the string for those CSSSelector, we recreate the string as needed in CSSSelector::selectorText(). The remaining two types are not yet split in this patch but this introduce the preliminary clean up toward that goal. The list of parsed pseudo types is now generated at compile time from the source in SelectorPseudoTypeMap.in. * DerivedSources.make: The mapping of strings to pseudo types is generated from SelectorPseudoTypeMap.in by the new script makeSelectorPseudoTypeMap.py. * WebCore.xcodeproj/project.pbxproj: * css/CSSGrammar.y.in: Split the parsing of Pseudo Types. Pseudo page get its own method. The others will need some work. * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePagePseudoSelector): (WebCore::CSSParserSelector::setPseudoTypeValue): * css/CSSParserValues.h: * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForPage): This is an example of invalid combination that is hidden by the current code. First, Left and Right could never appear in a pseudo class match. (WebCore::CSSSelector::pseudoId): (WebCore::CSSSelector::parsePseudoType): (WebCore::appendPseudoTypeTailIfNecessary): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoType): (WebCore::CSSSelector::matchesPseudoElement): (WebCore::CSSSelector::setValue): (WebCore::CSSSelector::CSSSelector): * css/PageRuleCollector.cpp: (WebCore::checkPageSelectorComponents): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): * css/SelectorPseudoTypeMap.h: Added. * css/SelectorPseudoTypeMap.in: Added. * css/makeSelectorPseudoTypeMap.py: Added. (enumerablePseudoType): (expand_ifdef_condition): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoType): Canonical link: https://commits.webkit.org/148023@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-03-10 21:00:26 +00:00
}""")
output_file.write("""
static inline const SelectorPseudoClassOrCompatibilityPseudoElementEntry* parsePseudoClassAndCompatibilityElementString(const UChar* characters, unsigned length)
Start splitting CSS Selectors's pseudo types https://bugs.webkit.org/show_bug.cgi?id=130003 Reviewed by Andreas Kling. CSS Selectors pseudo types come in 3 flavors: page, pseudo class, pseudo elements. The three types are mixed together in a single enum list named PseudoType. Only some combinations of match type + pseudo type are valid, but this is implicitly defined from the code. This patch is the beginning of a refactoring to add more clear boundaries between valid and invalid combinations. First, the handling of page pseudo types is completely split from the other values. The parser use a different method for handling the value CSSParserSelector::parsePagePseudoSelector(). PagePseudo types no longer store their string in the CSSSelector either to reduce the redundancy with m_pseudoType. When we need to generate the string for those CSSSelector, we recreate the string as needed in CSSSelector::selectorText(). The remaining two types are not yet split in this patch but this introduce the preliminary clean up toward that goal. The list of parsed pseudo types is now generated at compile time from the source in SelectorPseudoTypeMap.in. * DerivedSources.make: The mapping of strings to pseudo types is generated from SelectorPseudoTypeMap.in by the new script makeSelectorPseudoTypeMap.py. * WebCore.xcodeproj/project.pbxproj: * css/CSSGrammar.y.in: Split the parsing of Pseudo Types. Pseudo page get its own method. The others will need some work. * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePagePseudoSelector): (WebCore::CSSParserSelector::setPseudoTypeValue): * css/CSSParserValues.h: * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForPage): This is an example of invalid combination that is hidden by the current code. First, Left and Right could never appear in a pseudo class match. (WebCore::CSSSelector::pseudoId): (WebCore::CSSSelector::parsePseudoType): (WebCore::appendPseudoTypeTailIfNecessary): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoType): (WebCore::CSSSelector::matchesPseudoElement): (WebCore::CSSSelector::setValue): (WebCore::CSSSelector::CSSSelector): * css/PageRuleCollector.cpp: (WebCore::checkPageSelectorComponents): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): * css/SelectorPseudoTypeMap.h: Added. * css/SelectorPseudoTypeMap.in: Added. * css/makeSelectorPseudoTypeMap.py: Added. (enumerablePseudoType): (expand_ifdef_condition): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoType): Canonical link: https://commits.webkit.org/148023@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-03-10 21:00:26 +00:00
{
const unsigned maxKeywordLength = %s;
LChar buffer[maxKeywordLength];
if (length > maxKeywordLength)
return nullptr;
Start splitting CSS Selectors's pseudo types https://bugs.webkit.org/show_bug.cgi?id=130003 Reviewed by Andreas Kling. CSS Selectors pseudo types come in 3 flavors: page, pseudo class, pseudo elements. The three types are mixed together in a single enum list named PseudoType. Only some combinations of match type + pseudo type are valid, but this is implicitly defined from the code. This patch is the beginning of a refactoring to add more clear boundaries between valid and invalid combinations. First, the handling of page pseudo types is completely split from the other values. The parser use a different method for handling the value CSSParserSelector::parsePagePseudoSelector(). PagePseudo types no longer store their string in the CSSSelector either to reduce the redundancy with m_pseudoType. When we need to generate the string for those CSSSelector, we recreate the string as needed in CSSSelector::selectorText(). The remaining two types are not yet split in this patch but this introduce the preliminary clean up toward that goal. The list of parsed pseudo types is now generated at compile time from the source in SelectorPseudoTypeMap.in. * DerivedSources.make: The mapping of strings to pseudo types is generated from SelectorPseudoTypeMap.in by the new script makeSelectorPseudoTypeMap.py. * WebCore.xcodeproj/project.pbxproj: * css/CSSGrammar.y.in: Split the parsing of Pseudo Types. Pseudo page get its own method. The others will need some work. * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePagePseudoSelector): (WebCore::CSSParserSelector::setPseudoTypeValue): * css/CSSParserValues.h: * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForPage): This is an example of invalid combination that is hidden by the current code. First, Left and Right could never appear in a pseudo class match. (WebCore::CSSSelector::pseudoId): (WebCore::CSSSelector::parsePseudoType): (WebCore::appendPseudoTypeTailIfNecessary): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoType): (WebCore::CSSSelector::matchesPseudoElement): (WebCore::CSSSelector::setValue): (WebCore::CSSSelector::CSSSelector): * css/PageRuleCollector.cpp: (WebCore::checkPageSelectorComponents): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): * css/SelectorPseudoTypeMap.h: Added. * css/SelectorPseudoTypeMap.in: Added. * css/makeSelectorPseudoTypeMap.py: Added. (enumerablePseudoType): (expand_ifdef_condition): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoType): Canonical link: https://commits.webkit.org/148023@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-03-10 21:00:26 +00:00
for (unsigned i = 0; i < length; ++i) {
UChar character = characters[i];
Tidy up checks to see if a character is in the Latin-1 range by using isLatin1 consistently https://bugs.webkit.org/show_bug.cgi?id=200861 Reviewed by Ross Kirsling. Source/JavaScriptCore: * parser/Lexer.cpp: (JSC::Lexer<T>::record8): Use isLatin1. (JSC::assertCharIsIn8BitRange): Deleted. Can just assert isLatin1 directly. (JSC::Lexer<T>::append8): Assert isLatin1 directly. (JSC::characterRequiresParseStringSlowCase): Use isLatin1. * parser/Lexer.h: (JSC::Lexer<UChar>::isWhiteSpace): Ditto. * runtime/LiteralParser.cpp: (JSC::LiteralParser<CharType>::Lexer::lex): Ditto. (JSC::isSafeStringCharacter): Ditto. * runtime/Identifier.cpp: (JSC::Identifier::add8): Ditto. * runtime/LiteralParser.cpp: (JSC::isSafeStringCharacter): Ditto. * runtime/StringPrototype.cpp: (JSC::stringProtoFuncRepeatCharacter): Ditto. * yarr/YarrJIT.cpp: (JSC::Yarr::YarrGenerator::generatePatternCharacterOnce): Ditto. (JSC::Yarr::YarrGenerator::generatePatternCharacterGreedy): Ditto. (JSC::Yarr::YarrGenerator::backtrackPatternCharacterNonGreedy): Ditto. Source/WebCore: * css/makeSelectorPseudoClassAndCompatibilityElementMap.py: Use isLatin1. * css/makeSelectorPseudoElementsMap.py: Ditto. * editing/TextIterator.cpp: (WebCore::isNonLatin1Separator): Ditto. (WebCore::isSeparator): Ditto. * platform/network/HTTPParsers.cpp: (WebCore::isValidReasonPhrase): Ditto. (WebCore::isValidHTTPHeaderValue): Ditto. (WebCore::isValidAcceptHeaderValue): Ditto. * platform/text/TextCodecLatin1.cpp: (WebCore::TextCodecLatin1::decode): Ditto. * platform/text/TextCodecUTF8.cpp: (WebCore::TextCodecUTF8::handlePartialSequence): Ditto. (WebCore::TextCodecUTF8::decode): Ditto. Source/WebKitLegacy/mac: * Misc/WebKitNSStringExtras.mm: (canUseFastRenderer): Use isLatin1. Source/WTF: * wtf/text/StringBuilder.cpp: (WTF::StringBuilder::appendCharacters): Use isLatin1 and also call append rather than calling appendCharacters, since it's the same thing, inlined, and removes the need for a local variable. Also tweaked the idiom of the code using memcpy. (WTF::StringBuilder::canShrink const): Reworded a comment. * wtf/text/StringBuilder.h: (WTF::StringBuilder::append): Use isLatin1. * wtf/text/StringCommon.h: (WTF::isLatin1): Moved this function template here so it can be used here. (WTF::find): Use isLatin1. * wtf/text/StringImpl.h: (WTF::isLatin1): Deleted. Moved to StringCommon.h. (WTF::reverseFind): Use isLatin1. (WTF::isSpaceOrNewline): Ditto. Canonical link: https://commits.webkit.org/214605@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248831 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-18 15:12:19 +00:00
if (!isLatin1(character))
return nullptr;
Start splitting CSS Selectors's pseudo types https://bugs.webkit.org/show_bug.cgi?id=130003 Reviewed by Andreas Kling. CSS Selectors pseudo types come in 3 flavors: page, pseudo class, pseudo elements. The three types are mixed together in a single enum list named PseudoType. Only some combinations of match type + pseudo type are valid, but this is implicitly defined from the code. This patch is the beginning of a refactoring to add more clear boundaries between valid and invalid combinations. First, the handling of page pseudo types is completely split from the other values. The parser use a different method for handling the value CSSParserSelector::parsePagePseudoSelector(). PagePseudo types no longer store their string in the CSSSelector either to reduce the redundancy with m_pseudoType. When we need to generate the string for those CSSSelector, we recreate the string as needed in CSSSelector::selectorText(). The remaining two types are not yet split in this patch but this introduce the preliminary clean up toward that goal. The list of parsed pseudo types is now generated at compile time from the source in SelectorPseudoTypeMap.in. * DerivedSources.make: The mapping of strings to pseudo types is generated from SelectorPseudoTypeMap.in by the new script makeSelectorPseudoTypeMap.py. * WebCore.xcodeproj/project.pbxproj: * css/CSSGrammar.y.in: Split the parsing of Pseudo Types. Pseudo page get its own method. The others will need some work. * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePagePseudoSelector): (WebCore::CSSParserSelector::setPseudoTypeValue): * css/CSSParserValues.h: * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForPage): This is an example of invalid combination that is hidden by the current code. First, Left and Right could never appear in a pseudo class match. (WebCore::CSSSelector::pseudoId): (WebCore::CSSSelector::parsePseudoType): (WebCore::appendPseudoTypeTailIfNecessary): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoType): (WebCore::CSSSelector::matchesPseudoElement): (WebCore::CSSSelector::setValue): (WebCore::CSSSelector::CSSSelector): * css/PageRuleCollector.cpp: (WebCore::checkPageSelectorComponents): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): * css/SelectorPseudoTypeMap.h: Added. * css/SelectorPseudoTypeMap.in: Added. * css/makeSelectorPseudoTypeMap.py: Added. (enumerablePseudoType): (expand_ifdef_condition): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoType): Canonical link: https://commits.webkit.org/148023@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-03-10 21:00:26 +00:00
buffer[i] = static_cast<LChar>(character);
}
return parsePseudoClassAndCompatibilityElementString(buffer, length);
Start splitting CSS Selectors's pseudo types https://bugs.webkit.org/show_bug.cgi?id=130003 Reviewed by Andreas Kling. CSS Selectors pseudo types come in 3 flavors: page, pseudo class, pseudo elements. The three types are mixed together in a single enum list named PseudoType. Only some combinations of match type + pseudo type are valid, but this is implicitly defined from the code. This patch is the beginning of a refactoring to add more clear boundaries between valid and invalid combinations. First, the handling of page pseudo types is completely split from the other values. The parser use a different method for handling the value CSSParserSelector::parsePagePseudoSelector(). PagePseudo types no longer store their string in the CSSSelector either to reduce the redundancy with m_pseudoType. When we need to generate the string for those CSSSelector, we recreate the string as needed in CSSSelector::selectorText(). The remaining two types are not yet split in this patch but this introduce the preliminary clean up toward that goal. The list of parsed pseudo types is now generated at compile time from the source in SelectorPseudoTypeMap.in. * DerivedSources.make: The mapping of strings to pseudo types is generated from SelectorPseudoTypeMap.in by the new script makeSelectorPseudoTypeMap.py. * WebCore.xcodeproj/project.pbxproj: * css/CSSGrammar.y.in: Split the parsing of Pseudo Types. Pseudo page get its own method. The others will need some work. * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePagePseudoSelector): (WebCore::CSSParserSelector::setPseudoTypeValue): * css/CSSParserValues.h: * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForPage): This is an example of invalid combination that is hidden by the current code. First, Left and Right could never appear in a pseudo class match. (WebCore::CSSSelector::pseudoId): (WebCore::CSSSelector::parsePseudoType): (WebCore::appendPseudoTypeTailIfNecessary): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoType): (WebCore::CSSSelector::matchesPseudoElement): (WebCore::CSSSelector::setValue): (WebCore::CSSSelector::CSSSelector): * css/PageRuleCollector.cpp: (WebCore::checkPageSelectorComponents): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): * css/SelectorPseudoTypeMap.h: Added. * css/SelectorPseudoTypeMap.in: Added. * css/makeSelectorPseudoTypeMap.py: Added. (enumerablePseudoType): (expand_ifdef_condition): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoType): Canonical link: https://commits.webkit.org/148023@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-03-10 21:00:26 +00:00
}
""" % longest_keyword)
output_file.write("""
Streamline some string code, focusing on functions that were using substringSharingImpl https://bugs.webkit.org/show_bug.cgi?id=198898 Reviewed by Daniel Bates. Source/WebCore: * css/CSSComputedStyleDeclaration.cpp: (WebCore::CSSComputedStyleDeclaration::CSSComputedStyleDeclaration): Take a StringView instead of a String argument for the pseudo-element name. This prevents us from having to use substringSharingImpl to strip off leading colons. (WebCore::CSSComputedStyleDeclaration::create): Moved this function in here since it's no longer being inlined. * css/CSSComputedStyleDeclaration.h: Moved the create function to no longer be inlined, since it's better to have the constructor be inlined in the create function instead. Changed the pseudo-element name argument to be a StringView rather than a String. Also initialize m_refCount in the class definition. * css/CSSSelector.cpp: (WebCore::CSSSelector::parsePseudoElementType): Take a StringView instead of a String. * css/CSSSelector.h: Updated for the above change. * css/SelectorPseudoTypeMap.h: Change both parse functions to take StringView. Before one took a StringImpl and the other used const StringView&, which is not as good as StringView. * css/makeSelectorPseudoClassAndCompatibilityElementMap.py: Use StringView, not const StringView&. * css/makeSelectorPseudoElementsMap.py: Use StringView rather than StringImpl. * css/parser/CSSParserImpl.cpp: (WebCore::CSSParserImpl::parsePageSelector): Use a StringView for the pseudo-element name. It was already computed as a StringView, but the old code converted it to an AtomicString. * css/parser/CSSParserSelector.cpp: (WebCore::CSSParserSelector::parsePagePseudoSelector): Take a StringView, and return a std::unique_ptr. (WebCore::CSSParserSelector::parsePseudoElementSelector): Renamed to not mention StringView in function name. Take a StringView, not a StringView&. Do the lowercasing inside this function rather than having it be a caller responsibility. Don't convert from a StringView to an AtomicString before starting to parse; only do it in the "unknown/custom" case. Return a std::unique_ptr. (WebCore::CSSParserSelector::parsePseudoClassSelector): Ditto. * css/parser/CSSParserSelector.h: Make the three parse functions all take a StringView and all return a std::unique_ptr. They were already creating objects, but before callers just had to know to adopt. * css/parser/CSSSelectorParser.cpp: (WebCore::CSSSelectorParser::consumePseudo): Updated to use improved parse functions above. * page/DOMWindow.cpp: (WebCore::DOMWindow::getMatchedCSSRules const): Updated to use the new parsePseudoElementType above and use StringView::substring instead of String::substringSharingImpl. * platform/Length.cpp: (WebCore::newCoordsArray): Local string that is "spacified" can't have any non-Latin-1 characters, so use LChar instead of UChar. * rendering/RenderText.cpp: (WebCore::convertNoBreakSpaceToSpace): Renamed for clarity. Also use constexpr instead of inline since this is a pure function. (WebCore::capitalize): Tighten up logic a bit. Source/WTF: * wtf/URLHelpers.cpp: (WTF::URLHelpers::applyHostNameFunctionToURLString): Change code using substringSharingImpl so it could call String::find to call StringView::contains instead. Also rewrote lambdas to be simpler and likely more efficient. Rewrote another case using substringSharingImpl so it could call String::find to call StringView::find instead. * wtf/text/StringView.cpp: (WTF::StringView::startsWith const): Added. * wtf/text/StringView.h: Tweaked style a bit, and added an overload of StringView::contains that takes a CodeUnitMatchFunction and an overload of startsWith that cakes a UChar. Canonical link: https://commits.webkit.org/213279@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246951 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-06-29 21:50:00 +00:00
PseudoClassOrCompatibilityPseudoElement parsePseudoClassAndCompatibilityElementString(StringView pseudoTypeString)
Start splitting CSS Selectors's pseudo types https://bugs.webkit.org/show_bug.cgi?id=130003 Reviewed by Andreas Kling. CSS Selectors pseudo types come in 3 flavors: page, pseudo class, pseudo elements. The three types are mixed together in a single enum list named PseudoType. Only some combinations of match type + pseudo type are valid, but this is implicitly defined from the code. This patch is the beginning of a refactoring to add more clear boundaries between valid and invalid combinations. First, the handling of page pseudo types is completely split from the other values. The parser use a different method for handling the value CSSParserSelector::parsePagePseudoSelector(). PagePseudo types no longer store their string in the CSSSelector either to reduce the redundancy with m_pseudoType. When we need to generate the string for those CSSSelector, we recreate the string as needed in CSSSelector::selectorText(). The remaining two types are not yet split in this patch but this introduce the preliminary clean up toward that goal. The list of parsed pseudo types is now generated at compile time from the source in SelectorPseudoTypeMap.in. * DerivedSources.make: The mapping of strings to pseudo types is generated from SelectorPseudoTypeMap.in by the new script makeSelectorPseudoTypeMap.py. * WebCore.xcodeproj/project.pbxproj: * css/CSSGrammar.y.in: Split the parsing of Pseudo Types. Pseudo page get its own method. The others will need some work. * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePagePseudoSelector): (WebCore::CSSParserSelector::setPseudoTypeValue): * css/CSSParserValues.h: * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForPage): This is an example of invalid combination that is hidden by the current code. First, Left and Right could never appear in a pseudo class match. (WebCore::CSSSelector::pseudoId): (WebCore::CSSSelector::parsePseudoType): (WebCore::appendPseudoTypeTailIfNecessary): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoType): (WebCore::CSSSelector::matchesPseudoElement): (WebCore::CSSSelector::setValue): (WebCore::CSSSelector::CSSSelector): * css/PageRuleCollector.cpp: (WebCore::checkPageSelectorComponents): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): * css/SelectorPseudoTypeMap.h: Added. * css/SelectorPseudoTypeMap.in: Added. * css/makeSelectorPseudoTypeMap.py: Added. (enumerablePseudoType): (expand_ifdef_condition): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoType): Canonical link: https://commits.webkit.org/148023@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-03-10 21:00:26 +00:00
{
const SelectorPseudoClassOrCompatibilityPseudoElementEntry* entry;
Start splitting CSS Selectors's pseudo types https://bugs.webkit.org/show_bug.cgi?id=130003 Reviewed by Andreas Kling. CSS Selectors pseudo types come in 3 flavors: page, pseudo class, pseudo elements. The three types are mixed together in a single enum list named PseudoType. Only some combinations of match type + pseudo type are valid, but this is implicitly defined from the code. This patch is the beginning of a refactoring to add more clear boundaries between valid and invalid combinations. First, the handling of page pseudo types is completely split from the other values. The parser use a different method for handling the value CSSParserSelector::parsePagePseudoSelector(). PagePseudo types no longer store their string in the CSSSelector either to reduce the redundancy with m_pseudoType. When we need to generate the string for those CSSSelector, we recreate the string as needed in CSSSelector::selectorText(). The remaining two types are not yet split in this patch but this introduce the preliminary clean up toward that goal. The list of parsed pseudo types is now generated at compile time from the source in SelectorPseudoTypeMap.in. * DerivedSources.make: The mapping of strings to pseudo types is generated from SelectorPseudoTypeMap.in by the new script makeSelectorPseudoTypeMap.py. * WebCore.xcodeproj/project.pbxproj: * css/CSSGrammar.y.in: Split the parsing of Pseudo Types. Pseudo page get its own method. The others will need some work. * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePagePseudoSelector): (WebCore::CSSParserSelector::setPseudoTypeValue): * css/CSSParserValues.h: * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForPage): This is an example of invalid combination that is hidden by the current code. First, Left and Right could never appear in a pseudo class match. (WebCore::CSSSelector::pseudoId): (WebCore::CSSSelector::parsePseudoType): (WebCore::appendPseudoTypeTailIfNecessary): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoType): (WebCore::CSSSelector::matchesPseudoElement): (WebCore::CSSSelector::setValue): (WebCore::CSSSelector::CSSSelector): * css/PageRuleCollector.cpp: (WebCore::checkPageSelectorComponents): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): * css/SelectorPseudoTypeMap.h: Added. * css/SelectorPseudoTypeMap.in: Added. * css/makeSelectorPseudoTypeMap.py: Added. (enumerablePseudoType): (expand_ifdef_condition): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoType): Canonical link: https://commits.webkit.org/148023@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-03-10 21:00:26 +00:00
if (pseudoTypeString.is8Bit())
entry = parsePseudoClassAndCompatibilityElementString(pseudoTypeString.characters8(), pseudoTypeString.length());
else
entry = parsePseudoClassAndCompatibilityElementString(pseudoTypeString.characters16(), pseudoTypeString.length());
if (entry)
return entry->pseudoTypes;
Rename the CSSSelector PseudoType to PseudoClassType https://bugs.webkit.org/show_bug.cgi?id=131907 Reviewed by Andreas Kling. Pseudo Elements and Page Pseudo Classes have been moved out of PseudoType in previous patches. The remaining values in the PseudoType enumeration are the pseudo classes. This patch is the final clean up, PseudoType is renamed to PseudoClassType. * css/CSSGrammar.y.in: * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePseudoClassAndCompatibilityElementSelector): * css/CSSParserValues.h: (WebCore::CSSParserSelector::pseudoClassType): (WebCore::CSSParserSelector::pseudoType): Deleted. * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForOneSelector): (WebCore::appendPseudoClassFunctionTail): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoClassType): (WebCore::CSSSelector::pseudoElementType): (WebCore::CSSSelector::pagePseudoClassType): (WebCore::pseudoClassIsRelativeToSiblings): (WebCore::CSSSelector::isSiblingSelector): (WebCore::CSSSelector::CSSSelector): (WebCore::CSSSelector::pseudoType): Deleted. * css/RuleSet.cpp: (WebCore::RuleSet::findBestRuleSetAndAdd): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): (WebCore::SelectorChecker::checkScrollbarPseudoClass): (WebCore::SelectorChecker::determineLinkMatchType): (WebCore::SelectorChecker::matchesFocusPseudoClass): * css/SelectorChecker.h: (WebCore::SelectorChecker::isCommonPseudoClassSelector): * css/SelectorCheckerFastPath.cpp: (WebCore::SelectorCheckerFastPath::commonPseudoClassSelectorMatches): * css/SelectorPseudoClassAndCompatibilityElementMap.in: * css/SelectorPseudoTypeMap.h: * css/StyleResolver.cpp: (WebCore::StyleResolver::styleForElement): * css/makeSelectorPseudoClassAndCompatibilityElementMap.py: (enumerablePseudoType): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoClassType): (WebCore::SelectorCompiler::SelectorCodeGenerator::SelectorCodeGenerator): (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementMatching): (WebCore::SelectorCompiler::addPseudoType): Deleted. * inspector/InspectorCSSAgent.cpp: (WebCore::computePseudoClassMask): (WebCore::InspectorCSSAgent::forcePseudoState): * inspector/InspectorCSSAgent.h: * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::forcePseudoStateImpl): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::forcePseudoState): Canonical link: https://commits.webkit.org/149991@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167571 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-20 20:43:35 +00:00
return { CSSSelector::PseudoClassUnknown, CSSSelector::PseudoElementUnknown };
Start splitting CSS Selectors's pseudo types https://bugs.webkit.org/show_bug.cgi?id=130003 Reviewed by Andreas Kling. CSS Selectors pseudo types come in 3 flavors: page, pseudo class, pseudo elements. The three types are mixed together in a single enum list named PseudoType. Only some combinations of match type + pseudo type are valid, but this is implicitly defined from the code. This patch is the beginning of a refactoring to add more clear boundaries between valid and invalid combinations. First, the handling of page pseudo types is completely split from the other values. The parser use a different method for handling the value CSSParserSelector::parsePagePseudoSelector(). PagePseudo types no longer store their string in the CSSSelector either to reduce the redundancy with m_pseudoType. When we need to generate the string for those CSSSelector, we recreate the string as needed in CSSSelector::selectorText(). The remaining two types are not yet split in this patch but this introduce the preliminary clean up toward that goal. The list of parsed pseudo types is now generated at compile time from the source in SelectorPseudoTypeMap.in. * DerivedSources.make: The mapping of strings to pseudo types is generated from SelectorPseudoTypeMap.in by the new script makeSelectorPseudoTypeMap.py. * WebCore.xcodeproj/project.pbxproj: * css/CSSGrammar.y.in: Split the parsing of Pseudo Types. Pseudo page get its own method. The others will need some work. * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePagePseudoSelector): (WebCore::CSSParserSelector::setPseudoTypeValue): * css/CSSParserValues.h: * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForPage): This is an example of invalid combination that is hidden by the current code. First, Left and Right could never appear in a pseudo class match. (WebCore::CSSSelector::pseudoId): (WebCore::CSSSelector::parsePseudoType): (WebCore::appendPseudoTypeTailIfNecessary): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoType): (WebCore::CSSSelector::matchesPseudoElement): (WebCore::CSSSelector::setValue): (WebCore::CSSSelector::CSSSelector): * css/PageRuleCollector.cpp: (WebCore::checkPageSelectorComponents): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): * css/SelectorPseudoTypeMap.h: Added. * css/SelectorPseudoTypeMap.in: Added. * css/makeSelectorPseudoTypeMap.py: Added. (enumerablePseudoType): (expand_ifdef_condition): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoType): Canonical link: https://commits.webkit.org/148023@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-03-10 21:00:26 +00:00
}
} // namespace WebCore
Add IGNORE_WARNING_.* macros https://bugs.webkit.org/show_bug.cgi?id=188996 Reviewed by Michael Catanzaro. Source/JavaScriptCore: * API/JSCallbackObject.h: * API/tests/testapi.c: * assembler/LinkBuffer.h: (JSC::LinkBuffer::finalizeCodeWithDisassembly): * b3/B3LowerToAir.cpp: * b3/B3Opcode.cpp: * b3/B3Type.h: * b3/B3TypeMap.h: * b3/B3Width.h: * b3/air/AirArg.cpp: * b3/air/AirArg.h: * b3/air/AirCode.h: * bytecode/Opcode.h: (JSC::padOpcodeName): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::speculateNumber): (JSC::DFG::SpeculativeJIT::speculateMisc): * dfg/DFGSpeculativeJIT64.cpp: * ftl/FTLOutput.h: * jit/CCallHelpers.h: (JSC::CCallHelpers::calculatePokeOffset): * llint/LLIntData.cpp: * llint/LLIntSlowPaths.cpp: (JSC::LLInt::slowPathLogF): * runtime/ConfigFile.cpp: (JSC::ConfigFile::canonicalizePaths): * runtime/JSDataViewPrototype.cpp: * runtime/JSGenericTypedArrayViewConstructor.h: * runtime/JSGenericTypedArrayViewPrototype.h: * runtime/Options.cpp: (JSC::Options::setAliasedOption): * tools/CodeProfiling.cpp: * wasm/WasmSections.h: * wasm/generateWasmValidateInlinesHeader.py: Source/WebCore: * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h: * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h: * accessibility/mac/AXObjectCacheMac.mm: (WebCore::AXObjectCache::postPlatformNotification): * accessibility/mac/AccessibilityObjectMac.mm: (WebCore::AccessibilityObject::overrideAttachmentParent): (WebCore::AccessibilityObject::accessibilityIgnoreAttachment const): * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper renderWidgetChildren]): (-[WebAccessibilityObjectWrapper convertPointToScreenSpace:]): (-[WebAccessibilityObjectWrapper role]): (-[WebAccessibilityObjectWrapper roleDescription]): * bridge/objc/WebScriptObject.mm: * bridge/objc/objc_class.mm: (JSC::Bindings::ObjcClass::fieldNamed const): * crypto/CommonCryptoUtilities.cpp: (WebCore::getCommonCryptoDigestAlgorithm): * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp: (WebCore::encryptAES_GCM): (WebCore::decyptAES_GCM): * crypto/mac/SerializedCryptoKeyWrapMac.mm: (WebCore::wrapSerializedCryptoKey): (WebCore::unwrapSerializedCryptoKey): * css/makeSelectorPseudoClassAndCompatibilityElementMap.py: * css/makeSelectorPseudoElementsMap.py: * editing/TextIterator.cpp: * editing/mac/EditorMac.mm: (WebCore::Editor::pasteWithPasteboard): (WebCore::Editor::takeFindStringFromSelection): (WebCore::Editor::replaceNodeFromPasteboard): * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::sendFakeEventsAfterWidgetTracking): * page/mac/ServicesOverlayController.mm: (WebCore::ServicesOverlayController::Highlight::paintContents): * platform/LocalizedStrings.cpp: (WebCore::formatLocalizedString): * platform/ScreenProperties.h: (WebCore::ScreenData::decode): * platform/gamepad/mac/HIDGamepadProvider.cpp: (WebCore::HIDGamepadProvider::stopMonitoringInput): * platform/graphics/PlatformDisplay.cpp: (WebCore::PlatformDisplay::sharedDisplay): * platform/graphics/SurrogatePairAwareTextIterator.cpp: * platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.mm: (WebCore::MediaSelectionGroupAVFObjC::updateOptions): * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm: (WebCore::CDMSessionAVStreamSession::update): * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::setCurrentTextTrack): (WebCore::MediaPlayerPrivateAVFoundationObjC::languageOfPrimaryAudioTrack const): (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: (WebCore::IGNORE_CLANG_WARNING_END): * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h: * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: (-[WebAVSampleBufferErrorListener beginObservingRenderer:]): (-[WebAVSampleBufferErrorListener stopObservingRenderer:]): (-[WebAVSampleBufferErrorListener observeValueForKeyPath:ofObject:change:context:]): (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled): (WebCore::IGNORE_CLANG_WARNING_END): * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: (PlatformCALayer::drawLayerContents): * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp: (WebCore::FontCascade::fontForCombiningCharacterSequence const): * platform/graphics/cg/ImageDecoderCG.cpp: (WebCore::ImageDecoderCG::createFrameImageAtIndex): * platform/graphics/cocoa/GraphicsContextCocoa.mm: (WebCore::GraphicsContext::drawLineForDocumentMarker): * platform/graphics/cocoa/WebGLLayer.h: (IGNORE_CLANG_WARNING): * platform/graphics/mac/ComplexTextControllerCoreText.mm: (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): * platform/graphics/mac/IconMac.mm: (WebCore::Icon::Icon): * platform/graphics/mac/PDFDocumentImageMac.mm: (WebCore::PDFDocumentImage::drawPDFPage): * platform/graphics/mac/WebKitNSImageExtras.mm: (-[NSImage _web_lockFocusWithDeviceScaleFactor:]): * platform/ios/DragImageIOS.mm: * platform/mac/DragImageMac.mm: (WebCore::scaleDragImage): (WebCore::createDragImageForLink): * platform/mac/LegacyNSPasteboardTypes.h: * platform/mac/LocalCurrentGraphicsContext.mm: (WebCore::LocalCurrentGraphicsContext::LocalCurrentGraphicsContext): * platform/mac/PasteboardMac.mm: (WebCore::Pasteboard::createForCopyAndPaste): (WebCore::Pasteboard::createForDragAndDrop): (WebCore::setDragImageImpl): * platform/mac/PlatformEventFactoryMac.mm: (WebCore::globalPoint): * platform/mac/SSLKeyGeneratorMac.mm: * platform/mac/ScrollViewMac.mm: (WebCore::ScrollView::platformContentsToScreen const): (WebCore::ScrollView::platformScreenToContents const): * platform/mac/ThemeMac.mm: (WebCore::drawCellFocusRingWithFrameAtTime): * platform/mac/WebPlaybackControlsManager.mm: * platform/mac/WidgetMac.mm: (WebCore::Widget::paint): * platform/mediastream/RealtimeIncomingAudioSource.h: * platform/mediastream/RealtimeIncomingVideoSource.h: * platform/mediastream/RealtimeOutgoingAudioSource.h: * platform/mediastream/RealtimeOutgoingVideoSource.h: * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h: * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: * platform/mediastream/libwebrtc/LibWebRTCProvider.h: * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm: * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp: * platform/network/cf/NetworkStorageSessionCFNet.cpp: * platform/network/cf/ResourceHandleCFNet.cpp: (WebCore::ResourceHandle::createCFURLConnection): * platform/network/cf/SocketStreamHandleImplCFNet.cpp: (WebCore::SocketStreamHandleImpl::reportErrorToClient): * platform/network/create-http-header-name-table: * platform/text/TextEncoding.cpp: * testing/MockLibWebRTCPeerConnection.h: * xml/XPathGrammar.cpp: Source/WebCore/PAL: * pal/crypto/commoncrypto/CryptoDigestCommonCrypto.cpp: (PAL::CryptoDigest::create): (PAL::CryptoDigest::addBytes): (PAL::CryptoDigest::computeHash): * pal/spi/cocoa/AVKitSPI.h: * pal/spi/cocoa/NSKeyedArchiverSPI.h: (insecurelyUnarchiveObjectFromData): * pal/spi/ios/MediaPlayerSPI.h: * pal/system/mac/PopupMenu.mm: (PAL::popUpMenu): * pal/system/mac/WebPanel.mm: (-[WebPanel init]): Source/WebKit: * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::NetworkDataTaskCocoa::statelessCookieStorage): * NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::platformSyncAllCookies): * PluginProcess/mac/PluginProcessMac.mm: (WebKit::beginModal): * PluginProcess/mac/PluginProcessShim.mm: * Shared/Plugins/Netscape/NetscapePluginModule.cpp: (WebKit::NetscapePluginModule::tryLoad): * Shared/ios/ChildProcessIOS.mm: (WebKit::ChildProcess::initializeSandbox): * Shared/mac/ChildProcessMac.mm: (WebKit::compileAndApplySandboxSlowCase): * Shared/mac/ColorSpaceData.mm: (WebKit::ColorSpaceData::decode): * Shared/mac/SandboxExtensionMac.mm: (WebKit::SandboxExtensionImpl::sandboxExtensionForType): * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _web_superAccessibilityAttributeValue:]): * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: * UIProcess/API/Cocoa/_WKWebsiteDataStore.mm: * UIProcess/API/glib/WebKitWebView.cpp: (webkitWebViewRunAsModal): * UIProcess/API/mac/WKView.mm: (-[WKView _web_superAccessibilityAttributeValue:]): * UIProcess/Cocoa/DownloadClient.mm: (WebKit::DownloadClient::decideDestinationWithSuggestedFilename): * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm: (-[WKCustomProtocolLoader initWithLegacyCustomProtocolManagerProxy:customProtocolID:request:]): * UIProcess/Cocoa/NavigationState.mm: (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction): * UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::ContextMenuClient::menuFromProposedMenu): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): * UIProcess/Cocoa/WebViewImpl.mm: (-[WKTextListTouchBarViewController initWithWebViewImpl:]): (WebKit::WebViewImpl::updateWindowAndViewFrames): (WebKit::WebViewImpl::sendDragEndToPage): (WebKit::WebViewImpl::startDrag): (WebKit::WebViewImpl::characterIndexForPoint): * UIProcess/Plugins/mac/PluginProcessProxyMac.mm: (WebKit::PluginProcessProxy::getPluginProcessSerialNumber): (WebKit::PluginProcessProxy::makePluginProcessTheFrontProcess): (WebKit::PluginProcessProxy::makeUIProcessTheFrontProcess): (WebKit::PluginProcessProxy::exitFullscreen): * UIProcess/ios/SmartMagnificationController.mm: * UIProcess/ios/WKGeolocationProviderIOS.mm: * UIProcess/ios/WKLegacyPDFView.mm: * UIProcess/ios/WKPDFPageNumberIndicator.mm: (-[WKPDFPageNumberIndicator _makeRoundedCorners]): * UIProcess/ios/forms/WKAirPlayRoutePicker.mm: * UIProcess/ios/forms/WKFileUploadPanel.mm: (-[WKFileUploadPanel _presentPopoverWithContentViewController:animated:]): * UIProcess/ios/forms/WKFormColorControl.mm: (-[WKColorPopover initWithView:]): * UIProcess/ios/forms/WKFormInputControl.mm: (-[WKDateTimePopover initWithView:datePickerMode:]): * UIProcess/ios/forms/WKFormPopover.h: * UIProcess/ios/forms/WKFormPopover.mm: * UIProcess/ios/forms/WKFormSelectPopover.mm: (-[WKSelectPopover initWithView:hasGroups:]): * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::screenToRootView): (WebKit::PageClientImpl::rootViewToScreen): * UIProcess/mac/WKFullScreenWindowController.mm: (-[WKFullScreenWindowController enterFullScreen:]): (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]): (-[WKFullScreenWindowController exitFullScreen]): (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]): (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]): (-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]): (-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]): (-[WKFullScreenWindowController _startExitFullScreenAnimationWithDuration:]): * UIProcess/mac/WKPrintingView.mm: (-[WKPrintingView _setAutodisplay:]): (-[WKPrintingView _drawPDFDocument:page:atPoint:]): (-[WKPrintingView _drawPreview:]): (-[WKPrintingView drawRect:]): * UIProcess/mac/WKTextInputWindowController.mm: (-[WKTextInputPanel _interpretKeyEvent:usingLegacyCocoaTextInput:string:]): (-[WKTextInputPanel _hasMarkedText]): * UIProcess/mac/WebPopupMenuProxyMac.mm: (WebKit::WebPopupMenuProxyMac::showPopupMenu): * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: (WebKit::initializeEventRecord): (WebKit::NetscapePlugin::sendComplexTextInput): (WebKit::makeCGLPresentLayerOpaque): (WebKit::NetscapePlugin::nullEventTimerFired): * WebProcess/Plugins/PDF/PDFPlugin.mm: (-[WKPDFPluginAccessibilityObject accessibilityFocusedUIElement]): (-[WKPDFLayerControllerDelegate writeItemsToPasteboard:withTypes:]): (WebKit::PDFPlugin::handleEditingCommand): (WebKit::PDFPlugin::setActiveAnnotation): (WebKit:: const): * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.h: * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm: (WebKit::PDFPluginChoiceAnnotation::createAnnotationElement): * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.h: * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm: (WebKit::PDFPluginTextAnnotation::createAnnotationElement): * WebProcess/WebCoreSupport/WebAlternativeTextClient.h: * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm: (WebKit::convertImageToBitmap): (WebKit::WebDragClient::declareAndWriteDragImage): * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::drawPDFPage): Source/WebKitLegacy/mac: * Carbon/CarbonUtils.m: (PoolCleaner): * Carbon/CarbonWindowAdapter.mm: (-[CarbonWindowAdapter initWithCarbonWindowRef:takingOwnership:disableOrdering:carbon:]): (-[CarbonWindowAdapter setViewsNeedDisplay:]): (-[CarbonWindowAdapter reconcileToCarbonWindowBounds]): (-[CarbonWindowAdapter _termWindowIfOwner]): (-[CarbonWindowAdapter _windowMovedToRect:]): (-[CarbonWindowAdapter setContentView:]): (-[CarbonWindowAdapter _handleRootBoundsChanged]): (-[CarbonWindowAdapter _handleContentBoundsChanged]): * Carbon/CarbonWindowFrame.m: (-[CarbonWindowFrame title]): * Carbon/HIViewAdapter.m: (+[HIViewAdapter getHIViewForNSView:]): * Carbon/HIWebView.mm: (overrideCGContext): (restoreCGContext): (Draw): * DOM/DOM.mm: * History/WebHistory.mm: (-[WebHistoryPrivate loadHistoryGutsFromURL:savedItemsCount:collectDiscardedItemsInto:error:]): * History/WebHistoryItem.mm: (-[WebHistoryItem icon]): * Misc/WebKitNSStringExtras.mm: (-[NSString _web_drawAtPoint:font:textColor:]): * Misc/WebNSImageExtras.m: (-[NSImage _web_scaleToMaxSize:]): (-[NSImage _web_dissolveToFraction:]): * Misc/WebNSPasteboardExtras.mm: (+[NSPasteboard _web_setFindPasteboardString:withOwner:]): (-[NSPasteboard _web_declareAndWriteDragImageForElement:URL:title:archive:source:]): * Panels/WebAuthenticationPanel.m: (-[WebAuthenticationPanel loadNib]): * Plugins/Hosted/NetscapePluginHostManager.mm: (WebKit::NetscapePluginHostManager::spawnPluginHost): (WebKit::NetscapePluginHostManager::didCreateWindow): * Plugins/Hosted/NetscapePluginHostProxy.mm: (WebKit::NetscapePluginHostProxy::makeCurrentProcessFrontProcess): (WebKit::NetscapePluginHostProxy::makePluginHostProcessFrontProcess const): (WebKit::NetscapePluginHostProxy::isPluginHostProcessFrontProcess const): * Plugins/Hosted/NetscapePluginInstanceProxy.mm: (WebKit::NetscapePluginInstanceProxy::mouseEvent): * Plugins/Hosted/WebHostedNetscapePluginView.mm: (-[WebHostedNetscapePluginView drawRect:]): * Plugins/Hosted/WebTextInputWindowController.m: (-[WebTextInputPanel _interpretKeyEvent:string:]): * Plugins/WebBaseNetscapePluginView.mm: (-[WebBaseNetscapePluginView convertFromX:andY:space:toX:andY:space:]): * Plugins/WebNetscapePluginPackage.mm: (-[WebNetscapePluginPackage _tryLoad]): * Plugins/WebNetscapePluginView.mm: (-[WebNetscapePluginView saveAndSetNewPortStateForUpdate:]): (-[WebNetscapePluginView sendDrawRectEvent:]): (-[WebNetscapePluginView drawRect:]): * Plugins/WebPluginController.mm: (WebKit_TSUpdateCheck_alertDidEnd_returnCode_contextInfo_): (WebKit_NSAlert_beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_): * WebCoreSupport/PopupMenuMac.mm: (PopupMenuMac::populate): * WebCoreSupport/WebAlternativeTextClient.h: * WebCoreSupport/WebDragClient.mm: (WebDragClient::startDrag): * WebCoreSupport/WebFrameLoaderClient.mm: (WebFrameLoaderClient::convertMainResourceLoadToDownload): (webGetNSImage): * WebInspector/WebNodeHighlight.mm: * WebInspector/WebNodeHighlightView.mm: (-[WebNodeHighlightView drawRect:]): * WebView/WebClipView.mm: (-[WebClipView initWithFrame:]): * WebView/WebFrame.mm: (-[WebFrame _updateBackgroundAndUpdatesWhileOffscreen]): (-[WebFrame _drawRect:contentsOnly:]): (-[WebFrame accessibilityRoot]): * WebView/WebFullScreenController.mm: (-[WebFullScreenController enterFullScreen:]): (-[WebFullScreenController finishedEnterFullScreenAnimation:]): (-[WebFullScreenController exitFullScreen]): (-[WebFullScreenController finishedExitFullScreenAnimation:]): (-[WebFullScreenController _startEnterFullScreenAnimationWithDuration:]): (-[WebFullScreenController _startExitFullScreenAnimationWithDuration:]): * WebView/WebHTMLView.mm: (-[NSWindow _web_borderView]): (-[WebHTMLView _updateMouseoverWithFakeEvent]): (-[WebHTMLView _setAsideSubviews]): (-[WebHTMLView _autoscroll]): (-[WebHTMLView drawRect:]): (-[WebHTMLView mouseDown:]): (-[WebHTMLView mouseDragged:]): (-[WebHTMLView mouseUp:]): (-[WebHTMLView _endPrintModeAndRestoreWindowAutodisplay]): (-[WebHTMLView knowsPageRange:]): (-[WebHTMLView accessibilityHitTest:]): (-[WebHTMLView _fontAttributesFromFontPasteboard]): (-[WebHTMLView _colorAsString:]): (-[WebHTMLView copyFont:]): (-[WebHTMLView _executeSavedKeypressCommands]): (-[WebHTMLView attachRootLayer:]): (-[WebHTMLView textStorage]): (-[WebHTMLView _updateSelectionForInputManager]): * WebView/WebPDFView.mm: (_applicationInfoForMIMEType): (-[WebPDFView centerSelectionInVisibleArea:]): (-[WebPDFView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]): (-[WebPDFView _recursiveDisplayAllDirtyWithLockFocus:visRect:]): (-[WebPDFView _recursive:displayRectIgnoringOpacity:inContext:topView:]): (-[WebPDFView searchFor:direction:caseSensitive:wrap:startInSelection:]): * WebView/WebTextCompletionController.mm: (-[WebTextCompletionController _buildUI]): (-[WebTextCompletionController _placePopupWindow:]): * WebView/WebVideoFullscreenController.mm: * WebView/WebVideoFullscreenHUDWindowController.mm: (createMediaUIBackgroundView): * WebView/WebView.mm: (-[WebTextListTouchBarViewController initWithWebView:]): (-[WebView _dispatchTileDidDraw:]): (-[WebView encodeWithCoder:]): (-[WebView mainFrameIcon]): (LayerFlushController::flushLayers): * WebView/WebWindowAnimation.mm: (setScaledFrameForWindow): Source/WTF: * wtf/Assertions.cpp: * wtf/Assertions.h: * wtf/Compiler.h: * wtf/MD5.cpp: (WTF::MD5::MD5): (WTF::MD5::addBytes): (WTF::MD5::checksum): * wtf/PrintStream.cpp: (WTF::PrintStream::printfVariableFormat): * wtf/SHA1.cpp: (WTF::SHA1::SHA1): (WTF::SHA1::addBytes): (WTF::SHA1::computeHash): * wtf/ThreadingPthreads.cpp: * wtf/Vector.h: (WTF::VectorBuffer::endOfBuffer): * wtf/text/WTFString.cpp: (WTF::createWithFormatAndArguments): Canonical link: https://commits.webkit.org/204515@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235935 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-12 15:09:16 +00:00
IGNORE_WARNINGS_END
Start splitting CSS Selectors's pseudo types https://bugs.webkit.org/show_bug.cgi?id=130003 Reviewed by Andreas Kling. CSS Selectors pseudo types come in 3 flavors: page, pseudo class, pseudo elements. The three types are mixed together in a single enum list named PseudoType. Only some combinations of match type + pseudo type are valid, but this is implicitly defined from the code. This patch is the beginning of a refactoring to add more clear boundaries between valid and invalid combinations. First, the handling of page pseudo types is completely split from the other values. The parser use a different method for handling the value CSSParserSelector::parsePagePseudoSelector(). PagePseudo types no longer store their string in the CSSSelector either to reduce the redundancy with m_pseudoType. When we need to generate the string for those CSSSelector, we recreate the string as needed in CSSSelector::selectorText(). The remaining two types are not yet split in this patch but this introduce the preliminary clean up toward that goal. The list of parsed pseudo types is now generated at compile time from the source in SelectorPseudoTypeMap.in. * DerivedSources.make: The mapping of strings to pseudo types is generated from SelectorPseudoTypeMap.in by the new script makeSelectorPseudoTypeMap.py. * WebCore.xcodeproj/project.pbxproj: * css/CSSGrammar.y.in: Split the parsing of Pseudo Types. Pseudo page get its own method. The others will need some work. * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePagePseudoSelector): (WebCore::CSSParserSelector::setPseudoTypeValue): * css/CSSParserValues.h: * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForPage): This is an example of invalid combination that is hidden by the current code. First, Left and Right could never appear in a pseudo class match. (WebCore::CSSSelector::pseudoId): (WebCore::CSSSelector::parsePseudoType): (WebCore::appendPseudoTypeTailIfNecessary): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoType): (WebCore::CSSSelector::matchesPseudoElement): (WebCore::CSSSelector::setValue): (WebCore::CSSSelector::CSSSelector): * css/PageRuleCollector.cpp: (WebCore::checkPageSelectorComponents): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): * css/SelectorPseudoTypeMap.h: Added. * css/SelectorPseudoTypeMap.in: Added. * css/makeSelectorPseudoTypeMap.py: Added. (enumerablePseudoType): (expand_ifdef_condition): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoType): Canonical link: https://commits.webkit.org/148023@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-03-10 21:00:26 +00:00
""")
output_file.close()
gperf_command = sys.argv[2]
Start splitting CSS Selectors's pseudo types https://bugs.webkit.org/show_bug.cgi?id=130003 Reviewed by Andreas Kling. CSS Selectors pseudo types come in 3 flavors: page, pseudo class, pseudo elements. The three types are mixed together in a single enum list named PseudoType. Only some combinations of match type + pseudo type are valid, but this is implicitly defined from the code. This patch is the beginning of a refactoring to add more clear boundaries between valid and invalid combinations. First, the handling of page pseudo types is completely split from the other values. The parser use a different method for handling the value CSSParserSelector::parsePagePseudoSelector(). PagePseudo types no longer store their string in the CSSSelector either to reduce the redundancy with m_pseudoType. When we need to generate the string for those CSSSelector, we recreate the string as needed in CSSSelector::selectorText(). The remaining two types are not yet split in this patch but this introduce the preliminary clean up toward that goal. The list of parsed pseudo types is now generated at compile time from the source in SelectorPseudoTypeMap.in. * DerivedSources.make: The mapping of strings to pseudo types is generated from SelectorPseudoTypeMap.in by the new script makeSelectorPseudoTypeMap.py. * WebCore.xcodeproj/project.pbxproj: * css/CSSGrammar.y.in: Split the parsing of Pseudo Types. Pseudo page get its own method. The others will need some work. * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePagePseudoSelector): (WebCore::CSSParserSelector::setPseudoTypeValue): * css/CSSParserValues.h: * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForPage): This is an example of invalid combination that is hidden by the current code. First, Left and Right could never appear in a pseudo class match. (WebCore::CSSSelector::pseudoId): (WebCore::CSSSelector::parsePseudoType): (WebCore::appendPseudoTypeTailIfNecessary): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoType): (WebCore::CSSSelector::matchesPseudoElement): (WebCore::CSSSelector::setValue): (WebCore::CSSSelector::CSSSelector): * css/PageRuleCollector.cpp: (WebCore::checkPageSelectorComponents): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): * css/SelectorPseudoTypeMap.h: Added. * css/SelectorPseudoTypeMap.in: Added. * css/makeSelectorPseudoTypeMap.py: Added. (enumerablePseudoType): (expand_ifdef_condition): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoType): Canonical link: https://commits.webkit.org/148023@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-03-10 21:00:26 +00:00
if 'GPERF' in os.environ:
gperf_command = os.environ['GPERF']
if subprocess.call([gperf_command, '--key-positions=*', '-m', '10', '-s', '2', 'SelectorPseudoClassAndCompatibilityElementMap.gperf', '--output-file=SelectorPseudoClassAndCompatibilityElementMap.cpp']) != 0:
print("Error when generating SelectorPseudoClassAndCompatibilityElementMap.cpp from SelectorPseudoClassAndCompatibilityElementMap.gperf :(")
Start splitting CSS Selectors's pseudo types https://bugs.webkit.org/show_bug.cgi?id=130003 Reviewed by Andreas Kling. CSS Selectors pseudo types come in 3 flavors: page, pseudo class, pseudo elements. The three types are mixed together in a single enum list named PseudoType. Only some combinations of match type + pseudo type are valid, but this is implicitly defined from the code. This patch is the beginning of a refactoring to add more clear boundaries between valid and invalid combinations. First, the handling of page pseudo types is completely split from the other values. The parser use a different method for handling the value CSSParserSelector::parsePagePseudoSelector(). PagePseudo types no longer store their string in the CSSSelector either to reduce the redundancy with m_pseudoType. When we need to generate the string for those CSSSelector, we recreate the string as needed in CSSSelector::selectorText(). The remaining two types are not yet split in this patch but this introduce the preliminary clean up toward that goal. The list of parsed pseudo types is now generated at compile time from the source in SelectorPseudoTypeMap.in. * DerivedSources.make: The mapping of strings to pseudo types is generated from SelectorPseudoTypeMap.in by the new script makeSelectorPseudoTypeMap.py. * WebCore.xcodeproj/project.pbxproj: * css/CSSGrammar.y.in: Split the parsing of Pseudo Types. Pseudo page get its own method. The others will need some work. * css/CSSParserValues.cpp: (WebCore::CSSParserSelector::parsePagePseudoSelector): (WebCore::CSSParserSelector::setPseudoTypeValue): * css/CSSParserValues.h: * css/CSSSelector.cpp: (WebCore::CSSSelector::specificityForPage): This is an example of invalid combination that is hidden by the current code. First, Left and Right could never appear in a pseudo class match. (WebCore::CSSSelector::pseudoId): (WebCore::CSSSelector::parsePseudoType): (WebCore::appendPseudoTypeTailIfNecessary): (WebCore::CSSSelector::selectorText): * css/CSSSelector.h: (WebCore::CSSSelector::pseudoType): (WebCore::CSSSelector::matchesPseudoElement): (WebCore::CSSSelector::setValue): (WebCore::CSSSelector::CSSSelector): * css/PageRuleCollector.cpp: (WebCore::checkPageSelectorComponents): * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): * css/SelectorPseudoTypeMap.h: Added. * css/SelectorPseudoTypeMap.in: Added. * css/makeSelectorPseudoTypeMap.py: Added. (enumerablePseudoType): (expand_ifdef_condition): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoType): Canonical link: https://commits.webkit.org/148023@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-03-10 21:00:26 +00:00
sys.exit(gperf_return)