Start using the new :not() and :matches() in the Web Inspector
authorbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 22 Nov 2014 02:06:47 +0000 (02:06 +0000)
committerbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 22 Nov 2014 02:06:47 +0000 (02:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=138978

Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-11-21
Reviewed by Joseph Pecoraro.

Source/WebCore:

There are only minor pending issues on :not() and :matches(). The feedback
has only been positive so far. It is time to move them out the experimental
flag.

* css/CSSGrammar.y.in:
* css/CSSParser.cpp:
(WebCore::CSSParser::detectFunctionTypeToken):
* css/CSSSelector.cpp:
(WebCore::simpleSelectorSpecificityInternal):
(WebCore::simpleSelectorFunctionalPseudoClassStaticSpecificity):
(WebCore::appendSelectorList):
(WebCore::CSSSelector::selectorText):
* css/CSSSelector.h:
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOne):
(WebCore::SelectorChecker::determineLinkMatchType):
* css/SelectorPseudoClassAndCompatibilityElementMap.in:
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::addPseudoClassType):

Source/WebInspectorUI:

Start simpifying some definitions by using modern CSS.

* UserInterface/Views/CSSStyleDeclarationSection.css:
(body.mac-platform.legacy .style-declaration-section.last-in-group + .style-declaration-section:matches(.last-in-group, :last-child)):
(.style-declaration-section:matches(.locked, .selector-locked) > .header > .selector):
(body.mac-platform.legacy .style-declaration-section.last-in-group + .style-declaration-section:last-child): Deleted.
(.style-declaration-section.selector-locked > .header > .selector): Deleted.
* UserInterface/Views/CSSStyleDeclarationTextEditor.css:
(.css-style-text-editor > .CodeMirror .CodeMirror-lines .css-style-declaration-property:matches(.disabled, .invalid, .other-vendor, .not-inherited, .overridden)):
(.css-style-text-editor > .CodeMirror .CodeMirror-lines .css-style-declaration-property:matches(.implicit, .not-inherited)):
(.css-style-text-editor > .CodeMirror .CodeMirror-lines .editing-line .css-style-declaration-property:matches(.disabled, .other-vendor, .not-inherited, .overridden)):
(.css-style-text-editor > .CodeMirror .CodeMirror-lines .css-style-declaration-property.overridden): Deleted.
(.css-style-text-editor > .CodeMirror .CodeMirror-lines .css-style-declaration-property.not-inherited): Deleted.
(.css-style-text-editor > .CodeMirror .CodeMirror-lines .editing-line .css-style-declaration-property.overridden): Deleted.
* UserInterface/Views/ControlToolbarItem.css:
(.toolbar:matches(.icon-and-label-horizontal, .toolbar.icon-only) .item.control):
(.toolbar.icon-only .item.control): Deleted.
* UserInterface/Views/DOMStorageContentView.css:
* UserInterface/Views/DashboardContainerView.css:
(.toolbar.icon-and-label-vertical:matches(.small-size, .normal-size) .dashboard-container):
(.toolbar:matches(.label-only, .small-size:matches(.icon-only, .icon-and-label-vertical, .icon-and-label-horizontal)) .dashboard-container):
(.toolbar.normal-size:matches(.icon-only, .icon-and-label-vertical, .icon-and-label-horizontal) .dashboard-container):
(.toolbar.normal-size.icon-and-label-vertical .dashboard-container): Deleted.
(.toolbar.small-size.icon-and-label-horizontal .dashboard-container): Deleted.
(.toolbar.normal-size.icon-and-label-horizontal .dashboard-container): Deleted.
* UserInterface/Views/DataGrid.css:
(.data-grid :matches(th, td):not(:last-child)):
(.data-grid th:matches(.sort-ascending, .sort-descending)):
(.data-grid :matches(th, td) > div):
(.data-grid th:matches(.sort-ascending, .sort-descending) > div:first-child):
(.data-grid tr:matches(.selected, :hover) .go-to-arrow):
(.data-grid :-webkit-any(th, td):not(:last-child)): Deleted.
(.data-grid th:-webkit-any(.sort-ascending, .sort-descending)): Deleted.
(.data-grid :-webkit-any(th, td) > div): Deleted.
(.data-grid th:-webkit-any(.sort-ascending, .sort-descending) > div:first-child): Deleted.
(.data-grid tr:-webkit-any(.selected, :hover) .go-to-arrow): Deleted.
* UserInterface/Views/DebuggerDashboardView.css:
(.toolbar.collapsed .dashboard.debugger > :not(.message, .navigation-bar )):
(.toolbar.collapsed .dashboard.debugger > :not(.message):not(.navigation-bar )): Deleted.
* UserInterface/Views/DefaultDashboardView.css:
(body.web .toolbar.collapsed .dashboard.default > :matches(.time, .resourcesSize, .logs)):
(body.javascript .toolbar .dashboard.default > :matches(.time, .resourcesSize, .resourcesCount)):
(.toolbar:matches(.label-only, .small-size:matches(.icon-only, .icon-and-label-vertical, .icon-and-label-horizontal)) .dashboard.default > .item):
(.toolbar.normal-size:matches(.icon-only, .icon-and-label-vertical, .icon-and-label-horizontal) .dashboard.default > .item):
(body.web .toolbar.collapsed .dashboard.default > .logs): Deleted.
(body.javascript .toolbar .dashboard.default > .resourcesCount): Deleted.
(.toolbar.small-size.icon-and-label-horizontal .dashboard.default > .item): Deleted.
(.toolbar.normal-size.icon-and-label-horizontal .dashboard.default > .item): Deleted.
* UserInterface/Views/DetailsSection.css:
(.details-section > .header > :matches(.node-link, .go-to-arrow)):
(.details-section > .content > .group:nth-child(even) > .row:matches(.simple:first-child > *, :not(.simple):first-child)):
(body.mac-platform.legacy .details-section > .content > .group:matches(:nth-child(even), :last-child) > .row.simple:last-child > *):
(.details-section > .content > .group > .row:matches(.empty, .text)):
(body.mac-platform.legacy .details-section > .content > .group > .row:matches(.empty, .text)):
(.details-section > .header > .go-to-arrow): Deleted.
(.details-section > .content > .group:nth-child(even) > .row.simple:first-child > *): Deleted.
(body.mac-platform.legacy .details-section > .content > .group:last-child > .row.simple:last-child > *): Deleted.
(.details-section > .content > .group > .row.text): Deleted.
(body.mac-platform.legacy .details-section > .content > .group > .row.text): Deleted.
* UserInterface/Views/FindBanner.css:
(:matches(.find-banner, .supports-find-banner).no-find-banner-transition):
(.supports-find-banner.no-find-banner-transition): Deleted.
* UserInterface/Views/FlexibleSpaceNavigationItem.css:
(:matches(.navigation-bar, .toolbar) .item.flexible-space):
(.toolbar .item.flexible-space): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@176494 268f45cc-cd09-0410-ab3c-d52691b4dbfc

