Changeset 101998 in webkit
- Timestamp:
- Dec 5, 2011 7:30:38 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r101997 r101998 1 2011-12-05 Roland Steiner <rolandsteiner@chromium.org> 2 3 "Raw" pseudo selectors don't match if immediately after a child or descendant combinator 4 https://bugs.webkit.org/show_bug.cgi?id=72933 5 6 Add tests cases for "raw" shadow pseudo-element selectors with various combinators. 7 Also add cases with explicit universal '*' selector. 8 9 Reviewed by Antti Koivisto. 10 11 * fast/css/css-selector-text-expected.txt: 12 * fast/css/css-selector-text.html: 13 * fast/css/css-set-selector-text-expected.txt: 14 * fast/css/css-set-selector-text.html: 15 * fast/css/unknown-pseudo-element-matching-expected.txt: 16 * fast/css/unknown-pseudo-element-matching.html: 17 1 18 2011-12-05 Vsevolod Vlasov <vsevik@chromium.org> 2 19 -
trunk/LayoutTests/fast/css/css-selector-text-expected.txt
r101679 r101998 59 59 PASS parseThenSerializeRule(':-webkit-drag { }') is ':-webkit-drag { }' 60 60 61 PASS parseThenSerializeRule('::-webkit-file-upload-button { }') is ' ::-webkit-file-upload-button { }'62 PASS parseThenSerializeRule('::-webkit-search-cancel-button { }') is ' ::-webkit-search-cancel-button { }'63 PASS parseThenSerializeRule('::-webkit-search-decoration { }') is ' ::-webkit-search-decoration { }'64 PASS parseThenSerializeRule('::-webkit-search-results-button { }') is ' ::-webkit-search-results-button { }'65 PASS parseThenSerializeRule('::-webkit-search-results-decoration { }') is ' ::-webkit-search-results-decoration { }'66 PASS parseThenSerializeRule('::-webkit-slider-thumb { }') is ' ::-webkit-slider-thumb { }'61 PASS parseThenSerializeRule('::-webkit-file-upload-button { }') is '*::-webkit-file-upload-button { }' 62 PASS parseThenSerializeRule('::-webkit-search-cancel-button { }') is '*::-webkit-search-cancel-button { }' 63 PASS parseThenSerializeRule('::-webkit-search-decoration { }') is '*::-webkit-search-decoration { }' 64 PASS parseThenSerializeRule('::-webkit-search-results-button { }') is '*::-webkit-search-results-button { }' 65 PASS parseThenSerializeRule('::-webkit-search-results-decoration { }') is '*::-webkit-search-results-decoration { }' 66 PASS parseThenSerializeRule('::-webkit-slider-thumb { }') is '*::-webkit-slider-thumb { }' 67 67 68 68 PASS parseThenSerializeRule('a::-webkit-slider-thumb { }') is 'a::-webkit-slider-thumb { }' 69 PASS parseThenSerializeRule('a ::-webkit-slider-thumb { }') is 'a ::-webkit-slider-thumb { }'69 PASS parseThenSerializeRule('a ::-webkit-slider-thumb { }') is 'a *::-webkit-slider-thumb { }' 70 70 PASS parseThenSerializeRule('[a]::-webkit-slider-thumb { }') is '[a]::-webkit-slider-thumb { }' 71 PASS parseThenSerializeRule('[a] ::-webkit-slider-thumb { }') is '[a] ::-webkit-slider-thumb { }'71 PASS parseThenSerializeRule('[a] ::-webkit-slider-thumb { }') is '[a] *::-webkit-slider-thumb { }' 72 72 PASS parseThenSerializeRule('.a::-webkit-slider-thumb { }') is '.a::-webkit-slider-thumb { }' 73 PASS parseThenSerializeRule('.a ::-webkit-slider-thumb { }') is '.a ::-webkit-slider-thumb { }'73 PASS parseThenSerializeRule('.a ::-webkit-slider-thumb { }') is '.a *::-webkit-slider-thumb { }' 74 74 PASS parseThenSerializeRule('#a::-webkit-slider-thumb { }') is '#a::-webkit-slider-thumb { }' 75 PASS parseThenSerializeRule('#a ::-webkit-slider-thumb { }') is '#a ::-webkit-slider-thumb { }' 75 PASS parseThenSerializeRule('#a ::-webkit-slider-thumb { }') is '#a *::-webkit-slider-thumb { }' 76 PASS parseThenSerializeRule('* ::-webkit-slider-thumb { }') is '* *::-webkit-slider-thumb { }' 77 78 PASS parseThenSerializeRule('a[b]::-webkit-slider-thumb { }') is 'a[b]::-webkit-slider-thumb { }' 79 PASS parseThenSerializeRule('a.b::-webkit-slider-thumb { }') is 'a.b::-webkit-slider-thumb { }' 80 PASS parseThenSerializeRule('a#b::-webkit-slider-thumb { }') is 'a#b::-webkit-slider-thumb { }' 81 PASS parseThenSerializeRule('a[b].c#d::-webkit-slider-thumb { }') is 'a[b].c#d::-webkit-slider-thumb { }' 76 82 77 83 PASS parseThenSerializeRule('input:not([type="file"]):focus { }') is 'input:not([type="file"]):focus { }' -
trunk/LayoutTests/fast/css/css-selector-text.html
r101679 r101998 98 98 debug(''); 99 99 100 testSelectorRoundTrip("::-webkit-file-upload-button");101 testSelectorRoundTrip("::-webkit-search-cancel-button");102 testSelectorRoundTrip("::-webkit-search-decoration");103 testSelectorRoundTrip("::-webkit-search-results-button");104 testSelectorRoundTrip("::-webkit-search-results-decoration");105 testSelectorRoundTrip("::-webkit-slider-thumb");100 shouldBe("parseThenSerializeRule('::-webkit-file-upload-button { }')", "'*::-webkit-file-upload-button { }'"); 101 shouldBe("parseThenSerializeRule('::-webkit-search-cancel-button { }')", "'*::-webkit-search-cancel-button { }'"); 102 shouldBe("parseThenSerializeRule('::-webkit-search-decoration { }')", "'*::-webkit-search-decoration { }'"); 103 shouldBe("parseThenSerializeRule('::-webkit-search-results-button { }')", "'*::-webkit-search-results-button { }'"); 104 shouldBe("parseThenSerializeRule('::-webkit-search-results-decoration { }')", "'*::-webkit-search-results-decoration { }'"); 105 shouldBe("parseThenSerializeRule('::-webkit-slider-thumb { }')", "'*::-webkit-slider-thumb { }'"); 106 106 107 107 debug(''); 108 108 109 109 testSelectorRoundTrip("a::-webkit-slider-thumb"); 110 testSelectorRoundTrip("a ::-webkit-slider-thumb");110 shouldBe("parseThenSerializeRule('a ::-webkit-slider-thumb { }')", "'a *::-webkit-slider-thumb { }'"); 111 111 testSelectorRoundTrip("[a]::-webkit-slider-thumb"); 112 testSelectorRoundTrip("[a] ::-webkit-slider-thumb");112 shouldBe("parseThenSerializeRule('[a] ::-webkit-slider-thumb { }')", "'[a] *::-webkit-slider-thumb { }'"); 113 113 testSelectorRoundTrip(".a::-webkit-slider-thumb"); 114 testSelectorRoundTrip(".a ::-webkit-slider-thumb");114 shouldBe("parseThenSerializeRule('.a ::-webkit-slider-thumb { }')", "'.a *::-webkit-slider-thumb { }'"); 115 115 testSelectorRoundTrip("#a::-webkit-slider-thumb"); 116 testSelectorRoundTrip("#a ::-webkit-slider-thumb"); 116 shouldBe("parseThenSerializeRule('#a ::-webkit-slider-thumb { }')", "'#a *::-webkit-slider-thumb { }'"); 117 shouldBe("parseThenSerializeRule('* ::-webkit-slider-thumb { }')", "'* *::-webkit-slider-thumb { }'"); 118 119 debug(''); 120 121 testSelectorRoundTrip("a[b]::-webkit-slider-thumb"); 122 testSelectorRoundTrip("a.b::-webkit-slider-thumb"); 123 testSelectorRoundTrip("a#b::-webkit-slider-thumb"); 124 testSelectorRoundTrip("a[b].c#d::-webkit-slider-thumb"); 117 125 118 126 debug(''); -
trunk/LayoutTests/fast/css/css-set-selector-text-expected.txt
r101679 r101998 69 69 PASS setThenReadSelectorText(':-webkit-drag') is ':-webkit-drag' 70 70 71 PASS setThenReadSelectorText('::-webkit-file-upload-button') is ' ::-webkit-file-upload-button'72 PASS setThenReadSelectorText('::-webkit-search-cancel-button') is ' ::-webkit-search-cancel-button'73 PASS setThenReadSelectorText('::-webkit-search-decoration') is ' ::-webkit-search-decoration'74 PASS setThenReadSelectorText('::-webkit-search-results-button') is ' ::-webkit-search-results-button'75 PASS setThenReadSelectorText('::-webkit-search-results-decoration') is ' ::-webkit-search-results-decoration'76 PASS setThenReadSelectorText('::-webkit-slider-thumb') is ' ::-webkit-slider-thumb'71 PASS setThenReadSelectorText('::-webkit-file-upload-button') is '*::-webkit-file-upload-button' 72 PASS setThenReadSelectorText('::-webkit-search-cancel-button') is '*::-webkit-search-cancel-button' 73 PASS setThenReadSelectorText('::-webkit-search-decoration') is '*::-webkit-search-decoration' 74 PASS setThenReadSelectorText('::-webkit-search-results-button') is '*::-webkit-search-results-button' 75 PASS setThenReadSelectorText('::-webkit-search-results-decoration') is '*::-webkit-search-results-decoration' 76 PASS setThenReadSelectorText('::-webkit-slider-thumb') is '*::-webkit-slider-thumb' 77 77 78 78 PASS setThenReadSelectorText('a::-webkit-slider-thumb') is 'a::-webkit-slider-thumb' 79 PASS setThenReadSelectorText('a ::-webkit-slider-thumb') is 'a ::-webkit-slider-thumb'79 PASS setThenReadSelectorText('a ::-webkit-slider-thumb') is 'a *::-webkit-slider-thumb' 80 80 PASS setThenReadSelectorText('[a]::-webkit-slider-thumb') is '[a]::-webkit-slider-thumb' 81 PASS setThenReadSelectorText('[a] ::-webkit-slider-thumb') is '[a] ::-webkit-slider-thumb'81 PASS setThenReadSelectorText('[a] ::-webkit-slider-thumb') is '[a] *::-webkit-slider-thumb' 82 82 PASS setThenReadSelectorText('.a::-webkit-slider-thumb') is '.a::-webkit-slider-thumb' 83 PASS setThenReadSelectorText('.a ::-webkit-slider-thumb') is '.a ::-webkit-slider-thumb'83 PASS setThenReadSelectorText('.a ::-webkit-slider-thumb') is '.a *::-webkit-slider-thumb' 84 84 PASS setThenReadSelectorText('#a::-webkit-slider-thumb') is '#a::-webkit-slider-thumb' 85 PASS setThenReadSelectorText('#a ::-webkit-slider-thumb') is '#a ::-webkit-slider-thumb' 85 PASS setThenReadSelectorText('#a ::-webkit-slider-thumb') is '#a *::-webkit-slider-thumb' 86 PASS setThenReadSelectorText('* ::-webkit-slider-thumb') is '* *::-webkit-slider-thumb' 87 88 PASS setThenReadSelectorText('a[b]::-webkit-slider-thumb') is 'a[b]::-webkit-slider-thumb' 89 PASS setThenReadSelectorText('a.b::-webkit-slider-thumb') is 'a.b::-webkit-slider-thumb' 90 PASS setThenReadSelectorText('a#b::-webkit-slider-thumb') is 'a#b::-webkit-slider-thumb' 91 PASS setThenReadSelectorText('a[b].c#d::-webkit-slider-thumb') is 'a[b].c#d::-webkit-slider-thumb' 86 92 87 93 PASS setThenReadSelectorText('input:not([type="file"]):focus') is 'input:not([type="file"]):focus' -
trunk/LayoutTests/fast/css/css-set-selector-text.html
r101679 r101998 115 115 debug(''); 116 116 117 testSelectorRoundTrip("::-webkit-file-upload-button");118 testSelectorRoundTrip("::-webkit-search-cancel-button");119 testSelectorRoundTrip("::-webkit-search-decoration");120 testSelectorRoundTrip("::-webkit-search-results-button");121 testSelectorRoundTrip("::-webkit-search-results-decoration");122 testSelectorRoundTrip("::-webkit-slider-thumb");117 shouldBe("setThenReadSelectorText('::-webkit-file-upload-button')", "'*::-webkit-file-upload-button'"); 118 shouldBe("setThenReadSelectorText('::-webkit-search-cancel-button')", "'*::-webkit-search-cancel-button'"); 119 shouldBe("setThenReadSelectorText('::-webkit-search-decoration')", "'*::-webkit-search-decoration'"); 120 shouldBe("setThenReadSelectorText('::-webkit-search-results-button')", "'*::-webkit-search-results-button'"); 121 shouldBe("setThenReadSelectorText('::-webkit-search-results-decoration')", "'*::-webkit-search-results-decoration'"); 122 shouldBe("setThenReadSelectorText('::-webkit-slider-thumb')", "'*::-webkit-slider-thumb'"); 123 123 124 124 debug(''); 125 125 126 126 testSelectorRoundTrip("a::-webkit-slider-thumb"); 127 testSelectorRoundTrip("a ::-webkit-slider-thumb");127 shouldBe("setThenReadSelectorText('a ::-webkit-slider-thumb')", "'a *::-webkit-slider-thumb'"); 128 128 testSelectorRoundTrip("[a]::-webkit-slider-thumb"); 129 testSelectorRoundTrip("[a] ::-webkit-slider-thumb");129 shouldBe("setThenReadSelectorText('[a] ::-webkit-slider-thumb')", "'[a] *::-webkit-slider-thumb'"); 130 130 testSelectorRoundTrip(".a::-webkit-slider-thumb"); 131 testSelectorRoundTrip(".a ::-webkit-slider-thumb");131 shouldBe("setThenReadSelectorText('.a ::-webkit-slider-thumb')", "'.a *::-webkit-slider-thumb'"); 132 132 testSelectorRoundTrip("#a::-webkit-slider-thumb"); 133 testSelectorRoundTrip("#a ::-webkit-slider-thumb"); 133 shouldBe("setThenReadSelectorText('#a ::-webkit-slider-thumb')", "'#a *::-webkit-slider-thumb'"); 134 shouldBe("setThenReadSelectorText('* ::-webkit-slider-thumb')", "'* *::-webkit-slider-thumb'"); 135 136 debug(''); 137 138 testSelectorRoundTrip("a[b]::-webkit-slider-thumb"); 139 testSelectorRoundTrip("a.b::-webkit-slider-thumb"); 140 testSelectorRoundTrip("a#b::-webkit-slider-thumb"); 141 testSelectorRoundTrip("a[b].c#d::-webkit-slider-thumb"); 134 142 135 143 debug(''); -
trunk/LayoutTests/fast/css/unknown-pseudo-element-matching-expected.txt
r89742 r101998 3 3 Basic selector tests: 4 4 ::-webkit-slider-thumb should match: PASS 5 *::-webkit-slider-thumb should match: PASS 5 6 ::-webkit-slider-thumb, where HTML is not default namespace should not match: PASS 6 7 *|::-webkit-slider-thumb, where HTML is not default namespace should match: PASS 8 *|*::-webkit-slider-thumb, where HTML is not default namespace should match: PASS 7 9 html|::-webkit-slider-thumb, where HTML is not default namespace should match: PASS 10 html|*::-webkit-slider-thumb, where HTML is not default namespace should match: PASS 8 11 #foo::-webkit-slider-thumb should match: PASS 9 12 .bar::-webkit-slider-thumb should match: PASS … … 29 32 Shouldn't ignore selector after the unknown pseudo element: 30 33 ::-webkit-slider-thumb:disabled should not match: PASS 34 *::-webkit-slider-thumb:disabled should not match: PASS 31 35 input::-webkit-slider-thumb:disabled should not match: PASS 32 36 #foo::-webkit-slider-thumb:disabled should not match: PASS … … 37 41 Should not match disabled input, because the disabled state is on the input, not the thumb: 38 42 ::-webkit-slider-thumb:disabled should not match: PASS 43 *::-webkit-slider-thumb:disabled should not match: PASS 39 44 input::-webkit-slider-thumb:disabled should not match: PASS 40 45 #foo::-webkit-slider-thumb:disabled should not match: PASS … … 45 50 Should match :hover when the mouse is over the slider thumb: 46 51 ::-webkit-slider-thumb:hover should match: PASS 52 *::-webkit-slider-thumb:hover should match: PASS 47 53 input::-webkit-slider-thumb:hover should match: PASS 48 54 #foo::-webkit-slider-thumb:hover should match: PASS … … 52 58 53 59 Should match when combined with descendant selectors: 60 #baz ::-webkit-slider-thumb should match: PASS 61 #baz *::-webkit-slider-thumb should match: PASS 54 62 #baz input::-webkit-slider-thumb should match: PASS 55 63 #baz #foo::-webkit-slider-thumb should match: PASS … … 57 65 #baz input.bar::-webkit-slider-thumb should match: PASS 58 66 #baz input[type=range]::-webkit-slider-thumb should match: PASS 67 .qux ::-webkit-slider-thumb should match: PASS 68 .qux *::-webkit-slider-thumb should match: PASS 59 69 .qux input::-webkit-slider-thumb should match: PASS 60 70 .qux #foo::-webkit-slider-thumb should match: PASS … … 62 72 .qux input.bar::-webkit-slider-thumb should match: PASS 63 73 .qux input[type=range]::-webkit-slider-thumb should match: PASS 74 75 Should match when combined with sibling selectors: 76 #sib + ::-webkit-slider-thumb should match: PASS 77 #sib + *::-webkit-slider-thumb should match: PASS 78 #sib + input::-webkit-slider-thumb should match: PASS 79 #sib + #foo::-webkit-slider-thumb should match: PASS 80 #sib + input#foo::-webkit-slider-thumb should match: PASS 81 #sib + input.bar::-webkit-slider-thumb should match: PASS 82 #sib + input[type=range]::-webkit-slider-thumb should match: PASS 83 #sib ~ ::-webkit-slider-thumb should match: PASS 84 #sib ~ *::-webkit-slider-thumb should match: PASS 85 #sib ~ input::-webkit-slider-thumb should match: PASS 86 #sib ~ #foo::-webkit-slider-thumb should match: PASS 87 #sib ~ input#foo::-webkit-slider-thumb should match: PASS 88 #sib ~ input.bar::-webkit-slider-thumb should match: PASS 89 #sib ~ input[type=range]::-webkit-slider-thumb should match: PASS 90 .ling + ::-webkit-slider-thumb should match: PASS 91 .ling + *::-webkit-slider-thumb should match: PASS 92 .ling + input::-webkit-slider-thumb should match: PASS 93 .ling + #foo::-webkit-slider-thumb should match: PASS 94 .ling + input#foo::-webkit-slider-thumb should match: PASS 95 .ling + input.bar::-webkit-slider-thumb should match: PASS 96 .ling + input[type=range]::-webkit-slider-thumb should match: PASS 97 .ling ~ ::-webkit-slider-thumb should match: PASS 98 .ling ~ *::-webkit-slider-thumb should match: PASS 99 .ling ~ input::-webkit-slider-thumb should match: PASS 100 .ling ~ #foo::-webkit-slider-thumb should match: PASS 101 .ling ~ input#foo::-webkit-slider-thumb should match: PASS 102 .ling ~ input.bar::-webkit-slider-thumb should match: PASS 103 .ling ~ input[type=range]::-webkit-slider-thumb should match: PASS -
trunk/LayoutTests/fast/css/unknown-pseudo-element-matching.html
r89742 r101998 19 19 var SELECTORS = [ 20 20 '::-webkit-slider-thumb', 21 '*::-webkit-slider-thumb', 21 22 'input::-webkit-slider-thumb', 22 23 '#foo::-webkit-slider-thumb', … … 28 29 var HOVER_SELECTORS = SELECTORS.map(function(selector) { return selector + ':hover'; }); 29 30 var DESCENDANT_ID_SELECTORS = SELECTORS.map(function(selector) { return '#baz ' + selector; }); 30 DESCENDANT_ID_SELECTORS.shift();31 31 var DESCENDANT_CLASS_SELECTORS = SELECTORS.map(function(selector) { return '.qux ' + selector; }); 32 DESCENDANT_CLASS_SELECTORS.shift(); 32 var DIRECT_SIBLING_ID_SELECTORS = SELECTORS.map(function(selector) { return '#sib + ' + selector; }); 33 var INDIRECT_SIBLING_ID_SELECTORS = SELECTORS.map(function(selector) { return '#sib ~ ' + selector; }); 34 var DIRECT_SIBLING_CLASS_SELECTORS = SELECTORS.map(function(selector) { return '.ling + ' + selector; }); 35 var INDIRECT_SIBLING_CLASS_SELECTORS = SELECTORS.map(function(selector) { return '.ling ~ ' + selector; }); 33 36 34 37 // convenience constants … … 67 70 head = document.getElementsByTagName('head')[0]; 68 71 input = document.getElementsByTagName('input')[0]; 72 testContainer = document.getElementById('baz'); 69 73 logDiv = document.getElementById('log'); 70 74 log('Basic selector tests:'); 71 75 runSelectorTest(MATCH, '::-webkit-slider-thumb'); 76 runSelectorTest(MATCH, '*::-webkit-slider-thumb'); 72 77 runSelectorTest(NO_MATCH, '::-webkit-slider-thumb', WITH_NAMESPACES); 73 78 runSelectorTest(MATCH, '*|::-webkit-slider-thumb', WITH_NAMESPACES); 79 runSelectorTest(MATCH, '*|*::-webkit-slider-thumb', WITH_NAMESPACES); 74 80 runSelectorTest(MATCH, 'html|::-webkit-slider-thumb', WITH_NAMESPACES); 81 runSelectorTest(MATCH, 'html|*::-webkit-slider-thumb', WITH_NAMESPACES); 75 82 runSelectorTest(MATCH, '#foo::-webkit-slider-thumb'); 76 83 runSelectorTest(MATCH, '.bar::-webkit-slider-thumb'); … … 108 115 DESCENDANT_ID_SELECTORS.forEach(expectMatch); 109 116 DESCENDANT_CLASS_SELECTORS.forEach(expectMatch); 110 input.parentNode.removeChild(input); 117 log('<br>Should match when combined with sibling selectors:'); 118 DIRECT_SIBLING_ID_SELECTORS.forEach(expectMatch); 119 INDIRECT_SIBLING_ID_SELECTORS.forEach(expectMatch); 120 DIRECT_SIBLING_CLASS_SELECTORS.forEach(expectMatch); 121 INDIRECT_SIBLING_CLASS_SELECTORS.forEach(expectMatch); 122 123 testContainer.parentNode.removeChild(testContainer); 111 124 } 112 125 … … 124 137 <p>Tests various selector combinations, containing unknown pseudo element selectors.</p> 125 138 <div id="baz" class="qux"> 139 <span id="sib" class="ling">Sibling</span> 126 140 <input id="foo" class="bar" type="range"> 127 141 </div> -
trunk/Source/WebCore/ChangeLog
r101995 r101998 1 2011-12-05 Roland Steiner <rolandsteiner@chromium.org> 2 3 "Raw" pseudo selectors don't match if immediately after a child or descendant combinator 4 https://bugs.webkit.org/show_bug.cgi?id=72933 5 6 Remove shortcut that prevents universal selectors from being created before shadow pseudo-elements. 7 8 Reviewed by Antti Koivisto. 9 10 * css/CSSParser.cpp: 11 (WebCore::CSSParser::updateSpecifiersWithElementName): 12 1 13 2011-12-05 Sheriff Bot <webkit.review.bot@gmail.com> 2 14 -
trunk/Source/WebCore/css/CSSParser.cpp
r101935 r101998 7674 7674 } 7675 7675 7676 // No need to create an extra element name selector if we are matching any element 7677 // in any namespace. 7678 if (elementName == starAtom && m_defaultNamespace == starAtom) 7679 return; 7680 7676 // For shadow-ID pseudo-elements to be correctly matched, the ShadowDescendant combinator has to be used. 7677 // We therefore create a new Selector with that combinator here in any case, even if matching any (host) element in any namespace (i.e. '*'). 7681 7678 OwnPtr<CSSParserSelector> elementNameSelector = adoptPtr(new CSSParserSelector); 7682 7679 elementNameSelector->setTag(tag);
Note: See TracChangeset
for help on using the changeset viewer.