Changeset 70335 in webkit
- Timestamp:
- Oct 22, 2010 2:05:16 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r70334 r70335 1 2010-10-22 Abhishek Arya <inferno@chromium.org> 2 3 Reviewed by Dave Hyatt. 4 5 Tests that cross origin bypass does not work with getMatchedCSSRules. Rebaseline existing tests 6 that try to access non-author stylesheets. This functionality is no longer supported. So, css rules 7 should return null for those cases. 8 https://bugs.webkit.org/show_bug.cgi?id=46853 9 10 * fast/backgrounds/repeat/background-repeat-shorthand-expected.txt: 11 * fast/backgrounds/repeat/margin-shorthand-expected.txt: 12 * fast/backgrounds/repeat/resources/background-repeat-shorthand.js: 13 * fast/backgrounds/repeat/resources/margin-shorthand.js: 14 * fast/css/disabled-author-styles.html: 15 * fast/css/modify-ua-rules-from-javascript-expected.txt: 16 * fast/css/modify-ua-rules-from-javascript.html: 17 * fast/css/word-break-user-modify-allowed-values.html: 18 * http/tests/security/cross-frame-access-call-expected.txt: 19 * http/tests/security/cross-frame-access-call.html: 20 * http/tests/security/cross-origin-getMatchedCSSRules-expected.txt: Added. 21 * http/tests/security/cross-origin-getMatchedCSSRules.html: Added. 22 * http/tests/security/cross-origin-getMatchedCSSRules2-expected.txt: Added. 23 * http/tests/security/cross-origin-getMatchedCSSRules2.html: Added. 24 * http/tests/security/resources/cross-origin-getMatchedCSSRules-frame.html: Added. 25 * platform/chromium/http/tests/security/cross-frame-access-call-expected.txt: 26 * platform/qt/http/tests/security/cross-frame-access-call-expected.txt: 27 1 28 2010-10-22 Andy Estes <aestes@apple.com> 2 29 -
trunk/LayoutTests/fast/backgrounds/repeat/background-repeat-shorthand-expected.txt
r49616 r70335 1 T ests that correct shorthand name is returned for background-repeat-x, background-repeat-y, background-position-x, background-position-y, -webkit-mask-repeat-x,-webkit-mask-repeat-y, -webkit-mask-position-x, -webkit-mask-position-y when corresponding shorthand is used in the style declaration. It tests regression described in this bug.1 This layout test used to test that correct shorthand name is returned for background-repeat-x, background-repeat-y, background-position-x, background-position-y, -webkit-mask-repeat-x,-webkit-mask-repeat-y, -webkit-mask-position-x, -webkit-mask-position-y when corresponding shorthand is used in the style declaration. It tests regression described in this bug. Now that access to non author stylesheet is blocked, we should instead get null when accessing the css rules on that object. 2 2 3 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 4 4 5 5 6 PASS getShorthand("background-repeat-x", "icon1") is "background-repeat" 7 PASS getShorthand("background-repeat-y", "icon1") is "background-repeat" 8 PASS getShorthand("background-repeat", "icon1") is null 9 PASS getShorthand("background-position-x", "icon1") is "background-position" 10 PASS getShorthand("background-position-y", "icon1") is "background-position" 11 PASS getShorthand("background-position", "icon1") is null 12 PASS getShorthand("-webkit-mask-repeat-x", "icon1") is "-webkit-mask-repeat" 13 PASS getShorthand("-webkit-mask-repeat-y", "icon1") is "-webkit-mask-repeat" 14 PASS getShorthand("-webkit-mask-repeat", "icon1") is null 15 PASS getShorthand("-webkit-mask-position-x", "icon1") is "-webkit-mask-position" 16 PASS getShorthand("-webkit-mask-position-y", "icon1") is "-webkit-mask-position" 17 PASS getShorthand("-webkit-mask-repeat", "icon1") is null 18 Test that shorthand names are null for #icon2 since its styles are declared with longhand properties: 19 PASS getShorthand("background-repeat-x", "icon2") is null 20 PASS getShorthand("background-repeat-y", "icon2") is null 21 PASS getShorthand("background-repeat", "icon2") is null 22 PASS getShorthand("background-position-x", "icon2") is null 23 PASS getShorthand("background-position-y", "icon2") is null 24 PASS getShorthand("background-position", "icon2") is null 25 PASS getShorthand("-webkit-mask-repeat-x", "icon2") is null 26 PASS getShorthand("-webkit-mask-repeat-y", "icon2") is null 27 PASS getShorthand("-webkit-mask-repeat", "icon2") is null 28 PASS getShorthand("-webkit-mask-position-x", "icon2") is null 29 PASS getShorthand("-webkit-mask-position-y", "icon2") is null 30 PASS getShorthand("-webkit-mask-repeat", "icon2") is null 6 PASS getShorthand("background-repeat-x", "icon1") threw exception TypeError: Result of expression 'rules[1]' [undefined] is not an object.. 7 PASS getShorthand("background-repeat-y", "icon1") threw exception TypeError: Result of expression 'rules[1]' [undefined] is not an object.. 8 PASS getShorthand("background-repeat", "icon1") threw exception TypeError: Result of expression 'rules[1]' [undefined] is not an object.. 9 PASS getShorthand("background-position-x", "icon1") threw exception TypeError: Result of expression 'rules[1]' [undefined] is not an object.. 10 PASS getShorthand("background-position-y", "icon1") threw exception TypeError: Result of expression 'rules[1]' [undefined] is not an object.. 11 PASS getShorthand("background-position", "icon1") threw exception TypeError: Result of expression 'rules[1]' [undefined] is not an object.. 12 PASS getShorthand("-webkit-mask-repeat-x", "icon1") threw exception TypeError: Result of expression 'rules[1]' [undefined] is not an object.. 13 PASS getShorthand("-webkit-mask-repeat-y", "icon1") threw exception TypeError: Result of expression 'rules[1]' [undefined] is not an object.. 14 PASS getShorthand("-webkit-mask-repeat", "icon1") threw exception TypeError: Result of expression 'rules[1]' [undefined] is not an object.. 15 PASS getShorthand("-webkit-mask-position-x", "icon1") threw exception TypeError: Result of expression 'rules[1]' [undefined] is not an object.. 16 PASS getShorthand("-webkit-mask-position-y", "icon1") threw exception TypeError: Result of expression 'rules[1]' [undefined] is not an object.. 17 PASS getShorthand("-webkit-mask-repeat", "icon1") threw exception TypeError: Result of expression 'rules[1]' [undefined] is not an object.. 18 PASS getShorthand("background-repeat-x", "icon2") threw exception TypeError: Result of expression 'rules[1]' [undefined] is not an object.. 19 PASS getShorthand("background-repeat-y", "icon2") threw exception TypeError: Result of expression 'rules[1]' [undefined] is not an object.. 20 PASS getShorthand("background-repeat", "icon2") threw exception TypeError: Result of expression 'rules[1]' [undefined] is not an object.. 21 PASS getShorthand("background-position-x", "icon2") threw exception TypeError: Result of expression 'rules[1]' [undefined] is not an object.. 22 PASS getShorthand("background-position-y", "icon2") threw exception TypeError: Result of expression 'rules[1]' [undefined] is not an object.. 23 PASS getShorthand("background-position", "icon2") threw exception TypeError: Result of expression 'rules[1]' [undefined] is not an object.. 24 PASS getShorthand("-webkit-mask-repeat-x", "icon2") threw exception TypeError: Result of expression 'rules[1]' [undefined] is not an object.. 25 PASS getShorthand("-webkit-mask-repeat-y", "icon2") threw exception TypeError: Result of expression 'rules[1]' [undefined] is not an object.. 26 PASS getShorthand("-webkit-mask-repeat", "icon2") threw exception TypeError: Result of expression 'rules[1]' [undefined] is not an object.. 27 PASS getShorthand("-webkit-mask-position-x", "icon2") threw exception TypeError: Result of expression 'rules[1]' [undefined] is not an object.. 28 PASS getShorthand("-webkit-mask-position-y", "icon2") threw exception TypeError: Result of expression 'rules[1]' [undefined] is not an object.. 29 PASS getShorthand("-webkit-mask-repeat", "icon2") threw exception TypeError: Result of expression 'rules[1]' [undefined] is not an object.. 31 30 PASS successfullyParsed is true 32 31 -
trunk/LayoutTests/fast/backgrounds/repeat/margin-shorthand-expected.txt
r48436 r70335 1 T ests that shorthand property value is correct even if background-repeat property is declared before it in the style declaration. It tests regression described in this bug.1 This layouttest was initially there to test that shorthand property value is correct even if background-repeat property is declared before it in the style declaration. It used to test regression described in this bug. Now that access to non author stylesheet is blocked, we should instead get null when accessing the css rules on that object. 2 2 3 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 4 4 5 5 6 PASS iconMarginValue() is "0px"6 PASS iconMarginValue() threw exception TypeError: Result of expression 'rules[1]' [undefined] is not an object.. 7 7 PASS successfullyParsed is true 8 8 -
trunk/LayoutTests/fast/backgrounds/repeat/resources/background-repeat-shorthand.js
r49616 r70335 1 description('Tests that correct shorthand name is returned for background-repeat-x, ' + 1 description('This layout test used to test that correct shorthand name ' + 2 'is returned for background-repeat-x, ' + 2 3 'background-repeat-y, background-position-x, background-position-y, ' + 3 4 '-webkit-mask-repeat-x,-webkit-mask-repeat-y, -webkit-mask-position-x, ' + 4 5 '-webkit-mask-position-y when corresponding shorthand is used in the style ' + 5 6 'declaration. It tests regression described in ' + 6 '<a href="https://bugs.webkit.org/show_bug.cgi?id=28972">this bug</a>.'); 7 '<a href="https://bugs.webkit.org/show_bug.cgi?id=28972">this bug</a>.' + 8 ' Now that access to non author stylesheet is blocked, we should instead' + 9 ' get null when accessing the css rules on that object.'); 7 10 8 11 function getShorthand(longhand, iconId) … … 13 16 } 14 17 15 should Be('getShorthand("background-repeat-x", "icon1")', '"background-repeat"');16 should Be('getShorthand("background-repeat-y", "icon1")', '"background-repeat"');17 should Be('getShorthand("background-repeat", "icon1")', 'null');18 shouldThrow('getShorthand("background-repeat-x", "icon1")', '"TypeError: Result of expression \'rules[1]\' [undefined] is not an object."'); 19 shouldThrow('getShorthand("background-repeat-y", "icon1")', '"TypeError: Result of expression \'rules[1]\' [undefined] is not an object."'); 20 shouldThrow('getShorthand("background-repeat", "icon1")', '"TypeError: Result of expression \'rules[1]\' [undefined] is not an object."'); 18 21 19 should Be('getShorthand("background-position-x", "icon1")', '"background-position"');20 should Be('getShorthand("background-position-y", "icon1")', '"background-position"');21 should Be('getShorthand("background-position", "icon1")', 'null');22 shouldThrow('getShorthand("background-position-x", "icon1")', '"TypeError: Result of expression \'rules[1]\' [undefined] is not an object."'); 23 shouldThrow('getShorthand("background-position-y", "icon1")', '"TypeError: Result of expression \'rules[1]\' [undefined] is not an object."'); 24 shouldThrow('getShorthand("background-position", "icon1")', '"TypeError: Result of expression \'rules[1]\' [undefined] is not an object."'); 22 25 23 should Be('getShorthand("-webkit-mask-repeat-x", "icon1")', '"-webkit-mask-repeat"');24 should Be('getShorthand("-webkit-mask-repeat-y", "icon1")', '"-webkit-mask-repeat"');25 should Be('getShorthand("-webkit-mask-repeat", "icon1")', 'null');26 shouldThrow('getShorthand("-webkit-mask-repeat-x", "icon1")', '"TypeError: Result of expression \'rules[1]\' [undefined] is not an object."'); 27 shouldThrow('getShorthand("-webkit-mask-repeat-y", "icon1")', '"TypeError: Result of expression \'rules[1]\' [undefined] is not an object."'); 28 shouldThrow('getShorthand("-webkit-mask-repeat", "icon1")', '"TypeError: Result of expression \'rules[1]\' [undefined] is not an object."'); 26 29 27 should Be('getShorthand("-webkit-mask-position-x", "icon1")', '"-webkit-mask-position"');28 should Be('getShorthand("-webkit-mask-position-y", "icon1")', '"-webkit-mask-position"');29 should Be('getShorthand("-webkit-mask-repeat", "icon1")', 'null');30 shouldThrow('getShorthand("-webkit-mask-position-x", "icon1")', '"TypeError: Result of expression \'rules[1]\' [undefined] is not an object."'); 31 shouldThrow('getShorthand("-webkit-mask-position-y", "icon1")', '"TypeError: Result of expression \'rules[1]\' [undefined] is not an object."'); 32 shouldThrow('getShorthand("-webkit-mask-repeat", "icon1")', '"TypeError: Result of expression \'rules[1]\' [undefined] is not an object."'); 30 33 31 34 32 debug('Test that shorthand names are null for #icon2 since its styles are declared ' + 33 'with longhand properties:'); 34 shouldBe('getShorthand("background-repeat-x", "icon2")', 'null'); 35 shouldBe('getShorthand("background-repeat-y", "icon2")', 'null'); 36 shouldBe('getShorthand("background-repeat", "icon2")', 'null'); 35 shouldThrow('getShorthand("background-repeat-x", "icon2")', '"TypeError: Result of expression \'rules[1]\' [undefined] is not an object."'); 36 shouldThrow('getShorthand("background-repeat-y", "icon2")', '"TypeError: Result of expression \'rules[1]\' [undefined] is not an object."'); 37 shouldThrow('getShorthand("background-repeat", "icon2")', '"TypeError: Result of expression \'rules[1]\' [undefined] is not an object."'); 37 38 38 should Be('getShorthand("background-position-x", "icon2")', 'null');39 should Be('getShorthand("background-position-y", "icon2")', 'null');40 should Be('getShorthand("background-position", "icon2")', 'null');39 shouldThrow('getShorthand("background-position-x", "icon2")', '"TypeError: Result of expression \'rules[1]\' [undefined] is not an object."'); 40 shouldThrow('getShorthand("background-position-y", "icon2")', '"TypeError: Result of expression \'rules[1]\' [undefined] is not an object."'); 41 shouldThrow('getShorthand("background-position", "icon2")', '"TypeError: Result of expression \'rules[1]\' [undefined] is not an object."'); 41 42 42 should Be('getShorthand("-webkit-mask-repeat-x", "icon2")', 'null');43 should Be('getShorthand("-webkit-mask-repeat-y", "icon2")', 'null');44 should Be('getShorthand("-webkit-mask-repeat", "icon2")', 'null');43 shouldThrow('getShorthand("-webkit-mask-repeat-x", "icon2")', '"TypeError: Result of expression \'rules[1]\' [undefined] is not an object."'); 44 shouldThrow('getShorthand("-webkit-mask-repeat-y", "icon2")', '"TypeError: Result of expression \'rules[1]\' [undefined] is not an object."'); 45 shouldThrow('getShorthand("-webkit-mask-repeat", "icon2")', '"TypeError: Result of expression \'rules[1]\' [undefined] is not an object."'); 45 46 46 should Be('getShorthand("-webkit-mask-position-x", "icon2")', 'null');47 should Be('getShorthand("-webkit-mask-position-y", "icon2")', 'null');48 should Be('getShorthand("-webkit-mask-repeat", "icon2")', 'null');47 shouldThrow('getShorthand("-webkit-mask-position-x", "icon2")', '"TypeError: Result of expression \'rules[1]\' [undefined] is not an object."'); 48 shouldThrow('getShorthand("-webkit-mask-position-y", "icon2")', '"TypeError: Result of expression \'rules[1]\' [undefined] is not an object."'); 49 shouldThrow('getShorthand("-webkit-mask-repeat", "icon2")', '"TypeError: Result of expression \'rules[1]\' [undefined] is not an object."'); 49 50 50 51 -
trunk/LayoutTests/fast/backgrounds/repeat/resources/margin-shorthand.js
r48436 r70335 1 description('Tests that shorthand property value is correct even if' + 1 description('This layouttest was initially there to test that' + 2 ' shorthand property value is correct even if' + 2 3 ' background-repeat property is declared before it in the ' + 3 ' style declaration. It tests regression described in ' + 4 '<a href="https://bugs.webkit.org/show_bug.cgi?id=28973">this bug</a>.'); 4 ' style declaration. It used to test regression described in ' + 5 ' <a href="https://bugs.webkit.org/show_bug.cgi?id=28973">this bug</a>.' + 6 ' Now that access to non author stylesheet is blocked, we should instead' + 7 ' get null when accessing the css rules on that object.'); 5 8 6 9 function iconMarginValue() … … 11 14 } 12 15 13 should Be('iconMarginValue()', '"0px"');16 shouldThrow('iconMarginValue()', '"TypeError: Result of expression \'rules[1]\' [undefined] is not an object."'); 14 17 15 18 var successfullyParsed = true; -
trunk/LayoutTests/fast/css/disabled-author-styles.html
r66684 r70335 17 17 function checkMatchedRules() 18 18 { 19 var matchedRules = getMatchedCSSRules(document.getElementById("test"), "" , true);19 var matchedRules = getMatchedCSSRules(document.getElementById("test"), ""); 20 20 if (matchedRules && matchedRules.length) 21 21 alert(matchedRules.length + " rule(s) were returned from getMatchedCSSRules, expected zero."); -
trunk/LayoutTests/fast/css/modify-ua-rules-from-javascript-expected.txt
r59351 r70335 1 CONSOLE MESSAGE: line 11: TypeError: Result of expression 'window.getMatchedCSSRules(document.body, "", false)' [null] is not an object. 1 2 PASS -
trunk/LayoutTests/fast/css/modify-ua-rules-from-javascript.html
r59351 r70335 14 14 styleToChange.marginTop = originalMarginTop; 15 15 16 document.getElementById("result").innerHTML = " PASS";16 document.getElementById("result").innerHTML = "FAIL"; 17 17 } 18 18 </script> … … 20 20 <body onload="test()"> 21 21 <div id="result"> 22 Test didn't run 22 PASS 23 23 </div> 24 24 </body> -
trunk/LayoutTests/fast/css/word-break-user-modify-allowed-values.html
r23847 r70335 5 5 layoutTestController.dumpAsText(); 6 6 7 var rules = getMatchedCSSRules(document.body, "" , true);7 var rules = getMatchedCSSRules(document.body, ""); 8 8 if (rules && rules.length) { 9 9 log("FAIL: Expected 0 matched rules, but found " + rules.length + ":"); -
trunk/LayoutTests/http/tests/security/cross-frame-access-call-expected.txt
r61599 r70335 64 64 PASS: window.prompt.call(targetWindow, 'message', 'defaultValue') should be 'undefined' and is. 65 65 PASS: window.getComputedStyle.call(targetWindow, document.body, '') should be 'undefined' and is. 66 PASS: window.getMatchedCSSRules.call(targetWindow, document.body, '' , false) should be 'undefined' and is.66 PASS: window.getMatchedCSSRules.call(targetWindow, document.body, '') should be 'undefined' and is. 67 67 PASS: window.openDatabase.call(targetWindow, 'name', '1.0', 'description', 0) should be 'undefined' and is. 68 68 PASS: window.atob.call(targetWindow, 'string') should be 'undefined' and is. -
trunk/LayoutTests/http/tests/security/cross-frame-access-call.html
r61599 r70335 34 34 shouldBe("window.prompt.call(targetWindow, 'message', 'defaultValue')", "undefined"); 35 35 shouldBe("window.getComputedStyle.call(targetWindow, document.body, '')", "undefined"); 36 shouldBe("window.getMatchedCSSRules.call(targetWindow, document.body, '' , false)", "undefined");36 shouldBe("window.getMatchedCSSRules.call(targetWindow, document.body, '')", "undefined"); 37 37 shouldBe("window.openDatabase.call(targetWindow, 'name', '1.0', 'description', 0)", "undefined"); 38 38 shouldBe("window.atob.call(targetWindow, 'string')", "undefined"); -
trunk/LayoutTests/platform/chromium/http/tests/security/cross-frame-access-call-expected.txt
r61599 r70335 64 64 PASS: window.prompt.call(targetWindow, 'message', 'defaultValue') should be 'undefined' and is. 65 65 PASS: window.getComputedStyle.call(targetWindow, document.body, '') should be 'undefined' and is. 66 PASS: window.getMatchedCSSRules.call(targetWindow, document.body, '' , false) should be 'undefined' and is.66 PASS: window.getMatchedCSSRules.call(targetWindow, document.body, '') should be 'undefined' and is. 67 67 PASS: window.openDatabase.call(targetWindow, 'name', '1.0', 'description', 0) should be 'undefined' and is. 68 68 PASS: window.atob.call(targetWindow, 'string') should be 'undefined' and is. -
trunk/LayoutTests/platform/qt/http/tests/security/cross-frame-access-call-expected.txt
r61599 r70335 64 64 PASS: window.prompt.call(targetWindow, 'message', 'defaultValue') should be 'undefined' and is. 65 65 PASS: window.getComputedStyle.call(targetWindow, document.body, '') should be 'undefined' and is. 66 PASS: window.getMatchedCSSRules.call(targetWindow, document.body, '' , false) should be 'undefined' and is.66 PASS: window.getMatchedCSSRules.call(targetWindow, document.body, '') should be 'undefined' and is. 67 67 PASS: window.openDatabase.call(targetWindow, 'name', '1.0', 'description', 0) should be 'undefined' and is. 68 68 PASS: window.atob.call(targetWindow, 'string') should be 'undefined' and is. -
trunk/WebCore/ChangeLog
r70333 r70335 1 2010-10-22 Abhishek Arya <inferno@chromium.org> 2 3 Reviewed by Dave Hyatt. 4 5 Add code in getMatchedCSSRules to block cross origin access to stylesheet data. Prevent access 6 in Javascript to non author stylesheets. 7 https://bugs.webkit.org/show_bug.cgi?id=46853 8 9 Tests: http/tests/security/cross-origin-getMatchedCSSRules.html 10 http/tests/security/cross-origin-getMatchedCSSRules2.html 11 12 * css/CSSRule.h: 13 * css/CSSStyleSelector.cpp: 14 (WebCore::CSSStyleSelector::matchRulesForList): 15 (WebCore::CSSStyleSelector::SelectorChecker::SelectorChecker): 16 (WebCore::CSSStyleSelector::styleRulesForElement): 17 (WebCore::CSSStyleSelector::pseudoStyleRulesForElement): 18 * css/CSSStyleSelector.h: 19 * page/DOMWindow.cpp: 20 (WebCore::DOMWindow::getMatchedCSSRules): 21 * page/DOMWindow.idl: 22 1 23 2010-10-22 Sam Weinig <sam@webkit.org> 2 24 -
trunk/WebCore/css/CSSRule.h
r39601 r70335 30 30 31 31 typedef int ExceptionCode; 32 33 enum CSSRuleFilter { 34 AllCSSRules, 35 SameOriginCSSRulesOnly 36 }; 32 37 33 38 class CSSRule : public StyleBase { -
trunk/WebCore/css/CSSStyleSelector.cpp
r70250 r70335 703 703 for (CSSRuleData* d = rules->first(); d; d = d->next()) { 704 704 CSSStyleRule* rule = d->rule(); 705 if (m_checker.m_sameOriginOnly && !m_checker.m_document->securityOrigin()->canRequest(rule->baseURL())) 706 continue; 705 707 if (checkSelector(d->selector())) { 706 708 // If the rule has no properties to apply, then ignore it in the non-debug mode. … … 885 887 , m_strictParsing(strictParsing) 886 888 , m_collectRulesOnly(false) 889 , m_sameOriginOnly(false) 887 890 , m_pseudoStyle(NOPSEUDO) 888 891 , m_documentIsHTML(document->isHTMLDocument()) … … 1867 1870 } 1868 1871 1869 PassRefPtr<CSSRuleList> CSSStyleSelector::styleRulesForElement(Element* e, bool authorOnly, bool includeEmptyRules )1870 { 1871 return pseudoStyleRulesForElement(e, NOPSEUDO, authorOnly, includeEmptyRules );1872 } 1873 1874 PassRefPtr<CSSRuleList> CSSStyleSelector::pseudoStyleRulesForElement(Element* e, PseudoId pseudoId, bool authorOnly, bool includeEmptyRules )1872 PassRefPtr<CSSRuleList> CSSStyleSelector::styleRulesForElement(Element* e, bool authorOnly, bool includeEmptyRules, CSSRuleFilter filter) 1873 { 1874 return pseudoStyleRulesForElement(e, NOPSEUDO, authorOnly, includeEmptyRules, filter); 1875 } 1876 1877 PassRefPtr<CSSRuleList> CSSStyleSelector::pseudoStyleRulesForElement(Element* e, PseudoId pseudoId, bool authorOnly, bool includeEmptyRules, CSSRuleFilter filter) 1875 1878 { 1876 1879 if (!e || !e->document()->haveStylesheetsLoaded()) … … 1895 1898 1896 1899 if (m_matchAuthorAndUserStyles) { 1900 m_checker.m_sameOriginOnly = (filter == SameOriginCSSRulesOnly); 1901 1897 1902 // Check the rules in author sheets. 1898 1903 int firstAuthorRule = -1, lastAuthorRule = -1; 1899 1904 matchRules(m_authorStyle.get(), firstAuthorRule, lastAuthorRule, includeEmptyRules); 1905 1906 m_checker.m_sameOriginOnly = false; 1900 1907 } 1901 1908 1902 1909 m_checker.m_collectRulesOnly = false; 1903 1910 1904 1911 return m_ruleList.release(); 1905 1912 } -
trunk/WebCore/css/CSSStyleSelector.h
r70209 r70335 24 24 25 25 #include "CSSFontSelector.h" 26 #include "CSSRule.h" 26 27 #include "LinkHash.h" 27 28 #include "MediaQueryExp.h" … … 120 121 public: 121 122 // These methods will give back the set of rules that matched for a given element (or a pseudo-element). 122 PassRefPtr<CSSRuleList> styleRulesForElement(Element*, bool authorOnly, bool includeEmptyRules = false );123 PassRefPtr<CSSRuleList> pseudoStyleRulesForElement(Element*, PseudoId, bool authorOnly, bool includeEmptyRules = false );123 PassRefPtr<CSSRuleList> styleRulesForElement(Element*, bool authorOnly, bool includeEmptyRules = false, CSSRuleFilter filter = AllCSSRules); 124 PassRefPtr<CSSRuleList> pseudoStyleRulesForElement(Element*, PseudoId, bool authorOnly, bool includeEmptyRules = false, CSSRuleFilter filter = AllCSSRules); 124 125 125 126 // Given a CSS keyword in the range (xx-small to -webkit-xxx-large), this function will return … … 232 233 bool m_strictParsing; 233 234 bool m_collectRulesOnly; 235 bool m_sameOriginOnly; 234 236 PseudoId m_pseudoStyle; 235 237 bool m_documentIsHTML; -
trunk/WebCore/page/DOMWindow.cpp
r70102 r70335 1256 1256 1257 1257 Document* doc = m_frame->document(); 1258 return doc->styleSelector()->styleRulesForElement(elt, authorOnly );1258 return doc->styleSelector()->styleRulesForElement(elt, authorOnly, false, SameOriginCSSRulesOnly); 1259 1259 } 1260 1260 -
trunk/WebCore/page/DOMWindow.idl
r70102 r70335 148 148 149 149 // WebKit extensions 150 #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT 150 151 CSSRuleList getMatchedCSSRules(in Element element, 151 in DOMString pseudoElement, 152 in [Optional] boolean authorOnly); 152 in DOMString pseudoElement); 153 #endif 154 153 155 attribute [Replaceable] double devicePixelRatio; 154 156
Note: See TracChangeset
for help on using the changeset viewer.