20 files changed:
Source/WebCore/ChangeLog
Source/WebCore/css/CSSGrammar.y.in
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSSelector.cpp
Source/WebCore/css/CSSSelector.h
Source/WebCore/css/SelectorChecker.cpp
Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in
Source/WebCore/cssjit/SelectorCompiler.cpp
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.css
Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.css
Source/WebInspectorUI/UserInterface/Views/ControlToolbarItem.css
Source/WebInspectorUI/UserInterface/Views/DOMStorageContentView.css
Source/WebInspectorUI/UserInterface/Views/DashboardContainerView.css
Source/WebInspectorUI/UserInterface/Views/DataGrid.css
Source/WebInspectorUI/UserInterface/Views/DebuggerDashboardView.css
Source/WebInspectorUI/UserInterface/Views/DefaultDashboardView.css
Source/WebInspectorUI/UserInterface/Views/DetailsSection.css
Source/WebInspectorUI/UserInterface/Views/FindBanner.css
Source/WebInspectorUI/UserInterface/Views/FlexibleSpaceNavigationItem.css

index 7f4017f..c28ec0d 100644 (file)
@@ -1,3 +1,30 @@
+2014-11-21  Benjamin Poulain  <bpoulain@apple.com>
+
+        Start using the new :not() and :matches() in the Web Inspector
+        https://bugs.webkit.org/show_bug.cgi?id=138978
+
+        Reviewed by Joseph Pecoraro.
+
+        There are only minor pending issues on :not() and :matches(). The feedback
+        has only been positive so far. It is time to move them out the experimental
+        flag.
+
+        * css/CSSGrammar.y.in:
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::detectFunctionTypeToken):
+        * css/CSSSelector.cpp:
+        (WebCore::simpleSelectorSpecificityInternal):
+        (WebCore::simpleSelectorFunctionalPseudoClassStaticSpecificity):
+        (WebCore::appendSelectorList):
+        (WebCore::CSSSelector::selectorText):
+        * css/CSSSelector.h:
+        * css/SelectorChecker.cpp:
+        (WebCore::SelectorChecker::checkOne):
+        (WebCore::SelectorChecker::determineLinkMatchType):
+        * css/SelectorPseudoClassAndCompatibilityElementMap.in:
+        * cssjit/SelectorCompiler.cpp:
+        (WebCore::SelectorCompiler::addPseudoClassType):
+
 2014-11-21  Chris Dumez  <cdumez@apple.com>
 
         Unreviewed, iOS build fix after r176462.
index 6faa1d8..cf41fcb 100644 (file)
@@ -57,13 +57,13 @@ static inline bool isCSSTokenAString(int yytype)
     case ANYFUNCTION:
     case NOTFUNCTION:
     case CALCFUNCTION:
-    case MINFUNCTION:
+    case MATCHESFUNCTION:
     case MAXFUNCTION:
+    case MINFUNCTION:
     case NTHCHILDFUNCTIONS:
     case NTHCHILDSELECTORSEPARATOR:
 #if ENABLE_CSS_SELECTORS_LEVEL4
     case LANGFUNCTION:
-    case MATCHESFUNCTION:
     case ROLEFUNCTION:
 #endif
     case UNICODERANGE:
@@ -226,13 +226,13 @@ static bool selectorListDoesNotMatchAnyPseudoElement(const Vector<std::unique_pt
 %token <string> ANYFUNCTION
 %token <string> NOTFUNCTION
 %token <string> CALCFUNCTION
-%token <string> MINFUNCTION
+%token <string> MATCHESFUNCTION
 %token <string> MAXFUNCTION
+%token <string> MINFUNCTION
 %token <string> NTHCHILDFUNCTIONS
 
 #if ENABLE_CSS_SELECTORS_LEVEL4
 %token <string> LANGFUNCTION
-%token <string> MATCHESFUNCTION
 %token <string> ROLEFUNCTION
 #endif
 
@@ -1363,6 +1363,17 @@ pseudo:
                 $$ = selector.release();
         }
     }
+    | ':' MATCHESFUNCTION maybe_space nested_selector_list maybe_space ')' {
+        $$ = nullptr;
+        if ($4) {
+            auto selector = std::make_unique<CSSParserSelector>();
+            selector->setMatch(CSSSelector::PseudoClass);
+            selector->adoptSelectorVector(*std::unique_ptr<Vector<std::unique_ptr<CSSParserSelector>>>($4));
+            selector->setPseudoClassValue($2);
+            if (selector->pseudoClassType() == CSSSelector::PseudoClassMatches)
+                $$ = selector.release();
+        }
+    }
 
 #if ENABLE_CSS_SELECTORS_LEVEL4
     | ':' LANGFUNCTION maybe_space comma_separated_identifiers maybe_space ')' {
@@ -1377,18 +1388,6 @@ pseudo:
         }
     }
 
