Commit bffed136 authored by rkc's avatar rkc Committed by Commit bot

Revert of Make /deep/ as no-op and remove ::shadow in dynamic profile...

Revert of Make /deep/ as no-op and remove ::shadow in dynamic profile (patchset #9 id:160001 of https://codereview.chromium.org/2778983006/ )

Reason for revert:
(from the right account this time) Completely breaks Chrome OS login UI

Original issue's description:
> Make /deep/ as no-op and remove ::shadow in dynamic profile
>
> Intent to Remove: https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/HX5Y8Ykr5Ns
>
> To make this CL small one, and easy to be reverted, all tests which depend on /deep/
> (or ::shadow) were either removed or updated in another CL:
> https://bugs.chromium.org/p/chromium/issues/detail?id=715034.
>
> This CL only touched the small part so that users can't use /deep/ or ::shadow
> in CSS dynamic profile in M60. The further internal clean up is needed in other CLs.
>
> BUG=489954
>
> Review-Url: https://codereview.chromium.org/2778983006
> Cr-Commit-Position: refs/heads/master@{#471684}
> Committed: https://chromium.googlesource.com/chromium/src/+/a7ab8a110bd6b5339c03a34a5a6bb9a419a49e60

TBR=achuith@chromium.org,alemate@chromium.org,kochi@chromium.org,hayato@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=489954

Review-Url: https://codereview.chromium.org/2885153003
Cr-Commit-Position: refs/heads/master@{#472295}
parent abd73350
...@@ -58,7 +58,7 @@ void CSSPageRule::setSelectorText(const String& selector_text) { ...@@ -58,7 +58,7 @@ void CSSPageRule::setSelectorText(const String& selector_text) {
CSSParserContext* context = CSSParserContext* context =
CSSParserContext::Create(ParserContext(), nullptr); CSSParserContext::Create(ParserContext(), nullptr);
CSSSelectorList selector_list = CSSParser::ParsePageSelector( CSSSelectorList selector_list = CSSParser::ParsePageSelector(
*context, parentStyleSheet() ? parentStyleSheet()->Contents() : nullptr, context, parentStyleSheet() ? parentStyleSheet()->Contents() : nullptr,
selector_text); selector_text);
if (!selector_list.IsValid()) if (!selector_list.IsValid())
return; return;
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include "core/HTMLNames.h" #include "core/HTMLNames.h"
#include "core/css/CSSMarkup.h" #include "core/css/CSSMarkup.h"
#include "core/css/CSSSelectorList.h" #include "core/css/CSSSelectorList.h"
#include "core/css/parser/CSSParserContext.h"
#include "platform/RuntimeEnabledFeatures.h" #include "platform/RuntimeEnabledFeatures.h"
#include "platform/wtf/Assertions.h" #include "platform/wtf/Assertions.h"
#include "platform/wtf/HashMap.h" #include "platform/wtf/HashMap.h"
...@@ -490,7 +489,6 @@ PseudoId CSSSelector::ParsePseudoId(const String& name) { ...@@ -490,7 +489,6 @@ PseudoId CSSSelector::ParsePseudoId(const String& name) {
} }
void CSSSelector::UpdatePseudoType(const AtomicString& value, void CSSSelector::UpdatePseudoType(const AtomicString& value,
const CSSParserContext& context,
bool has_arguments) { bool has_arguments) {
DCHECK(match_ == kPseudoClass || match_ == kPseudoElement || DCHECK(match_ == kPseudoClass || match_ == kPseudoElement ||
match_ == kPagePseudoClass); match_ == kPagePseudoClass);
...@@ -523,14 +521,11 @@ void CSSSelector::UpdatePseudoType(const AtomicString& value, ...@@ -523,14 +521,11 @@ void CSSSelector::UpdatePseudoType(const AtomicString& value,
case kPseudoWebKitCustomElement: case kPseudoWebKitCustomElement:
case kPseudoBlinkInternalElement: case kPseudoBlinkInternalElement:
case kPseudoContent: case kPseudoContent:
case kPseudoShadow:
case kPseudoSlotted: case kPseudoSlotted:
if (match_ != kPseudoElement) if (match_ != kPseudoElement)
pseudo_type_ = kPseudoUnknown; pseudo_type_ = kPseudoUnknown;
break; break;
case kPseudoShadow:
if (match_ != kPseudoElement || context.IsDynamicProfile())
pseudo_type_ = kPseudoUnknown;
break;
case kPseudoFirstPage: case kPseudoFirstPage:
case kPseudoLeftPage: case kPseudoLeftPage:
case kPseudoRightPage: case kPseudoRightPage:
...@@ -774,7 +769,6 @@ String CSSSelector::SelectorText(const String& right_side) const { ...@@ -774,7 +769,6 @@ String CSSSelector::SelectorText(const String& right_side) const {
case kChild: case kChild:
return tag_history->SelectorText(" > " + str.ToString() + right_side); return tag_history->SelectorText(" > " + str.ToString() + right_side);
case kShadowDeep: case kShadowDeep:
case kShadowDeepAsDescendant:
return tag_history->SelectorText(" /deep/ " + str.ToString() + return tag_history->SelectorText(" /deep/ " + str.ToString() +
right_side); right_side);
case kShadowPiercingDescendant: case kShadowPiercingDescendant:
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include <memory> #include <memory>
#include "core/CoreExport.h" #include "core/CoreExport.h"
#include "core/css/parser/CSSParserContext.h"
#include "core/dom/QualifiedName.h" #include "core/dom/QualifiedName.h"
#include "core/style/ComputedStyleConstants.h" #include "core/style/ComputedStyleConstants.h"
#include "platform/wtf/RefCounted.h" #include "platform/wtf/RefCounted.h"
...@@ -133,7 +132,6 @@ class CORE_EXPORT CSSSelector { ...@@ -133,7 +132,6 @@ class CORE_EXPORT CSSSelector {
// Special cases for shadow DOM related selectors. // Special cases for shadow DOM related selectors.
kShadowPiercingDescendant, // >>> combinator kShadowPiercingDescendant, // >>> combinator
kShadowDeep, // /deep/ combinator kShadowDeep, // /deep/ combinator
kShadowDeepAsDescendant, // /deep/ as an alias for descendant
kShadowPseudo, // ::shadow pseudo element kShadowPseudo, // ::shadow pseudo element
kShadowSlot // ::slotted() pseudo element kShadowSlot // ::slotted() pseudo element
}; };
...@@ -240,9 +238,7 @@ class CORE_EXPORT CSSSelector { ...@@ -240,9 +238,7 @@ class CORE_EXPORT CSSSelector {
PseudoType GetPseudoType() const { PseudoType GetPseudoType() const {
return static_cast<PseudoType>(pseudo_type_); return static_cast<PseudoType>(pseudo_type_);
} }
void UpdatePseudoType(const AtomicString&, void UpdatePseudoType(const AtomicString&, bool has_arguments);
const CSSParserContext&,
bool has_arguments);
static PseudoType ParsePseudoType(const AtomicString&, bool has_arguments); static PseudoType ParsePseudoType(const AtomicString&, bool has_arguments);
static PseudoId ParsePseudoId(const String&); static PseudoId ParsePseudoId(const String&);
......
...@@ -339,10 +339,6 @@ SelectorChecker::MatchStatus SelectorChecker::MatchForRelation( ...@@ -339,10 +339,6 @@ SelectorChecker::MatchStatus SelectorChecker::MatchForRelation(
next_context.pseudo_id = kPseudoIdNone; next_context.pseudo_id = kPseudoIdNone;
switch (relation) { switch (relation) {
case CSSSelector::kShadowDeepAsDescendant:
Deprecation::CountDeprecation(context.element->GetDocument(),
UseCounter::kCSSDeepCombinator);
// fall through
case CSSSelector::kDescendant: case CSSSelector::kDescendant:
if (context.selector->RelationIsAffectedByPseudoContent()) { if (context.selector->RelationIsAffectedByPseudoContent()) {
for (Element* element = context.element; element; for (Element* element = context.element; element;
...@@ -420,6 +416,10 @@ SelectorChecker::MatchStatus SelectorChecker::MatchForRelation( ...@@ -420,6 +416,10 @@ SelectorChecker::MatchStatus SelectorChecker::MatchForRelation(
return kSelectorFailsAllSiblings; return kSelectorFailsAllSiblings;
case CSSSelector::kShadowPseudo: { case CSSSelector::kShadowPseudo: {
if (!is_ua_rule_ && mode_ != kQueryingRules &&
context.selector->GetPseudoType() == CSSSelector::kPseudoShadow)
Deprecation::CountDeprecation(context.element->GetDocument(),
UseCounter::kCSSSelectorPseudoShadow);
// If we're in the same tree-scope as the scoping element, then following // If we're in the same tree-scope as the scoping element, then following
// a shadow descendant combinator would escape that and thus the scope. // a shadow descendant combinator would escape that and thus the scope.
if (context.scope && context.scope->OwnerShadowHost() && if (context.scope && context.scope->OwnerShadowHost() &&
......
...@@ -177,7 +177,6 @@ void SelectorFilter::CollectIdentifierHashes( ...@@ -177,7 +177,6 @@ void SelectorFilter::CollectIdentifierHashes(
*identifier_hashes = 0; *identifier_hashes = 0;
return; return;
case CSSSelector::kDescendant: case CSSSelector::kDescendant:
case CSSSelector::kShadowDeepAsDescendant:
case CSSSelector::kChild: case CSSSelector::kChild:
// Fall through. // Fall through.
case CSSSelector::kShadowPseudo: case CSSSelector::kShadowPseudo:
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "core/css/parser/CSSParser.h" #include "core/css/parser/CSSParser.h"
#include <memory>
#include "core/css/CSSColorValue.h" #include "core/css/CSSColorValue.h"
#include "core/css/CSSKeyframeRule.h" #include "core/css/CSSKeyframeRule.h"
#include "core/css/StyleColor.h" #include "core/css/StyleColor.h"
...@@ -18,6 +17,7 @@ ...@@ -18,6 +17,7 @@
#include "core/css/parser/CSSTokenizer.h" #include "core/css/parser/CSSTokenizer.h"
#include "core/css/parser/CSSVariableParser.h" #include "core/css/parser/CSSVariableParser.h"
#include "core/layout/LayoutTheme.h" #include "core/layout/LayoutTheme.h"
#include <memory>
namespace blink { namespace blink {
...@@ -48,11 +48,11 @@ CSSSelectorList CSSParser::ParseSelector( ...@@ -48,11 +48,11 @@ CSSSelectorList CSSParser::ParseSelector(
} }
CSSSelectorList CSSParser::ParsePageSelector( CSSSelectorList CSSParser::ParsePageSelector(
const CSSParserContext& context, const CSSParserContext* context,
StyleSheetContents* style_sheet_contents, StyleSheetContents* style_sheet_contents,
const String& selector) { const String& selector) {
CSSTokenizer tokenizer(selector); CSSTokenizer tokenizer(selector);
return CSSParserImpl::ParsePageSelector(context, tokenizer.TokenRange(), return CSSParserImpl::ParsePageSelector(tokenizer.TokenRange(),
style_sheet_contents); style_sheet_contents);
} }
......
...@@ -5,11 +5,11 @@ ...@@ -5,11 +5,11 @@
#ifndef CSSParser_h #ifndef CSSParser_h
#define CSSParser_h #define CSSParser_h
#include <memory>
#include "core/CSSPropertyNames.h" #include "core/CSSPropertyNames.h"
#include "core/CoreExport.h" #include "core/CoreExport.h"
#include "core/css/StylePropertySet.h" #include "core/css/StylePropertySet.h"
#include "core/css/parser/CSSParserContext.h" #include "core/css/parser/CSSParserContext.h"
#include <memory>
namespace blink { namespace blink {
...@@ -40,7 +40,7 @@ class CORE_EXPORT CSSParser { ...@@ -40,7 +40,7 @@ class CORE_EXPORT CSSParser {
static CSSSelectorList ParseSelector(const CSSParserContext*, static CSSSelectorList ParseSelector(const CSSParserContext*,
StyleSheetContents*, StyleSheetContents*,
const String&); const String&);
static CSSSelectorList ParsePageSelector(const CSSParserContext&, static CSSSelectorList ParsePageSelector(const CSSParserContext*,
StyleSheetContents*, StyleSheetContents*,
const String&); const String&);
static bool ParseDeclarationList(const CSSParserContext*, static bool ParseDeclarationList(const CSSParserContext*,
......
...@@ -254,7 +254,6 @@ void CSSParserImpl::ParseStyleSheet(const String& string, ...@@ -254,7 +254,6 @@ void CSSParserImpl::ParseStyleSheet(const String& string,
} }
CSSSelectorList CSSParserImpl::ParsePageSelector( CSSSelectorList CSSParserImpl::ParsePageSelector(
const CSSParserContext& context,
CSSParserTokenRange range, CSSParserTokenRange range,
StyleSheetContents* style_sheet) { StyleSheetContents* style_sheet) {
// We only support a small subset of the css-page spec. // We only support a small subset of the css-page spec.
...@@ -283,7 +282,7 @@ CSSSelectorList CSSParserImpl::ParsePageSelector( ...@@ -283,7 +282,7 @@ CSSSelectorList CSSParserImpl::ParsePageSelector(
selector = CSSParserSelector::Create(); selector = CSSParserSelector::Create();
if (!pseudo.IsNull()) { if (!pseudo.IsNull()) {
selector->SetMatch(CSSSelector::kPagePseudoClass); selector->SetMatch(CSSSelector::kPagePseudoClass);
selector->UpdatePseudoType(pseudo.DeprecatedLower(), context); selector->UpdatePseudoType(pseudo.DeprecatedLower());
if (selector->GetPseudoType() == CSSSelector::kPseudoUnknown) if (selector->GetPseudoType() == CSSSelector::kPseudoUnknown)
return CSSSelectorList(); return CSSSelectorList();
} }
...@@ -734,8 +733,7 @@ StyleRuleKeyframes* CSSParserImpl::ConsumeKeyframesRule( ...@@ -734,8 +733,7 @@ StyleRuleKeyframes* CSSParserImpl::ConsumeKeyframesRule(
StyleRulePage* CSSParserImpl::ConsumePageRule(CSSParserTokenRange prelude, StyleRulePage* CSSParserImpl::ConsumePageRule(CSSParserTokenRange prelude,
CSSParserTokenRange block) { CSSParserTokenRange block) {
CSSSelectorList selector_list = CSSSelectorList selector_list = ParsePageSelector(prelude, style_sheet_);
ParsePageSelector(*context_, prelude, style_sheet_);
if (!selector_list.IsValid()) if (!selector_list.IsValid())
return nullptr; // Parse error, invalid @page selector return nullptr; // Parse error, invalid @page selector
......
...@@ -84,8 +84,7 @@ class CSSParserImpl { ...@@ -84,8 +84,7 @@ class CSSParserImpl {
const CSSParserContext*, const CSSParserContext*,
StyleSheetContents*, StyleSheetContents*,
bool defer_property_parsing = false); bool defer_property_parsing = false);
static CSSSelectorList ParsePageSelector(const CSSParserContext&, static CSSSelectorList ParsePageSelector(CSSParserTokenRange,
CSSParserTokenRange,
StyleSheetContents*); StyleSheetContents*);
static ImmutableStylePropertySet* ParseCustomPropertySet(CSSParserTokenRange); static ImmutableStylePropertySet* ParseCustomPropertySet(CSSParserTokenRange);
......
...@@ -29,8 +29,6 @@ ...@@ -29,8 +29,6 @@
namespace blink { namespace blink {
class CSSParserContext;
class CORE_EXPORT CSSParserSelector { class CORE_EXPORT CSSParserSelector {
WTF_MAKE_NONCOPYABLE(CSSParserSelector); WTF_MAKE_NONCOPYABLE(CSSParserSelector);
USING_FAST_MALLOC(CSSParserSelector); USING_FAST_MALLOC(CSSParserSelector);
...@@ -76,9 +74,8 @@ class CORE_EXPORT CSSParserSelector { ...@@ -76,9 +74,8 @@ class CORE_EXPORT CSSParserSelector {
} }
void UpdatePseudoType(const AtomicString& value, void UpdatePseudoType(const AtomicString& value,
const CSSParserContext& context,
bool has_arguments = false) const { bool has_arguments = false) const {
selector_->UpdatePseudoType(value, context, has_arguments); selector_->UpdatePseudoType(value, has_arguments);
} }
void AdoptSelectorVector( void AdoptSelectorVector(
......
...@@ -442,7 +442,7 @@ std::unique_ptr<CSSParserSelector> CSSSelectorParser::ConsumePseudo( ...@@ -442,7 +442,7 @@ std::unique_ptr<CSSParserSelector> CSSSelectorParser::ConsumePseudo(
AtomicString value = token.Value().ToAtomicString().LowerASCII(); AtomicString value = token.Value().ToAtomicString().LowerASCII();
bool has_arguments = token.GetType() == kFunctionToken; bool has_arguments = token.GetType() == kFunctionToken;
selector->UpdatePseudoType(value, *context_, has_arguments); selector->UpdatePseudoType(value, has_arguments);
if (!RuntimeEnabledFeatures::cssSelectorsFocusWithinEnabled() && if (!RuntimeEnabledFeatures::cssSelectorsFocusWithinEnabled() &&
selector->GetPseudoType() == CSSSelector::kPseudoFocusWithin) selector->GetPseudoType() == CSSSelector::kPseudoFocusWithin)
...@@ -582,8 +582,7 @@ CSSSelector::RelationType CSSSelectorParser::ConsumeCombinator( ...@@ -582,8 +582,7 @@ CSSSelector::RelationType CSSSelectorParser::ConsumeCombinator(
const CSSParserToken& slash = range.ConsumeIncludingWhitespace(); const CSSParserToken& slash = range.ConsumeIncludingWhitespace();
if (slash.GetType() != kDelimiterToken || slash.Delimiter() != '/') if (slash.GetType() != kDelimiterToken || slash.Delimiter() != '/')
failed_parsing_ = true; failed_parsing_ = true;
return context_->IsDynamicProfile() ? CSSSelector::kShadowDeepAsDescendant return CSSSelector::kShadowDeep;
: CSSSelector::kShadowDeep;
} }
default: default:
......
...@@ -331,6 +331,12 @@ TEST_F(StyleEngineTest, RuleSetInvalidationV0BoundaryCrossing) { ...@@ -331,6 +331,12 @@ TEST_F(StyleEngineTest, RuleSetInvalidationV0BoundaryCrossing) {
EXPECT_EQ(ScheduleInvalidationsForRules( EXPECT_EQ(ScheduleInvalidationsForRules(
*shadow_root, ".a ::content span { background: green}"), *shadow_root, ".a ::content span { background: green}"),
kRuleSetInvalidationFullRecalc); kRuleSetInvalidationFullRecalc);
EXPECT_EQ(ScheduleInvalidationsForRules(
*shadow_root, ".a /deep/ span { background: green}"),
kRuleSetInvalidationFullRecalc);
EXPECT_EQ(ScheduleInvalidationsForRules(
*shadow_root, ".a::shadow span { background: green}"),
kRuleSetInvalidationFullRecalc);
} }
TEST_F(StyleEngineTest, HasViewportDependentMediaQueries) { TEST_F(StyleEngineTest, HasViewportDependentMediaQueries) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment