REGRESSION(r129644): User StyleSheet not applying
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 18 Nov 2012 22:38:53 +0000 (22:38 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 18 Nov 2012 22:38:53 +0000 (22:38 +0000)
commit575a02fc445092280294405dfa6590bc46a525a1
tree11fdd6327d8880b412e9df3d344ba08759309f19
parente254797a2977333d0f790984a086cef9e3a5c36c
REGRESSION(r129644): User StyleSheet not applying
https://bugs.webkit.org/show_bug.cgi?id=102110

Reviewed by Andreas Kling.

Source/WebCore:

Injected stylesheets added as UserStyleAuthorLevel fail to apply. r129644 implicitly assumed that
such things don't exists but on Chromium addUserStyleSheet() confusingly uses them.

The patch adds injected author stylesheets to DocumentStyleSheetCollection::activeStyleSheets().
It also generally cleans up the code around injected and user stylesheets.

Tests: userscripts/user-script-and-stylesheet.html
       userscripts/user-stylesheet-invalidate.html

* css/StyleResolver.cpp:
(WebCore::StyleResolver::StyleResolver):
(WebCore::StyleResolver::collectRulesFromUserStyleSheets):
(WebCore::collectCSSOMWrappers):
* css/StyleResolver.h:
(StyleResolver):
* dom/Document.cpp:
(WebCore::Document::setCompatibilityMode):
* dom/DocumentStyleSheetCollection.cpp:
(WebCore::DocumentStyleSheetCollection::DocumentStyleSheetCollection):
(WebCore::DocumentStyleSheetCollection::~DocumentStyleSheetCollection):
(WebCore::DocumentStyleSheetCollection::injectedUserStyleSheets):
(WebCore):
(WebCore::DocumentStyleSheetCollection::injectedAuthorStyleSheets):
(WebCore::DocumentStyleSheetCollection::updateInjectedStyleSheetCache):
(WebCore::DocumentStyleSheetCollection::invalidateInjectedStyleSheetCache):
(WebCore::DocumentStyleSheetCollection::addUserSheet):
(WebCore::DocumentStyleSheetCollection::updateActiveStyleSheets):
(WebCore::DocumentStyleSheetCollection::reportMemoryUsage):
* dom/DocumentStyleSheetCollection.h:
(WebCore::DocumentStyleSheetCollection::documentUserStyleSheets):
(DocumentStyleSheetCollection):
* page/PageGroup.cpp:
(WebCore::PageGroup::addUserStyleSheetToWorld):
(WebCore::PageGroup::removeUserStyleSheetFromWorld):
(WebCore::PageGroup::removeUserStyleSheetsFromWorld):
(WebCore::PageGroup::removeAllUserContent):
(WebCore::PageGroup::invalidatedInjectedStyleSheetCacheInAllFrames):
* page/PageGroup.h:
(PageGroup):

LayoutTests:

* inspector/timeline/timeline-script-tag-1-expected.txt:

    Update the test result. The style invalidation log is slightly different.

* userscripts/user-stylesheet-invalidate-expected.txt: Added.
* userscripts/user-stylesheet-invalidate.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@135082 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/timeline/timeline-script-tag-1-expected.txt
LayoutTests/userscripts/user-stylesheet-invalidate-expected.txt [new file with mode: 0644]
LayoutTests/userscripts/user-stylesheet-invalidate.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/css/StyleResolver.h
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/DocumentStyleSheetCollection.cpp
Source/WebCore/dom/DocumentStyleSheetCollection.h
Source/WebCore/page/PageGroup.cpp
Source/WebCore/page/PageGroup.h