-    | ':' MATCHESFUNCTION maybe_space nested_selector_list maybe_space ')' {
-        $$ = nullptr;
-        if ($4) {
-            auto selector = std::make_unique<CSSParserSelector>();
-            selector->setMatch(CSSSelector::PseudoClass);
-            selector->adoptSelectorVector(*std::unique_ptr<Vector<std::unique_ptr<CSSParserSelector>>>($4));
-            selector->setPseudoClassValue($2);
-            if (selector->pseudoClassType() == CSSSelector::PseudoClassMatches)
-                $$ = selector.release();
-        }
-    }
-
     | ':' ROLEFUNCTION maybe_space IDENT maybe_space ')' {
         $$ = nullptr;
         auto selector = std::make_unique<CSSParserSelector>();
@@ -1483,9 +1482,7 @@ pseudo:
         }
         $$ = selector.release();
     }
-
     // Definition of :not().
-#if ENABLE_CSS_SELECTORS_LEVEL4
     | ':' NOTFUNCTION maybe_space nested_selector_list maybe_space ')' {
         $$ = nullptr;
         if ($4 && selectorListDoesNotMatchAnyPseudoElement($4)) {
@@ -1497,21 +1494,6 @@ pseudo:
                 $$ = selector.release();
         }
     }
-#else
-    | ':' NOTFUNCTION maybe_space compound_selector maybe_space ')' {
-        std::unique_ptr<CSSParserSelector> selector($4);
-        $$ = nullptr;
-        if (selector && selector->isSimple()) {
-            $$ = new CSSParserSelector;
-            $$->setMatch(CSSSelector::PseudoClass);
-
-            Vector<std::unique_ptr<CSSParserSelector>> selectorVector;
-            selectorVector.append(WTF::move(selector));
-            $$->adoptSelectorVector(selectorVector);
-            $$->setPseudoClassValue($2);
-        }
-    }
-#endif
   ;
 
 declaration_list:
@@ -1889,9 +1871,9 @@ invalid_square_brackets_block: '[' error_recovery ']' | '[' error_recovery TOKEN
 invalid_parentheses_block: opening_parenthesis error_recovery closing_parenthesis;
 
 opening_parenthesis:
-    '(' | FUNCTION | CALCFUNCTION | MINFUNCTION | MAXFUNCTION | ANYFUNCTION | NOTFUNCTION
+    '(' | FUNCTION | CALCFUNCTION | MATCHESFUNCTION | MAXFUNCTION | MINFUNCTION | ANYFUNCTION | NOTFUNCTION
 #if ENABLE_CSS_SELECTORS_LEVEL4
-    | LANGFUNCTION | MATCHESFUNCTION | ROLEFUNCTION
+    | LANGFUNCTION | ROLEFUNCTION
 #endif
 #if ENABLE_VIDEO_TRACK
     | CUEFUNCTION
index 9ec2178..0f4631c 100644 (file)
@@ -10711,14 +10711,12 @@ inline bool CSSParser::detectFunctionTypeToken(int length)
 #endif
         return false;
 
-#if ENABLE(CSS_SELECTORS_LEVEL4)
     case 7:
         if (isEqualToCSSIdentifier(name, "matches")) {
             m_token = MATCHESFUNCTION;
             return true;
         }
         return false;
