RESOLVED FIXED102110
REGRESSION(r129644): User StyleSheet not applying
https://bugs.webkit.org/show_bug.cgi?id=102110
Summary REGRESSION(r129644): User StyleSheet not applying
Tony Chang
Reported 2012-11-13 11:39:02 PST
I was able to bisect this to http://trac.webkit.org/changeset/129644 . I'll upload a layout test that repros the problem. Antti, can you take a look? This was originally reported to Chromium: https://code.google.com/p/chromium/issues/detail?id=160263
Attachments
Patch (test only) (2.53 KB, patch)
2012-11-13 11:40 PST, Tony Chang
no flags
patch (20.19 KB, patch)
2012-11-16 11:39 PST, Antti Koivisto
kling: review+
buildbot: commit-queue-
updated patch (18.59 KB, patch)
2012-11-18 12:17 PST, Antti Koivisto
webkit.review.bot: commit-queue-
retry (21.20 KB, patch)
2012-11-18 14:13 PST, Antti Koivisto
no flags
Tony Chang
Comment 1 2012-11-13 11:40:01 PST
Created attachment 173933 [details] Patch (test only)
Tony Chang
Comment 2 2012-11-13 11:40:55 PST
Comment on attachment 173933 [details] Patch (test only) The user stylesheet should apply and you should see a green box with "PASS" in it. If you see a red box, the test failed.
Tony Chang
Comment 3 2012-11-14 15:41:32 PST
Hmm, looks like neither Antti nor I can repro this failure on Apple DRT on Mac. I'm surprised that there's differing behavior here (maybe a timing issue in the network layer?) I'll see if I can figure out why the ports don't match.
Tony Chang
Comment 4 2012-11-15 16:06:37 PST
Ok, I figured out the difference. In Chromium, when an extension adds a style sheet, we add it as an author level style sheet. In Safari, when an extension adds a style sheet, we add it as a user level style sheet. I'm still trying to figure out why this difference doesn't work with Antti's change.
Tony Chang
Comment 5 2012-11-15 17:42:03 PST
I think what's happening is: In http://trac.webkit.org/browser/trunk/Source/WebCore/dom/DocumentStyleSheetCollection.cpp#L470 , we call resetAuthorStyle(), which clears all author styles, including those that were added from pageGroupUserSheets here: http://trac.webkit.org/browser/trunk/Source/WebCore/css/StyleResolver.cpp#L321. Maybe in resetAuthorStyle we should add a loop over styleSheetCollection->pageGroupUserSheets() that adds back the extension specified author stylesheets?
Antti Koivisto
Comment 6 2012-11-16 11:39:49 PST
Andreas Kling
Comment 7 2012-11-16 12:02:15 PST
Comment on attachment 174731 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=174731&action=review r=me.. > Source/WebCore/css/StyleResolver.cpp:346 > + for (unsigned i = 0; i < userSheets.size(); i++) { ++i > Source/WebCore/css/StyleResolver.cpp:2583 > + for (size_t i = 0; i < sheets.size(); ++i) size_t! > Source/WebCore/dom/DocumentStyleSheetCollection.cpp:82 > + for (size_t i = 0; i < m_userStyleSheets.size(); ++i) size_t again!
Antti Koivisto
Comment 8 2012-11-16 13:23:08 PST
Dimitri Glazkov (Google)
Comment 9 2012-11-16 13:31:46 PST
Reverted r134986 for reason: Triggered ASSERT in fast/frames/seamless/seamless-inherited-origin.html. Committed r134992: <http://trac.webkit.org/changeset/134992>
Build Bot
Comment 10 2012-11-17 06:00:21 PST
Comment on attachment 174731 [details] patch Attachment 174731 [details] did not pass mac-ews (mac): Output: http://queues.webkit.org/results/14875335 New failing tests: inspector/timeline/timeline-script-tag-1.html
Antti Koivisto
Comment 11 2012-11-18 12:17:42 PST
Created attachment 174852 [details] updated patch Removed a faulty ASSERT and updated one test result.
WebKit Review Bot
Comment 12 2012-11-18 14:03:01 PST
Comment on attachment 174852 [details] updated patch Rejecting attachment 174852 [details] from commit-queue. New failing tests: inspector/timeline/timeline-script-tag-1.html Full output: http://queues.webkit.org/results/14888544
Antti Koivisto
Comment 13 2012-11-18 14:13:08 PST
Created attachment 174856 [details] retry forgot the test update
WebKit Review Bot
Comment 14 2012-11-18 14:39:33 PST
Comment on attachment 174856 [details] retry Clearing flags on attachment: 174856 Committed r135082: <http://trac.webkit.org/changeset/135082>
WebKit Review Bot
Comment 15 2012-11-18 14:39:37 PST
All reviewed patches have been landed. Closing bug.
Antti Koivisto
Comment 17 2012-11-19 04:12:06 PST
A WebKit test case would be cool.
Kentaro Hara
Comment 18 2012-11-19 04:13:50 PST
Yeah, I'm trying to invent a WebKit test case to reproduce the bug (but still not successful:-).
Jian Li
Comment 19 2012-11-19 14:07:30 PST
Got an assert from one Chromium build bot: ASSERTION FAILED: userSheets[i]->contents()->isUserStyleSheet() third_party/WebKit/Source/WebCore/css/StyleResolver.cpp(340) : void WebCore::StyleResolver::collectRulesFromUserStyleSheets(const WTF::Vector<WTF::RefPtr<WebCore::CSSStyleSheet>, 0u>&, WebCore::RuleSet&) Here is the link to bot output: http://build.chromium.org/p/chromium.linux/builders/Linux%20%28Precise%29/builds/651/steps/browser_tests/logs/ExecuteScriptBasic
Tony Chang
Comment 20 2012-11-20 14:09:04 PST
There are 2 bugs, both in Chromium: 1) We were calling DocumentStyleSheetCollection::addUserSheet and trying to add an author level stylesheet. This is chromium using the DocumentStyleSheetCollection incorrectly and I'm fixing it in bug 102835. This will fix the asserts in ExecuteScriptApiTest.ExecuteScriptBasic, ExecuteScriptApiTest.ExecuteScriptInFrame. 2) Because we were adding an author level style sheet via DocumentStyleSheetCollection::addUserSheet, it was getting matched by window.getMatchedCSSRules (which only matches author level stylesheets). This this is Chromium specific, I filed a bug at http://crbug.com/162096 for this. It's not clear to me if we want to just live with the current behavior or add functionality to addAuthorSheets.
Note You need to log in before you can comment on or make changes to this bug.