- Revision
- 187149
- Author
- benja...@webkit.org
- Date
- 2015-07-21 22:23:06 -0700 (Tue, 21 Jul 2015)
Log Message
[CSS Selectors Level 4] Add #ifdefs to the new '>>' descendant combinator
https://bugs.webkit.org/show_bug.cgi?id=147184
Patch by Benjamin Poulain <bpoul...@apple.com> on 2015-07-21
Reviewed by Anders Carlsson.
Now that '>>>' is dead, the combinator '>>' is at risk.
This patch #ifdef all that code with the other experimental
features from Level 4.
* css/CSSGrammar.y.in:
* css/CSSParserValues.cpp:
(WebCore::CSSParserSelector::appendTagHistory):
* css/CSSParserValues.h:
* css/CSSSelector.cpp:
(WebCore::CSSSelector::CSSSelector):
(WebCore::CSSSelector::selectorText):
* css/CSSSelector.h:
(WebCore::CSSSelector::CSSSelector):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (187148 => 187149)
--- trunk/Source/WebCore/ChangeLog 2015-07-22 03:51:12 UTC (rev 187148)
+++ trunk/Source/WebCore/ChangeLog 2015-07-22 05:23:06 UTC (rev 187149)
@@ -1,3 +1,25 @@
+2015-07-21 Benjamin Poulain <bpoul...@apple.com>
+
+ [CSS Selectors Level 4] Add #ifdefs to the new '>>' descendant combinator
+ https://bugs.webkit.org/show_bug.cgi?id=147184
+
+ Reviewed by Anders Carlsson.
+
+ Now that '>>>' is dead, the combinator '>>' is at risk.
+
+ This patch #ifdef all that code with the other experimental
+ features from Level 4.
+
+ * css/CSSGrammar.y.in:
+ * css/CSSParserValues.cpp:
+ (WebCore::CSSParserSelector::appendTagHistory):
+ * css/CSSParserValues.h:
+ * css/CSSSelector.cpp:
+ (WebCore::CSSSelector::CSSSelector):
+ (WebCore::CSSSelector::selectorText):
+ * css/CSSSelector.h:
+ (WebCore::CSSSelector::CSSSelector):
+
2015-07-21 Joseph Pecoraro <pecor...@apple.com>
Web Inspector: Node highlights are wrong when the page is zoomed
Modified: trunk/Source/WebCore/css/CSSGrammar.y.in (187148 => 187149)
--- trunk/Source/WebCore/css/CSSGrammar.y.in 2015-07-22 03:51:12 UTC (rev 187148)
+++ trunk/Source/WebCore/css/CSSGrammar.y.in 2015-07-22 05:23:06 UTC (rev 187149)
@@ -1011,7 +1011,9 @@
'+' maybe_space { $$ = CSSParserSelectorCombinator::DirectAdjacent; }
| '~' maybe_space { $$ = CSSParserSelectorCombinator::IndirectAdjacent; }
| '>' maybe_space { $$ = CSSParserSelectorCombinator::Child; }
+#if ENABLE_CSS_SELECTORS_LEVEL4
| '>' '>' maybe_space { $$ = CSSParserSelectorCombinator::DescendantDoubleChild; }
+#endif
;
maybe_unary_operator: unary_operator | { $$ = 1; } ;
Modified: trunk/Source/WebCore/css/CSSParserValues.cpp (187148 => 187149)
--- trunk/Source/WebCore/css/CSSParserValues.cpp 2015-07-22 03:51:12 UTC (rev 187148)
+++ trunk/Source/WebCore/css/CSSParserValues.cpp 2015-07-22 05:23:06 UTC (rev 187149)
@@ -336,9 +336,11 @@
case CSSParserSelectorCombinator::DescendantSpace:
selectorRelation = CSSSelector::Descendant;
break;
+#if ENABLE_CSS_SELECTORS_LEVEL4
case CSSParserSelectorCombinator::DescendantDoubleChild:
selectorRelation = CSSSelector::Descendant;
break;
+#endif
case CSSParserSelectorCombinator::DirectAdjacent:
selectorRelation = CSSSelector::DirectAdjacent;
break;
@@ -348,8 +350,10 @@
}
end->setRelation(selectorRelation);
+#if ENABLE_CSS_SELECTORS_LEVEL4
if (relation == CSSParserSelectorCombinator::DescendantDoubleChild)
end->setDescendantUseDoubleChildSyntax();
+#endif
end->setTagHistory(WTF::move(selector));
}
Modified: trunk/Source/WebCore/css/CSSParserValues.h (187148 => 187149)
--- trunk/Source/WebCore/css/CSSParserValues.h 2015-07-22 03:51:12 UTC (rev 187148)
+++ trunk/Source/WebCore/css/CSSParserValues.h 2015-07-22 05:23:06 UTC (rev 187149)
@@ -181,7 +181,9 @@
enum class CSSParserSelectorCombinator {
Child,
DescendantSpace,
+#if ENABLE_CSS_SELECTORS_LEVEL4
DescendantDoubleChild,
+#endif
DirectAdjacent,
IndirectAdjacent
};
@@ -236,7 +238,9 @@
void prependTagSelector(const QualifiedName&, bool tagIsForNamespaceRule = false);
private:
+#if ENABLE_CSS_SELECTORS_LEVEL4
void setDescendantUseDoubleChildSyntax() { m_selector->setDescendantUseDoubleChildSyntax(); }
+#endif
std::unique_ptr<CSSSelector> m_selector;
std::unique_ptr<CSSParserSelector> m_tagHistory;
Modified: trunk/Source/WebCore/css/CSSSelector.cpp (187148 => 187149)
--- trunk/Source/WebCore/css/CSSSelector.cpp 2015-07-22 03:51:12 UTC (rev 187148)
+++ trunk/Source/WebCore/css/CSSSelector.cpp 2015-07-22 05:23:06 UTC (rev 187149)
@@ -60,7 +60,9 @@
, m_hasNameWithCase(false)
, m_isForPage(false)
, m_tagIsForNamespaceRule(tagIsForNamespaceRule)
+#if ENABLE(CSS_SELECTORS_LEVEL4)
, m_descendantDoubleChildSyntax(false)
+#endif
, m_caseInsensitiveAttributeValueMatching(false)
{
const AtomicString& tagLocalName = tagQName.localName();
@@ -699,8 +701,10 @@
if (const CSSSelector* tagHistory = cs->tagHistory()) {
switch (cs->relation()) {
case CSSSelector::Descendant:
+#if ENABLE(CSS_SELECTORS_LEVEL4)
if (cs->m_descendantDoubleChildSyntax)
return tagHistory->selectorText(" >> " + str.toString() + rightSide);
+#endif
return tagHistory->selectorText(" " + str.toString() + rightSide);
case CSSSelector::Child:
return tagHistory->selectorText(" > " + str.toString() + rightSide);
Modified: trunk/Source/WebCore/css/CSSSelector.h (187148 => 187149)
--- trunk/Source/WebCore/css/CSSSelector.h 2015-07-22 03:51:12 UTC (rev 187148)
+++ trunk/Source/WebCore/css/CSSSelector.h 2015-07-22 05:23:06 UTC (rev 187149)
@@ -283,11 +283,13 @@
ASSERT(m_relation == relation);
}
+#if ENABLE_CSS_SELECTORS_LEVEL4
void setDescendantUseDoubleChildSyntax()
{
ASSERT(relation() == Descendant);
m_descendantDoubleChildSyntax = true;
}
+#endif
Match match() const { return static_cast<Match>(m_match); }
void setMatch(Match match)
@@ -315,7 +317,9 @@
unsigned m_hasNameWithCase : 1;
unsigned m_isForPage : 1;
unsigned m_tagIsForNamespaceRule : 1;
+#if ENABLE(CSS_SELECTORS_LEVEL4)
unsigned m_descendantDoubleChildSyntax : 1;
+#endif
unsigned m_caseInsensitiveAttributeValueMatching : 1;
unsigned simpleSelectorSpecificityForPage() const;
@@ -455,7 +459,9 @@
, m_hasNameWithCase(false)
, m_isForPage(false)
, m_tagIsForNamespaceRule(false)
+#if ENABLE(CSS_SELECTORS_LEVEL4)
, m_descendantDoubleChildSyntax(false)
+#endif
, m_caseInsensitiveAttributeValueMatching(false)
{
}
@@ -471,7 +477,9 @@
, m_hasNameWithCase(o.m_hasNameWithCase)
, m_isForPage(o.m_isForPage)
, m_tagIsForNamespaceRule(o.m_tagIsForNamespaceRule)
+#if ENABLE(CSS_SELECTORS_LEVEL4)
, m_descendantDoubleChildSyntax(o.m_descendantDoubleChildSyntax)
+#endif
, m_caseInsensitiveAttributeValueMatching(o.m_caseInsensitiveAttributeValueMatching)
{
if (o.m_hasRareData) {