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