<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[209826] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/209826">209826</a></dd>
<dt>Author</dt> <dd>hyatt@apple.com</dd>
<dt>Date</dt> <dd>2016-12-14 13:02:07 -0800 (Wed, 14 Dec 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>[CSS Parser] Implement deferred parsing of properties, @media, @supports and @keyframes
https://bugs.webkit.org/show_bug.cgi?id=165743
Reviewed by Dean Jackson.
Source/WebCore:
Added new tests in fast/css/deferred-parsing.
This patch implements deferred parsing in CSS. By default, when parsing
author stylesheets, the parser goes into a deferred mode where it leaves
the declaration block of all style rules unparsed initially. Instead of
creating and setting an ImmutableStyleProperties object on the StyleRule,
the parser creates a DeferredStyleProperties object instead that is
capable of calling into CSSDeferredParser to parse the properties and values
only when the properties are finally asked for.
In addition, this patch defers the parsing of the interior of @media,
@supports, and @keyframes rules. @media blocks that are never matched will
never parse any of the rules inside. @supports conditions for unsupported
features will also not be parsed. For @keyframes, if the animation is never
referenced/used, then the @keyframes child rules will never be parsed.
* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
Add CSSDeferredParser to the build.
* css/CSSFontFaceSet.cpp:
(WebCore::CSSFontFaceSet::matchingFaces):
Patched to drop the StyleSheetContents* argument from parseValue, since it
is no longer needed.
* css/CSSKeyframesRule.cpp:
(WebCore::StyleRuleKeyframes::StyleRuleKeyframes):
(WebCore::StyleRuleKeyframes::parseDeferredRulesIfNeeded):
(WebCore::StyleRuleKeyframes::keyframes):
(WebCore::StyleRuleKeyframes::wrapperAppendKeyframe):
(WebCore::StyleRuleKeyframes::wrapperRemoveKeyframe):
(WebCore::StyleRuleKeyframes::findKeyframeIndex):
* css/CSSKeyframesRule.h:
Keyframes now hold both a keyframes Vector and a DeferredStyleGroupRuleList
object. The keyframes vector won't be populated until it is needed, and the
population is done by DeferredStyleGroupRuleList, which holds both the original
tokens of the keyframes rule interior, and a references to the
CSSDeferredParser that will do the parsing.
* css/DOMCSSNamespace.cpp:
(WebCore::DOMCSSNamespace::supports):
Patched to drop the StyleSheetContents* argument from parseValue, since it
is no longer needed.
* css/ElementRuleCollector.cpp:
(WebCore::ElementRuleCollector::collectMatchingRulesForList):
ElementRuleCollector tests to see if a rule is empty by counting properties(),
but we don't want to initiate deferred parsing just to check this. Instead we
invoke propertiesWithoutDeferredParsing, which will hand back a nullptr if
the properties haven't been parsed yet. In order to ensure this optimization
continues to work, any rules whose interiors consist of only whitespace do
not get deferred.
* css/FontFace.cpp:
(WebCore::FontFace::setVariant):
* css/PropertySetCSSStyleDeclaration.cpp:
(WebCore::PropertySetCSSStyleDeclaration::setProperty):
(WebCore::PropertySetCSSStyleDeclaration::setPropertyInternal):
Patched to drop the StyleSheetContents* argument from parseValue, since it
is no longer needed.
* css/StyleProperties.cpp:
(WebCore::MutableStyleProperties::MutableStyleProperties):
(WebCore::MutableStyleProperties::setProperty):
(WebCore::DeferredStyleProperties::create):
(WebCore::DeferredStyleProperties::DeferredStyleProperties):
(WebCore::DeferredStyleProperties::~DeferredStyleProperties):
(WebCore::DeferredStyleProperties::parseDeferredProperties):
* css/StyleProperties.h:
(WebCore::StylePropertiesBase::type):
(WebCore::StylePropertiesBase::cssParserMode):
(WebCore::StylePropertiesBase::StylePropertiesBase):
(WebCore::StyleProperties::isMutable):
(WebCore::StyleProperties::StyleProperties):
(WebCore::StylePropertiesBase::deref):
(isType):
(WebCore::StyleProperties::cssParserMode): Deleted.
(WebCore::StyleProperties::deref): Deleted.
Right now StyleProperties has two subclasses, ImmutableStyleProperties (which
is created by the parser when not deferring), and MutableStyleProperties (used
when making changes and doing DOM Manipulations).
This patch adds a new base class called StylePropertiesBase, and StyleProperties
now derives from it. DeferredStyleProperties derives from this base. The members
of StyleProperties have been moved up into StylePropertiesBase.
The m_isMutable bit, used to determine the type for downcasting has been enhanced
to m_type (2 bits), since there are now three possible subclasses.
* css/StyleRule.cpp:
(WebCore::StyleRule::StyleRule):
(WebCore::StyleRule::properties):
(WebCore::StyleRule::mutableProperties):
(WebCore::StyleRule::splitIntoMultipleRulesWithMaximumSelectorComponentCount):
Patched to ensure that when properties() are accessed, that if the current
stored StylePropertyBase in the rule is a DeferredStyleProperties, we then
parse and replace DeferredStyleProperties with ImmutableStyleProperties on the
rule. By using a common base class, we avoid increasing memory usage in
StyleRule.
(WebCore::DeferredStyleGroupRuleList::create):
(WebCore::DeferredStyleGroupRuleList::DeferredStyleGroupRuleList):
(WebCore::DeferredStyleGroupRuleList::parseDeferredRules):
(WebCore::DeferredStyleGroupRuleList::parseDeferredKeyframes):
DeferredStyleGroupList is used to handle deferred parsing of objects with
child rules. These include @media, @supports and @keyframes.
(WebCore::StyleRuleGroup::StyleRuleGroup):
(WebCore::StyleRuleGroup::childRules):
(WebCore::StyleRuleGroup::wrapperInsertRule):
(WebCore::StyleRuleGroup::wrapperRemoveRule):
(WebCore::StyleRuleGroup::parseDeferredRulesIfNeeded):
(WebCore::StyleRuleMedia::StyleRuleMedia):
(WebCore::StyleRuleSupports::StyleRuleSupports):
StyleRuleGroup now holds both a child rules Vector and a
DeferredStyleGroupRuleList. If DeferredStyleGroupRuleList is set, then
when the childRules are finally accessed, we will populate the childRules
Vector and then null out the DeferredStyleGroupRuleList.
* css/StyleRule.h:
(WebCore::StyleRule::propertiesWithoutDeferredParsing):
(WebCore::StyleRuleGroup::childRulesWithoutDeferredParsing):
(WebCore::StyleRuleGroup::childRules): Deleted.
Add new accesors for fetching properties and child rules without causing
deferred parsing to happen.
* css/StyleSheetContents.cpp:
(WebCore::StyleSheetContents::parseAuthorStyleSheet):
(WebCore::StyleSheetContents::parseString):
Patched to turn on deferred parsing for author sheets and for all
non-UA stylesheets parsed from a string (e.g., <style>).
(WebCore::traverseSubresourcesInRules):
The broken resource check was aggressively accessing properties(). Patch
it to call propertiesWithoutDeferredParsing() instead so that it doesn't
defeat the new optimization.
* css/WebKitCSSMatrix.cpp:
(WebCore::WebKitCSSMatrix::setMatrixValue):
Patched to drop the StyleSheetContents* argument from parseValue, since it
is no longer needed.
* css/parser/CSSDeferredParser.cpp: Added.
(WebCore::CSSDeferredParser::CSSDeferredParser):
(WebCore::CSSDeferredParser::parseDeclaration):
(WebCore::CSSDeferredParser::parseRuleList):
(WebCore::CSSDeferredParser::parseKeyframeList):
* css/parser/CSSDeferredParser.h: Added.
(WebCore::CSSDeferredParser::create):
(WebCore::CSSDeferredParser::tokenizer):
(WebCore::CSSDeferredParser::mode):
(WebCore::CSSDeferredParser::context):
(WebCore::CSSDeferredParser::styleSheet):
The CSSDeferredParser. It caches the original tokenizer's' escaped strings. Because
the CSSDeferredParser is referenced by all the rules that have yet to parse,
it will stay alive until all rules in the stylesheet has been fully parsed.
The parser receives CSSParserTokenRanges from DeferredStyleProperties or
DeferredStyleGroupRuleList and feeds them to CSSParserImpl, which then
is able to do the parsing as it would have occurred originally had the
range not been deferred.
* css/parser/CSSParser.cpp:
(WebCore::CSSParser::parseSheet):
(WebCore::CSSParser::parseSupportsCondition):
(WebCore::CSSParser::parseSingleValue):
(WebCore::CSSParser::parseValue):
* css/parser/CSSParser.h:
* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
(WebCore::parseKeywordValue):
(WebCore::CSSParserFastPaths::maybeParseValue):
* css/parser/CSSParserFastPaths.h:
Drop the StyleSheetContents* argument from the methods that no longer need
them.
* css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::CSSParserImpl):
(WebCore::CSSParserImpl::tokenizer):
(WebCore::CSSParserImpl::parseValue):
(WebCore::CSSParserImpl::parseCustomPropertyValue):
(WebCore::CSSParserImpl::parseDeclarationList):
(WebCore::CSSParserImpl::parseInlineStyleDeclaration):
(WebCore::CSSParserImpl::parseRule):
(WebCore::CSSParserImpl::parseStyleSheet):
(WebCore::CSSParserImpl::parseDeclarationListForInspector):
(WebCore::CSSParserImpl::parseStyleSheetForInspector):
(WebCore::CSSParserImpl::consumeQualifiedRule):
(WebCore::CSSParserImpl::consumeMediaRule):
(WebCore::CSSParserImpl::consumeSupportsRule):
(WebCore::CSSParserImpl::consumeKeyframesRule):
(WebCore::CSSParserImpl::consumeStyleRule):
Drop the StyleSheetContents* argument from the methods that no longer need
them.
(WebCore::CSSParserImpl::createDeferredStyleProperties):
(WebCore::CSSParserImpl::parseDeferredDeclaration):
(WebCore::CSSParserImpl::parseDeferredRuleList):
(WebCore::CSSParserImpl::parseDeferredKeyframeList):
The methods that handle deferred parsing. They make sure to initialize
new CSSParserImpls with the original deferred parser, and then call existing
methods to do the parsing.
* css/parser/CSSParserImpl.h:
Patched to remove StyleSheetContents* arguments from some methods and
to add the new deferred parsing methods.
* css/parser/CSSParserTokenRange.cpp:
(WebCore::CSSParserTokenRange::consumeBlockCheckingForEditability):
* css/parser/CSSParserTokenRange.h:
In order to preserve the editability optimization from <a href="http://trac.webkit.org/projects/webkit/changeset/180867">r180867</a>, when
a style rule's block is consumed, we use a special method that looks
for -webkit-user-modify tokens. If one is seen, then the editability
optimization is turned off. Because we do this at the token level,
the optimization keeps working even if properties don't get parsed.
* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::parseSingleValue):
(WebCore::CSSPropertyParser::parseFontFaceDescriptor):
(WebCore::CSSPropertyParser::consumeFont):
(WebCore::CSSPropertyParser::parseShorthand):
Patched to remove StyleSheetContents* arguments now that the editability
check is in CSSTokenizer instead.
* css/parser/CSSTokenizer.cpp:
(WebCore::CSSTokenizer::tokenRange):
* css/parser/CSSTokenizer.h:
Make tokenRange() const.
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::setFont):
Patched to drop the StyleSheetContents* argument.
* testing/Internals.cpp:
(WebCore::deferredStyleRulesCountForList):
(WebCore::Internals::deferredStyleRulesCount):
(WebCore::deferredGroupRulesCountForList):
(WebCore::Internals::deferredGroupRulesCount):
(WebCore::deferredKeyframesRulesCountForList):
(WebCore::Internals::deferredKeyframesRulesCount):
* testing/Internals.h:
* testing/Internals.idl:
Add new testing methods that can count the deferred style rules and
group child rule lists. These methods are used by the new layout tests.
Source/WebKit2:
Repurpose the newCSSParserEnabled preference for deferred parsing. Just change the name
from "new" to "deferred."
* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetDeferredCSSParserEnabled):
(WKPreferencesGetDeferredCSSParserEnabled):
(WKPreferencesSetNewCSSParserEnabled): Deleted.
(WKPreferencesGetNewCSSParserEnabled): Deleted.
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):
LayoutTests:
* fast/css/deferred-parsing: Added.
* fast/css/deferred-parsing/dynamic-external-style-expected.txt: Added.
* fast/css/deferred-parsing/dynamic-external-style.html: Added.
* fast/css/deferred-parsing/dynamic-style-in-document-expected.txt: Added.
* fast/css/deferred-parsing/dynamic-style-in-document.html: Added.
* fast/css/deferred-parsing/hover-test-expected.txt: Added.
* fast/css/deferred-parsing/hover-test.html: Added.
* fast/css/deferred-parsing/keyframes-rule-expected.txt: Added.
* fast/css/deferred-parsing/keyframes-rule.html: Added.
* fast/css/deferred-parsing/media-print-expected.txt: Added.
* fast/css/deferred-parsing/media-print.html: Added.
* fast/css/deferred-parsing/nth-of-type-expected.txt: Added.
* fast/css/deferred-parsing/nth-of-type.html: Added.
* fast/css/deferred-parsing/resources: Added.
* fast/css/deferred-parsing/resources/basic-sheet.css: Added.
* fast/css/deferred-parsing/simple-external-style-expected.txt: Added.
* fast/css/deferred-parsing/simple-external-style.html: Added.
* fast/css/deferred-parsing/simple-style-in-document-expected.txt: Added.
* fast/css/deferred-parsing/simple-style-in-document.html: Added.
* fast/css/deferred-parsing/supports-rule-expected.txt: Added.
* fast/css/deferred-parsing/supports-rule.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorTestExpectations">trunk/LayoutTests/platform/ios-simulator/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorwk1TestExpectations">trunk/LayoutTests/platform/ios-simulator-wk1/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorwk2TestExpectations">trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorecssCSSFontFaceSetcpp">trunk/Source/WebCore/css/CSSFontFaceSet.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSKeyframesRulecpp">trunk/Source/WebCore/css/CSSKeyframesRule.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSKeyframesRuleh">trunk/Source/WebCore/css/CSSKeyframesRule.h</a></li>
<li><a href="#trunkSourceWebCorecssDOMCSSNamespacecpp">trunk/Source/WebCore/css/DOMCSSNamespace.cpp</a></li>
<li><a href="#trunkSourceWebCorecssElementRuleCollectorcpp">trunk/Source/WebCore/css/ElementRuleCollector.cpp</a></li>
<li><a href="#trunkSourceWebCorecssFontFacecpp">trunk/Source/WebCore/css/FontFace.cpp</a></li>
<li><a href="#trunkSourceWebCorecssPropertySetCSSStyleDeclarationcpp">trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStylePropertiescpp">trunk/Source/WebCore/css/StyleProperties.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStylePropertiesh">trunk/Source/WebCore/css/StyleProperties.h</a></li>
<li><a href="#trunkSourceWebCorecssStyleRulecpp">trunk/Source/WebCore/css/StyleRule.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStyleRuleh">trunk/Source/WebCore/css/StyleRule.h</a></li>
<li><a href="#trunkSourceWebCorecssStyleSheetContentscpp">trunk/Source/WebCore/css/StyleSheetContents.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStyleSheetContentsh">trunk/Source/WebCore/css/StyleSheetContents.h</a></li>
<li><a href="#trunkSourceWebCorecssWebKitCSSMatrixcpp">trunk/Source/WebCore/css/WebKitCSSMatrix.cpp</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSParsercpp">trunk/Source/WebCore/css/parser/CSSParser.cpp</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSParserh">trunk/Source/WebCore/css/parser/CSSParser.h</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSParserFastPathscpp">trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSParserFastPathsh">trunk/Source/WebCore/css/parser/CSSParserFastPaths.h</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSParserImplcpp">trunk/Source/WebCore/css/parser/CSSParserImpl.cpp</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSParserImplh">trunk/Source/WebCore/css/parser/CSSParserImpl.h</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSParserModeh">trunk/Source/WebCore/css/parser/CSSParserMode.h</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSParserTokenRangecpp">trunk/Source/WebCore/css/parser/CSSParserTokenRange.cpp</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSParserTokenRangeh">trunk/Source/WebCore/css/parser/CSSParserTokenRange.h</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSPropertyParsercpp">trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSTokenizercpp">trunk/Source/WebCore/css/parser/CSSTokenizer.cpp</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSTokenizerh">trunk/Source/WebCore/css/parser/CSSTokenizer.h</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasCanvasRenderingContext2Dcpp">trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp</a></li>
<li><a href="#trunkSourceWebCorepageSettingsin">trunk/Source/WebCore/page/Settings.in</a></li>
<li><a href="#trunkSourceWebCoretestingInternalSettingscpp">trunk/Source/WebCore/testing/InternalSettings.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingInternalSettingsh">trunk/Source/WebCore/testing/InternalSettings.h</a></li>
<li><a href="#trunkSourceWebCoretestingInternalSettingsidl">trunk/Source/WebCore/testing/InternalSettings.idl</a></li>
<li><a href="#trunkSourceWebCoretestingInternalscpp">trunk/Source/WebCore/testing/Internals.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingInternalsh">trunk/Source/WebCore/testing/Internals.h</a></li>
<li><a href="#trunkSourceWebCoretestingInternalsidl">trunk/Source/WebCore/testing/Internals.idl</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedWebPreferencesDefinitionsh">trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKPreferencescpp">trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKPreferencesRefPrivateh">trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li>trunk/LayoutTests/fast/css/deferred-parsing/</li>
<li><a href="#trunkLayoutTestsfastcssdeferredparsingdynamicexternalstyleexpectedtxt">trunk/LayoutTests/fast/css/deferred-parsing/dynamic-external-style-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcssdeferredparsingdynamicexternalstylehtml">trunk/LayoutTests/fast/css/deferred-parsing/dynamic-external-style.html</a></li>
<li><a href="#trunkLayoutTestsfastcssdeferredparsingdynamicstyleindocumentexpectedtxt">trunk/LayoutTests/fast/css/deferred-parsing/dynamic-style-in-document-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcssdeferredparsingdynamicstyleindocumenthtml">trunk/LayoutTests/fast/css/deferred-parsing/dynamic-style-in-document.html</a></li>
<li><a href="#trunkLayoutTestsfastcssdeferredparsinghovertestexpectedtxt">trunk/LayoutTests/fast/css/deferred-parsing/hover-test-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcssdeferredparsinghovertesthtml">trunk/LayoutTests/fast/css/deferred-parsing/hover-test.html</a></li>
<li><a href="#trunkLayoutTestsfastcssdeferredparsingkeyframesruleexpectedtxt">trunk/LayoutTests/fast/css/deferred-parsing/keyframes-rule-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcssdeferredparsingkeyframesrulehtml">trunk/LayoutTests/fast/css/deferred-parsing/keyframes-rule.html</a></li>
<li><a href="#trunkLayoutTestsfastcssdeferredparsingmediaprintexpectedtxt">trunk/LayoutTests/fast/css/deferred-parsing/media-print-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcssdeferredparsingmediaprinthtml">trunk/LayoutTests/fast/css/deferred-parsing/media-print.html</a></li>
<li><a href="#trunkLayoutTestsfastcssdeferredparsingnthoftypeexpectedtxt">trunk/LayoutTests/fast/css/deferred-parsing/nth-of-type-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcssdeferredparsingnthoftypehtml">trunk/LayoutTests/fast/css/deferred-parsing/nth-of-type.html</a></li>
<li>trunk/LayoutTests/fast/css/deferred-parsing/resources/</li>
<li><a href="#trunkLayoutTestsfastcssdeferredparsingresourcesbasicsheetcss">trunk/LayoutTests/fast/css/deferred-parsing/resources/basic-sheet.css</a></li>
<li><a href="#trunkLayoutTestsfastcssdeferredparsingsimpleexternalstyleexpectedtxt">trunk/LayoutTests/fast/css/deferred-parsing/simple-external-style-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcssdeferredparsingsimpleexternalstylehtml">trunk/LayoutTests/fast/css/deferred-parsing/simple-external-style.html</a></li>
<li><a href="#trunkLayoutTestsfastcssdeferredparsingsimplestyleindocumentexpectedtxt">trunk/LayoutTests/fast/css/deferred-parsing/simple-style-in-document-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcssdeferredparsingsimplestyleindocumenthtml">trunk/LayoutTests/fast/css/deferred-parsing/simple-style-in-document.html</a></li>
<li><a href="#trunkLayoutTestsfastcssdeferredparsingsupportsruleexpectedtxt">trunk/LayoutTests/fast/css/deferred-parsing/supports-rule-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcssdeferredparsingsupportsrulehtml">trunk/LayoutTests/fast/css/deferred-parsing/supports-rule.html</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSDeferredParsercpp">trunk/Source/WebCore/css/parser/CSSDeferredParser.cpp</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSDeferredParserh">trunk/Source/WebCore/css/parser/CSSDeferredParser.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/LayoutTests/ChangeLog        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2016-12-14 Dave Hyatt <hyatt@apple.com>
+
+ [CSS Parser] Implement deferred parsing of properties, @media, @supports and @keyframes
+ https://bugs.webkit.org/show_bug.cgi?id=165743
+
+ Reviewed by Dean Jackson.
+
+ * fast/css/deferred-parsing: Added.
+ * fast/css/deferred-parsing/dynamic-external-style-expected.txt: Added.
+ * fast/css/deferred-parsing/dynamic-external-style.html: Added.
+ * fast/css/deferred-parsing/dynamic-style-in-document-expected.txt: Added.
+ * fast/css/deferred-parsing/dynamic-style-in-document.html: Added.
+ * fast/css/deferred-parsing/hover-test-expected.txt: Added.
+ * fast/css/deferred-parsing/hover-test.html: Added.
+ * fast/css/deferred-parsing/keyframes-rule-expected.txt: Added.
+ * fast/css/deferred-parsing/keyframes-rule.html: Added.
+ * fast/css/deferred-parsing/media-print-expected.txt: Added.
+ * fast/css/deferred-parsing/media-print.html: Added.
+ * fast/css/deferred-parsing/nth-of-type-expected.txt: Added.
+ * fast/css/deferred-parsing/nth-of-type.html: Added.
+ * fast/css/deferred-parsing/resources: Added.
+ * fast/css/deferred-parsing/resources/basic-sheet.css: Added.
+ * fast/css/deferred-parsing/simple-external-style-expected.txt: Added.
+ * fast/css/deferred-parsing/simple-external-style.html: Added.
+ * fast/css/deferred-parsing/simple-style-in-document-expected.txt: Added.
+ * fast/css/deferred-parsing/simple-style-in-document.html: Added.
+ * fast/css/deferred-parsing/supports-rule-expected.txt: Added.
+ * fast/css/deferred-parsing/supports-rule.html: Added.
+
</ins><span class="cx"> 2016-12-14 Daniel Bates <dabates@apple.com>
</span><span class="cx">
</span><span class="cx"> CSP: Allow HTTPS URL to match HTTP source expression
</span></span></pre></div>
<a id="trunkLayoutTestsfastcssdeferredparsingdynamicexternalstyleexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/deferred-parsing/dynamic-external-style-expected.txt (0 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/deferred-parsing/dynamic-external-style-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/css/deferred-parsing/dynamic-external-style-expected.txt        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+This tests deferred parsing of CSS style rules.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+PASS internals.deferredStyleRulesCount(document.styleSheets[0]) is 2
+PASS internals.deferredStyleRulesCount(document.styleSheets[0]) is 1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssdeferredparsingdynamicexternalstylehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/deferred-parsing/dynamic-external-style.html (0 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/deferred-parsing/dynamic-external-style.html         (rev 0)
+++ trunk/LayoutTests/fast/css/deferred-parsing/dynamic-external-style.html        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+
+<html>
+ <head id="head">
+ <script>
+ if (window.internals && window.internals.settings)
+ window.internals.settings.setDeferredCSSParserEnabled(true);
+ </script>
+ <link rel=stylesheet type="text/css" href="resources/basic-sheet.css?2">
+ <script src="../../../resources/js-test-pre.js"></script>
+ </head>
+ <body>
+ <script>
+ document.body.offsetWidth;
+
+ description("This tests deferred parsing of CSS style rules.");
+
+ debug('');
+
+ if (window.internals)
+ shouldBe("internals.deferredStyleRulesCount(document.styleSheets[0])", "2");
+
+ var elt = document.createElement("div")
+ elt.setAttribute("id", "unknown")
+
+ document.body.appendChild(elt)
+ document.body.offsetWidth;
+
+ if (window.internals)
+ shouldBe("internals.deferredStyleRulesCount(document.styleSheets[0])", "1");
+
+ </script>
+
+ <script src="../../../resources/js-test-post.js"></script>
+ </body>
+</html>
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssdeferredparsingdynamicstyleindocumentexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/deferred-parsing/dynamic-style-in-document-expected.txt (0 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/deferred-parsing/dynamic-style-in-document-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/css/deferred-parsing/dynamic-style-in-document-expected.txt        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+This tests deferred parsing of CSS style rules.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+PASS internals.deferredStyleRulesCount(document.styleSheets[0]) is 2
+PASS internals.deferredStyleRulesCount(document.styleSheets[0]) is 1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssdeferredparsingdynamicstyleindocumenthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/deferred-parsing/dynamic-style-in-document.html (0 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/deferred-parsing/dynamic-style-in-document.html         (rev 0)
+++ trunk/LayoutTests/fast/css/deferred-parsing/dynamic-style-in-document.html        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -0,0 +1,52 @@
</span><ins>+<html>
+<head id="head">
+<script>
+ if (window.internals && window.internals.settings)
+ window.internals.settings.setDeferredCSSParserEnabled(true);
+</script>
+<style>
+/* This rule should parse. */
+body {
+ color: black;
+}
+
+/* This rule should parse because it is empty. */
+.unknown {
+
+}
+
+/* This rule should not parse. */
+div#unknown {
+ color:red;
+}
+
+/* This rule should not parse. */
+faketag {
+ color:lime;
+ background-color:blue;
+ border:10px solid white;
+}
+</style>
+<script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+document.body.offsetWidth;
+
+description("This tests deferred parsing of CSS style rules.");
+
+debug('');
+
+if (window.internals)
+ shouldBe("internals.deferredStyleRulesCount(document.styleSheets[0])", "2");
+</script>
+<div id="unknown"></div>
+<script>
+document.body.offsetWidth;
+if (window.internals)
+ shouldBe("internals.deferredStyleRulesCount(document.styleSheets[0])", "1");
+</script>
+
+<script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssdeferredparsinghovertestexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/deferred-parsing/hover-test-expected.txt (0 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/deferred-parsing/hover-test-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/css/deferred-parsing/hover-test-expected.txt        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+Test that deferred parsing doesn't parse the :hover rule until the hover happens.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS internals.deferredStyleRulesCount(document.styleSheets[0]) is 1
+PASS internals.deferredStyleRulesCount(document.styleSheets[0]) is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssdeferredparsinghovertesthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/deferred-parsing/hover-test.html (0 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/deferred-parsing/hover-test.html         (rev 0)
+++ trunk/LayoutTests/fast/css/deferred-parsing/hover-test.html        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.internals && window.internals.settings)
+ window.internals.settings.setDeferredCSSParserEnabled(true);
+</script>
+<style>
+ #test {
+ font: "ahem";
+ font-size: 50px;
+ display: block;
+ color: red;
+ }
+ a:hover #test {
+ color: rgb(0, 255, 0);
+ }
+ </style>
+ <script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+ <div id="container">
+ <a href="#">
+ <span id="test">This text should be green when hovered.</span>
+ </a>
+</div>
+</body>
+
+<script src="../../resources/js-test-pre.js"></script>
+<script>
+ if (window.testRunner) {
+ description("Test that deferred parsing doesn't parse the :hover rule until the hover happens.")
+ var test = document.getElementById('test');
+ var container = document.getElementById('container');
+ test.offsetTop;
+ if (window.internals)
+ shouldBe("internals.deferredStyleRulesCount(document.styleSheets[0])", "1");
+ eventSender.mouseMoveTo(50, container.offsetTop + 25)
+ test.offsetTop;
+ if (window.internals)
+ shouldBe("internals.deferredStyleRulesCount(document.styleSheets[0])", "0");
+ container.parentNode.removeChild(container); // clean up after ourselves.
+ }
+ successfullyParsed = true;
+</script>
+<script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssdeferredparsingkeyframesruleexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/deferred-parsing/keyframes-rule-expected.txt (0 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/deferred-parsing/keyframes-rule-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/css/deferred-parsing/keyframes-rule-expected.txt        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+This tests deferred parsing of CSS style rules.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+PASS internals.deferredStyleRulesCount(document.styleSheets[0]) is 0
+PASS internals.deferredKeyframesRulesCount(document.styleSheets[0]) is 1
+PASS internals.deferredKeyframesRulesCount(document.styleSheets[0]) is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssdeferredparsingkeyframesrulehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/deferred-parsing/keyframes-rule.html (0 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/deferred-parsing/keyframes-rule.html         (rev 0)
+++ trunk/LayoutTests/fast/css/deferred-parsing/keyframes-rule.html        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+<html>
+<head id="head">
+<script>
+if (window.internals && window.internals.settings)
+ window.internals.settings.setDeferredCSSParserEnabled(true);
+</script>
+<style>
+/* The keyframe won't parse at all until we access its keyframes below. */
+@keyframes anim {
+ from {
+ color: green;
+ }
+}
+</style>
+</style>
+<script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body >
+<script>
+
+document.body.offsetWidth;
+
+description("This tests deferred parsing of CSS style rules.");
+
+debug('');
+
+if (window.internals) {
+ shouldBe("internals.deferredStyleRulesCount(document.styleSheets[0])", "0");
+ shouldBe("internals.deferredKeyframesRulesCount(document.styleSheets[0])", "1");
+}
+
+var keyframes = document.styleSheets[0].cssRules[0].keyframes
+
+if (window.internals)
+ shouldBe("internals.deferredKeyframesRulesCount(document.styleSheets[0])", "0");
+</script>
+
+<script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssdeferredparsingmediaprintexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/deferred-parsing/media-print-expected.txt (0 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/deferred-parsing/media-print-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/css/deferred-parsing/media-print-expected.txt        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+This tests deferred parsing of CSS style rules.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+PASS internals.deferredStyleRulesCount(document.styleSheets[0]) is 0
+PASS internals.deferredGroupRulesCount(document.styleSheets[0]) is 1
+PASS internals.deferredGroupRulesCount(document.styleSheets[0]) is 0
+PASS internals.deferredStyleRulesCount(document.styleSheets[0]) is 3
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssdeferredparsingmediaprinthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/deferred-parsing/media-print.html (0 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/deferred-parsing/media-print.html         (rev 0)
+++ trunk/LayoutTests/fast/css/deferred-parsing/media-print.html        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -0,0 +1,59 @@
</span><ins>+<html>
+<head id="head">
+<script>
+if (window.internals && window.internals.settings)
+ window.internals.settings.setDeferredCSSParserEnabled(true);
+</script>
+<style>
+/* The media block won't parse at all until we access cssRules below. */
+@media print {
+ /* This rule should not parse, since it's inside print media. */
+ body {
+ color: black;
+ }
+
+ /* This rule should parse because it is empty. */
+ .unknown {
+
+ }
+
+ /* This rule should not parse. */
+ div#unknown {
+ color:red;
+ }
+
+ /* This rule should not parse. */
+ faketag {
+ color:lime;
+ background-color:blue;
+ border:10px solid white;
+ }
+}
+</style>
+<script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body >
+<script>
+
+document.body.offsetWidth;
+
+description("This tests deferred parsing of CSS style rules.");
+
+debug('');
+
+if (window.internals) {
+ shouldBe("internals.deferredStyleRulesCount(document.styleSheets[0])", "0");
+ shouldBe("internals.deferredGroupRulesCount(document.styleSheets[0])", "1");
+}
+
+var mediaRules = document.styleSheets[0].cssRules[0].cssRules
+
+if (window.internals) {
+ shouldBe("internals.deferredGroupRulesCount(document.styleSheets[0])", "0");
+ shouldBe("internals.deferredStyleRulesCount(document.styleSheets[0])", "3");
+}
+</script>
+
+<script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssdeferredparsingnthoftypeexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/deferred-parsing/nth-of-type-expected.txt (0 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/deferred-parsing/nth-of-type-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/css/deferred-parsing/nth-of-type-expected.txt        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+This tests deferred parsing of CSS :nth-of-type style rules where some are invalid.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+PASS document.styleSheets[0].cssRules.length is 4
+PASS internals.deferredStyleRulesCount(document.styleSheets[0]) is 4
+PASS internals.deferredStyleRulesCount(document.styleSheets[0]) is 2
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssdeferredparsingnthoftypehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/deferred-parsing/nth-of-type.html (0 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/deferred-parsing/nth-of-type.html         (rev 0)
+++ trunk/LayoutTests/fast/css/deferred-parsing/nth-of-type.html        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+<html>
+<head id="head">
+<script>
+if (window.internals && window.internals.settings)
+ window.internals.settings.setDeferredCSSParserEnabled(true);
+</script>
+ <style>
+ /* The red rules are invalid, leaving 4 valid rules. They should all be unparsed */
+
+ span.c1:nth-of-type(2n + 1){ color: red; }
+ span.c1:nth-of-type(2n - 2){ color: green; }
+ span.c2:nth-of-type(odd){ color: red; }
+ span.c2:nth-of-type(even){ color: green; }
+ span.c3:nth-of-type(n3){ color: red; }
+ span.c3:nth-of-type(foo){ color: green; }
+ span.c4:nth-of-type(2n3){ color: red; }
+ span.c4:nth-of-type(foon + bar ){ color: green; }
+
+ </style>
+<script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+ <span></span>
+
+<script>
+document.body.offsetWidth;
+
+description("This tests deferred parsing of CSS :nth-of-type style rules where some are invalid.");
+
+debug('');
+
+shouldBe("document.styleSheets[0].cssRules.length", "4");
+if (window.internals)
+ shouldBe("internals.deferredStyleRulesCount(document.styleSheets[0])", "4");
+</script>
+
+<span class="c1 c2"></span>
+
+<script>
+ document.body.offsetWidth;
+ if (window.internals)
+ shouldBe("internals.deferredStyleRulesCount(document.styleSheets[0])", "2");
+</script>
+<script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssdeferredparsingresourcesbasicsheetcss"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/deferred-parsing/resources/basic-sheet.css (0 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/deferred-parsing/resources/basic-sheet.css         (rev 0)
+++ trunk/LayoutTests/fast/css/deferred-parsing/resources/basic-sheet.css        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+/* This rule should parse. */
+body {
+ color: black;
+}
+
+/* This rule should parse because it is empty. */
+.unknown {
+
+}
+
+/* This rule should not parse. */
+div#unknown {
+ color:red;
+}
+
+/* This rule should not parse. */
+quote {
+ color:lime;
+ background-color:blue;
+ border:10px solid white;
+}
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssdeferredparsingsimpleexternalstyleexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/deferred-parsing/simple-external-style-expected.txt (0 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/deferred-parsing/simple-external-style-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/css/deferred-parsing/simple-external-style-expected.txt        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+This tests deferred parsing of CSS style rules.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+PASS internals.deferredStyleRulesCount(document.styleSheets[0]) is 2
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssdeferredparsingsimpleexternalstylehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/deferred-parsing/simple-external-style.html (0 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/deferred-parsing/simple-external-style.html         (rev 0)
+++ trunk/LayoutTests/fast/css/deferred-parsing/simple-external-style.html        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+<html>
+<head id="head">
+<script>
+if (window.internals && window.internals.settings)
+ window.internals.settings.setDeferredCSSParserEnabled(true);
+</script>
+<link rel=stylesheet type="text/css" href="resources/basic-sheet.css?1">
+<script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body >
+<script>
+
+document.body.offsetWidth;
+
+description("This tests deferred parsing of CSS style rules.");
+
+debug('');
+
+if (window.internals)
+ shouldBe("internals.deferredStyleRulesCount(document.styleSheets[0])", "2");
+
+</script>
+
+<script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssdeferredparsingsimplestyleindocumentexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/deferred-parsing/simple-style-in-document-expected.txt (0 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/deferred-parsing/simple-style-in-document-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/css/deferred-parsing/simple-style-in-document-expected.txt        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+This tests deferred parsing of CSS style rules.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+PASS internals.deferredStyleRulesCount(document.styleSheets[0]) is 2
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssdeferredparsingsimplestyleindocumenthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/deferred-parsing/simple-style-in-document.html (0 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/deferred-parsing/simple-style-in-document.html         (rev 0)
+++ trunk/LayoutTests/fast/css/deferred-parsing/simple-style-in-document.html        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+<html>
+<head id="head">
+<script>
+if (window.internals && window.internals.settings)
+ window.internals.settings.setDeferredCSSParserEnabled(true);
+</script>
+<style>
+/* This rule should parse. */
+body {
+ color: black;
+}
+
+/* This rule should parse because it is empty. */
+.unknown {
+
+}
+
+/* This rule should not parse. */
+div#unknown {
+ color:red;
+}
+
+/* This rule should not parse. */
+faketag {
+ color:lime;
+ background-color:blue;
+ border:10px solid white;
+}
+</style>
+<script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+document.body.offsetWidth;
+
+description("This tests deferred parsing of CSS style rules.");
+
+debug('');
+
+if (window.internals)
+ shouldBe("internals.deferredStyleRulesCount(document.styleSheets[0])", "2");
+</script>
+<script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssdeferredparsingsupportsruleexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/deferred-parsing/supports-rule-expected.txt (0 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/deferred-parsing/supports-rule-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/css/deferred-parsing/supports-rule-expected.txt        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+This tests deferred parsing of CSS style rules.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+PASS internals.deferredStyleRulesCount(document.styleSheets[0]) is 0
+PASS internals.deferredGroupRulesCount(document.styleSheets[0]) is 1
+PASS internals.deferredGroupRulesCount(document.styleSheets[0]) is 0
+PASS internals.deferredStyleRulesCount(document.styleSheets[0]) is 3
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssdeferredparsingsupportsrulehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/deferred-parsing/supports-rule.html (0 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/deferred-parsing/supports-rule.html         (rev 0)
+++ trunk/LayoutTests/fast/css/deferred-parsing/supports-rule.html        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+<html>
+<head id="head">
+<script>
+if (window.internals && window.internals.settings)
+ window.internals.settings.setDeferredCSSParserEnabled(true);
+</script>
+<style>
+/* The support won't parse at all until we access cssRules below. */
+@supports (madeup:madeup) {
+ /* This rule should not parse, since it's inside print media. */
+ body {
+ color: black;
+ }
+
+ /* This rule should parse because it is empty. */
+ .unknown {
+
+ }
+
+ /* This rule should not parse. */
+ div#unknown {
+ color:red;
+ }
+
+ /* This rule should not parse. */
+ faketag {
+ color:lime;
+ background-color:blue;
+ border:10px solid white;
+ }
+}
+</style>
+<script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body >
+<script>
+document.body.offsetWidth;
+
+description("This tests deferred parsing of CSS style rules.");
+
+debug('');
+
+if (window.internals) {
+ shouldBe("internals.deferredStyleRulesCount(document.styleSheets[0])", "0");
+ shouldBe("internals.deferredGroupRulesCount(document.styleSheets[0])", "1");
+}
+
+var mediaRules = document.styleSheets[0].cssRules[0].cssRules
+
+if (window.internals) {
+ shouldBe("internals.deferredGroupRulesCount(document.styleSheets[0])", "0");
+ shouldBe("internals.deferredStyleRulesCount(document.styleSheets[0])", "3");
+}
+</script>
+
+<script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator/TestExpectations        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -2755,3 +2755,6 @@
</span><span class="cx"> fast/selectors/040.html
</span><span class="cx">
</span><span class="cx"> webkit.org/b/165691 http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-iframe-in-main-frame.html [ Pass Failure ]
</span><ins>+
+fast/css/deferred-parsing/hover-test.html [ Skip ]
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorwk1TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator-wk1/TestExpectations (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator-wk1/TestExpectations        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/LayoutTests/platform/ios-simulator-wk1/TestExpectations        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -1885,3 +1885,7 @@
</span><span class="cx"> imported/blink/imported/csswg-test/css-writing-modes-3/block-embed-001.html [ Pass ImageOnlyFailure ]
</span><span class="cx"> imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.html [ Crash Pass ]
</span><span class="cx"> imported/mozilla/svg/text/clipPath-content.svg [ Pass ImageOnlyFailure ]
</span><ins>+
+# Hover test does not apply
+fast/css/deferred-parsing/hover-test.html [ Skip ]
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorwk2TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -1920,3 +1920,7 @@
</span><span class="cx"> webkit.org/b/165165 [ Release ] http/tests/security/contentSecurityPolicy/1.1/scriptnonce-invalidnonce.html [ Pass Timeout ]
</span><span class="cx">
</span><span class="cx"> webkit.org/b/165344 [ Release ] http/tests/security/module-incorrect-mime-types.html [ Pass Timeout ]
</span><ins>+
+# Hover test does not apply
+fast/css/deferred-parsing/hover-test.html [ Skip ]
+
</ins></span></pre></div>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/CMakeLists.txt        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -1368,6 +1368,7 @@
</span><span class="cx"> css/WebKitCSSViewportRule.cpp
</span><span class="cx">
</span><span class="cx"> css/parser/CSSAtRuleID.cpp
</span><ins>+ css/parser/CSSDeferredParser.cpp
</ins><span class="cx"> css/parser/CSSParser.cpp
</span><span class="cx"> css/parser/CSSParserFastPaths.cpp
</span><span class="cx"> css/parser/CSSParserIdioms.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/ChangeLog        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -1,3 +1,255 @@
</span><ins>+2016-12-14 Dave Hyatt <hyatt@apple.com>
+
+ [CSS Parser] Implement deferred parsing of properties, @media, @supports and @keyframes
+ https://bugs.webkit.org/show_bug.cgi?id=165743
+
+ Reviewed by Dean Jackson.
+
+ Added new tests in fast/css/deferred-parsing.
+
+ This patch implements deferred parsing in CSS. By default, when parsing
+ author stylesheets, the parser goes into a deferred mode where it leaves
+ the declaration block of all style rules unparsed initially. Instead of
+ creating and setting an ImmutableStyleProperties object on the StyleRule,
+ the parser creates a DeferredStyleProperties object instead that is
+ capable of calling into CSSDeferredParser to parse the properties and values
+ only when the properties are finally asked for.
+
+ In addition, this patch defers the parsing of the interior of @media,
+ @supports, and @keyframes rules. @media blocks that are never matched will
+ never parse any of the rules inside. @supports conditions for unsupported
+ features will also not be parsed. For @keyframes, if the animation is never
+ referenced/used, then the @keyframes child rules will never be parsed.
+
+ * CMakeLists.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ Add CSSDeferredParser to the build.
+
+ * css/CSSFontFaceSet.cpp:
+ (WebCore::CSSFontFaceSet::matchingFaces):
+ Patched to drop the StyleSheetContents* argument from parseValue, since it
+ is no longer needed.
+
+ * css/CSSKeyframesRule.cpp:
+ (WebCore::StyleRuleKeyframes::StyleRuleKeyframes):
+ (WebCore::StyleRuleKeyframes::parseDeferredRulesIfNeeded):
+ (WebCore::StyleRuleKeyframes::keyframes):
+ (WebCore::StyleRuleKeyframes::wrapperAppendKeyframe):
+ (WebCore::StyleRuleKeyframes::wrapperRemoveKeyframe):
+ (WebCore::StyleRuleKeyframes::findKeyframeIndex):
+ * css/CSSKeyframesRule.h:
+ Keyframes now hold both a keyframes Vector and a DeferredStyleGroupRuleList
+ object. The keyframes vector won't be populated until it is needed, and the
+ population is done by DeferredStyleGroupRuleList, which holds both the original
+ tokens of the keyframes rule interior, and a references to the
+ CSSDeferredParser that will do the parsing.
+
+ * css/DOMCSSNamespace.cpp:
+ (WebCore::DOMCSSNamespace::supports):
+ Patched to drop the StyleSheetContents* argument from parseValue, since it
+ is no longer needed.
+
+ * css/ElementRuleCollector.cpp:
+ (WebCore::ElementRuleCollector::collectMatchingRulesForList):
+ ElementRuleCollector tests to see if a rule is empty by counting properties(),
+ but we don't want to initiate deferred parsing just to check this. Instead we
+ invoke propertiesWithoutDeferredParsing, which will hand back a nullptr if
+ the properties haven't been parsed yet. In order to ensure this optimization
+ continues to work, any rules whose interiors consist of only whitespace do
+ not get deferred.
+
+ * css/FontFace.cpp:
+ (WebCore::FontFace::setVariant):
+ * css/PropertySetCSSStyleDeclaration.cpp:
+ (WebCore::PropertySetCSSStyleDeclaration::setProperty):
+ (WebCore::PropertySetCSSStyleDeclaration::setPropertyInternal):
+ Patched to drop the StyleSheetContents* argument from parseValue, since it
+ is no longer needed.
+
+ * css/StyleProperties.cpp:
+ (WebCore::MutableStyleProperties::MutableStyleProperties):
+ (WebCore::MutableStyleProperties::setProperty):
+ (WebCore::DeferredStyleProperties::create):
+ (WebCore::DeferredStyleProperties::DeferredStyleProperties):
+ (WebCore::DeferredStyleProperties::~DeferredStyleProperties):
+ (WebCore::DeferredStyleProperties::parseDeferredProperties):
+ * css/StyleProperties.h:
+ (WebCore::StylePropertiesBase::type):
+ (WebCore::StylePropertiesBase::cssParserMode):
+ (WebCore::StylePropertiesBase::StylePropertiesBase):
+ (WebCore::StyleProperties::isMutable):
+ (WebCore::StyleProperties::StyleProperties):
+ (WebCore::StylePropertiesBase::deref):
+ (isType):
+ (WebCore::StyleProperties::cssParserMode): Deleted.
+ (WebCore::StyleProperties::deref): Deleted.
+ Right now StyleProperties has two subclasses, ImmutableStyleProperties (which
+ is created by the parser when not deferring), and MutableStyleProperties (used
+ when making changes and doing DOM Manipulations).
+
+ This patch adds a new base class called StylePropertiesBase, and StyleProperties
+ now derives from it. DeferredStyleProperties derives from this base. The members
+ of StyleProperties have been moved up into StylePropertiesBase.
+
+ The m_isMutable bit, used to determine the type for downcasting has been enhanced
+ to m_type (2 bits), since there are now three possible subclasses.
+
+ * css/StyleRule.cpp:
+ (WebCore::StyleRule::StyleRule):
+ (WebCore::StyleRule::properties):
+ (WebCore::StyleRule::mutableProperties):
+ (WebCore::StyleRule::splitIntoMultipleRulesWithMaximumSelectorComponentCount):
+ Patched to ensure that when properties() are accessed, that if the current
+ stored StylePropertyBase in the rule is a DeferredStyleProperties, we then
+ parse and replace DeferredStyleProperties with ImmutableStyleProperties on the
+ rule. By using a common base class, we avoid increasing memory usage in
+ StyleRule.
+
+ (WebCore::DeferredStyleGroupRuleList::create):
+ (WebCore::DeferredStyleGroupRuleList::DeferredStyleGroupRuleList):
+ (WebCore::DeferredStyleGroupRuleList::parseDeferredRules):
+ (WebCore::DeferredStyleGroupRuleList::parseDeferredKeyframes):
+ DeferredStyleGroupList is used to handle deferred parsing of objects with
+ child rules. These include @media, @supports and @keyframes.
+
+ (WebCore::StyleRuleGroup::StyleRuleGroup):
+ (WebCore::StyleRuleGroup::childRules):
+ (WebCore::StyleRuleGroup::wrapperInsertRule):
+ (WebCore::StyleRuleGroup::wrapperRemoveRule):
+ (WebCore::StyleRuleGroup::parseDeferredRulesIfNeeded):
+ (WebCore::StyleRuleMedia::StyleRuleMedia):
+ (WebCore::StyleRuleSupports::StyleRuleSupports):
+ StyleRuleGroup now holds both a child rules Vector and a
+ DeferredStyleGroupRuleList. If DeferredStyleGroupRuleList is set, then
+ when the childRules are finally accessed, we will populate the childRules
+ Vector and then null out the DeferredStyleGroupRuleList.
+
+ * css/StyleRule.h:
+ (WebCore::StyleRule::propertiesWithoutDeferredParsing):
+ (WebCore::StyleRuleGroup::childRulesWithoutDeferredParsing):
+ (WebCore::StyleRuleGroup::childRules): Deleted.
+ Add new accesors for fetching properties and child rules without causing
+ deferred parsing to happen.
+
+ * css/StyleSheetContents.cpp:
+ (WebCore::StyleSheetContents::parseAuthorStyleSheet):
+ (WebCore::StyleSheetContents::parseString):
+ Patched to turn on deferred parsing for author sheets and for all
+ non-UA stylesheets parsed from a string (e.g., <style>).
+
+ (WebCore::traverseSubresourcesInRules):
+ The broken resource check was aggressively accessing properties(). Patch
+ it to call propertiesWithoutDeferredParsing() instead so that it doesn't
+ defeat the new optimization.
+
+ * css/WebKitCSSMatrix.cpp:
+ (WebCore::WebKitCSSMatrix::setMatrixValue):
+ Patched to drop the StyleSheetContents* argument from parseValue, since it
+ is no longer needed.
+
+ * css/parser/CSSDeferredParser.cpp: Added.
+ (WebCore::CSSDeferredParser::CSSDeferredParser):
+ (WebCore::CSSDeferredParser::parseDeclaration):
+ (WebCore::CSSDeferredParser::parseRuleList):
+ (WebCore::CSSDeferredParser::parseKeyframeList):
+ * css/parser/CSSDeferredParser.h: Added.
+ (WebCore::CSSDeferredParser::create):
+ (WebCore::CSSDeferredParser::tokenizer):
+ (WebCore::CSSDeferredParser::mode):
+ (WebCore::CSSDeferredParser::context):
+ (WebCore::CSSDeferredParser::styleSheet):
+ The CSSDeferredParser. It caches the original tokenizer's' escaped strings. Because
+ the CSSDeferredParser is referenced by all the rules that have yet to parse,
+ it will stay alive until all rules in the stylesheet has been fully parsed.
+
+ The parser receives CSSParserTokenRanges from DeferredStyleProperties or
+ DeferredStyleGroupRuleList and feeds them to CSSParserImpl, which then
+ is able to do the parsing as it would have occurred originally had the
+ range not been deferred.
+
+ * css/parser/CSSParser.cpp:
+ (WebCore::CSSParser::parseSheet):
+ (WebCore::CSSParser::parseSupportsCondition):
+ (WebCore::CSSParser::parseSingleValue):
+ (WebCore::CSSParser::parseValue):
+ * css/parser/CSSParser.h:
+ * css/parser/CSSParserFastPaths.cpp:
+ (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
+ (WebCore::parseKeywordValue):
+ (WebCore::CSSParserFastPaths::maybeParseValue):
+ * css/parser/CSSParserFastPaths.h:
+ Drop the StyleSheetContents* argument from the methods that no longer need
+ them.
+
+ * css/parser/CSSParserImpl.cpp:
+ (WebCore::CSSParserImpl::CSSParserImpl):
+ (WebCore::CSSParserImpl::tokenizer):
+ (WebCore::CSSParserImpl::parseValue):
+ (WebCore::CSSParserImpl::parseCustomPropertyValue):
+ (WebCore::CSSParserImpl::parseDeclarationList):
+ (WebCore::CSSParserImpl::parseInlineStyleDeclaration):
+ (WebCore::CSSParserImpl::parseRule):
+ (WebCore::CSSParserImpl::parseStyleSheet):
+ (WebCore::CSSParserImpl::parseDeclarationListForInspector):
+ (WebCore::CSSParserImpl::parseStyleSheetForInspector):
+ (WebCore::CSSParserImpl::consumeQualifiedRule):
+ (WebCore::CSSParserImpl::consumeMediaRule):
+ (WebCore::CSSParserImpl::consumeSupportsRule):
+ (WebCore::CSSParserImpl::consumeKeyframesRule):
+ (WebCore::CSSParserImpl::consumeStyleRule):
+ Drop the StyleSheetContents* argument from the methods that no longer need
+ them.
+
+ (WebCore::CSSParserImpl::createDeferredStyleProperties):
+ (WebCore::CSSParserImpl::parseDeferredDeclaration):
+ (WebCore::CSSParserImpl::parseDeferredRuleList):
+ (WebCore::CSSParserImpl::parseDeferredKeyframeList):
+ The methods that handle deferred parsing. They make sure to initialize
+ new CSSParserImpls with the original deferred parser, and then call existing
+ methods to do the parsing.
+
+ * css/parser/CSSParserImpl.h:
+ Patched to remove StyleSheetContents* arguments from some methods and
+ to add the new deferred parsing methods.
+
+ * css/parser/CSSParserTokenRange.cpp:
+ (WebCore::CSSParserTokenRange::consumeBlockCheckingForEditability):
+ * css/parser/CSSParserTokenRange.h:
+ In order to preserve the editability optimization from r180867, when
+ a style rule's block is consumed, we use a special method that looks
+ for -webkit-user-modify tokens. If one is seen, then the editability
+ optimization is turned off. Because we do this at the token level,
+ the optimization keeps working even if properties don't get parsed.
+
+ * css/parser/CSSPropertyParser.cpp:
+ (WebCore::CSSPropertyParser::parseSingleValue):
+ (WebCore::CSSPropertyParser::parseFontFaceDescriptor):
+ (WebCore::CSSPropertyParser::consumeFont):
+ (WebCore::CSSPropertyParser::parseShorthand):
+ Patched to remove StyleSheetContents* arguments now that the editability
+ check is in CSSTokenizer instead.
+
+ * css/parser/CSSTokenizer.cpp:
+ (WebCore::CSSTokenizer::tokenRange):
+ * css/parser/CSSTokenizer.h:
+ Make tokenRange() const.
+
+ * html/canvas/CanvasRenderingContext2D.cpp:
+ (WebCore::CanvasRenderingContext2D::setFont):
+ Patched to drop the StyleSheetContents* argument.
+
+ * testing/Internals.cpp:
+ (WebCore::deferredStyleRulesCountForList):
+ (WebCore::Internals::deferredStyleRulesCount):
+ (WebCore::deferredGroupRulesCountForList):
+ (WebCore::Internals::deferredGroupRulesCount):
+ (WebCore::deferredKeyframesRulesCountForList):
+ (WebCore::Internals::deferredKeyframesRulesCount):
+ * testing/Internals.h:
+ * testing/Internals.idl:
+ Add new testing methods that can count the deferred style rules and
+ group child rule lists. These methods are used by the new layout tests.
+
</ins><span class="cx"> 2016-12-14 Brady Eidson <beidson@apple.com>
</span><span class="cx">
</span><span class="cx"> IndexedDB 2.0: Massively speedup IDBIndex.get().
</span><span class="lines">@@ -9,9 +261,9 @@
</span><span class="cx">
</span><span class="cx"> This change upgrades the IndexRecords schema to include the ObjectStore record ID for the referenced record.
</span><span class="cx"> It also adds a SQLite Index-by-key on IndexRecords.
</span><del>-
</del><ins>+
</ins><span class="cx"> This speeds up PerformanceTests/IndexedDB/index-get.html by 15-20x.
</span><del>-
</del><ins>+
</ins><span class="cx"> * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
</span><span class="cx"> (WebCore::IDBServer::v3IndexRecordsTableSchema):
</span><span class="cx"> (WebCore::IDBServer::v3IndexRecordsTableSchemaAlternate):
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -3505,6 +3505,8 @@
</span><span class="cx">                 9444CBE81D8861C20073A074 /* CSSVariableData.h in Headers */ = {isa = PBXBuildFile; fileRef = 9444CBDD1D8861580073A074 /* CSSVariableData.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 9444CBE91D8861CA0073A074 /* CSSVariableReferenceValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9444CBDC1D8861580073A074 /* CSSVariableReferenceValue.cpp */; };
</span><span class="cx">                 9444CBEA1D8861CA0073A074 /* CSSVariableReferenceValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 9444CBDB1D8861580073A074 /* CSSVariableReferenceValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                94476BDA1DFCAC0300690E23 /* CSSDeferredParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94476BD81DFCA4A700690E23 /* CSSDeferredParser.cpp */; };
+                94476BDB1DFCAC0300690E23 /* CSSDeferredParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 94476BD91DFCA4A700690E23 /* CSSDeferredParser.h */; };
</ins><span class="cx">                 946D372D1D6CB2940077084F /* CSSParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 946D37281D6CB28B0077084F /* CSSParser.cpp */; };
</span><span class="cx">                 946D372E1D6CB2940077084F /* CSSParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 946D37291D6CB28B0077084F /* CSSParser.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 946D372F1D6CB2940077084F /* CSSParserMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 946D372A1D6CB28B0077084F /* CSSParserMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -11057,6 +11059,8 @@
</span><span class="cx">                 9444CBDE1D8861580073A074 /* CSSVariableData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSVariableData.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 9444CBE11D8861580073A074 /* CSSCustomIdentValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSCustomIdentValue.h; sourceTree = "<group>"; };
</span><span class="cx">                 9444CBE21D8861580073A074 /* CSSCustomIdentValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSCustomIdentValue.cpp; sourceTree = "<group>"; };
</span><ins>+                94476BD81DFCA4A700690E23 /* CSSDeferredParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CSSDeferredParser.cpp; path = parser/CSSDeferredParser.cpp; sourceTree = "<group>"; };
+                94476BD91DFCA4A700690E23 /* CSSDeferredParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CSSDeferredParser.h; path = parser/CSSDeferredParser.h; sourceTree = "<group>"; };
</ins><span class="cx">                 946D37281D6CB28B0077084F /* CSSParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CSSParser.cpp; path = parser/CSSParser.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 946D37291D6CB28B0077084F /* CSSParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CSSParser.h; path = parser/CSSParser.h; sourceTree = "<group>"; };
</span><span class="cx">                 946D372A1D6CB28B0077084F /* CSSParserMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CSSParserMode.h; path = parser/CSSParserMode.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -18998,6 +19002,8 @@
</span><span class="cx">                         children = (
</span><span class="cx">                                 94DE5C7F1D7F39D000164F2A /* CSSAtRuleID.cpp */,
</span><span class="cx">                                 94DE5C801D7F39D000164F2A /* CSSAtRuleID.h */,
</span><ins>+                                94476BD81DFCA4A700690E23 /* CSSDeferredParser.cpp */,
+                                94476BD91DFCA4A700690E23 /* CSSDeferredParser.h */,
</ins><span class="cx">                                 946D37281D6CB28B0077084F /* CSSParser.cpp */,
</span><span class="cx">                                 946D37291D6CB28B0077084F /* CSSParser.h */,
</span><span class="cx">                                 949C76FE1D6E1D8C00C0DE4F /* CSSParserFastPaths.cpp */,
</span><span class="lines">@@ -27639,6 +27645,7 @@
</span><span class="cx">                                 832B843419D8E55100B26055 /* SVGAnimateElementBase.h in Headers */,
</span><span class="cx">                                 B22279930D00BF220071B782 /* SVGAnimateMotionElement.h in Headers */,
</span><span class="cx">                                 B22279950D00BF220071B782 /* SVGAnimateTransformElement.h in Headers */,
</span><ins>+                                94476BDB1DFCAC0300690E23 /* CSSDeferredParser.h in Headers */,
</ins><span class="cx">                                 B22279980D00BF220071B782 /* SVGAnimationElement.h in Headers */,
</span><span class="cx">                                 439D334513A6911C00C20F4F /* SVGAnimatorFactory.h in Headers */,
</span><span class="cx">                                 08FB3F8413BC754C0099FC18 /* SVGAttributeToPropertyMap.h in Headers */,
</span><span class="lines">@@ -30909,6 +30916,7 @@
</span><span class="cx">                                 99CC0B5718BE984A006CEBCC /* ReplayInputCreationMethods.cpp in Sources */,
</span><span class="cx">                                 99CC0B5818BE984A006CEBCC /* ReplayInputDispatchMethods.cpp in Sources */,
</span><span class="cx">                                 99CC0B5918BE984A006CEBCC /* ReplaySession.cpp in Sources */,
</span><ins>+                                94476BDA1DFCAC0300690E23 /* CSSDeferredParser.cpp in Sources */,
</ins><span class="cx">                                 99CC0B5B18BE984A006CEBCC /* ReplaySessionSegment.cpp in Sources */,
</span><span class="cx">                                 F55B3DCF1251F12D003EF269 /* ResetInputType.cpp in Sources */,
</span><span class="cx">                                 934F713E0D5A6F2800018D69 /* ResourceErrorBase.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSFontFaceSetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSFontFaceSet.cpp (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSFontFaceSet.cpp        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/css/CSSFontFaceSet.cpp        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -328,7 +328,7 @@
</span><span class="cx"> ExceptionOr<Vector<std::reference_wrapper<CSSFontFace>>> CSSFontFaceSet::matchingFaces(const String& font, const String& string)
</span><span class="cx"> {
</span><span class="cx"> auto style = MutableStyleProperties::create();
</span><del>- auto parseResult = CSSParser::parseValue(style, CSSPropertyFont, font, true, HTMLStandardMode, nullptr);
</del><ins>+ auto parseResult = CSSParser::parseValue(style, CSSPropertyFont, font, true, HTMLStandardMode);
</ins><span class="cx"> if (parseResult == CSSParser::ParseResult::Error)
</span><span class="cx"> return Exception { SYNTAX_ERR };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSKeyframesRulecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSKeyframesRule.cpp (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSKeyframesRule.cpp        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/css/CSSKeyframesRule.cpp        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "CSSKeyframesRule.h"
</span><span class="cx">
</span><ins>+#include "CSSDeferredParser.h"
</ins><span class="cx"> #include "CSSKeyframeRule.h"
</span><span class="cx"> #include "CSSParser.h"
</span><span class="cx"> #include "CSSRuleList.h"
</span><span class="lines">@@ -37,11 +38,20 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-StyleRuleKeyframes::StyleRuleKeyframes()
</del><ins>+StyleRuleKeyframes::StyleRuleKeyframes(const AtomicString& name)
</ins><span class="cx"> : StyleRuleBase(Keyframes)
</span><ins>+ , m_name(name)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+StyleRuleKeyframes::StyleRuleKeyframes(const AtomicString& name, std::unique_ptr<DeferredStyleGroupRuleList>&& deferredRules)
+ : StyleRuleBase(Keyframes)
+ , m_name(name)
+ , m_deferredRules(WTFMove(deferredRules))
+{
+
+}
+
</ins><span class="cx"> StyleRuleKeyframes::StyleRuleKeyframes(const StyleRuleKeyframes& o)
</span><span class="cx"> : StyleRuleBase(o)
</span><span class="cx"> , m_name(o.m_name)
</span><span class="lines">@@ -55,6 +65,21 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void StyleRuleKeyframes::parseDeferredRulesIfNeeded() const
+{
+ if (!m_deferredRules)
+ return;
+
+ m_deferredRules->parseDeferredKeyframes(const_cast<StyleRuleKeyframes&>(*this));
+ m_deferredRules = nullptr;
+}
+
+const Vector<Ref<StyleKeyframe>>& StyleRuleKeyframes::keyframes() const
+{
+ parseDeferredRulesIfNeeded();
+ return m_keyframes;
+}
+
</ins><span class="cx"> void StyleRuleKeyframes::parserAppendKeyframe(RefPtr<StyleKeyframe>&& keyframe)
</span><span class="cx"> {
</span><span class="cx"> if (!keyframe)
</span><span class="lines">@@ -64,16 +89,20 @@
</span><span class="cx">
</span><span class="cx"> void StyleRuleKeyframes::wrapperAppendKeyframe(Ref<StyleKeyframe>&& keyframe)
</span><span class="cx"> {
</span><ins>+ parseDeferredRulesIfNeeded();
</ins><span class="cx"> m_keyframes.append(WTFMove(keyframe));
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void StyleRuleKeyframes::wrapperRemoveKeyframe(unsigned index)
</span><span class="cx"> {
</span><ins>+ parseDeferredRulesIfNeeded();
</ins><span class="cx"> m_keyframes.remove(index);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> size_t StyleRuleKeyframes::findKeyframeIndex(const String& key) const
</span><span class="cx"> {
</span><ins>+ parseDeferredRulesIfNeeded();
+
</ins><span class="cx"> auto keys = CSSParser::parseKeyframeKeyList(key);
</span><span class="cx">
</span><span class="cx"> for (size_t i = m_keyframes.size(); i--; ) {
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSKeyframesRuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSKeyframesRule.h (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSKeyframesRule.h        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/css/CSSKeyframesRule.h        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -39,12 +39,17 @@
</span><span class="cx">
</span><span class="cx"> class StyleRuleKeyframes final : public StyleRuleBase {
</span><span class="cx"> public:
</span><del>- static Ref<StyleRuleKeyframes> create() { return adoptRef(*new StyleRuleKeyframes()); }
</del><ins>+ static Ref<StyleRuleKeyframes> create(const AtomicString& name) { return adoptRef(*new StyleRuleKeyframes(name)); }
+ static Ref<StyleRuleKeyframes> create(const AtomicString& name, std::unique_ptr<DeferredStyleGroupRuleList>&& deferredRules) { return adoptRef(*new StyleRuleKeyframes(name, WTFMove(deferredRules))); }
</ins><span class="cx">
</span><span class="cx"> ~StyleRuleKeyframes();
</span><span class="cx">
</span><del>- const Vector<Ref<StyleKeyframe>>& keyframes() const { return m_keyframes; }
-
</del><ins>+ const Vector<Ref<StyleKeyframe>>& keyframes() const;
+ const Vector<Ref<StyleKeyframe>>* keyframesWithoutDeferredParsing() const
+ {
+ return !m_deferredRules ? &m_keyframes : nullptr;
+ }
+
</ins><span class="cx"> void parserAppendKeyframe(RefPtr<StyleKeyframe>&&);
</span><span class="cx"> void wrapperAppendKeyframe(Ref<StyleKeyframe>&&);
</span><span class="cx"> void wrapperRemoveKeyframe(unsigned);
</span><span class="lines">@@ -51,17 +56,22 @@
</span><span class="cx">
</span><span class="cx"> const AtomicString& name() const { return m_name; }
</span><span class="cx"> void setName(const AtomicString& name) { m_name = name; }
</span><del>-
</del><ins>+
</ins><span class="cx"> size_t findKeyframeIndex(const String& key) const;
</span><span class="cx">
</span><span class="cx"> Ref<StyleRuleKeyframes> copy() const { return adoptRef(*new StyleRuleKeyframes(*this)); }
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- StyleRuleKeyframes();
</del><ins>+ StyleRuleKeyframes(const AtomicString&);
+ StyleRuleKeyframes(const AtomicString&, std::unique_ptr<DeferredStyleGroupRuleList>&&);
</ins><span class="cx"> StyleRuleKeyframes(const StyleRuleKeyframes&);
</span><span class="cx">
</span><del>- Vector<Ref<StyleKeyframe>> m_keyframes;
</del><ins>+ void parseDeferredRulesIfNeeded() const;
+
+ mutable Vector<Ref<StyleKeyframe>> m_keyframes;
</ins><span class="cx"> AtomicString m_name;
</span><ins>+
+ mutable std::unique_ptr<DeferredStyleGroupRuleList> m_deferredRules;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> class CSSKeyframesRule final : public CSSRule {
</span></span></pre></div>
<a id="trunkSourceWebCorecssDOMCSSNamespacecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/DOMCSSNamespace.cpp (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/DOMCSSNamespace.cpp        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/css/DOMCSSNamespace.cpp        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -70,7 +70,7 @@
</span><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> auto dummyStyle = MutableStyleProperties::create();
</span><del>- return CSSParser::parseValue(dummyStyle, propertyID, normalizedValue, false, document, nullptr) != CSSParser::ParseResult::Error;
</del><ins>+ return CSSParser::parseValue(dummyStyle, propertyID, normalizedValue, false, document) != CSSParser::ParseResult::Error;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool DOMCSSNamespace::supports(Document& document, const String& conditionText)
</span></span></pre></div>
<a id="trunkSourceWebCorecssElementRuleCollectorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/ElementRuleCollector.cpp (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/ElementRuleCollector.cpp        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/css/ElementRuleCollector.cpp        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -484,8 +484,10 @@
</span><span class="cx"> StyleRule* rule = ruleData.rule();
</span><span class="cx">
</span><span class="cx"> // If the rule has no properties to apply, then ignore it in the non-debug mode.
</span><del>- const StyleProperties& properties = rule->properties();
- if (properties.isEmpty() && !matchRequest.includeEmptyRules)
</del><ins>+ // Note that if we get null back here, it means we have a rule with deferred properties,
+ // and that means we always have to consider it.
+ const StyleProperties* properties = rule->propertiesWithoutDeferredParsing();
+ if (properties && properties->isEmpty() && !matchRequest.includeEmptyRules)
</ins><span class="cx"> continue;
</span><span class="cx">
</span><span class="cx"> // FIXME: Exposing the non-standard getMatchedCSSRules API to web is the only reason this is needed.
</span></span></pre></div>
<a id="trunkSourceWebCorecssFontFacecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/FontFace.cpp (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/FontFace.cpp        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/css/FontFace.cpp        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -195,7 +195,7 @@
</span><span class="cx"> return Exception { SYNTAX_ERR };
</span><span class="cx">
</span><span class="cx"> auto style = MutableStyleProperties::create();
</span><del>- auto result = CSSParser::parseValue(style, CSSPropertyFontVariant, variant, true, HTMLStandardMode, nullptr);
</del><ins>+ auto result = CSSParser::parseValue(style, CSSPropertyFontVariant, variant, true, HTMLStandardMode);
</ins><span class="cx"> if (result == CSSParser::ParseResult::Error)
</span><span class="cx"> return Exception { SYNTAX_ERR };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorecssPropertySetCSSStyleDeclarationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -249,7 +249,7 @@
</span><span class="cx"> if (propertyID == CSSPropertyCustom)
</span><span class="cx"> changed = m_propertySet->setCustomProperty(propertyName, value, important, cssParserContext());
</span><span class="cx"> else
</span><del>- changed = m_propertySet->setProperty(propertyID, value, important, cssParserContext(), contextStyleSheet());
</del><ins>+ changed = m_propertySet->setProperty(propertyID, value, important, cssParserContext());
</ins><span class="cx">
</span><span class="cx"> didMutate(changed ? PropertyChanged : NoChanges);
</span><span class="cx">
</span><span class="lines">@@ -304,7 +304,7 @@
</span><span class="cx"> if (!willMutate())
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- bool changed = m_propertySet->setProperty(propertyID, value, important, cssParserContext(), contextStyleSheet());
</del><ins>+ bool changed = m_propertySet->setProperty(propertyID, value, important, cssParserContext());
</ins><span class="cx">
</span><span class="cx"> didMutate(changed ? PropertyChanged : NoChanges);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorecssStylePropertiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleProperties.cpp (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleProperties.cpp        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/css/StyleProperties.cpp        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx">
</span><span class="cx"> #include "CSSComputedStyleDeclaration.h"
</span><span class="cx"> #include "CSSCustomPropertyValue.h"
</span><ins>+#include "CSSDeferredParser.h"
</ins><span class="cx"> #include "CSSParser.h"
</span><span class="cx"> #include "CSSPendingSubstitutionValue.h"
</span><span class="cx"> #include "CSSValueKeywords.h"
</span><span class="lines">@@ -71,12 +72,12 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> MutableStyleProperties::MutableStyleProperties(CSSParserMode cssParserMode)
</span><del>- : StyleProperties(cssParserMode)
</del><ins>+ : StyleProperties(cssParserMode, MutablePropertiesType)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> MutableStyleProperties::MutableStyleProperties(const CSSProperty* properties, unsigned length)
</span><del>- : StyleProperties(HTMLStandardMode)
</del><ins>+ : StyleProperties(HTMLStandardMode, MutablePropertiesType)
</ins><span class="cx"> {
</span><span class="cx"> m_propertyVector.reserveInitialCapacity(length);
</span><span class="cx"> for (unsigned i = 0; i < length; ++i)
</span><span class="lines">@@ -107,8 +108,9 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> MutableStyleProperties::MutableStyleProperties(const StyleProperties& other)
</span><del>- : StyleProperties(other.cssParserMode())
</del><ins>+ : StyleProperties(other.cssParserMode(), MutablePropertiesType)
</ins><span class="cx"> {
</span><ins>+ ASSERT(other.type() != DeferredPropertiesType);
</ins><span class="cx"> if (is<MutableStyleProperties>(other))
</span><span class="cx"> m_propertyVector = downcast<MutableStyleProperties>(other).m_propertyVector;
</span><span class="cx"> else {
</span><span class="lines">@@ -719,7 +721,7 @@
</span><span class="cx"> return propertyAt(foundPropertyIndex).isImplicit();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool MutableStyleProperties::setProperty(CSSPropertyID propertyID, const String& value, bool important, CSSParserContext parserContext, StyleSheetContents* contextStyleSheet)
</del><ins>+bool MutableStyleProperties::setProperty(CSSPropertyID propertyID, const String& value, bool important, CSSParserContext parserContext)
</ins><span class="cx"> {
</span><span class="cx"> // Setting the value to an empty string just removes the property in both IE and Gecko.
</span><span class="cx"> // Setting it to null seems to produce less consistent results, but we treat it just the same.
</span><span class="lines">@@ -730,7 +732,7 @@
</span><span class="cx">
</span><span class="cx"> // When replacing an existing property value, this moves the property to the end of the list.
</span><span class="cx"> // Firefox preserves the position, and MSIE moves the property to the beginning.
</span><del>- return CSSParser::parseValue(*this, propertyID, value, important, parserContext, contextStyleSheet) == CSSParser::ParseResult::Changed;
</del><ins>+ return CSSParser::parseValue(*this, propertyID, value, important, parserContext) == CSSParser::ParseResult::Changed;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool MutableStyleProperties::setProperty(CSSPropertyID propertyID, const String& value, bool important)
</span><span class="lines">@@ -1361,6 +1363,28 @@
</span><span class="cx"> result.append(';');
</span><span class="cx"> return result.toString();
</span><span class="cx"> }
</span><ins>+
+Ref<DeferredStyleProperties> DeferredStyleProperties::create(const CSSParserTokenRange& tokenRange, CSSDeferredParser& parser)
+{
+ return adoptRef(*new DeferredStyleProperties(tokenRange, parser));
+}
</ins><span class="cx">
</span><ins>+DeferredStyleProperties::DeferredStyleProperties(const CSSParserTokenRange& range, CSSDeferredParser& parser)
+ : StylePropertiesBase(parser.mode(), DeferredPropertiesType)
+ , m_parser(parser)
+{
+ size_t length = range.end() - range.begin();
+ m_tokens.reserveCapacity(length);
+ m_tokens.append(range.begin(), length);
+}
+
+DeferredStyleProperties::~DeferredStyleProperties()
+{
+}
</ins><span class="cx">
</span><ins>+Ref<ImmutableStyleProperties> DeferredStyleProperties::parseDeferredProperties()
+{
+ return m_parser->parseDeclaration(m_tokens);
+}
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecssStylePropertiesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleProperties.h (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleProperties.h        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/css/StyleProperties.h        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -22,6 +22,7 @@
</span><span class="cx"> #pragma once
</span><span class="cx">
</span><span class="cx"> #include "CSSParserMode.h"
</span><ins>+#include "CSSParserTokenRange.h"
</ins><span class="cx"> #include "CSSProperty.h"
</span><span class="cx"> #include "CSSValueKeywords.h"
</span><span class="cx"> #include <memory>
</span><span class="lines">@@ -32,6 +33,7 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><ins>+class CSSDeferredParser;
</ins><span class="cx"> class CSSStyleDeclaration;
</span><span class="cx"> class CachedResource;
</span><span class="cx"> class ImmutableStyleProperties;
</span><span class="lines">@@ -42,13 +44,39 @@
</span><span class="cx"> class StylePropertyShorthand;
</span><span class="cx"> class StyleSheetContents;
</span><span class="cx">
</span><del>-class StyleProperties : public RefCounted<StyleProperties> {
- friend class PropertyReference;
</del><ins>+enum StylePropertiesType { ImmutablePropertiesType, MutablePropertiesType, DeferredPropertiesType };
+
+class StylePropertiesBase : public RefCounted<StylePropertiesBase> {
</ins><span class="cx"> public:
</span><span class="cx"> // Override RefCounted's deref() to ensure operator delete is called on
</span><span class="cx"> // the appropriate subclass type.
</span><span class="cx"> void deref();
</span><ins>+
+ StylePropertiesType type() const { return static_cast<StylePropertiesType>(m_type); }
</ins><span class="cx">
</span><ins>+ CSSParserMode cssParserMode() const { return static_cast<CSSParserMode>(m_cssParserMode); }
+
+protected:
+ StylePropertiesBase(CSSParserMode cssParserMode, StylePropertiesType type)
+ : m_cssParserMode(cssParserMode)
+ , m_type(type)
+ , m_arraySize(0)
+ { }
+
+ StylePropertiesBase(CSSParserMode cssParserMode, unsigned immutableArraySize)
+ : m_cssParserMode(cssParserMode)
+ , m_type(ImmutablePropertiesType)
+ , m_arraySize(immutableArraySize)
+ { }
+
+ unsigned m_cssParserMode : 3;
+ mutable unsigned m_type : 2;
+ unsigned m_arraySize : 27;
+};
+
+class StyleProperties : public StylePropertiesBase {
+ friend class PropertyReference;
+public:
</ins><span class="cx"> class PropertyReference {
</span><span class="cx"> public:
</span><span class="cx"> PropertyReference(const StylePropertyMetadata& metadata, const CSSValue* value)
</span><span class="lines">@@ -94,8 +122,6 @@
</span><span class="cx">
</span><span class="cx"> Ref<MutableStyleProperties> copyBlockProperties() const;
</span><span class="cx">
</span><del>- CSSParserMode cssParserMode() const { return static_cast<CSSParserMode>(m_cssParserMode); }
-
</del><span class="cx"> WEBCORE_EXPORT Ref<MutableStyleProperties> mutableCopy() const;
</span><span class="cx"> Ref<ImmutableStyleProperties> immutableCopyIfNeeded() const;
</span><span class="cx">
</span><span class="lines">@@ -103,8 +129,8 @@
</span><span class="cx">
</span><span class="cx"> String asText() const;
</span><span class="cx">
</span><del>- bool isMutable() const { return m_isMutable; }
</del><span class="cx"> bool hasCSSOMWrapper() const;
</span><ins>+ bool isMutable() const { return type() == MutablePropertiesType; }
</ins><span class="cx">
</span><span class="cx"> bool traverseSubresources(const std::function<bool (const CachedResource&)>& handler) const;
</span><span class="cx">
</span><span class="lines">@@ -117,25 +143,17 @@
</span><span class="cx"> bool propertyMatches(CSSPropertyID, const CSSValue*) const;
</span><span class="cx">
</span><span class="cx"> protected:
</span><del>- StyleProperties(CSSParserMode cssParserMode)
- : m_cssParserMode(cssParserMode)
- , m_isMutable(true)
- , m_arraySize(0)
</del><ins>+ StyleProperties(CSSParserMode cssParserMode, StylePropertiesType type)
+ : StylePropertiesBase(cssParserMode, type)
</ins><span class="cx"> { }
</span><span class="cx">
</span><span class="cx"> StyleProperties(CSSParserMode cssParserMode, unsigned immutableArraySize)
</span><del>- : m_cssParserMode(cssParserMode)
- , m_isMutable(false)
- , m_arraySize(immutableArraySize)
</del><ins>+ : StylePropertiesBase(cssParserMode, immutableArraySize)
</ins><span class="cx"> { }
</span><span class="cx">
</span><span class="cx"> int findPropertyIndex(CSSPropertyID) const;
</span><span class="cx"> int findCustomPropertyIndex(const String& propertyName) const;
</span><del>-
- unsigned m_cssParserMode : 3;
- mutable unsigned m_isMutable : 1;
- unsigned m_arraySize : 28;
-
</del><ins>+
</ins><span class="cx"> private:
</span><span class="cx"> String getShorthandValue(const StylePropertyShorthand&) const;
</span><span class="cx"> String getCommonValue(const StylePropertyShorthand&) const;
</span><span class="lines">@@ -199,7 +217,7 @@
</span><span class="cx"> bool addParsedProperty(const CSSProperty&);
</span><span class="cx">
</span><span class="cx"> // These expand shorthand properties into multiple properties.
</span><del>- bool setProperty(CSSPropertyID, const String& value, bool important, CSSParserContext, StyleSheetContents* = nullptr);
</del><ins>+ bool setProperty(CSSPropertyID, const String& value, bool important, CSSParserContext);
</ins><span class="cx"> bool setProperty(CSSPropertyID, const String& value, bool important = false);
</span><span class="cx"> void setProperty(CSSPropertyID, RefPtr<CSSValue>&&, bool important = false);
</span><span class="cx">
</span><span class="lines">@@ -242,6 +260,20 @@
</span><span class="cx"> friend class StyleProperties;
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+class DeferredStyleProperties final : public StylePropertiesBase {
+public:
+ WEBCORE_EXPORT ~DeferredStyleProperties();
+ static Ref<DeferredStyleProperties> create(const CSSParserTokenRange&, CSSDeferredParser&);
+
+ Ref<ImmutableStyleProperties> parseDeferredProperties();
+
+private:
+ DeferredStyleProperties(const CSSParserTokenRange&, CSSDeferredParser&);
+
+ Vector<CSSParserToken> m_tokens;
+ Ref<CSSDeferredParser> m_parser;
+};
+
</ins><span class="cx"> inline ImmutableStyleProperties::PropertyReference ImmutableStyleProperties::propertyAt(unsigned index) const
</span><span class="cx"> {
</span><span class="cx"> return PropertyReference(metadataArray()[index], valueArray()[index]);
</span><span class="lines">@@ -267,7 +299,7 @@
</span><span class="cx"> return downcast<ImmutableStyleProperties>(*this).propertyCount();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-inline void StyleProperties::deref()
</del><ins>+inline void StylePropertiesBase::deref()
</ins><span class="cx"> {
</span><span class="cx"> if (!derefBase())
</span><span class="cx"> return;
</span><span class="lines">@@ -274,8 +306,10 @@
</span><span class="cx">
</span><span class="cx"> if (is<MutableStyleProperties>(*this))
</span><span class="cx"> delete downcast<MutableStyleProperties>(this);
</span><ins>+ else if (is<ImmutableStyleProperties>(*this))
+ delete downcast<ImmutableStyleProperties>(this);
</ins><span class="cx"> else
</span><del>- delete downcast<ImmutableStyleProperties>(this);
</del><ins>+ delete downcast<DeferredStyleProperties>(this);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> inline int StyleProperties::findPropertyIndex(CSSPropertyID propertyID) const
</span><span class="lines">@@ -294,10 +328,18 @@
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><ins>+SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::StyleProperties)
+ static bool isType(const WebCore::StylePropertiesBase& set) { return set.type() != WebCore::DeferredPropertiesType; }
+SPECIALIZE_TYPE_TRAITS_END()
+
</ins><span class="cx"> SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::MutableStyleProperties)
</span><del>- static bool isType(const WebCore::StyleProperties& set) { return set.isMutable(); }
</del><ins>+ static bool isType(const WebCore::StylePropertiesBase& set) { return set.type() == WebCore::MutablePropertiesType; }
</ins><span class="cx"> SPECIALIZE_TYPE_TRAITS_END()
</span><span class="cx">
</span><span class="cx"> SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::ImmutableStyleProperties)
</span><del>- static bool isType(const WebCore::StyleProperties& set) { return !set.isMutable(); }
</del><ins>+ static bool isType(const WebCore::StylePropertiesBase& set) { return set.type() == WebCore::ImmutablePropertiesType; }
</ins><span class="cx"> SPECIALIZE_TYPE_TRAITS_END()
</span><ins>+
+SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::DeferredStyleProperties)
+ static bool isType(const WebCore::StylePropertiesBase& set) { return set.type() == WebCore::DeferredPropertiesType; }
+SPECIALIZE_TYPE_TRAITS_END()
</ins></span></pre></div>
<a id="trunkSourceWebCorecssStyleRulecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleRule.cpp (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleRule.cpp        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/css/StyleRule.cpp        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -22,6 +22,7 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "StyleRule.h"
</span><span class="cx">
</span><ins>+#include "CSSDeferredParser.h"
</ins><span class="cx"> #include "CSSFontFaceRule.h"
</span><span class="cx"> #include "CSSImportRule.h"
</span><span class="cx"> #include "CSSKeyframeRule.h"
</span><span class="lines">@@ -207,7 +208,7 @@
</span><span class="cx"> return sizeof(StyleRule) + sizeof(CSSSelector) + StyleProperties::averageSizeInBytes();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-StyleRule::StyleRule(Ref<StyleProperties>&& properties)
</del><ins>+StyleRule::StyleRule(Ref<StylePropertiesBase>&& properties)
</ins><span class="cx"> : StyleRuleBase(Style)
</span><span class="cx"> , m_properties(WTFMove(properties))
</span><span class="cx"> {
</span><span class="lines">@@ -215,7 +216,7 @@
</span><span class="cx">
</span><span class="cx"> StyleRule::StyleRule(const StyleRule& o)
</span><span class="cx"> : StyleRuleBase(o)
</span><del>- , m_properties(o.m_properties->mutableCopy())
</del><ins>+ , m_properties(o.properties().mutableCopy())
</ins><span class="cx"> , m_selectorList(o.m_selectorList)
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -224,10 +225,17 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+const StyleProperties& StyleRule::properties() const
+{
+ if (m_properties->type() == DeferredPropertiesType)
+ m_properties = downcast<DeferredStyleProperties>(m_properties.get()).parseDeferredProperties();
+ return downcast<StyleProperties>(m_properties.get());
+}
+
</ins><span class="cx"> MutableStyleProperties& StyleRule::mutableProperties()
</span><span class="cx"> {
</span><span class="cx"> if (!is<MutableStyleProperties>(m_properties.get()))
</span><del>- m_properties = m_properties->mutableCopy();
</del><ins>+ m_properties = properties().mutableCopy();
</ins><span class="cx"> return downcast<MutableStyleProperties>(m_properties.get());
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -256,7 +264,7 @@
</span><span class="cx"> componentsInThisSelector.append(component);
</span><span class="cx">
</span><span class="cx"> if (componentsInThisSelector.size() + componentsSinceLastSplit.size() > maxCount && !componentsSinceLastSplit.isEmpty()) {
</span><del>- rules.append(create(componentsSinceLastSplit, const_cast<StyleProperties&>(m_properties.get())));
</del><ins>+ rules.append(create(componentsSinceLastSplit, const_cast<StyleProperties&>(properties())));
</ins><span class="cx"> componentsSinceLastSplit.clear();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -264,7 +272,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (!componentsSinceLastSplit.isEmpty())
</span><del>- rules.append(create(componentsSinceLastSplit, const_cast<StyleProperties&>(m_properties.get())));
</del><ins>+ rules.append(create(componentsSinceLastSplit, const_cast<StyleProperties&>(properties())));
</ins><span class="cx">
</span><span class="cx"> return rules;
</span><span class="cx"> }
</span><span class="lines">@@ -316,6 +324,24 @@
</span><span class="cx"> return downcast<MutableStyleProperties>(m_properties.get());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+DeferredStyleGroupRuleList::DeferredStyleGroupRuleList(const CSSParserTokenRange& range, CSSDeferredParser& parser)
+ : m_parser(parser)
+{
+ size_t length = range.end() - range.begin();
+ m_tokens.reserveCapacity(length);
+ m_tokens.append(range.begin(), length);
+}
+
+void DeferredStyleGroupRuleList::parseDeferredRules(Vector<RefPtr<StyleRuleBase>>& childRules)
+{
+ m_parser->parseRuleList(m_tokens, childRules);
+}
+
+void DeferredStyleGroupRuleList::parseDeferredKeyframes(StyleRuleKeyframes& keyframesRule)
+{
+ m_parser->parseKeyframeList(m_tokens, keyframesRule);
+}
+
</ins><span class="cx"> StyleRuleGroup::StyleRuleGroup(Type type, Vector<RefPtr<StyleRuleBase>>& adoptRule)
</span><span class="cx"> : StyleRuleBase(type)
</span><span class="cx"> {
</span><span class="lines">@@ -322,25 +348,47 @@
</span><span class="cx"> m_childRules.swap(adoptRule);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+StyleRuleGroup::StyleRuleGroup(Type type, std::unique_ptr<DeferredStyleGroupRuleList>&& deferredRules)
+ : StyleRuleBase(type)
+ , m_deferredRules(WTFMove(deferredRules))
+{
+}
+
</ins><span class="cx"> StyleRuleGroup::StyleRuleGroup(const StyleRuleGroup& o)
</span><span class="cx"> : StyleRuleBase(o)
</span><span class="cx"> {
</span><del>- m_childRules.reserveInitialCapacity(o.m_childRules.size());
- for (auto& childRule : o.m_childRules)
</del><ins>+ m_childRules.reserveInitialCapacity(o.childRules().size());
+ for (auto& childRule : o.childRules())
</ins><span class="cx"> m_childRules.uncheckedAppend(childRule->copy());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+const Vector<RefPtr<StyleRuleBase>>& StyleRuleGroup::childRules() const
+{
+ parseDeferredRulesIfNeeded();
+ return m_childRules;
+}
+
</ins><span class="cx"> void StyleRuleGroup::wrapperInsertRule(unsigned index, Ref<StyleRuleBase>&& rule)
</span><span class="cx"> {
</span><ins>+ parseDeferredRulesIfNeeded();
</ins><span class="cx"> m_childRules.insert(index, WTFMove(rule));
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void StyleRuleGroup::wrapperRemoveRule(unsigned index)
</span><span class="cx"> {
</span><ins>+ parseDeferredRulesIfNeeded();
</ins><span class="cx"> m_childRules.remove(index);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-
</del><ins>+void StyleRuleGroup::parseDeferredRulesIfNeeded() const
+{
+ if (!m_deferredRules)
+ return;
+
+ m_deferredRules->parseDeferredRules(m_childRules);
+ m_deferredRules = nullptr;
+}
+
</ins><span class="cx"> StyleRuleMedia::StyleRuleMedia(Ref<MediaQuerySet>&& media, Vector<RefPtr<StyleRuleBase>>& adoptRules)
</span><span class="cx"> : StyleRuleGroup(Media, adoptRules)
</span><span class="cx"> , m_mediaQueries(WTFMove(media))
</span><span class="lines">@@ -347,6 +395,12 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+StyleRuleMedia::StyleRuleMedia(Ref<MediaQuerySet>&& media, std::unique_ptr<DeferredStyleGroupRuleList>&& deferredRules)
+ : StyleRuleGroup(Media, WTFMove(deferredRules))
+ , m_mediaQueries(WTFMove(media))
+{
+}
+
</ins><span class="cx"> StyleRuleMedia::StyleRuleMedia(const StyleRuleMedia& o)
</span><span class="cx"> : StyleRuleGroup(o)
</span><span class="cx"> {
</span><span class="lines">@@ -362,6 +416,13 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+StyleRuleSupports::StyleRuleSupports(const String& conditionText, bool conditionIsSupported, std::unique_ptr<DeferredStyleGroupRuleList>&& deferredRules)
+ : StyleRuleGroup(Supports, WTFMove(deferredRules))
+ , m_conditionText(conditionText)
+ , m_conditionIsSupported(conditionIsSupported)
+{
+}
+
</ins><span class="cx"> StyleRuleSupports::StyleRuleSupports(const StyleRuleSupports& o)
</span><span class="cx"> : StyleRuleGroup(o)
</span><span class="cx"> , m_conditionText(o.m_conditionText)
</span><span class="lines">@@ -380,7 +441,7 @@
</span><span class="cx"> , m_selectorList(WTFMove(selectors))
</span><span class="cx"> {
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> StyleRuleRegion::StyleRuleRegion(const StyleRuleRegion& o)
</span><span class="cx"> : StyleRuleGroup(o)
</span><span class="cx"> , m_selectorList(o.m_selectorList)
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleRuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleRule.h (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleRule.h        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/css/StyleRule.h        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -35,7 +35,8 @@
</span><span class="cx"> class MutableStyleProperties;
</span><span class="cx"> class StyleKeyframe;
</span><span class="cx"> class StyleProperties;
</span><del>-
</del><ins>+class StyleRuleKeyframes;
+
</ins><span class="cx"> class StyleRuleBase : public WTF::RefCountedBase {
</span><span class="cx"> WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><span class="lines">@@ -99,7 +100,7 @@
</span><span class="cx"> ~StyleRuleBase() { }
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- void destroy();
</del><ins>+ WEBCORE_EXPORT void destroy();
</ins><span class="cx">
</span><span class="cx"> RefPtr<CSSRule> createCSSOMWrapper(CSSStyleSheet* parentSheet, CSSRule* parentRule) const;
</span><span class="cx">
</span><span class="lines">@@ -109,7 +110,7 @@
</span><span class="cx"> class StyleRule final : public StyleRuleBase {
</span><span class="cx"> WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>- static Ref<StyleRule> create(Ref<StyleProperties>&& properties)
</del><ins>+ static Ref<StyleRule> create(Ref<StylePropertiesBase>&& properties)
</ins><span class="cx"> {
</span><span class="cx"> return adoptRef(*new StyleRule(WTFMove(properties)));
</span><span class="cx"> }
</span><span class="lines">@@ -117,9 +118,11 @@
</span><span class="cx"> ~StyleRule();
</span><span class="cx">
</span><span class="cx"> const CSSSelectorList& selectorList() const { return m_selectorList; }
</span><del>- const StyleProperties& properties() const { return m_properties; }
</del><ins>+
+ const StyleProperties& properties() const;
</ins><span class="cx"> MutableStyleProperties& mutableProperties();
</span><del>-
</del><ins>+ const StyleProperties* propertiesWithoutDeferredParsing() const;
+
</ins><span class="cx"> void parserAdoptSelectorVector(Vector<std::unique_ptr<CSSParserSelector>>& selectors) { m_selectorList.adoptSelectorVector(selectors); }
</span><span class="cx"> void wrapperAdoptSelectorList(CSSSelectorList& selectors) { m_selectorList = WTFMove(selectors); }
</span><span class="cx"> void parserAdoptSelectorArray(CSSSelector* selectors) { m_selectorList.adoptSelectorArray(selectors); }
</span><span class="lines">@@ -131,15 +134,20 @@
</span><span class="cx"> static unsigned averageSizeInBytes();
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- StyleRule(Ref<StyleProperties>&&);
</del><ins>+ StyleRule(Ref<StylePropertiesBase>&&);
</ins><span class="cx"> StyleRule(const StyleRule&);
</span><span class="cx">
</span><span class="cx"> static Ref<StyleRule> create(const Vector<const CSSSelector*>&, Ref<StyleProperties>&&);
</span><span class="cx">
</span><del>- Ref<StyleProperties> m_properties;
</del><ins>+ mutable Ref<StylePropertiesBase> m_properties;
</ins><span class="cx"> CSSSelectorList m_selectorList;
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+inline const StyleProperties* StyleRule::propertiesWithoutDeferredParsing() const
+{
+ return m_properties->type() != DeferredPropertiesType ? &downcast<StyleProperties>(m_properties.get()) : nullptr;
+}
+
</ins><span class="cx"> class StyleRuleFontFace final : public StyleRuleBase {
</span><span class="cx"> public:
</span><span class="cx"> static Ref<StyleRuleFontFace> create(Ref<StyleProperties>&& properties) { return adoptRef(*new StyleRuleFontFace(WTFMove(properties))); }
</span><span class="lines">@@ -181,21 +189,43 @@
</span><span class="cx"> CSSSelectorList m_selectorList;
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+class DeferredStyleGroupRuleList final {
+public:
+ DeferredStyleGroupRuleList(const CSSParserTokenRange&, CSSDeferredParser&);
+
+ void parseDeferredRules(Vector<RefPtr<StyleRuleBase>>&);
+ void parseDeferredKeyframes(StyleRuleKeyframes&);
+
+private:
+ Vector<CSSParserToken> m_tokens;
+ Ref<CSSDeferredParser> m_parser;
+};
+
</ins><span class="cx"> class StyleRuleGroup : public StyleRuleBase {
</span><span class="cx"> public:
</span><del>- const Vector<RefPtr<StyleRuleBase>>& childRules() const { return m_childRules; }
-
</del><ins>+ const Vector<RefPtr<StyleRuleBase>>& childRules() const;
+ const Vector<RefPtr<StyleRuleBase>>* childRulesWithoutDeferredParsing() const;
+
</ins><span class="cx"> void wrapperInsertRule(unsigned, Ref<StyleRuleBase>&&);
</span><span class="cx"> void wrapperRemoveRule(unsigned);
</span><span class="cx">
</span><span class="cx"> protected:
</span><del>- StyleRuleGroup(Type, Vector<RefPtr<StyleRuleBase>>& adoptRule);
</del><ins>+ StyleRuleGroup(Type, Vector<RefPtr<StyleRuleBase>>&);
+ StyleRuleGroup(Type, std::unique_ptr<DeferredStyleGroupRuleList>&&);
</ins><span class="cx"> StyleRuleGroup(const StyleRuleGroup&);
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- Vector<RefPtr<StyleRuleBase>> m_childRules;
</del><ins>+ void parseDeferredRulesIfNeeded() const;
+
+ mutable Vector<RefPtr<StyleRuleBase>> m_childRules;
+ mutable std::unique_ptr<DeferredStyleGroupRuleList> m_deferredRules;
</ins><span class="cx"> };
</span><span class="cx">
</span><ins>+inline const Vector<RefPtr<StyleRuleBase>>* StyleRuleGroup::childRulesWithoutDeferredParsing() const
+{
+ return !m_deferredRules ? &m_childRules : nullptr;
+}
+
</ins><span class="cx"> class StyleRuleMedia final : public StyleRuleGroup {
</span><span class="cx"> public:
</span><span class="cx"> static Ref<StyleRuleMedia> create(Ref<MediaQuerySet>&& media, Vector<RefPtr<StyleRuleBase>>& adoptRules)
</span><span class="lines">@@ -203,6 +233,11 @@
</span><span class="cx"> return adoptRef(*new StyleRuleMedia(WTFMove(media), adoptRules));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ static Ref<StyleRuleMedia> create(Ref<MediaQuerySet>&& media, std::unique_ptr<DeferredStyleGroupRuleList>&& deferredChildRules)
+ {
+ return adoptRef(*new StyleRuleMedia(WTFMove(media), WTFMove(deferredChildRules)));
+ }
+
</ins><span class="cx"> MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); }
</span><span class="cx">
</span><span class="cx"> Ref<StyleRuleMedia> copy() const { return adoptRef(*new StyleRuleMedia(*this)); }
</span><span class="lines">@@ -209,6 +244,7 @@
</span><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> StyleRuleMedia(Ref<MediaQuerySet>&&, Vector<RefPtr<StyleRuleBase>>& adoptRules);
</span><ins>+ StyleRuleMedia(Ref<MediaQuerySet>&&, std::unique_ptr<DeferredStyleGroupRuleList>&&);
</ins><span class="cx"> StyleRuleMedia(const StyleRuleMedia&);
</span><span class="cx">
</span><span class="cx"> RefPtr<MediaQuerySet> m_mediaQueries;
</span><span class="lines">@@ -220,6 +256,11 @@
</span><span class="cx"> {
</span><span class="cx"> return adoptRef(*new StyleRuleSupports(conditionText, conditionIsSupported, adoptRules));
</span><span class="cx"> }
</span><ins>+
+ static Ref<StyleRuleSupports> create(const String& conditionText, bool conditionIsSupported, std::unique_ptr<DeferredStyleGroupRuleList>&& deferredChildRules)
+ {
+ return adoptRef(*new StyleRuleSupports(conditionText, conditionIsSupported, WTFMove(deferredChildRules)));
+ }
</ins><span class="cx">
</span><span class="cx"> String conditionText() const { return m_conditionText; }
</span><span class="cx"> bool conditionIsSupported() const { return m_conditionIsSupported; }
</span><span class="lines">@@ -227,6 +268,8 @@
</span><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> StyleRuleSupports(const String& conditionText, bool conditionIsSupported, Vector<RefPtr<StyleRuleBase>>& adoptRules);
</span><ins>+ StyleRuleSupports(const String& conditionText, bool conditionIsSupported, std::unique_ptr<DeferredStyleGroupRuleList>&&);
+
</ins><span class="cx"> StyleRuleSupports(const StyleRuleSupports&);
</span><span class="cx">
</span><span class="cx"> String m_conditionText;
</span><span class="lines">@@ -252,6 +295,7 @@
</span><span class="cx"> private:
</span><span class="cx"> StyleRuleRegion(Vector<std::unique_ptr<CSSParserSelector>>*, Vector<RefPtr<StyleRuleBase>>& adoptRules);
</span><span class="cx"> StyleRuleRegion(CSSSelectorList&, Vector<RefPtr<StyleRuleBase>>&);
</span><ins>+
</ins><span class="cx"> StyleRuleRegion(const StyleRuleRegion&);
</span><span class="cx">
</span><span class="cx"> CSSSelectorList m_selectorList;
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleSheetContentscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleSheetContents.cpp (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleSheetContents.cpp        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/css/StyleSheetContents.cpp        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -330,7 +330,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> CSSParser p(parserContext());
</span><del>- p.parseSheet(this, sheetText);
</del><ins>+ p.parseSheet(this, sheetText, CSSParser::RuleParsing::Deferred);
</ins><span class="cx">
</span><span class="cx"> if (m_parserContext.needsSiteSpecificQuirks && isStrictParserMode(m_parserContext.mode)) {
</span><span class="cx"> // Work around <https://bugs.webkit.org/show_bug.cgi?id=28350>.
</span><span class="lines">@@ -346,7 +346,7 @@
</span><span class="cx"> bool StyleSheetContents::parseString(const String& sheetText)
</span><span class="cx"> {
</span><span class="cx"> CSSParser p(parserContext());
</span><del>- p.parseSheet(this, sheetText);
</del><ins>+ p.parseSheet(this, sheetText, parserContext().mode != UASheetMode ? CSSParser::RuleParsing::Deferred : CSSParser::RuleParsing::Normal);
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -428,18 +428,22 @@
</span><span class="cx"> {
</span><span class="cx"> for (auto& rule : rules) {
</span><span class="cx"> switch (rule->type()) {
</span><del>- case StyleRuleBase::Style:
- if (downcast<StyleRule>(*rule).properties().traverseSubresources(handler))
</del><ins>+ case StyleRuleBase::Style: {
+ auto* properties = downcast<StyleRule>(*rule).propertiesWithoutDeferredParsing();
+ if (properties && properties->traverseSubresources(handler))
</ins><span class="cx"> return true;
</span><span class="cx"> break;
</span><ins>+ }
</ins><span class="cx"> case StyleRuleBase::FontFace:
</span><span class="cx"> if (downcast<StyleRuleFontFace>(*rule).properties().traverseSubresources(handler))
</span><span class="cx"> return true;
</span><span class="cx"> break;
</span><del>- case StyleRuleBase::Media:
- if (traverseSubresourcesInRules(downcast<StyleRuleMedia>(*rule).childRules(), handler))
</del><ins>+ case StyleRuleBase::Media: {
+ auto* childRules = downcast<StyleRuleMedia>(*rule).childRulesWithoutDeferredParsing();
+ if (childRules && traverseSubresourcesInRules(*childRules, handler))
</ins><span class="cx"> return true;
</span><span class="cx"> break;
</span><ins>+ }
</ins><span class="cx"> case StyleRuleBase::Region:
</span><span class="cx"> if (traverseSubresourcesInRules(downcast<StyleRuleRegion>(*rule).childRules(), handler))
</span><span class="cx"> return true;
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleSheetContentsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleSheetContents.h (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleSheetContents.h        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/css/StyleSheetContents.h        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #include <wtf/ListHashSet.h>
</span><span class="cx"> #include <wtf/RefCounted.h>
</span><span class="cx"> #include <wtf/Vector.h>
</span><ins>+#include <wtf/WeakPtr.h>
</ins><span class="cx"> #include <wtf/text/AtomicStringHash.h>
</span><span class="cx"> #include <wtf/text/TextPosition.h>
</span><span class="cx">
</span><span class="lines">@@ -142,6 +143,8 @@
</span><span class="cx">
</span><span class="cx"> void shrinkToFit();
</span><span class="cx">
</span><ins>+ WeakPtr<StyleSheetContents> createWeakPtr() { return m_weakPtrFactory.createWeakPtr(); }
+
</ins><span class="cx"> private:
</span><span class="cx"> WEBCORE_EXPORT StyleSheetContents(StyleRuleImport* ownerRule, const String& originalURL, const CSSParserContext&);
</span><span class="cx"> StyleSheetContents(const StyleSheetContents&);
</span><span class="lines">@@ -171,6 +174,8 @@
</span><span class="cx"> CSSParserContext m_parserContext;
</span><span class="cx">
</span><span class="cx"> Vector<CSSStyleSheet*> m_clients;
</span><ins>+
+ WeakPtrFactory<StyleSheetContents> m_weakPtrFactory { this };
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecssWebKitCSSMatrixcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/WebKitCSSMatrix.cpp (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/WebKitCSSMatrix.cpp        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/css/WebKitCSSMatrix.cpp        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -67,7 +67,7 @@
</span><span class="cx"> return { };
</span><span class="cx">
</span><span class="cx"> auto styleDeclaration = MutableStyleProperties::create();
</span><del>- if (CSSParser::parseValue(styleDeclaration, CSSPropertyTransform, string, true, HTMLStandardMode, nullptr) == CSSParser::ParseResult::Error)
</del><ins>+ if (CSSParser::parseValue(styleDeclaration, CSSPropertyTransform, string, true, HTMLStandardMode) == CSSParser::ParseResult::Error)
</ins><span class="cx"> return Exception { SYNTAX_ERR };
</span><span class="cx">
</span><span class="cx"> // Convert to TransformOperations. This can fail if a property requires style (i.e., param uses 'ems' or 'exs')
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSDeferredParsercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/css/parser/CSSDeferredParser.cpp (0 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSDeferredParser.cpp         (rev 0)
+++ trunk/Source/WebCore/css/parser/CSSDeferredParser.cpp        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -0,0 +1,56 @@
</span><ins>+/*
+ * Copyright (C) 2016 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. ``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
+ * 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.
+ */
+
+#include "config.h"
+#include "CSSDeferredParser.h"
+
+#include "CSSParserImpl.h"
+#include "StyleSheetContents.h"
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+CSSDeferredParser::CSSDeferredParser(const CSSParserContext& context, StyleSheetContents& styleSheet)
+ : m_context(context)
+ , m_styleSheet(styleSheet.createWeakPtr())
+{
+}
+
+Ref<ImmutableStyleProperties> CSSDeferredParser::parseDeclaration(const CSSParserTokenRange& range)
+{
+ return CSSParserImpl::parseDeferredDeclaration(range, m_context, m_styleSheet.get());
+}
+
+void CSSDeferredParser::parseRuleList(const CSSParserTokenRange& range, Vector<RefPtr<StyleRuleBase>>& childRules)
+{
+ CSSParserImpl::parseDeferredRuleList(range, *this, childRules);
+}
+
+void CSSDeferredParser::parseKeyframeList(const CSSParserTokenRange& range, StyleRuleKeyframes&keyframesRule)
+{
+ CSSParserImpl::parseDeferredKeyframeList(range, *this, keyframesRule);
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSDeferredParserh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/css/parser/CSSDeferredParser.h (0 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSDeferredParser.h         (rev 0)
+++ trunk/Source/WebCore/css/parser/CSSDeferredParser.h        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -0,0 +1,66 @@
</span><ins>+/*
+ * Copyright (C) 2016 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. ``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
+ * 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.
+ */
+
+#pragma once
+
+#include "CSSParserMode.h"
+#include "CSSTokenizer.h"
+#include <wtf/RefCounted.h>
+#include <wtf/WeakPtr.h>
+
+namespace WebCore {
+
+class ImmutableStyleProperties;
+class StyleRuleKeyframes;
+class StyleRuleBase;
+
+class CSSDeferredParser : public RefCounted<CSSDeferredParser> {
+public:
+ static Ref<CSSDeferredParser> create(const CSSParserContext& parserContext, StyleSheetContents& styleSheet)
+ {
+ return adoptRef(*new CSSDeferredParser(parserContext, styleSheet));
+ }
+
+ CSSParserMode mode() const { return m_context.mode; }
+
+ const CSSParserContext& context() const { return m_context; }
+ StyleSheetContents* styleSheet() const { return m_styleSheet.get(); }
+
+ Ref<ImmutableStyleProperties> parseDeclaration(const CSSParserTokenRange&);
+ void parseRuleList(const CSSParserTokenRange&, Vector<RefPtr<StyleRuleBase>>&);
+ void parseKeyframeList(const CSSParserTokenRange&, StyleRuleKeyframes&);
+
+ void adoptTokenizerEscapedStrings(Vector<String>&& strings) { m_escapedStrings = WTFMove(strings); }
+
+private:
+ CSSDeferredParser(const CSSParserContext&, StyleSheetContents&);
+
+ Vector<String> m_escapedStrings;
+ CSSParserContext m_context;
+
+ WeakPtr<StyleSheetContents> m_styleSheet;
+};
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSParser.cpp (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSParser.cpp        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/css/parser/CSSParser.cpp        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -96,6 +96,7 @@
</span><span class="cx"> #if ENABLE(VARIATION_FONTS)
</span><span class="cx"> variationFontsEnabled = settings->variationFontsEnabled();
</span><span class="cx"> #endif
</span><ins>+ deferredCSSParserEnabled = settings->deferredCSSParserEnabled();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="lines">@@ -121,7 +122,8 @@
</span><span class="cx"> #if ENABLE(VARIATION_FONTS)
</span><span class="cx"> && a.variationFontsEnabled == b.variationFontsEnabled
</span><span class="cx"> #endif
</span><del>- && a.springTimingFunctionEnabled == b.springTimingFunctionEnabled;
</del><ins>+ && a.springTimingFunctionEnabled == b.springTimingFunctionEnabled
+ && a.deferredCSSParserEnabled == b.deferredCSSParserEnabled;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> CSSParser::CSSParser(const CSSParserContext& context)
</span><span class="lines">@@ -133,9 +135,9 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void CSSParser::parseSheet(StyleSheetContents* sheet, const String& string)
</del><ins>+void CSSParser::parseSheet(StyleSheetContents* sheet, const String& string, RuleParsing ruleParsing)
</ins><span class="cx"> {
</span><del>- return CSSParserImpl::parseStyleSheet(string, m_context, sheet);
</del><ins>+ return CSSParserImpl::parseStyleSheet(string, m_context, sheet, ruleParsing);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void CSSParser::parseSheetForInspector(const CSSParserContext& context, StyleSheetContents* sheet, const String& string, CSSParserObserver& observer)
</span><span class="lines">@@ -156,10 +158,8 @@
</span><span class="cx">
</span><span class="cx"> bool CSSParser::parseSupportsCondition(const String& condition)
</span><span class="cx"> {
</span><del>- CSSTokenizer tokenizer(condition);
- CSSParserTokenRange range = tokenizer.tokenRange();
- CSSParserImpl parser(m_context);
- return CSSSupportsParser::supportsCondition(range, parser) == CSSSupportsParser::Supported;
</del><ins>+ CSSParserImpl parser(m_context, condition);
+ return CSSSupportsParser::supportsCondition(parser.tokenizer()->tokenRange(), parser) == CSSSupportsParser::Supported;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Color CSSParser::parseColor(const String& string, bool strict)
</span><span class="lines">@@ -202,16 +202,16 @@
</span><span class="cx"> {
</span><span class="cx"> if (string.isEmpty())
</span><span class="cx"> return nullptr;
</span><del>- if (RefPtr<CSSValue> value = CSSParserFastPaths::maybeParseValue(propertyID, string, context.mode, nullptr))
</del><ins>+ if (RefPtr<CSSValue> value = CSSParserFastPaths::maybeParseValue(propertyID, string, context.mode))
</ins><span class="cx"> return value;
</span><span class="cx"> CSSTokenizer tokenizer(string);
</span><span class="cx"> return CSSPropertyParser::parseSingleValue(propertyID, tokenizer.tokenRange(), context, nullptr);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-CSSParser::ParseResult CSSParser::parseValue(MutableStyleProperties& declaration, CSSPropertyID propertyID, const String& string, bool important, const CSSParserContext& context, StyleSheetContents* contextStyleSheet)
</del><ins>+CSSParser::ParseResult CSSParser::parseValue(MutableStyleProperties& declaration, CSSPropertyID propertyID, const String& string, bool important, const CSSParserContext& context)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(!string.isEmpty());
</span><del>- RefPtr<CSSValue> value = CSSParserFastPaths::maybeParseValue(propertyID, string, context.mode, contextStyleSheet);
</del><ins>+ RefPtr<CSSValue> value = CSSParserFastPaths::maybeParseValue(propertyID, string, context.mode);
</ins><span class="cx"> if (value)
</span><span class="cx"> return declaration.addParsedProperty(CSSProperty(propertyID, WTFMove(value), important)) ? CSSParser::ParseResult::Changed : CSSParser::ParseResult::Unchanged;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSParser.h (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSParser.h        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/css/parser/CSSParser.h        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -47,10 +47,11 @@
</span><span class="cx"> Error
</span><span class="cx"> };
</span><span class="cx">
</span><del>- WEBCORE_EXPORT CSSParser(const CSSParserContext&);
</del><ins>+ WEBCORE_EXPORT explicit CSSParser(const CSSParserContext&);
</ins><span class="cx"> WEBCORE_EXPORT ~CSSParser();
</span><span class="cx">
</span><del>- void parseSheet(StyleSheetContents*, const String&);
</del><ins>+ enum class RuleParsing { Normal, Deferred };
+ void parseSheet(StyleSheetContents*, const String&, RuleParsing = RuleParsing::Normal);
</ins><span class="cx">
</span><span class="cx"> static RefPtr<StyleRuleBase> parseRule(const CSSParserContext&, StyleSheetContents*, const String&);
</span><span class="cx">
</span><span class="lines">@@ -62,7 +63,7 @@
</span><span class="cx"> static void parseSheetForInspector(const CSSParserContext&, StyleSheetContents*, const String&, CSSParserObserver&);
</span><span class="cx"> static void parseDeclarationForInspector(const CSSParserContext&, const String&, CSSParserObserver&);
</span><span class="cx">
</span><del>- static ParseResult parseValue(MutableStyleProperties&, CSSPropertyID, const String&, bool important, const CSSParserContext&, StyleSheetContents*);
</del><ins>+ static ParseResult parseValue(MutableStyleProperties&, CSSPropertyID, const String&, bool important, const CSSParserContext&);
</ins><span class="cx"> static ParseResult parseCustomPropertyValue(MutableStyleProperties&, const AtomicString& propertyName, const String&, bool important, const CSSParserContext&);
</span><span class="cx">
</span><span class="cx"> static RefPtr<CSSValue> parseFontFaceDescriptor(CSSPropertyID, const String&, const CSSParserContext&);
</span><span class="lines">@@ -71,7 +72,7 @@
</span><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT bool parseDeclaration(MutableStyleProperties&, const String&);
</span><span class="cx"> static Ref<ImmutableStyleProperties> parseInlineStyleDeclaration(const String&, Element*);
</span><del>-
</del><ins>+
</ins><span class="cx"> void parseSelector(const String&, CSSSelectorList&);
</span><span class="cx">
</span><span class="cx"> RefPtr<CSSValue> parseValueWithVariableReferences(CSSPropertyID, const CSSValue&, const CustomPropertyValueMap& customProperties, TextDirection, WritingMode);
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSParserFastPathscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -495,7 +495,7 @@
</span><span class="cx"> return CSSValuePool::singleton().createColorValue(color);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyID propertyId, CSSValueID valueID, CSSParserMode parserMode, StyleSheetContents* styleSheetContents)
</del><ins>+bool CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyID propertyId, CSSValueID valueID, CSSParserMode parserMode)
</ins><span class="cx"> {
</span><span class="cx"> if (valueID == CSSValueInvalid || !isValueAllowedInMode(valueID, parserMode))
</span><span class="cx"> return false;
</span><span class="lines">@@ -750,21 +750,9 @@
</span><span class="cx"> case CSSPropertyWebkitUserDrag: // auto | none | element
</span><span class="cx"> return valueID == CSSValueAuto || valueID == CSSValueNone || valueID == CSSValueElement;
</span><span class="cx"> case CSSPropertyWebkitUserModify: // read-only | read-write
</span><del>- if (valueID == CSSValueReadOnly || valueID == CSSValueReadWrite || valueID == CSSValueReadWritePlaintextOnly) {
- if (styleSheetContents)
- styleSheetContents->parserSetUsesStyleBasedEditability();
- return true;
- }
- return false;
</del><ins>+ return valueID == CSSValueReadOnly || valueID == CSSValueReadWrite || valueID == CSSValueReadWritePlaintextOnly;
</ins><span class="cx"> case CSSPropertyWebkitUserSelect: // auto | none | text | all
</span><del>- if (valueID == CSSValueAuto || valueID == CSSValueNone || valueID == CSSValueText)
- return true;
- if (valueID == CSSValueAll) {
- if (styleSheetContents)
- styleSheetContents->parserSetUsesStyleBasedEditability();
- return true;
- }
- return false;
</del><ins>+ return valueID == CSSValueAuto || valueID == CSSValueNone || valueID == CSSValueText || valueID == CSSValueAll;
</ins><span class="cx"> case CSSPropertyWritingMode:
</span><span class="cx"> // Note that horizontal-bt is not supported by the unprefixed version of
</span><span class="cx"> // the property, only by the -webkit- version.
</span><span class="lines">@@ -1025,7 +1013,7 @@
</span><span class="cx"> || equalLettersIgnoringASCIICase(string, "revert");
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static RefPtr<CSSValue> parseKeywordValue(CSSPropertyID propertyId, const String& string, CSSParserMode parserMode, StyleSheetContents* styleSheetContents)
</del><ins>+static RefPtr<CSSValue> parseKeywordValue(CSSPropertyID propertyId, const String& string, CSSParserMode parserMode)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(!string.isEmpty());
</span><span class="cx">
</span><span class="lines">@@ -1057,7 +1045,7 @@
</span><span class="cx"> if (valueID == CSSValueRevert)
</span><span class="cx"> return CSSValuePool::singleton().createRevertValue();
</span><span class="cx">
</span><del>- if (CSSParserFastPaths::isValidKeywordPropertyAndValue(propertyId, valueID, parserMode, styleSheetContents))
</del><ins>+ if (CSSParserFastPaths::isValidKeywordPropertyAndValue(propertyId, valueID, parserMode))
</ins><span class="cx"> return CSSPrimitiveValue::createIdentifier(valueID);
</span><span class="cx"> return nullptr;
</span><span class="cx"> }
</span><span class="lines">@@ -1270,7 +1258,7 @@
</span><span class="cx"> return parseSimpleTransformList(string.characters16(), string.length());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<CSSValue> CSSParserFastPaths::maybeParseValue(CSSPropertyID propertyID, const String& string, CSSParserMode parserMode, StyleSheetContents* styleSheetContents)
</del><ins>+RefPtr<CSSValue> CSSParserFastPaths::maybeParseValue(CSSPropertyID propertyID, const String& string, CSSParserMode parserMode)
</ins><span class="cx"> {
</span><span class="cx"> RefPtr<CSSValue> result = parseSimpleLengthValue(propertyID, string, parserMode);
</span><span class="cx"> if (result)
</span><span class="lines">@@ -1277,7 +1265,7 @@
</span><span class="cx"> return result;
</span><span class="cx"> if (isColorPropertyID(propertyID))
</span><span class="cx"> return parseColor(string, parserMode);
</span><del>- result = parseKeywordValue(propertyID, string, parserMode, styleSheetContents);
</del><ins>+ result = parseKeywordValue(propertyID, string, parserMode);
</ins><span class="cx"> if (result)
</span><span class="cx"> return result;
</span><span class="cx"> result = parseSimpleTransform(propertyID, string);
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSParserFastPathsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSParserFastPaths.h (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSParserFastPaths.h        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/css/parser/CSSParserFastPaths.h        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -43,11 +43,11 @@
</span><span class="cx"> public:
</span><span class="cx"> // Parses simple values like '10px' or 'green', but makes no guarantees
</span><span class="cx"> // about handling any property completely.
</span><del>- static RefPtr<CSSValue> maybeParseValue(CSSPropertyID, const String&, CSSParserMode, StyleSheetContents*);
</del><ins>+ static RefPtr<CSSValue> maybeParseValue(CSSPropertyID, const String&, CSSParserMode);
</ins><span class="cx">
</span><span class="cx"> // Properties handled here shouldn't be explicitly handled in CSSPropertyParser
</span><span class="cx"> static bool isKeywordPropertyID(CSSPropertyID);
</span><del>- static bool isValidKeywordPropertyAndValue(CSSPropertyID, CSSValueID, CSSParserMode, StyleSheetContents*);
</del><ins>+ static bool isValidKeywordPropertyAndValue(CSSPropertyID, CSSValueID, CSSParserMode);
</ins><span class="cx">
</span><span class="cx"> static RefPtr<CSSValue> parseColor(const String&, CSSParserMode);
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSParserImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSParserImpl.cpp (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSParserImpl.cpp        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/css/parser/CSSParserImpl.cpp        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx">
</span><span class="cx"> #include "CSSAtRuleID.h"
</span><span class="cx"> #include "CSSCustomPropertyValue.h"
</span><ins>+#include "CSSDeferredParser.h"
</ins><span class="cx"> #include "CSSKeyframeRule.h"
</span><span class="cx"> #include "CSSKeyframesRule.h"
</span><span class="cx"> #include "CSSParserObserver.h"
</span><span class="lines">@@ -58,20 +59,36 @@
</span><span class="cx"> CSSParserImpl::CSSParserImpl(const CSSParserContext& context, StyleSheetContents* styleSheet)
</span><span class="cx"> : m_context(context)
</span><span class="cx"> , m_styleSheet(styleSheet)
</span><del>- , m_observerWrapper(nullptr)
</del><span class="cx"> {
</span><ins>+
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+CSSParserImpl::CSSParserImpl(CSSDeferredParser& deferredParser)
+ : m_context(deferredParser.context())
+ , m_styleSheet(deferredParser.styleSheet())
+ , m_deferredParser(&deferredParser)
+{
+}
+
+CSSParserImpl::CSSParserImpl(const CSSParserContext& context, const String& string, StyleSheetContents* styleSheet, CSSParserObserverWrapper* wrapper, CSSParser::RuleParsing ruleParsing)
+ : m_context(context)
+ , m_styleSheet(styleSheet)
+ , m_observerWrapper(wrapper)
+{
+ m_tokenizer = wrapper ? std::make_unique<CSSTokenizer>(string, *wrapper) : std::make_unique<CSSTokenizer>(string);
+ if (context.deferredCSSParserEnabled && !wrapper && styleSheet && ruleParsing == CSSParser::RuleParsing::Deferred)
+ m_deferredParser = CSSDeferredParser::create(context, *styleSheet);
+}
+
</ins><span class="cx"> CSSParser::ParseResult CSSParserImpl::parseValue(MutableStyleProperties* declaration, CSSPropertyID propertyID, const String& string, bool important, const CSSParserContext& context)
</span><span class="cx"> {
</span><del>- CSSParserImpl parser(context);
</del><ins>+ CSSParserImpl parser(context, string);
</ins><span class="cx"> StyleRule::Type ruleType = StyleRule::Style;
</span><span class="cx"> #if ENABLE(CSS_DEVICE_ADAPTATION)
</span><span class="cx"> if (declaration->cssParserMode() == CSSViewportRuleMode)
</span><span class="cx"> ruleType = StyleRule::Viewport;
</span><span class="cx"> #endif
</span><del>- CSSTokenizer tokenizer(string);
- parser.consumeDeclarationValue(tokenizer.tokenRange(), propertyID, important, ruleType);
</del><ins>+ parser.consumeDeclarationValue(parser.tokenizer()->tokenRange(), propertyID, important, ruleType);
</ins><span class="cx"> if (parser.m_parsedProperties.isEmpty())
</span><span class="cx"> return CSSParser::ParseResult::Error;
</span><span class="cx"> return declaration->addParsedProperties(parser.m_parsedProperties) ? CSSParser::ParseResult::Changed : CSSParser::ParseResult::Unchanged;
</span><span class="lines">@@ -79,9 +96,8 @@
</span><span class="cx">
</span><span class="cx"> CSSParser::ParseResult CSSParserImpl::parseCustomPropertyValue(MutableStyleProperties* declaration, const AtomicString& propertyName, const String& string, bool important, const CSSParserContext& context)
</span><span class="cx"> {
</span><del>- CSSParserImpl parser(context);
- CSSTokenizer tokenizer(string);
- parser.consumeCustomPropertyValue(tokenizer.tokenRange(), propertyName, important);
</del><ins>+ CSSParserImpl parser(context, string);
+ parser.consumeCustomPropertyValue(parser.tokenizer()->tokenRange(), propertyName, important);
</ins><span class="cx"> if (parser.m_parsedProperties.isEmpty())
</span><span class="cx"> return CSSParser::ParseResult::Error;
</span><span class="cx"> return declaration->addParsedProperties(parser.m_parsedProperties) ? CSSParser::ParseResult::Changed : CSSParser::ParseResult::Unchanged;
</span><span class="lines">@@ -117,6 +133,12 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+Ref<DeferredStyleProperties> CSSParserImpl::createDeferredStyleProperties(const CSSParserTokenRange& propertyRange)
+{
+ ASSERT(m_deferredParser);
+ return DeferredStyleProperties::create(propertyRange, *m_deferredParser);
+}
+
</ins><span class="cx"> static Ref<ImmutableStyleProperties> createStyleProperties(ParsedPropertyVector& parsedProperties, CSSParserMode mode)
</span><span class="cx"> {
</span><span class="cx"> std::bitset<numCSSProperties> seenProperties;
</span><span class="lines">@@ -137,22 +159,51 @@
</span><span class="cx"> CSSParserContext context(element->document());
</span><span class="cx"> context.mode = strictToCSSParserMode(element->isHTMLElement() && !element->document().inQuirksMode());
</span><span class="cx">
</span><del>- CSSParserImpl parser(context);
- CSSTokenizer tokenizer(string);
- parser.consumeDeclarationList(tokenizer.tokenRange(), StyleRule::Style);
</del><ins>+ CSSParserImpl parser(context, string);
+ parser.consumeDeclarationList(parser.tokenizer()->tokenRange(), StyleRule::Style);
</ins><span class="cx"> return createStyleProperties(parser.m_parsedProperties, context.mode);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+Ref<ImmutableStyleProperties> CSSParserImpl::parseDeferredDeclaration(CSSParserTokenRange tokenRange, const CSSParserContext& context, StyleSheetContents* styleSheet)
+{
+ if (!styleSheet) {
+ ParsedPropertyVector properties;
+ return createStyleProperties(properties, context.mode);
+ }
+ CSSParserImpl parser(context, styleSheet);
+ parser.consumeDeclarationList(tokenRange, StyleRule::Style);
+ return createStyleProperties(parser.m_parsedProperties, context.mode);
+}
+
+void CSSParserImpl::parseDeferredRuleList(CSSParserTokenRange tokenRange, CSSDeferredParser& deferredParser, Vector<RefPtr<StyleRuleBase>>& childRules)
+{
+ if (!deferredParser.styleSheet())
+ return;
+ CSSParserImpl parser(deferredParser);
+ parser.consumeRuleList(tokenRange, RegularRuleList, [&childRules](const RefPtr<StyleRuleBase>& rule) {
+ childRules.append(rule);
+ });
+}
+
+void CSSParserImpl::parseDeferredKeyframeList(CSSParserTokenRange tokenRange, CSSDeferredParser& deferredParser, StyleRuleKeyframes& keyframeRule)
+{
+ if (!deferredParser.styleSheet())
+ return;
+ CSSParserImpl parser(deferredParser);
+ parser.consumeRuleList(tokenRange, KeyframesRuleList, [&keyframeRule](const RefPtr<StyleRuleBase>& keyframe) {
+ keyframeRule.parserAppendKeyframe(downcast<const StyleKeyframe>(keyframe.get()));
+ });
+}
+
</ins><span class="cx"> bool CSSParserImpl::parseDeclarationList(MutableStyleProperties* declaration, const String& string, const CSSParserContext& context)
</span><span class="cx"> {
</span><del>- CSSParserImpl parser(context);
</del><ins>+ CSSParserImpl parser(context, string);
</ins><span class="cx"> StyleRule::Type ruleType = StyleRule::Style;
</span><span class="cx"> #if ENABLE(CSS_DEVICE_ADAPTATION)
</span><span class="cx"> if (declaration->cssParserMode() == CSSViewportRuleMode)
</span><span class="cx"> ruleType = StyleRule::Viewport;
</span><span class="cx"> #endif
</span><del>- CSSTokenizer tokenizer(string);
- parser.consumeDeclarationList(tokenizer.tokenRange(), ruleType);
</del><ins>+ parser.consumeDeclarationList(parser.tokenizer()->tokenRange(), ruleType);
</ins><span class="cx"> if (parser.m_parsedProperties.isEmpty())
</span><span class="cx"> return false;
</span><span class="cx">
</span><span class="lines">@@ -169,9 +220,8 @@
</span><span class="cx">
</span><span class="cx"> RefPtr<StyleRuleBase> CSSParserImpl::parseRule(const String& string, const CSSParserContext& context, StyleSheetContents* styleSheet, AllowedRulesType allowedRules)
</span><span class="cx"> {
</span><del>- CSSParserImpl parser(context, styleSheet);
- CSSTokenizer tokenizer(string);
- CSSParserTokenRange range = tokenizer.tokenRange();
</del><ins>+ CSSParserImpl parser(context, string, styleSheet);
+ CSSParserTokenRange range = parser.tokenizer()->tokenRange();
</ins><span class="cx"> range.consumeWhitespace();
</span><span class="cx"> if (range.atEnd())
</span><span class="cx"> return nullptr; // Parse error, empty rule
</span><span class="lines">@@ -188,18 +238,25 @@
</span><span class="cx"> return rule;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void CSSParserImpl::parseStyleSheet(const String& string, const CSSParserContext& context, StyleSheetContents* styleSheet)
</del><ins>+void CSSParserImpl::parseStyleSheet(const String& string, const CSSParserContext& context, StyleSheetContents* styleSheet, CSSParser::RuleParsing ruleParsing)
</ins><span class="cx"> {
</span><del>- CSSTokenizer tokenizer(string);
- CSSParserImpl parser(context, styleSheet);
- bool firstRuleValid = parser.consumeRuleList(tokenizer.tokenRange(), TopLevelRuleList, [&styleSheet](RefPtr<StyleRuleBase> rule) {
</del><ins>+ CSSParserImpl parser(context, string, styleSheet, nullptr, ruleParsing);
+ bool firstRuleValid = parser.consumeRuleList(parser.tokenizer()->tokenRange(), TopLevelRuleList, [&styleSheet](RefPtr<StyleRuleBase> rule) {
</ins><span class="cx"> if (rule->isCharsetRule())
</span><span class="cx"> return;
</span><span class="cx"> styleSheet->parserAppendRule(rule.releaseNonNull());
</span><span class="cx"> });
</span><span class="cx"> styleSheet->setHasSyntacticallyValidCSSHeader(firstRuleValid);
</span><ins>+ parser.adoptTokenizerEscapedStrings();
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+void CSSParserImpl::adoptTokenizerEscapedStrings()
+{
+ if (!m_deferredParser || !m_tokenizer)
+ return;
+ m_deferredParser->adoptTokenizerEscapedStrings(m_tokenizer->escapedStringsForAdoption());
+}
+
</ins><span class="cx"> CSSSelectorList CSSParserImpl::parsePageSelector(CSSParserTokenRange range, StyleSheetContents* styleSheet)
</span><span class="cx"> {
</span><span class="cx"> // We only support a small subset of the css-page spec.
</span><span class="lines">@@ -258,22 +315,18 @@
</span><span class="cx">
</span><span class="cx"> void CSSParserImpl::parseDeclarationListForInspector(const String& declaration, const CSSParserContext& context, CSSParserObserver& observer)
</span><span class="cx"> {
</span><del>- CSSParserImpl parser(context);
</del><span class="cx"> CSSParserObserverWrapper wrapper(observer);
</span><del>- parser.m_observerWrapper = &wrapper;
- CSSTokenizer tokenizer(declaration, wrapper);
</del><ins>+ CSSParserImpl parser(context, declaration, nullptr, &wrapper);
</ins><span class="cx"> observer.startRuleHeader(StyleRule::Style, 0);
</span><span class="cx"> observer.endRuleHeader(1);
</span><del>- parser.consumeDeclarationList(tokenizer.tokenRange(), StyleRule::Style);
</del><ins>+ parser.consumeDeclarationList(parser.tokenizer()->tokenRange(), StyleRule::Style);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void CSSParserImpl::parseStyleSheetForInspector(const String& string, const CSSParserContext& context, StyleSheetContents* styleSheet, CSSParserObserver& observer)
</span><span class="cx"> {
</span><del>- CSSParserImpl parser(context, styleSheet);
</del><span class="cx"> CSSParserObserverWrapper wrapper(observer);
</span><del>- parser.m_observerWrapper = &wrapper;
- CSSTokenizer tokenizer(string, wrapper);
- bool firstRuleValid = parser.consumeRuleList(tokenizer.tokenRange(), TopLevelRuleList, [&styleSheet](RefPtr<StyleRuleBase> rule) {
</del><ins>+ CSSParserImpl parser(context, string, styleSheet, &wrapper);
+ bool firstRuleValid = parser.consumeRuleList(parser.tokenizer()->tokenRange(), TopLevelRuleList, [&styleSheet](RefPtr<StyleRuleBase> rule) {
</ins><span class="cx"> if (rule->isCharsetRule())
</span><span class="cx"> return;
</span><span class="cx"> styleSheet->parserAppendRule(rule.releaseNonNull());
</span><span class="lines">@@ -417,7 +470,7 @@
</span><span class="cx"> return nullptr; // Parse error, EOF instead of qualified rule block
</span><span class="cx">
</span><span class="cx"> CSSParserTokenRange prelude = range.makeSubRange(preludeStart, &range.peek());
</span><del>- CSSParserTokenRange block = range.consumeBlock();
</del><ins>+ CSSParserTokenRange block = range.consumeBlockCheckingForEditability(m_styleSheet.get());
</ins><span class="cx">
</span><span class="cx"> if (allowedRules <= RegularRules)
</span><span class="cx"> return consumeStyleRule(prelude, block);
</span><span class="lines">@@ -486,6 +539,9 @@
</span><span class="cx">
</span><span class="cx"> RefPtr<StyleRuleMedia> CSSParserImpl::consumeMediaRule(CSSParserTokenRange prelude, CSSParserTokenRange block)
</span><span class="cx"> {
</span><ins>+ if (m_deferredParser)
+ return StyleRuleMedia::create(MediaQueryParser::parseMediaQuerySet(prelude).releaseNonNull(), std::make_unique<DeferredStyleGroupRuleList>(block, *m_deferredParser));
+
</ins><span class="cx"> Vector<RefPtr<StyleRuleBase>> rules;
</span><span class="cx">
</span><span class="cx"> if (m_observerWrapper) {
</span><span class="lines">@@ -510,6 +566,9 @@
</span><span class="cx"> if (supported == CSSSupportsParser::Invalid)
</span><span class="cx"> return nullptr; // Parse error, invalid @supports condition
</span><span class="cx">
</span><ins>+ if (m_deferredParser)
+ return StyleRuleSupports::create(prelude.serialize().stripWhiteSpace(), supported, std::make_unique<DeferredStyleGroupRuleList>(block, *m_deferredParser));
+
</ins><span class="cx"> if (m_observerWrapper) {
</span><span class="cx"> m_observerWrapper->observer().startRuleHeader(StyleRule::Supports, m_observerWrapper->startOffset(prelude));
</span><span class="cx"> m_observerWrapper->observer().endRuleHeader(m_observerWrapper->endOffset(prelude));
</span><span class="lines">@@ -578,6 +637,9 @@
</span><span class="cx"> else
</span><span class="cx"> return nullptr; // Parse error; expected ident token in @keyframes header
</span><span class="cx">
</span><ins>+ if (m_deferredParser)
+ return StyleRuleKeyframes::create(name, std::make_unique<DeferredStyleGroupRuleList>(block, *m_deferredParser));
+
</ins><span class="cx"> if (m_observerWrapper) {
</span><span class="cx"> m_observerWrapper->observer().startRuleHeader(StyleRule::Keyframes, m_observerWrapper->startOffset(rangeCopy));
</span><span class="cx"> m_observerWrapper->observer().endRuleHeader(m_observerWrapper->endOffset(prelude));
</span><span class="lines">@@ -585,12 +647,11 @@
</span><span class="cx"> m_observerWrapper->observer().endRuleBody(m_observerWrapper->endOffset(block));
</span><span class="cx"> }
</span><span class="cx">
</span><del>- RefPtr<StyleRuleKeyframes> keyframeRule = StyleRuleKeyframes::create();
- consumeRuleList(block, KeyframesRuleList, [keyframeRule](RefPtr<StyleRuleBase> keyframe) {
- RefPtr<StyleKeyframe> key = static_cast<StyleKeyframe*>(keyframe.get());
- keyframeRule->parserAppendKeyframe(key.releaseNonNull());
</del><ins>+ RefPtr<StyleRuleKeyframes> keyframeRule = StyleRuleKeyframes::create(name);
+ consumeRuleList(block, KeyframesRuleList, [keyframeRule](const RefPtr<StyleRuleBase>& keyframe) {
+ keyframeRule->parserAppendKeyframe(downcast<const StyleKeyframe>(keyframe.get()));
</ins><span class="cx"> });
</span><del>- keyframeRule->setName(name);
</del><ins>+
</ins><span class="cx"> // FIXME-NEWPARSER: Find out why this is done. Behavior difference when prefixed?
</span><span class="cx"> // keyframeRule->setVendorPrefixed(webkitPrefixed);
</span><span class="cx"> return keyframeRule;
</span><span class="lines">@@ -694,12 +755,26 @@
</span><span class="cx"> if (!selectorList.isValid())
</span><span class="cx"> return nullptr; // Parse error, invalid selector list
</span><span class="cx">
</span><ins>+ RefPtr<StyleRule> rule;
</ins><span class="cx"> if (m_observerWrapper)
</span><span class="cx"> observeSelectors(*m_observerWrapper, prelude);
</span><ins>+
+ if (m_deferredParser) {
+ // If a rule is empty (i.e., only whitespace), don't bother using
+ // deferred parsing. This allows the empty rule optimization in ElementRuleCollector
+ // to continue to work. Note we don't have to consider CommentTokens, since those
+ // are stripped out.
+ CSSParserTokenRange blockCopy = block;
+ blockCopy.consumeWhitespace();
+ if (!blockCopy.atEnd()) {
+ rule = StyleRule::create(createDeferredStyleProperties(block));
+ rule->wrapperAdoptSelectorList(selectorList);
+ return rule;
+ }
+ }
</ins><span class="cx">
</span><span class="cx"> consumeDeclarationList(block, StyleRule::Style);
</span><del>-
- RefPtr<StyleRule> rule = StyleRule::create(createStyleProperties(m_parsedProperties, m_context.mode));
</del><ins>+ rule = StyleRule::create(createStyleProperties(m_parsedProperties, m_context.mode));
</ins><span class="cx"> rule->wrapperAdoptSelectorList(selectorList);
</span><span class="cx"> return rule;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSParserImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSParserImpl.h (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSParserImpl.h        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/css/parser/CSSParserImpl.h        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx">
</span><span class="cx"> #pragma once
</span><span class="cx">
</span><ins>+#include "CSSDeferredParser.h"
</ins><span class="cx"> #include "CSSParser.h"
</span><span class="cx"> #include "CSSParserMode.h"
</span><span class="cx"> #include "CSSParserTokenRange.h"
</span><span class="lines">@@ -46,6 +47,7 @@
</span><span class="cx"> class CSSParserObserver;
</span><span class="cx"> class CSSParserObserverWrapper;
</span><span class="cx"> class CSSSelectorList;
</span><ins>+class CSSTokenizer;
</ins><span class="cx"> class StyleKeyframe;
</span><span class="cx"> class StyleRule;
</span><span class="cx"> class StyleRuleBase;
</span><span class="lines">@@ -66,7 +68,7 @@
</span><span class="cx"> class CSSParserImpl {
</span><span class="cx"> WTF_MAKE_NONCOPYABLE(CSSParserImpl);
</span><span class="cx"> public:
</span><del>- CSSParserImpl(const CSSParserContext&, StyleSheetContents* = nullptr);
</del><ins>+ CSSParserImpl(const CSSParserContext&, const String&, StyleSheetContents* = nullptr, CSSParserObserverWrapper* = nullptr, CSSParser::RuleParsing = CSSParser::RuleParsing::Normal);
</ins><span class="cx">
</span><span class="cx"> enum AllowedRulesType {
</span><span class="cx"> // As per css-syntax, css-cascade and css-namespaces, @charset rules
</span><span class="lines">@@ -88,7 +90,7 @@
</span><span class="cx"> static Ref<ImmutableStyleProperties> parseInlineStyleDeclaration(const String&, Element*);
</span><span class="cx"> static bool parseDeclarationList(MutableStyleProperties*, const String&, const CSSParserContext&);
</span><span class="cx"> static RefPtr<StyleRuleBase> parseRule(const String&, const CSSParserContext&, StyleSheetContents*, AllowedRulesType);
</span><del>- static void parseStyleSheet(const String&, const CSSParserContext&, StyleSheetContents*);
</del><ins>+ static void parseStyleSheet(const String&, const CSSParserContext&, StyleSheetContents*, CSSParser::RuleParsing);
</ins><span class="cx"> static CSSSelectorList parsePageSelector(CSSParserTokenRange, StyleSheetContents*);
</span><span class="cx">
</span><span class="cx"> static std::unique_ptr<Vector<double>> parseKeyframeKeyList(const String&);
</span><span class="lines">@@ -98,7 +100,17 @@
</span><span class="cx"> static void parseDeclarationListForInspector(const String&, const CSSParserContext&, CSSParserObserver&);
</span><span class="cx"> static void parseStyleSheetForInspector(const String&, const CSSParserContext&, StyleSheetContents*, CSSParserObserver&);
</span><span class="cx">
</span><ins>+ static Ref<ImmutableStyleProperties> parseDeferredDeclaration(CSSParserTokenRange, const CSSParserContext&, StyleSheetContents*);
+ static void parseDeferredRuleList(CSSParserTokenRange, CSSDeferredParser&, Vector<RefPtr<StyleRuleBase>>&);
+ static void parseDeferredKeyframeList(CSSParserTokenRange, CSSDeferredParser&, StyleRuleKeyframes&);
+
+ CSSTokenizer* tokenizer() const { return m_tokenizer.get(); };
+ CSSDeferredParser* deferredParser() const { return m_deferredParser.get(); }
+
</ins><span class="cx"> private:
</span><ins>+ CSSParserImpl(const CSSParserContext&, StyleSheetContents*);
+ CSSParserImpl(CSSDeferredParser&);
+
</ins><span class="cx"> enum RuleListType {
</span><span class="cx"> TopLevelRuleList,
</span><span class="cx"> RegularRuleList,
</span><span class="lines">@@ -140,6 +152,10 @@
</span><span class="cx">
</span><span class="cx"> static std::unique_ptr<Vector<double>> consumeKeyframeKeyList(CSSParserTokenRange);
</span><span class="cx">
</span><ins>+ Ref<DeferredStyleProperties> createDeferredStyleProperties(const CSSParserTokenRange& propertyRange);
+
+ void adoptTokenizerEscapedStrings();
+
</ins><span class="cx"> // FIXME: Can we build StylePropertySets directly?
</span><span class="cx"> // FIXME: Investigate using a smaller inline buffer
</span><span class="cx"> ParsedPropertyVector m_parsedProperties;
</span><span class="lines">@@ -147,8 +163,14 @@
</span><span class="cx">
</span><span class="cx"> RefPtr<StyleSheetContents> m_styleSheet;
</span><span class="cx">
</span><ins>+ // For deferred property parsing.
+ RefPtr<CSSDeferredParser> m_deferredParser;
+
+ // For normal parsing.
+ std::unique_ptr<CSSTokenizer> m_tokenizer;
+
</ins><span class="cx"> // For the inspector
</span><del>- CSSParserObserverWrapper* m_observerWrapper;
</del><ins>+ CSSParserObserverWrapper* m_observerWrapper { nullptr };
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSParserModeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSParserMode.h (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSParserMode.h        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/css/parser/CSSParserMode.h        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -107,6 +107,8 @@
</span><span class="cx"> bool useLegacyBackgroundSizeShorthandBehavior { false };
</span><span class="cx"> bool springTimingFunctionEnabled { false };
</span><span class="cx">
</span><ins>+ bool deferredCSSParserEnabled { false };
+
</ins><span class="cx"> URL completeURL(const String& url) const
</span><span class="cx"> {
</span><span class="cx"> if (url.isNull())
</span><span class="lines">@@ -147,7 +149,8 @@
</span><span class="cx"> #if ENABLE(VARIATION_FONTS)
</span><span class="cx"> & key.variationFontsEnabled << 8
</span><span class="cx"> #endif
</span><del>- & key.mode << 9;
</del><ins>+ & key.deferredCSSParserEnabled << 9
+ & key.mode << 10;
</ins><span class="cx"> hash ^= WTF::intHash(bits);
</span><span class="cx"> return hash;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSParserTokenRangecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSParserTokenRange.cpp (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSParserTokenRange.cpp        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/css/parser/CSSParserTokenRange.cpp        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "CSSParserTokenRange.h"
</span><span class="cx">
</span><ins>+#include "StyleSheetContents.h"
</ins><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><span class="cx"> #include <wtf/text/StringBuilder.h>
</span><span class="cx">
</span><span class="lines">@@ -69,6 +70,27 @@
</span><span class="cx"> return makeSubRange(start, m_first - 1);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+CSSParserTokenRange CSSParserTokenRange::consumeBlockCheckingForEditability(StyleSheetContents* styleSheet)
+{
+ ASSERT(peek().getBlockType() == CSSParserToken::BlockStart);
+ const auto* start = &peek() + 1;
+ unsigned nestingLevel = 0;
+ do {
+ const auto& token = consume();
+ if (token.getBlockType() == CSSParserToken::BlockStart)
+ nestingLevel++;
+ else if (token.getBlockType() == CSSParserToken::BlockEnd)
+ nestingLevel--;
+
+ if (styleSheet && !styleSheet->usesStyleBasedEditability() && token.type() == IdentToken && equalLettersIgnoringASCIICase(token.value(), "-webkit-user-modify"))
+ styleSheet->parserSetUsesStyleBasedEditability();
+ } while (nestingLevel && m_first < m_last);
+
+ if (nestingLevel)
+ return makeSubRange(start, m_first); // Ended at EOF
+ return makeSubRange(start, m_first - 1);
+}
+
</ins><span class="cx"> void CSSParserTokenRange::consumeComponentValue()
</span><span class="cx"> {
</span><span class="cx"> // FIXME: This is going to do multiple passes over large sections of a stylesheet.
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSParserTokenRangeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSParserTokenRange.h (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSParserTokenRange.h        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/css/parser/CSSParserTokenRange.h        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -75,6 +75,7 @@
</span><span class="cx">
</span><span class="cx"> // The returned range doesn't include the brackets
</span><span class="cx"> CSSParserTokenRange consumeBlock();
</span><ins>+ CSSParserTokenRange consumeBlockCheckingForEditability(StyleSheetContents*);
</ins><span class="cx">
</span><span class="cx"> void consumeComponentValue();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSPropertyParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -3657,7 +3657,7 @@
</span><span class="cx"> RefPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSPropertyID property, CSSPropertyID currentShorthand)
</span><span class="cx"> {
</span><span class="cx"> if (CSSParserFastPaths::isKeywordPropertyID(property)) {
</span><del>- if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(property, m_range.peek().id(), m_context.mode, m_styleSheetContents))
</del><ins>+ if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(property, m_range.peek().id(), m_context.mode))
</ins><span class="cx"> return nullptr;
</span><span class="cx"> return consumeIdent(m_range);
</span><span class="cx"> }
</span><span class="lines">@@ -4202,7 +4202,7 @@
</span><span class="cx"> case CSSPropertyFontStretch:
</span><span class="cx"> case CSSPropertyFontStyle: {
</span><span class="cx"> CSSValueID id = m_range.consumeIncludingWhitespace().id();
</span><del>- if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(propId, id, m_context.mode, m_styleSheetContents))
</del><ins>+ if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(propId, id, m_context.mode))
</ins><span class="cx"> return false;
</span><span class="cx"> parsedValue = CSSValuePool::singleton().createIdentifierValue(id);
</span><span class="cx"> break;
</span><span class="lines">@@ -4287,7 +4287,7 @@
</span><span class="cx"> // FIXME-NEWPARSER: Implement. RefPtr<CSSPrimitiveValue> fontStretch;
</span><span class="cx"> while (!m_range.atEnd()) {
</span><span class="cx"> CSSValueID id = m_range.peek().id();
</span><del>- if (!fontStyle && CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyFontStyle, id, m_context.mode, m_styleSheetContents)) {
</del><ins>+ if (!fontStyle && CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyFontStyle, id, m_context.mode)) {
</ins><span class="cx"> fontStyle = consumeIdent(m_range);
</span><span class="cx"> continue;
</span><span class="cx"> }
</span><span class="lines">@@ -5292,7 +5292,7 @@
</span><span class="cx"> switch (property) {
</span><span class="cx"> case CSSPropertyWebkitMarginCollapse: {
</span><span class="cx"> CSSValueID id = m_range.consumeIncludingWhitespace().id();
</span><del>- if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyWebkitMarginBeforeCollapse, id, m_context.mode, m_styleSheetContents))
</del><ins>+ if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyWebkitMarginBeforeCollapse, id, m_context.mode))
</ins><span class="cx"> return false;
</span><span class="cx"> addProperty(CSSPropertyWebkitMarginBeforeCollapse, CSSPropertyWebkitMarginCollapse, CSSValuePool::singleton().createIdentifierValue(id), important);
</span><span class="cx"> if (m_range.atEnd()) {
</span><span class="lines">@@ -5300,7 +5300,7 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx"> id = m_range.consumeIncludingWhitespace().id();
</span><del>- if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyWebkitMarginAfterCollapse, id, m_context.mode, m_styleSheetContents))
</del><ins>+ if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyWebkitMarginAfterCollapse, id, m_context.mode))
</ins><span class="cx"> return false;
</span><span class="cx"> addProperty(CSSPropertyWebkitMarginAfterCollapse, CSSPropertyWebkitMarginCollapse, CSSValuePool::singleton().createIdentifierValue(id), important);
</span><span class="cx"> return true;
</span><span class="lines">@@ -5307,7 +5307,7 @@
</span><span class="cx"> }
</span><span class="cx"> case CSSPropertyOverflow: {
</span><span class="cx"> CSSValueID id = m_range.consumeIncludingWhitespace().id();
</span><del>- if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyOverflowY, id, m_context.mode, m_styleSheetContents))
</del><ins>+ if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyOverflowY, id, m_context.mode))
</ins><span class="cx"> return false;
</span><span class="cx"> if (!m_range.atEnd())
</span><span class="cx"> return false;
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSTokenizercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSTokenizer.cpp (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSTokenizer.cpp        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/css/parser/CSSTokenizer.cpp        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -92,7 +92,7 @@
</span><span class="cx"> wrapper.finalizeConstruction(m_tokens.begin());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-CSSParserTokenRange CSSTokenizer::tokenRange()
</del><ins>+CSSParserTokenRange CSSTokenizer::tokenRange() const
</ins><span class="cx"> {
</span><span class="cx"> return m_tokens;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSTokenizerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSTokenizer.h (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSTokenizer.h        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/css/parser/CSSTokenizer.h        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -48,9 +48,11 @@
</span><span class="cx"> CSSTokenizer(const String&);
</span><span class="cx"> CSSTokenizer(const String&, CSSParserObserverWrapper&); // For the inspector
</span><span class="cx">
</span><del>- CSSParserTokenRange tokenRange();
</del><ins>+ CSSParserTokenRange tokenRange() const;
</ins><span class="cx"> unsigned tokenCount();
</span><span class="cx">
</span><ins>+ Vector<String>&& escapedStringsForAdoption() { return WTFMove(m_stringPool); }
+
</ins><span class="cx"> private:
</span><span class="cx"> CSSParserToken nextToken();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasCanvasRenderingContext2Dcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -2117,7 +2117,7 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> auto parsedStyle = MutableStyleProperties::create();
</span><del>- CSSParser::parseValue(parsedStyle, CSSPropertyFont, newFont, true, strictToCSSParserMode(!m_usesCSSCompatibilityParseMode), nullptr);
</del><ins>+ CSSParser::parseValue(parsedStyle, CSSPropertyFont, newFont, true, strictToCSSParserMode(!m_usesCSSCompatibilityParseMode));
</ins><span class="cx"> if (parsedStyle->isEmpty())
</span><span class="cx"> return;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorepageSettingsin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Settings.in (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Settings.in        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/page/Settings.in        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -249,7 +249,7 @@
</span><span class="cx">
</span><span class="cx"> newBlockInsideInlineModelEnabled initial=false, setNeedsStyleRecalcInAllFrames=1
</span><span class="cx">
</span><del>-newCSSParserEnabled initial=true
</del><ins>+deferredCSSParserEnabled initial=false
</ins><span class="cx">
</span><span class="cx"> httpEquivEnabled initial=true
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalSettingscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/InternalSettings.cpp (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/InternalSettings.cpp        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/testing/InternalSettings.cpp        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -93,6 +93,7 @@
</span><span class="cx"> #if ENABLE(VARIATION_FONTS)
</span><span class="cx"> , m_variationFontsEnabled(settings.variationFontsEnabled())
</span><span class="cx"> #endif
</span><ins>+ , m_deferredCSSParserEnabled(settings.deferredCSSParserEnabled())
</ins><span class="cx"> , m_inputEventsEnabled(settings.inputEventsEnabled())
</span><span class="cx"> , m_userInterfaceDirectionPolicy(settings.userInterfaceDirectionPolicy())
</span><span class="cx"> , m_systemLayoutDirection(settings.systemLayoutDirection())
</span><span class="lines">@@ -175,6 +176,7 @@
</span><span class="cx"> #if ENABLE(VARIATION_FONTS)
</span><span class="cx"> settings.setVariationFontsEnabled(m_variationFontsEnabled);
</span><span class="cx"> #endif
</span><ins>+ settings.setDeferredCSSParserEnabled(m_deferredCSSParserEnabled);
</ins><span class="cx"> settings.setInputEventsEnabled(m_inputEventsEnabled);
</span><span class="cx"> settings.setUserInterfaceDirectionPolicy(m_userInterfaceDirectionPolicy);
</span><span class="cx"> settings.setSystemLayoutDirection(m_systemLayoutDirection);
</span><span class="lines">@@ -755,6 +757,21 @@
</span><span class="cx"> return { };
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ExceptionOr<bool> InternalSettings::deferredCSSParserEnabled()
+{
+ if (!m_page)
+ return Exception { INVALID_ACCESS_ERR };
+ return settings().deferredCSSParserEnabled();
+}
+
+ExceptionOr<void> InternalSettings::setDeferredCSSParserEnabled(bool enabled)
+{
+ if (!m_page)
+ return Exception { INVALID_ACCESS_ERR };
+ settings().setDeferredCSSParserEnabled(enabled);
+ return { };
+}
+
</ins><span class="cx"> static InternalSettings::ForcedAccessibilityValue settingsToInternalSettingsValue(Settings::ForcedAccessibilityValue value)
</span><span class="cx"> {
</span><span class="cx"> switch (value) {
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalSettingsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/InternalSettings.h (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/InternalSettings.h        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/testing/InternalSettings.h        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -98,6 +98,9 @@
</span><span class="cx"> ExceptionOr<void> setSystemLayoutDirection(const String&);
</span><span class="cx"> ExceptionOr<bool> variationFontsEnabled();
</span><span class="cx"> ExceptionOr<void> setVariationFontsEnabled(bool);
</span><ins>+
+ ExceptionOr<bool> deferredCSSParserEnabled();
+ ExceptionOr<void> setDeferredCSSParserEnabled(bool);
</ins><span class="cx">
</span><span class="cx"> enum class ForcedAccessibilityValue { System, On, Off };
</span><span class="cx"> ForcedAccessibilityValue forcedColorsAreInvertedAccessibilityValue() const;
</span><span class="lines">@@ -177,6 +180,7 @@
</span><span class="cx"> #if ENABLE(VARIATION_FONTS)
</span><span class="cx"> bool m_variationFontsEnabled;
</span><span class="cx"> #endif
</span><ins>+ bool m_deferredCSSParserEnabled;
</ins><span class="cx"> bool m_inputEventsEnabled;
</span><span class="cx">
</span><span class="cx"> UserInterfaceDirectionPolicy m_userInterfaceDirectionPolicy;
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalSettingsidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/InternalSettings.idl (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/InternalSettings.idl        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/testing/InternalSettings.idl        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -92,6 +92,9 @@
</span><span class="cx"> [MayThrowException] boolean variationFontsEnabled();
</span><span class="cx"> [MayThrowException] void setVariationFontsEnabled(boolean enabled);
</span><span class="cx">
</span><ins>+ [MayThrowException] boolean deferredCSSParserEnabled();
+ [MayThrowException] void setDeferredCSSParserEnabled(boolean enabled);
+
</ins><span class="cx"> attribute ForcedAccessibilityValue forcedColorsAreInvertedAccessibilityValue;
</span><span class="cx"> attribute ForcedAccessibilityValue forcedDisplayIsMonochromeAccessibilityValue;
</span><span class="cx"> attribute ForcedAccessibilityValue forcedPrefersReducedMotionAccessibilityValue;
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.cpp (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.cpp        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/testing/Internals.cpp        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -34,6 +34,10 @@
</span><span class="cx"> #include "Autofill.h"
</span><span class="cx"> #include "BackForwardController.h"
</span><span class="cx"> #include "BitmapImage.h"
</span><ins>+#include "CSSKeyframesRule.h"
+#include "CSSMediaRule.h"
+#include "CSSStyleRule.h"
+#include "CSSSupportsRule.h"
</ins><span class="cx"> #include "CachedImage.h"
</span><span class="cx"> #include "CachedResourceLoader.h"
</span><span class="cx"> #include "Chrome.h"
</span><span class="lines">@@ -119,6 +123,7 @@
</span><span class="cx"> #include "SourceBuffer.h"
</span><span class="cx"> #include "SpellChecker.h"
</span><span class="cx"> #include "StaticNodeList.h"
</span><ins>+#include "StyleRule.h"
</ins><span class="cx"> #include "StyleScope.h"
</span><span class="cx"> #include "StyleSheetContents.h"
</span><span class="cx"> #include "TextIterator.h"
</span><span class="lines">@@ -845,6 +850,101 @@
</span><span class="cx"> return element.setPseudo(id);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static unsigned deferredStyleRulesCountForList(const Vector<RefPtr<StyleRuleBase>>& childRules)
+{
+ unsigned count = 0;
+ for (auto rule : childRules) {
+ if (is<StyleRule>(rule.get())) {
+ auto* cssRule = downcast<StyleRule>(rule.get());
+ if (!cssRule->propertiesWithoutDeferredParsing())
+ count++;
+ continue;
+ }
+
+ StyleRuleGroup* groupRule = nullptr;
+ if (is<StyleRuleMedia>(rule.get()))
+ groupRule = downcast<StyleRuleMedia>(rule.get());
+ else if (is<StyleRuleSupports>(rule.get()))
+ groupRule = downcast<StyleRuleSupports>(rule.get());
+ if (!groupRule)
+ continue;
+
+ auto* groupChildRules = groupRule->childRulesWithoutDeferredParsing();
+ if (!groupChildRules)
+ continue;
+
+ count += deferredStyleRulesCountForList(*groupChildRules);
+ }
+
+ return count;
+}
+
+unsigned Internals::deferredStyleRulesCount(StyleSheet& styleSheet)
+{
+ return deferredStyleRulesCountForList(downcast<CSSStyleSheet>(styleSheet).contents().childRules());
+}
+
+static unsigned deferredGroupRulesCountForList(const Vector<RefPtr<StyleRuleBase>>& childRules)
+{
+ unsigned count = 0;
+ for (auto rule : childRules) {
+ StyleRuleGroup* groupRule = nullptr;
+ if (is<StyleRuleMedia>(rule.get()))
+ groupRule = downcast<StyleRuleMedia>(rule.get());
+ else if (is<StyleRuleSupports>(rule.get()))
+ groupRule = downcast<StyleRuleSupports>(rule.get());
+ if (!groupRule)
+ continue;
+
+ auto* groupChildRules = groupRule->childRulesWithoutDeferredParsing();
+ if (!groupChildRules)
+ count++;
+ else
+ count += deferredGroupRulesCountForList(*groupChildRules);
+ }
+ return count;
+}
+
+unsigned Internals::deferredGroupRulesCount(StyleSheet& styleSheet)
+{
+ return deferredGroupRulesCountForList(downcast<CSSStyleSheet>(styleSheet).contents().childRules());
+}
+
+static unsigned deferredKeyframesRulesCountForList(const Vector<RefPtr<StyleRuleBase>>& childRules)
+{
+ unsigned count = 0;
+ for (auto rule : childRules) {
+ if (is<StyleRuleKeyframes>(rule.get())) {
+ auto* cssRule = downcast<StyleRuleKeyframes>(rule.get());
+ if (!cssRule->keyframesWithoutDeferredParsing())
+ count++;
+ continue;
+ }
+
+ StyleRuleGroup* groupRule = nullptr;
+ if (is<StyleRuleMedia>(rule.get()))
+ groupRule = downcast<StyleRuleMedia>(rule.get());
+ else if (is<StyleRuleSupports>(rule.get()))
+ groupRule = downcast<StyleRuleSupports>(rule.get());
+ if (!groupRule)
+ continue;
+
+ auto* groupChildRules = groupRule->childRulesWithoutDeferredParsing();
+ if (!groupChildRules)
+ continue;
+
+ count += deferredKeyframesRulesCountForList(*groupChildRules);
+ }
+
+ return count;
+}
+
+unsigned Internals::deferredKeyframesRulesCount(StyleSheet& styleSheet)
+{
+ StyleSheetContents& contents = downcast<CSSStyleSheet>(styleSheet).contents();
+ return deferredKeyframesRulesCountForList(contents.childRules());
+}
+
</ins><span class="cx"> ExceptionOr<bool> Internals::isTimerThrottled(int timeoutId)
</span><span class="cx"> {
</span><span class="cx"> DOMTimer* timer = scriptExecutionContext()->findTimeout(timeoutId);
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.h (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.h        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/testing/Internals.h        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -67,6 +67,7 @@
</span><span class="cx"> class RTCPeerConnection;
</span><span class="cx"> class SerializedScriptValue;
</span><span class="cx"> class SourceBuffer;
</span><ins>+class StyleSheet;
</ins><span class="cx"> class TimeRanges;
</span><span class="cx"> class TypeConversions;
</span><span class="cx"> class XMLHttpRequest;
</span><span class="lines">@@ -117,6 +118,11 @@
</span><span class="cx"> String shadowPseudoId(Element&);
</span><span class="cx"> void setShadowPseudoId(Element&, const String&);
</span><span class="cx">
</span><ins>+ // CSS Deferred Parsing Testing
+ unsigned deferredStyleRulesCount(StyleSheet&);
+ unsigned deferredGroupRulesCount(StyleSheet&);
+ unsigned deferredKeyframesRulesCount(StyleSheet&);
+
</ins><span class="cx"> // DOMTimers throttling testing.
</span><span class="cx"> ExceptionOr<bool> isTimerThrottled(int timeoutId);
</span><span class="cx"> bool isRequestAnimationFrameThrottled() const;
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalsidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.idl (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.idl        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebCore/testing/Internals.idl        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -108,6 +108,11 @@
</span><span class="cx"> Node ensureUserAgentShadowRoot(Element host);
</span><span class="cx"> Node shadowRoot(Element host);
</span><span class="cx">
</span><ins>+ // CSS Deferred Parsing Testing.
+ long deferredStyleRulesCount(StyleSheet sheet);
+ long deferredGroupRulesCount(StyleSheet sheet);
+ long deferredKeyframesRulesCount(StyleSheet sheet);
+
</ins><span class="cx"> [MayThrowException] DOMString shadowRootType(Node root);
</span><span class="cx"> DOMString shadowPseudoId(Element element);
</span><span class="cx"> void setShadowPseudoId(Element element, DOMString id);
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebKit2/ChangeLog        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2016-12-14 Dave Hyatt <hyatt@apple.com>
+
+ [CSS Parser] Implement deferred parsing of properties, @media, @supports and @keyframes
+ https://bugs.webkit.org/show_bug.cgi?id=165743
+
+ Reviewed by Dean Jackson.
+
+ Repurpose the newCSSParserEnabled preference for deferred parsing. Just change the name
+ from "new" to "deferred."
+
+ * Shared/WebPreferencesDefinitions.h:
+ * UIProcess/API/C/WKPreferences.cpp:
+ (WKPreferencesSetDeferredCSSParserEnabled):
+ (WKPreferencesGetDeferredCSSParserEnabled):
+ (WKPreferencesSetNewCSSParserEnabled): Deleted.
+ (WKPreferencesGetNewCSSParserEnabled): Deleted.
+ * UIProcess/API/C/WKPreferencesRefPrivate.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::updatePreferences):
+
</ins><span class="cx"> 2016-12-14 Brent Fulgham <bfulgham@apple.com>
</span><span class="cx">
</span><span class="cx"> Unreviewed test fix after r209806.
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebPreferencesDefinitionsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -229,7 +229,7 @@
</span><span class="cx"> macro(EnableInheritURIQueryComponent, enableInheritURIQueryComponent, Bool, bool, false, "", "") \
</span><span class="cx"> macro(ServiceControlsEnabled, serviceControlsEnabled, Bool, bool, false, "", "") \
</span><span class="cx"> macro(NewBlockInsideInlineModelEnabled, newBlockInsideInlineModelEnabled, Bool, bool, false, "", "") \
</span><del>- macro(NewCSSParserEnabled, newCSSParserEnabled, Bool, bool, true, "", "") \
</del><ins>+ macro(DeferredCSSParserEnabled, deferredCSSParserEnabled, Bool, bool, false, "", "") \
</ins><span class="cx"> macro(HTTPEquivEnabled, httpEquivEnabled, Bool, bool, true, "", "") \
</span><span class="cx"> macro(MockCaptureDevicesEnabled, mockCaptureDevicesEnabled, Bool, bool, false, "", "") \
</span><span class="cx"> macro(MediaCaptureRequiresSecureConnection, mediaCaptureRequiresSecureConnection, Bool, bool, true, "", "") \
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKPreferencescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -1281,14 +1281,14 @@
</span><span class="cx"> return toImpl(preferencesRef)->newBlockInsideInlineModelEnabled();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WKPreferencesSetNewCSSParserEnabled(WKPreferencesRef preferencesRef, bool flag)
</del><ins>+void WKPreferencesSetDeferredCSSParserEnabled(WKPreferencesRef preferencesRef, bool flag)
</ins><span class="cx"> {
</span><del>- toImpl(preferencesRef)->setNewCSSParserEnabled(flag);
</del><ins>+ toImpl(preferencesRef)->setDeferredCSSParserEnabled(flag);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool WKPreferencesGetNewCSSParserEnabled(WKPreferencesRef preferencesRef)
</del><ins>+bool WKPreferencesGetDeferredCSSParserEnabled(WKPreferencesRef preferencesRef)
</ins><span class="cx"> {
</span><del>- return toImpl(preferencesRef)->newCSSParserEnabled();
</del><ins>+ return toImpl(preferencesRef)->deferredCSSParserEnabled();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WKPreferencesSetSubpixelCSSOMElementMetricsEnabled(WKPreferencesRef preferencesRef, bool flag)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKPreferencesRefPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -336,8 +336,8 @@
</span><span class="cx"> WK_EXPORT bool WKPreferencesGetNewBlockInsideInlineModelEnabled(WKPreferencesRef);
</span><span class="cx">
</span><span class="cx"> // Defaults to false.
</span><del>-WK_EXPORT void WKPreferencesSetNewCSSParserEnabled(WKPreferencesRef, bool);
-WK_EXPORT bool WKPreferencesGetNewCSSParserEnabled(WKPreferencesRef);
</del><ins>+WK_EXPORT void WKPreferencesSetDeferredCSSParserEnabled(WKPreferencesRef, bool);
+WK_EXPORT bool WKPreferencesGetDeferredCSSParserEnabled(WKPreferencesRef);
</ins><span class="cx">
</span><span class="cx"> // Defaults to false.
</span><span class="cx"> WK_EXPORT void WKPreferencesSetSubpixelCSSOMElementMetricsEnabled(WKPreferencesRef, bool);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (209825 => 209826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2016-12-14 20:57:20 UTC (rev 209825)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2016-12-14 21:02:07 UTC (rev 209826)
</span><span class="lines">@@ -3107,7 +3107,7 @@
</span><span class="cx"> settings.setSimpleLineLayoutDebugBordersEnabled(store.getBoolValueForKey(WebPreferencesKey::simpleLineLayoutDebugBordersEnabledKey()));
</span><span class="cx">
</span><span class="cx"> settings.setNewBlockInsideInlineModelEnabled(store.getBoolValueForKey(WebPreferencesKey::newBlockInsideInlineModelEnabledKey()));
</span><del>- settings.setNewCSSParserEnabled(store.getBoolValueForKey(WebPreferencesKey::newCSSParserEnabledKey()));
</del><ins>+ settings.setDeferredCSSParserEnabled(store.getBoolValueForKey(WebPreferencesKey::deferredCSSParserEnabledKey()));
</ins><span class="cx">
</span><span class="cx"> settings.setSubpixelCSSOMElementMetricsEnabled(store.getBoolValueForKey(WebPreferencesKey::subpixelCSSOMElementMetricsEnabledKey()));
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>