-#endif
 
     case 9:
         if (isEqualToCSSIdentifier(name, "nth-child")) {
index 7a2223f..c67899b 100644 (file)
@@ -89,7 +89,6 @@ static unsigned simpleSelectorSpecificityInternal(const CSSSelector& simpleSelec
     case CSSSelector::PagePseudoClass:
         break;
     case CSSSelector::PseudoClass:
-#if ENABLE(CSS_SELECTORS_LEVEL4)
         if (simpleSelector.pseudoClassType() == CSSSelector::PseudoClassMatches) {
             ASSERT_WITH_MESSAGE(simpleSelector.selectorList() && simpleSelector.selectorList()->first(), "The parser should never generate a valid selector for an empty :matches().");
             if (!isComputingMaximumSpecificity)
@@ -102,11 +101,6 @@ static unsigned simpleSelectorSpecificityInternal(const CSSSelector& simpleSelec
             return maxSpecificity(*simpleSelector.selectorList());
         }
         FALLTHROUGH;
-#else
-        if (simpleSelector.pseudoClassType() == CSSSelector::PseudoClassNot && simpleSelector.selectorList())
-            return simpleSelector.selectorList()->first()->simpleSelectorSpecificity();
-        FALLTHROUGH;
-#endif
     case CSSSelector::Exact:
     case CSSSelector::Class:
     case CSSSelector::Set:
@@ -136,7 +130,6 @@ static unsigned staticSpecificityInternal(const CSSSelector& firstSimpleSelector
 
 static unsigned simpleSelectorFunctionalPseudoClassStaticSpecificity(const CSSSelector& simpleSelector, bool& ok)
 {
-#if ENABLE(CSS_SELECTORS_LEVEL4)
     if (simpleSelector.match() == CSSSelector::PseudoClass) {
         if (simpleSelector.pseudoClassType() == CSSSelector::PseudoClassMatches) {
             const CSSSelectorList& selectorList = *simpleSelector.selectorList();
@@ -157,7 +150,6 @@ static unsigned simpleSelectorFunctionalPseudoClassStaticSpecificity(const CSSSe
             return initialSpecificity;
         }
     }
-#endif
     return 0;
 }
 
@@ -354,6 +346,7 @@ static void appendArgumentList(StringBuilder& str, const Vector<AtomicString>& a
             str.appendLiteral(", ");
     }
 }
+#endif
 
 static void appendSelectorList(StringBuilder& str, const CSSSelectorList* selectorList)
 {
@@ -364,7 +357,6 @@ static void appendSelectorList(StringBuilder& str, const CSSSelectorList* select
         str.append(subSelector->selectorText());
     }
 }
-#endif
 
 String CSSSelector::selectorText(const String& rightSide) const
 {
@@ -520,12 +512,7 @@ String CSSSelector::selectorText(const String& rightSide) const
                 break;
             case CSSSelector::PseudoClassNot:
                 str.appendLiteral(":not(");
-#if ENABLE(CSS_SELECTORS_LEVEL4)
                 appendSelectorList(str, cs->selectorList());
-#else
-                if (const CSSSelectorList* selectorList = cs->selectorList())
-                    str.append(selectorList->first()->selectorText());
-#endif
                 str.append(')');
                 break;
             case CSSSelector::PseudoClassNthChild:
@@ -571,13 +558,13 @@ String CSSSelector::selectorText(const String& rightSide) const
             case CSSSelector::PseudoClassOptional:
                 str.appendLiteral(":optional");
                 break;
-#if ENABLE(CSS_SELECTORS_LEVEL4)
             case CSSSelector::PseudoClassMatches: {
                 str.appendLiteral(":matches(");
                 appendSelectorList(str, cs->selectorList());
                 str.append(')');
                 break;
             }
+#if ENABLE(CSS_SELECTORS_LEVEL4)
             case CSSSelector::PseudoClassPlaceholderShown:
                 str.appendLiteral(":placeholder-shown");
                 break;
index 5a6d8c0..85227ad 100644 (file)
@@ -122,9 +122,9 @@ namespace WebCore {
             PseudoClassDisabled,
             PseudoClassOptional,
 #if ENABLE(CSS_SELECTORS_LEVEL4)
-            PseudoClassMatches,
             PseudoClassPlaceholderShown,
 #endif
+            PseudoClassMatches,
             PseudoClassRequired,
             PseudoClassReadOnly,
             PseudoClassReadWrite,
index deddff5..3072251 100644 (file)
@@ -576,12 +576,6 @@ bool SelectorChecker::checkOne(const CheckingContextWithStatus& context, PseudoI
         if (selector->pseudoClassType() == CSSSelector::PseudoClassNot) {
             const CSSSelectorList* selectorList = selector->selectorList();
 
-#if !ENABLE(CSS_SELECTORS_LEVEL4)
-            // FIXME: We probably should fix the parser and make it never produce :not rules with missing selector list.
-            if (!selectorList)
-                return false;
-#endif
-
             for (const CSSSelector* subselector = selectorList->first(); subselector; subselector = CSSSelectorList::next(subselector)) {
                 CheckingContextWithStatus subcontext(context);
                 subcontext.inFunctionalPseudoClass = true;
@@ -591,30 +585,12 @@ bool SelectorChecker::checkOne(const CheckingContextWithStatus& context, PseudoI
                 PseudoIdSet ignoreDynamicPseudo;
 
                 unsigned ignoredSpecificity;
-#if ENABLE(CSS_SELECTORS_LEVEL4)
                 if (matchRecursively(subcontext, ignoreDynamicPseudo, ignoredSpecificity).match == Match::SelectorMatches) {
                     ASSERT(!ignoreDynamicPseudo);
                     return false;
                 }
-#else
-                if (subcontext.selector->match() == CSSSelector::PseudoClass) {
-                    // :not cannot nest. I don't really know why this is a
-                    // restriction in CSS3, but it is, so let's honor it.
-                    // the parser enforces that this never occurs
-                    ASSERT(subcontext.selector->pseudoClassType() != CSSSelector::PseudoClassNot);
-                    // We select between :visited and :link when applying. We don't know which one applied (or not) yet.
-                    if (subcontext.selector->pseudoClassType() == CSSSelector::PseudoClassVisited)
-                        return true;
-                }
-                // Since :not cannot contain pseudo elements, there's no effect on matchType.
-                MatchType ignoreMatchType = MatchType::Element;
-                if (!checkOne(subcontext, ignoreDynamicPseudo, ignoreMatchType, ignoredSpecificity))
-                    return true;
-#endif
             }
-#if ENABLE(CSS_SELECTORS_LEVEL4)
             return true;
-#endif
         } else if (context.hasScrollbarPseudo) {
             // CSS scrollbars match a specific subset of pseudo classes, and they have specialized rules for each
             // (since there are no elements involved except with window-inactive).
@@ -722,7 +698,6 @@ bool SelectorChecker::checkOne(const CheckingContextWithStatus& context, PseudoI
                 return isFirstOfType(element, element->tagQName(), context.resolvingMode == Mode::ResolvingStyle) && isLastOfType(element, element->tagQName());
             }
             break;
-#if ENABLE(CSS_SELECTORS_LEVEL4)
         case CSSSelector::PseudoClassMatches:
             {
                 bool hasMatchedAnything = false;
@@ -754,7 +729,7 @@ bool SelectorChecker::checkOne(const CheckingContextWithStatus& context, PseudoI
                 }
                 return hasMatchedAnything;
             }
-
+#if ENABLE(CSS_SELECTORS_LEVEL4)
         case CSSSelector::PseudoClassPlaceholderShown:
             if (is<HTMLTextFormControlElement>(*element)) {
                 if (context.resolvingMode == Mode::ResolvingStyle) {
@@ -1120,26 +1095,6 @@ unsigned SelectorChecker::determineLinkMatchType(const CSSSelector* selector)
     for (; selector; selector = selector->tagHistory()) {
         if (selector->match() == CSSSelector::PseudoClass) {
             switch (selector->pseudoClassType()) {
-#if! ENABLE(CSS_SELECTORS_LEVEL4)
-            case CSSSelector::PseudoClassNot:
-                {
-                    // :not(:visited) is equivalent to :link. Parser enforces that :not can't nest.
-                    const CSSSelectorList* selectorList = selector->selectorList();
-                    if (!selectorList)
-                        break;
-
-                    for (const CSSSelector* subSelector = selectorList->first(); subSelector; subSelector = subSelector->tagHistory()) {
-                        if (subSelector->match() == CSSSelector::PseudoClass) {
-                            CSSSelector::PseudoClassType subType = subSelector->pseudoClassType();
-                            if (subType == CSSSelector::PseudoClassVisited)
-                                linkMatchType &= ~SelectorChecker::MatchVisited;
-                            else if (subType == CSSSelector::PseudoClassLink)
-                                linkMatchType &= ~SelectorChecker::MatchLink;
-                        }
-                    }
-                }
-                break;
-#endif
             case CSSSelector::PseudoClassLink:
                 linkMatchType &= ~SelectorChecker::MatchVisited;
                 break;
index e30d6fe..7e91b0e 100644 (file)
@@ -34,6 +34,7 @@ lang(
 last-child
 last-of-type
 link
+matches(
 no-button
 not(
 nth-child(
@@ -46,7 +47,6 @@ optional
 out-of-range
 #if ENABLE(CSS_SELECTORS_LEVEL4)
 placeholder-shown
-matches(
 #endif
 read-only
 read-write
index 2961eaa..0942423 100644 (file)
@@ -756,7 +756,6 @@ static inline FunctionType addPseudoClassType(const CSSSelector& selector, Selec
 #endif
         }
 
-#if ENABLE(CSS_SELECTORS_LEVEL4)
     case CSSSelector::PseudoClassMatches:
         {
             SelectorList matchesList;
@@ -804,7 +803,6 @@ static inline FunctionType addPseudoClassType(const CSSSelector& selector, Selec
 
             return functionType;
         }
-#endif
 
     case CSSSelector::PseudoClassUnknown:
         ASSERT_NOT_REACHED();
index 2a6535c..a9cd875 100644 (file)
@@ -1,3 +1,76 @@
+2014-11-21  Benjamin Poulain  <bpoulain@apple.com>
+
+        Start using the new :not() and :matches() in the Web Inspector
+        https://bugs.webkit.org/show_bug.cgi?id=138978
+
+        Reviewed by Joseph Pecoraro.
+
+        Start simpifying some definitions by using modern CSS.
+
+        * UserInterface/Views/CSSStyleDeclarationSection.css:
+        (body.mac-platform.legacy .style-declaration-section.last-in-group + .style-declaration-section:matches(.last-in-group, :last-child)):
+        (.style-declaration-section:matches(.locked, .selector-locked) > .header > .selector):
+        (body.mac-platform.legacy .style-declaration-section.last-in-group + .style-declaration-section:last-child): Deleted.
+        (.style-declaration-section.selector-locked > .header > .selector): Deleted.
+        * UserInterface/Views/CSSStyleDeclarationTextEditor.css:
+        (.css-style-text-editor > .CodeMirror .CodeMirror-lines .css-style-declaration-property:matches(.disabled, .invalid, .other-vendor, .not-inherited, .overridden)):
+        (.css-style-text-editor > .CodeMirror .CodeMirror-lines .css-style-declaration-property:matches(.implicit, .not-inherited)):
+        (.css-style-text-editor > .CodeMirror .CodeMirror-lines .editing-line .css-style-declaration-property:matches(.disabled, .other-vendor, .not-inherited, .overridden)):
+        (.css-style-text-editor > .CodeMirror .CodeMirror-lines .css-style-declaration-property.overridden): Deleted.
+        (.css-style-text-editor > .CodeMirror .CodeMirror-lines .css-style-declaration-property.not-inherited): Deleted.
+        (.css-style-text-editor > .CodeMirror .CodeMirror-lines .editing-line .css-style-declaration-property.overridden): Deleted.
+        * UserInterface/Views/ControlToolbarItem.css:
+        (.toolbar:matches(.icon-and-label-horizontal, .toolbar.icon-only) .item.control):
+        (.toolbar.icon-only .item.control): Deleted.
+        * UserInterface/Views/DOMStorageContentView.css:
+        * UserInterface/Views/DashboardContainerView.css:
+        (.toolbar.icon-and-label-vertical:matches(.small-size, .normal-size) .dashboard-container):
+        (.toolbar:matches(.label-only, .small-size:matches(.icon-only, .icon-and-label-vertical, .icon-and-label-horizontal)) .dashboard-container):
+        (.toolbar.normal-size:matches(.icon-only, .icon-and-label-vertical, .icon-and-label-horizontal) .dashboard-container):
+        (.toolbar.normal-size.icon-and-label-vertical .dashboard-container): Deleted.
+        (.toolbar.small-size.icon-and-label-horizontal .dashboard-container): Deleted.
+        (.toolbar.normal-size.icon-and-label-horizontal .dashboard-container): Deleted.
+        * UserInterface/Views/DataGrid.css:
+        (.data-grid :matches(th, td):not(:last-child)):
+        (.data-grid th:matches(.sort-ascending, .sort-descending)):
+        (.data-grid :matches(th, td) > div):
+        (.data-grid th:matches(.sort-ascending, .sort-descending) > div:first-child):
+        (.data-grid tr:matches(.selected, :hover) .go-to-arrow):
+        (.data-grid :-webkit-any(th, td):not(:last-child)): Deleted.
+        (.data-grid th:-webkit-any(.sort-ascending, .sort-descending)): Deleted.
+        (.data-grid :-webkit-any(th, td) > div): Deleted.
+        (.data-grid th:-webkit-any(.sort-ascending, .sort-descending) > div:first-child): Deleted.
+        (.data-grid tr:-webkit-any(.selected, :hover) .go-to-arrow): Deleted.
+        * UserInterface/Views/DebuggerDashboardView.css:
+        (.toolbar.collapsed .dashboard.debugger > :not(.message, .navigation-bar )):
+        (.toolbar.collapsed .dashboard.debugger > :not(.message):not(.navigation-bar )): Deleted.
+        * UserInterface/Views/DefaultDashboardView.css:
+        (body.web .toolbar.collapsed .dashboard.default > :matches(.time, .resourcesSize, .logs)):
+        (body.javascript .toolbar .dashboard.default > :matches(.time, .resourcesSize, .resourcesCount)):
+        (.toolbar:matches(.label-only, .small-size:matches(.icon-only, .icon-and-label-vertical, .icon-and-label-horizontal)) .dashboard.default > .item):
+        (.toolbar.normal-size:matches(.icon-only, .icon-and-label-vertical, .icon-and-label-horizontal) .dashboard.default > .item):
+        (body.web .toolbar.collapsed .dashboard.default > .logs): Deleted.
+        (body.javascript .toolbar .dashboard.default > .resourcesCount): Deleted.
+        (.toolbar.small-size.icon-and-label-horizontal .dashboard.default > .item): Deleted.
+        (.toolbar.normal-size.icon-and-label-horizontal .dashboard.default > .item): Deleted.
+        * UserInterface/Views/DetailsSection.css:
+        (.details-section > .header > :matches(.node-link, .go-to-arrow)):
+        (.details-section > .content > .group:nth-child(even) > .row:matches(.simple:first-child > *, :not(.simple):first-child)):
+        (body.mac-platform.legacy .details-section > .content > .group:matches(:nth-child(even), :last-child) > .row.simple:last-child > *):
+        (.details-section > .content > .group > .row:matches(.empty, .text)):
+        (body.mac-platform.legacy .details-section > .content > .group > .row:matches(.empty, .text)):
+        (.details-section > .header > .go-to-arrow): Deleted.
+        (.details-section > .content > .group:nth-child(even) > .row.simple:first-child > *): Deleted.
+        (body.mac-platform.legacy .details-section > .content > .group:last-child > .row.simple:last-child > *): Deleted.
+        (.details-section > .content > .group > .row.text): Deleted.
+        (body.mac-platform.legacy .details-section > .content > .group > .row.text): Deleted.
+        * UserInterface/Views/FindBanner.css:
+        (:matches(.find-banner, .supports-find-banner).no-find-banner-transition):
+        (.supports-find-banner.no-find-banner-transition): Deleted.
+        * UserInterface/Views/FlexibleSpaceNavigationItem.css:
+        (:matches(.navigation-bar, .toolbar) .item.flexible-space):
+        (.toolbar .item.flexible-space): Deleted.
+
 2014-11-19  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: LayoutTests/inspector should not have localStorage side effects
index 692132a..b6c4ce7 100644 (file)
@@ -64,8 +64,7 @@ body.mac-platform.legacy .style-declaration-section.last-in-group + .style-decla
 
 body.mac-platform.legacy .style-declaration-section:first-child,
 body.mac-platform.legacy div:not(.style-declaration-section) + .style-declaration-section,
-body.mac-platform.legacy .style-declaration-section.last-in-group + .style-declaration-section.last-in-group,
-body.mac-platform.legacy .style-declaration-section.last-in-group + .style-declaration-section:last-child {
+body.mac-platform.legacy .style-declaration-section.last-in-group + .style-declaration-section:matches(.last-in-group, :last-child) {
     box-shadow: rgba(0, 0, 0, 0.3) 0 1px 3px 1px;
 }
 
@@ -121,8 +120,7 @@ body.mac-platform.legacy .style-declaration-section.last-in-group + .style-decla
     color: black;
 }
 
-.style-declaration-section.locked > .header > .selector,
-.style-declaration-section.selector-locked > .header > .selector {
+.style-declaration-section:matches(.locked, .selector-locked) > .header > .selector {
     -webkit-user-modify: read-only;
 }
 
index 08387f2..36fc69e 100644 (file)
     display: none;
 }
 
-.css-style-text-editor > .CodeMirror .CodeMirror-lines pre > span span:not(.css-style-declaration-property):not(.CodeMirror-widget):not(.cm-comment):not(.cm-tab),
-.css-style-text-editor > .CodeMirror .CodeMirror-lines .css-style-declaration-property.disabled,
-.css-style-text-editor > .CodeMirror .CodeMirror-lines .css-style-declaration-property.invalid,
-.css-style-text-editor > .CodeMirror .CodeMirror-lines .css-style-declaration-property.other-vendor,
-.css-style-text-editor > .CodeMirror .CodeMirror-lines .css-style-declaration-property.not-inherited,
-.css-style-text-editor > .CodeMirror .CodeMirror-lines .css-style-declaration-property.overridden {
+.css-style-text-editor > .CodeMirror .CodeMirror-lines pre > span span:not(.css-style-declaration-property, .CodeMirror-widget, .cm-comment, .cm-tab),
+.css-style-text-editor > .CodeMirror .CodeMirror-lines .css-style-declaration-property:matches(.disabled, .invalid, .other-vendor, .not-inherited, .overridden) {
     text-decoration: line-through;
     -webkit-text-stroke-width: 0.000000000000001px; /* A hack to get a different line-through color. */
     -webkit-text-stroke-color: rgba(0, 0, 0, 0.6);
 }
 
-.css-style-text-editor > .CodeMirror .CodeMirror-lines pre > span span:not(.css-style-declaration-property):not(.CodeMirror-widget):not(.cm-comment):not(.cm-tab),
+.css-style-text-editor > .CodeMirror .CodeMirror-lines pre > span span:not(.css-style-declaration-property, .CodeMirror-widget, .cm-comment, .cm-tab),
 .css-style-text-editor > .CodeMirror .CodeMirror-lines .css-style-declaration-property.invalid {
     -webkit-text-stroke-color: rgba(255, 0, 0, 0.6);
 }
 
-.css-style-text-editor > .CodeMirror .CodeMirror-lines .css-style-declaration-property.implicit,
-.css-style-text-editor > .CodeMirror .CodeMirror-lines .css-style-declaration-property.not-inherited {
+.css-style-text-editor > .CodeMirror .CodeMirror-lines .css-style-declaration-property:matches(.implicit, .not-inherited) {
     opacity: 0.5;
 }
 
-.css-style-text-editor > .CodeMirror .CodeMirror-lines .editing-line .css-style-declaration-property.disabled,
-.css-style-text-editor > .CodeMirror .CodeMirror-lines .editing-line .css-style-declaration-property.other-vendor,
-.css-style-text-editor > .CodeMirror .CodeMirror-lines .editing-line .css-style-declaration-property.not-inherited,
-.css-style-text-editor > .CodeMirror .CodeMirror-lines .editing-line .css-style-declaration-property.overridden {
+.css-style-text-editor > .CodeMirror .CodeMirror-lines .editing-line .css-style-declaration-property:matches(.disabled, .other-vendor, .not-inherited, .overridden) {
     -webkit-text-stroke-color: rgba(0, 0, 0, 0.3);
 }
 
-.css-style-text-editor > .CodeMirror .CodeMirror-lines .editing-line span:not(.css-style-declaration-property):not(.CodeMirror-widget):not(.cm-comment):not(.cm-tab),
+.css-style-text-editor > .CodeMirror .CodeMirror-lines .editing-line span:not(.css-style-declaration-property, .CodeMirror-widget, .cm-comment, .cm-tab),
 .css-style-text-editor > .CodeMirror .CodeMirror-lines .editing-line .css-style-declaration-property.invalid {
     text-decoration: none;
 }
index 9804e2f..c3d47c3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -40,8 +40,7 @@ body.mac-platform.legacy .toolbar .item.control {
     padding: 2px;
 }
 
-.toolbar.icon-and-label-horizontal .item.control,
-.toolbar.icon-only .item.control {
+.toolbar:matches(.icon-and-label-horizontal, .icon-only) .item.control {
     padding: 0 2px;
 }
 
index dfef5eb..e300854 100644 (file)
     bottom: 0;
 }
 
-.content-view.dom-storage > .data-grid tr.duplicate-key td.key-column,
-.content-view.dom-storage > .data-grid tr.missing-key td.key-column,
+.content-view.dom-storage > .data-grid tr:matches(.duplicate-key, .missing-key) td.key-column,
 .content-view.dom-storage > .data-grid tr.missing-value td.value-column {
     background-color: #fee;
 }
 
-.content-view.dom-storage > .data-grid:focus tr.selected.duplicate-key td.key-column,
-.content-view.dom-storage > .data-grid:focus tr.selected.missing-key td.key-column,
+.content-view.dom-storage > .data-grid:focus tr.selected:matches(.duplicate-key, .missing-key) td.key-column,
 .content-view.dom-storage > .data-grid:focus tr.selected.missing-value td.value-column {
     background-color: #daa;
 }
index 5feabb8..645d7c8 100644 (file)
@@ -63,25 +63,20 @@ body.mac-platform.legacy.window-inactive .toolbar .dashboard-container {
     width: 175px;
 }
 
-.toolbar.small-size.icon-and-label-vertical .dashboard-container,
-.toolbar.normal-size.icon-and-label-vertical .dashboard-container {
+.toolbar.icon-and-label-vertical:matches(.small-size, .normal-size) .dashboard-container {
     margin-top: 6px;
 }
 
 /* Styles for the extra short style, one row with quite a small y-margin */
 
 .toolbar.label-only .dashboard-container,
-.toolbar.small-size.icon-only .dashboard-container,
-.toolbar.small-size.icon-and-label-vertical .dashboard-container,
-.toolbar.small-size.icon-and-label-horizontal .dashboard-container {
+.toolbar.small-size:matches(.icon-only, .icon-and-label-vertical, .icon-and-label-horizontal) .dashboard-container {
     height: 22px;
 }
 
 /* Styles for the fairly short style, one row with quite a bit of y-margin */
 
-.toolbar.normal-size.icon-only .dashboard-container,
-.toolbar.normal-size.icon-and-label-vertical .dashboard-container,
-.toolbar.normal-size.icon-and-label-horizontal .dashboard-container {
+.toolbar.normal-size:matches(.icon-only, .icon-and-label-vertical, .icon-and-label-horizontal) .dashboard-container {
     height: 30px;
 }
 
index 5d6f391..416484c 100644 (file)
@@ -86,7 +86,7 @@
     overflow: hidden;
 }
 
-.data-grid :-webkit-any(th, td):not(:last-child) {
+.data-grid :matches(th, td):not(:last-child) {
     border-right: 1px solid rgb(179, 179, 179);
 }
 
@@ -94,7 +94,7 @@
     background-color: rgb(179, 179, 179);
 }
 
-.data-grid th:-webkit-any(.sort-ascending, .sort-descending) {
+.data-grid th:matches(.sort-ascending, .sort-descending) {
     background-color: rgb(230, 230, 230);
 }
 
@@ -150,7 +150,7 @@ body.mac-platform.legacy .data-grid:focus tr.selected td:not(:last-child) {
     border-right-color: rgb(53, 109, 189);
 }
 
-.data-grid :-webkit-any(th, td) > div {
+.data-grid :matches(th, td) > div {
     white-space: nowrap;
     text-overflow: ellipsis;
     overflow: hidden;
@@ -168,7 +168,7 @@ body.mac-platform.legacy .data-grid:focus tr.selected td:not(:last-child) {
     position: relative;
 }
 
-.data-grid th:-webkit-any(.sort-ascending, .sort-descending) > div:first-child {
+.data-grid th:matches(.sort-ascending, .sort-descending) > div:first-child {
     padding-right: 12px;
 }
 
@@ -298,7 +298,7 @@ body.mac-platform.legacy .data-grid:focus tr.selected {
     margin-left: 2px;
 }
 
-.data-grid tr:-webkit-any(.selected, :hover) .go-to-arrow {
+.data-grid tr:matches(.selected, :hover) .go-to-arrow {
     display: block;
 }
 
index e4d0d45..b251888 100644 (file)
     overflow: hidden;
 }
 
-.toolbar.collapsed .dashboard.debugger > :not(.message):not(.navigation-bar ) {
+.toolbar.collapsed .dashboard.debugger > :not(.message, .navigation-bar) {
     display: none;
 }
 
index d74c5f2..d25b708 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-body.web .toolbar.collapsed .dashboard.default > .time,
-body.web .toolbar.collapsed .dashboard.default > .resourcesSize,
-body.web .toolbar.collapsed .dashboard.default > .logs {
+body.web .toolbar.collapsed .dashboard.default > :matches(.time, .resourcesSize, .logs) {
     display: none;
 }
 
-body.javascript .toolbar .dashboard.default > .time,
-body.javascript .toolbar .dashboard.default > .resourcesSize,
-body.javascript .toolbar .dashboard.default > .resourcesCount {
+body.javascript .toolbar .dashboard.default > :matches(.time, .resourcesSize, .resourcesCount) {
     display: none;
 }
 
@@ -216,16 +212,12 @@ body.mac-platform.legacy .toolbar .dashboard.default > .issues.enabled > img {
 /* Styles for the extra short style, one row with quite a small y-margin */
 
 .toolbar.label-only .dashboard.default > .item,
-.toolbar.small-size.icon-only .dashboard.default > .item,
-.toolbar.small-size.icon-and-label-vertical .dashboard.default > .item,
-.toolbar.small-size.icon-and-label-horizontal .dashboard.default > .item {
+.toolbar.small-size:matches(.icon-only, .icon-and-label-vertical, .icon-and-label-horizontal) .dashboard.default > .item {
     margin: 1px 0;
 }
 
 /* Styles for the fairly short style, one row with quite a bit of y-margin */
 
-.toolbar.normal-size.icon-only .dashboard.default > .item,
-.toolbar.normal-size.icon-and-label-vertical .dashboard.default > .item,
-.toolbar.normal-size.icon-and-label-horizontal .dashboard.default > .item {
+.toolbar.normal-size:matches(.icon-only, .icon-and-label-vertical, .icon-and-label-horizontal) .dashboard.default > .item {
     margin: 4px 0;
 }
index 9b87b63..12dbaae 100644 (file)
@@ -167,8 +167,7 @@ body.mac-platform.legacy .details-section.computed-style-properties:not(.collaps
     font-size: 10px;
 }
 
-.details-section > .header > .node-link,
-.details-section > .header > .go-to-arrow {
+.details-section > .header > :matches(.node-link, .go-to-arrow) {
     float: right;
 }
 
@@ -210,15 +209,12 @@ body.mac-platform.legacy .details-section > .content > .group:nth-child(even) {
     background-color: rgb(222, 222, 222);
 }
 
-.details-section > .content > .group:nth-child(even) > .row:not(.simple):first-child,
-.details-section > .content > .group:nth-child(even) > .row.simple:first-child > * {
+.details-section > .content > .group:nth-child(even) > .row:matches(.simple:first-child > *, :not(.simple):first-child) {
     border-top: 1px solid rgb(179, 179, 179);
 }
 
-body.mac-platform.legacy .details-section > .content > .group:nth-child(even) > .row:not(.simple):last-child,
-body.mac-platform.legacy .details-section > .content > .group:last-child > .row:not(.simple):last-child,
-body.mac-platform.legacy .details-section > .content > .group:nth-child(even) > .row.simple:last-child > *,
-body.mac-platform.legacy .details-section > .content > .group:last-child > .row.simple:last-child > * {
+body.mac-platform.legacy .details-section > .content > .group:matches(:nth-child(even), :last-child) > .row:not(.simple):last-child,
+body.mac-platform.legacy .details-section > .content > .group:matches(:nth-child(even), :last-child) > .row.simple:last-child > * {
     border-bottom: 1px solid rgb(179, 179, 179);
 }
 
@@ -298,15 +294,13 @@ body.mac-platform.legacy .details-section > .content > .group:first-child > .row
     word-break: break-all;
 }
 
-.details-section > .content > .group > .row.empty,
-.details-section > .content > .group > .row.text {
+.details-section > .content > .group > .row:matches(.empty, .text) {
     padding: 0 6px 7px 6px;
     text-align: center;
     color: gray;
 }
 
-body.mac-platform.legacy .details-section > .content > .group > .row.empty,
-body.mac-platform.legacy .details-section > .content > .group > .row.text {
+body.mac-platform.legacy .details-section > .content > .group > .row:matches(.empty, .text) {
     padding: 6px;
 }
 
index ca68b14..9a79124 100644 (file)
@@ -49,8 +49,7 @@
     transition-timing-function: ease-out;
 }
 
-.find-banner.no-find-banner-transition,
-.supports-find-banner.no-find-banner-transition {
+.no-find-banner-transition:matches(.find-banner, .supports-find-banner) {
     transition-duration: 0 !important;
 }
 
index b36c4d1..433db56 100644 (file)
@@ -23,7 +23,6 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-.navigation-bar .item.flexible-space,
-.toolbar .item.flexible-space {
+:matches(.navigation-bar, .toolbar) .item.flexible-space {
     flex: 1;
 }