Diff
Modified: trunk/ChangeLog (136877 => 136878)
--- trunk/ChangeLog 2012-12-06 21:15:45 UTC (rev 136877)
+++ trunk/ChangeLog 2012-12-06 21:19:12 UTC (rev 136878)
@@ -1,3 +1,14 @@
+2012-12-06 Tony Chang <t...@chromium.org>
+
+ REGRESSION(r135082): Restore the ability to insert author level style sheets from script
+ https://bugs.webkit.org/show_bug.cgi?id=104042
+
+ Reviewed by Antti Koivisto.
+
+ Update exports for Internals.cpp.
+
+ * Source/autotools/symbols.filter:
+
2012-12-06 Laszlo Gombos <l.gom...@samsung.com>
[EFL] Optimize binary size by removing dead sections on unix/gcc
Modified: trunk/LayoutTests/ChangeLog (136877 => 136878)
--- trunk/LayoutTests/ChangeLog 2012-12-06 21:15:45 UTC (rev 136877)
+++ trunk/LayoutTests/ChangeLog 2012-12-06 21:19:12 UTC (rev 136878)
@@ -1,3 +1,15 @@
+2012-12-06 Tony Chang <t...@chromium.org>
+
+ REGRESSION(r135082): Restore the ability to insert author level style sheets from script
+ https://bugs.webkit.org/show_bug.cgi?id=104042
+
+ Reviewed by Antti Koivisto.
+
+ Add a test that makes sure that an author level style is set.
+
+ * userscripts/insert-stylesheets-expected.txt: Added.
+ * userscripts/insert-stylesheets.html: Added.
+
2012-12-06 Stephen White <senorbla...@chromium.org>
[Chromium] Unreviewed gardening.
Added: trunk/LayoutTests/userscripts/insert-stylesheets-expected.txt (0 => 136878)
--- trunk/LayoutTests/userscripts/insert-stylesheets-expected.txt (rev 0)
+++ trunk/LayoutTests/userscripts/insert-stylesheets-expected.txt 2012-12-06 21:19:12 UTC (rev 136878)
@@ -0,0 +1,9 @@
+PASS getComputedStyle(testElement).backgroundColor is 'rgb(255, 0, 0)'
+PASS testElement.offsetWidth is 0
+PASS getComputedStyle(testElement).backgroundColor is 'rgb(255, 0, 0)'
+PASS testElement.offsetWidth is 0
+PASS getComputedStyle(testElement).backgroundColor is 'rgb(0, 128, 0)'
+PASS testElement.offsetWidth is 100
+This test requires testRunner and window.internals.
+
+
Added: trunk/LayoutTests/userscripts/insert-stylesheets.html (0 => 136878)
--- trunk/LayoutTests/userscripts/insert-stylesheets.html (rev 0)
+++ trunk/LayoutTests/userscripts/insert-stylesheets.html 2012-12-06 21:19:12 UTC (rev 136878)
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style>
+ .styled {
+ background-color: red;
+ width: 0;
+ height: 100px;
+ }
+</style>
+<script src=""
+</head>
+<body>
+<p>This test requires testRunner and window.internals.</p>
+<div id="test" class="styled"></div>
+<script>
+function test()
+{
+ if (!window.testRunner)
+ return;
+ testRunner.dumpAsText();
+ window.testElement = document.getElementById("test");
+ shouldBe("getComputedStyle(testElement).backgroundColor", "'rgb(255, 0, 0)'");
+ shouldBe("testElement.offsetWidth", "0");
+
+ if (!window.internals)
+ return;
+
+ // The author style above should override this user style.
+ internals.insertUserCSS(document, "body .styled { background-color: green; width: 100px; }");
+ shouldBe("getComputedStyle(testElement).backgroundColor", "'rgb(255, 0, 0)'");
+ shouldBe("testElement.offsetWidth", "0");
+
+ // Since this style is more specific, it should override the original author style above.
+ internals.insertAuthorCSS(document, "body .styled { background-color: green; width: 100px; }");
+ shouldBe("getComputedStyle(testElement).backgroundColor", "'rgb(0, 128, 0)'");
+ shouldBe("testElement.offsetWidth", "100");
+}
+
+test();
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (136877 => 136878)
--- trunk/Source/WebCore/ChangeLog 2012-12-06 21:15:45 UTC (rev 136877)
+++ trunk/Source/WebCore/ChangeLog 2012-12-06 21:19:12 UTC (rev 136878)
@@ -1,3 +1,31 @@
+2012-12-06 Tony Chang <t...@chromium.org>
+
+ REGRESSION(r135082): Restore the ability to insert author level style sheets from script
+ https://bugs.webkit.org/show_bug.cgi?id=104042
+
+ Reviewed by Antti Koivisto.
+
+ Add DocumentStyleSheetCollection::addAuthorSheet so embedders can allow scripts
+ to insert author level styles. Expose the method to window.interals for testing.
+
+ Test: userscripts/insert-stylesheets.html
+
+ * WebCore.exp.in: Update exports for Internals.cpp.
+ * WebCore.order: Update exports for Internals.cpp.
+ * dom/DocumentStyleSheetCollection.cpp:
+ (WebCore::DocumentStyleSheetCollection::~DocumentStyleSheetCollection):
+ (WebCore::DocumentStyleSheetCollection::addAuthorSheet): Add the stylesheet and force a style recalc.
+ (WebCore::DocumentStyleSheetCollection::updateActiveStyleSheets): Include author level styles.
+ (WebCore::DocumentStyleSheetCollection::reportMemoryUsage): Include author styles.
+ * dom/DocumentStyleSheetCollection.h:
+ (WebCore::DocumentStyleSheetCollection::documentAuthorStyleSheets): Accessor.
+ (DocumentStyleSheetCollection): Keep track of author styles added by script.
+ * testing/Internals.cpp:
+ (WebCore::Internals::insertAuthorCSS): Testing addAuthorSheet.
+ (WebCore::Internals::insertUserCSS): Testing addUserSheet.
+ * testing/Internals.h:
+ * testing/Internals.idl: Add addAuthorSheet and addUserSheet.
+
2012-12-06 Elliott Sprehn <espr...@gmail.com>
Create only NodeRareDataBase when setting TreeScope
Modified: trunk/Source/WebCore/WebCore.exp.in (136877 => 136878)
--- trunk/Source/WebCore/WebCore.exp.in 2012-12-06 21:15:45 UTC (rev 136877)
+++ trunk/Source/WebCore/WebCore.exp.in 2012-12-06 21:19:12 UTC (rev 136878)
@@ -1484,6 +1484,12 @@
__ZTVN7WebCore17FrameLoaderClientE
__ZTVN7WebCore25HistoryPropertyListWriterE
__ZTVN7WebCore28InspectorFrontendClientLocal8SettingsE
+__ZN7WebCore16CSSParserContextC1EPNS_8DocumentERKNS_4KURLERKN3WTF6StringE
+__ZN7WebCore18StyleSheetContents11parseStringERKN3WTF6StringE
+__ZN7WebCore18StyleSheetContentsC1EPNS_15StyleRuleImportERKN3WTF6StringERKNS_16CSSParserContextE
+__ZN7WebCore18StyleSheetContentsD1Ev
+__ZN7WebCore28DocumentStyleSheetCollection12addUserSheetEN3WTF10PassRefPtrINS_18StyleSheetContentsEEE
+__ZN7WebCore28DocumentStyleSheetCollection14addAuthorSheetEN3WTF10PassRefPtrINS_18StyleSheetContentsEEE
_filenameByFixingIllegalCharacters
_hasCaseInsensitivePrefix
_hasCaseInsensitiveSubstring
Modified: trunk/Source/WebCore/WebCore.order (136877 => 136878)
--- trunk/Source/WebCore/WebCore.order 2012-12-06 21:15:45 UTC (rev 136877)
+++ trunk/Source/WebCore/WebCore.order 2012-12-06 21:19:12 UTC (rev 136878)
@@ -31878,3 +31878,9 @@
__ZN7WebCore21jsDocumentOnmousemoveEPN3JSC9ExecStateENS0_7JSValueERKNS0_10IdentifierE
__ZN7WebCore14StorageTracker8isActiveEv
__ZN7WebCore14StorageTracker12deleteOriginERKN3WTF6StringE
+__ZN7WebCore16CSSParserContextC1EPNS_8DocumentERKNS_4KURLERKN3WTF6StringE
+__ZN7WebCore18StyleSheetContents11parseStringERKN3WTF6StringE
+__ZN7WebCore18StyleSheetContentsC1EPNS_15StyleRuleImportERKN3WTF6StringERKNS_16CSSParserContextE
+__ZN7WebCore18StyleSheetContentsD1Ev
+__ZN7WebCore28DocumentStyleSheetCollection12addUserSheetEN3WTF10PassRefPtrINS_18StyleSheetContentsEEE
+__ZN7WebCore28DocumentStyleSheetCollection14addAuthorSheetEN3WTF10PassRefPtrINS_18StyleSheetContentsEEE
Modified: trunk/Source/WebCore/dom/DocumentStyleSheetCollection.cpp (136877 => 136878)
--- trunk/Source/WebCore/dom/DocumentStyleSheetCollection.cpp 2012-12-06 21:15:45 UTC (rev 136877)
+++ trunk/Source/WebCore/dom/DocumentStyleSheetCollection.cpp 2012-12-06 21:19:12 UTC (rev 136878)
@@ -81,6 +81,8 @@
m_injectedAuthorStyleSheets[i]->clearOwnerNode();
for (unsigned i = 0; i < m_userStyleSheets.size(); ++i)
m_userStyleSheets[i]->clearOwnerNode();
+ for (unsigned i = 0; i < m_authorStyleSheets.size(); ++i)
+ m_authorStyleSheets[i]->clearOwnerNode();
}
void DocumentStyleSheetCollection::combineCSSFeatureFlags()
@@ -191,6 +193,13 @@
m_document->styleResolverChanged(DeferRecalcStyle);
}
+void DocumentStyleSheetCollection::addAuthorSheet(PassRefPtr<StyleSheetContents> authorSheet)
+{
+ ASSERT(!authorSheet->isUserStyleSheet());
+ m_authorStyleSheets.append(CSSStyleSheet::create(authorSheet, m_document));
+ m_document->styleResolverChanged(RecalcStyleImmediately);
+}
+
void DocumentStyleSheetCollection::addUserSheet(PassRefPtr<StyleSheetContents> userSheet)
{
ASSERT(userSheet->isUserStyleSheet());
@@ -456,6 +465,7 @@
Vector<RefPtr<CSSStyleSheet> > activeCSSStyleSheets;
activeCSSStyleSheets.append(injectedAuthorStyleSheets());
+ activeCSSStyleSheets.append(documentAuthorStyleSheets());
collectActiveCSSStyleSheetsFromSeamlessParents(activeCSSStyleSheets, m_document);
filterEnabledCSSStyleSheets(activeCSSStyleSheets, activeStyleSheets);
@@ -494,6 +504,7 @@
info.addMember(m_injectedUserStyleSheets);
info.addMember(m_injectedAuthorStyleSheets);
info.addMember(m_userStyleSheets);
+ info.addMember(m_authorStyleSheets);
info.addMember(m_activeAuthorStyleSheets);
info.addMember(m_styleSheetsForStyleSheetList);
info.addMember(m_styleSheetCandidateNodes);
Modified: trunk/Source/WebCore/dom/DocumentStyleSheetCollection.h (136877 => 136878)
--- trunk/Source/WebCore/dom/DocumentStyleSheetCollection.h 2012-12-06 21:15:45 UTC (rev 136877)
+++ trunk/Source/WebCore/dom/DocumentStyleSheetCollection.h 2012-12-06 21:19:12 UTC (rev 136878)
@@ -56,6 +56,7 @@
CSSStyleSheet* pageUserSheet();
const Vector<RefPtr<CSSStyleSheet> >& documentUserStyleSheets() const { return m_userStyleSheets; }
+ const Vector<RefPtr<CSSStyleSheet> >& documentAuthorStyleSheets() const { return m_authorStyleSheets; }
const Vector<RefPtr<CSSStyleSheet> >& injectedUserStyleSheets() const;
const Vector<RefPtr<CSSStyleSheet> >& injectedAuthorStyleSheets() const;
@@ -67,6 +68,7 @@
void invalidateInjectedStyleSheetCache();
void updateInjectedStyleSheetCache() const;
+ void addAuthorSheet(PassRefPtr<StyleSheetContents> authorSheet);
void addUserSheet(PassRefPtr<StyleSheetContents> userSheet);
bool needsUpdateActiveStylesheetsOnStyleRecalc() const { return m_needsUpdateActiveStylesheetsOnStyleRecalc; }
@@ -132,6 +134,7 @@
mutable bool m_injectedStyleSheetCacheValid;
Vector<RefPtr<CSSStyleSheet> > m_userStyleSheets;
+ Vector<RefPtr<CSSStyleSheet> > m_authorStyleSheets;
bool m_hadActiveLoadingStylesheet;
bool m_needsUpdateActiveStylesheetsOnStyleRecalc;
Modified: trunk/Source/WebCore/testing/Internals.cpp (136877 => 136878)
--- trunk/Source/WebCore/testing/Internals.cpp 2012-12-06 21:15:45 UTC (rev 136877)
+++ trunk/Source/WebCore/testing/Internals.cpp 2012-12-06 21:19:12 UTC (rev 136878)
@@ -78,6 +78,7 @@
#include "Settings.h"
#include "ShadowRoot.h"
#include "SpellChecker.h"
+#include "StyleSheetContents.h"
#include "TextIterator.h"
#include "TreeScope.h"
#include "ViewportArguments.h"
@@ -1474,6 +1475,22 @@
TextRun::setAllowsRoundingHacks(true);
}
+void Internals::insertAuthorCSS(Document* document, const String& css) const
+{
+ RefPtr<StyleSheetContents> parsedSheet = StyleSheetContents::create(document);
+ parsedSheet->setIsUserStyleSheet(false);
+ parsedSheet->parseString(css);
+ document->styleSheetCollection()->addAuthorSheet(parsedSheet);
+}
+
+void Internals::insertUserCSS(Document* document, const String& css) const
+{
+ RefPtr<StyleSheetContents> parsedSheet = StyleSheetContents::create(document);
+ parsedSheet->setIsUserStyleSheet(true);
+ parsedSheet->parseString(css);
+ document->styleSheetCollection()->addUserSheet(parsedSheet);
+}
+
String Internals::counterValue(Element* element)
{
if (!element)
Modified: trunk/Source/WebCore/testing/Internals.h (136877 => 136878)
--- trunk/Source/WebCore/testing/Internals.h 2012-12-06 21:15:45 UTC (rev 136877)
+++ trunk/Source/WebCore/testing/Internals.h 2012-12-06 21:19:12 UTC (rev 136878)
@@ -212,6 +212,9 @@
void allowRoundingHacks() const;
+ void insertAuthorCSS(Document*, const String&) const;
+ void insertUserCSS(Document*, const String&) const;
+
#if ENABLE(INSPECTOR)
unsigned numberOfLiveNodes() const;
unsigned numberOfLiveDocuments() const;
Modified: trunk/Source/WebCore/testing/Internals.idl (136877 => 136878)
--- trunk/Source/WebCore/testing/Internals.idl 2012-12-06 21:15:45 UTC (rev 136877)
+++ trunk/Source/WebCore/testing/Internals.idl 2012-12-06 21:19:12 UTC (rev 136878)
@@ -172,6 +172,9 @@
void allowRoundingHacks();
+ void insertAuthorCSS(in Document document, in DOMString css);
+ void insertUserCSS(in Document document, in DOMString css);
+
#if defined(ENABLE_BATTERY_STATUS) && ENABLE_BATTERY_STATUS
void setBatteryStatus(in Document document, in DOMString eventType, in boolean charging, in double chargingTime, in double dischargingTime, in double level) raises (DOMException);
#endif
Modified: trunk/Source/WebKit/chromium/ChangeLog (136877 => 136878)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-12-06 21:15:45 UTC (rev 136877)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-12-06 21:19:12 UTC (rev 136878)
@@ -1,3 +1,13 @@
+2012-12-06 Tony Chang <t...@chromium.org>
+
+ REGRESSION(r135082): Restore the ability to insert author level style sheets from script
+ https://bugs.webkit.org/show_bug.cgi?id=104042
+
+ Reviewed by Antti Koivisto.
+
+ * src/WebDocument.cpp:
+ (WebKit::WebDocument::insertUserStyleSheet): Use addAuthorSheet if an author level script is requested.
+
2012-12-06 Sadrul Habib Chowdhury <sad...@chromium.org>
[chromium] Add some null-checks for the touch-lists in TouchEvent
Modified: trunk/Source/WebKit/chromium/src/WebDocument.cpp (136877 => 136878)
--- trunk/Source/WebKit/chromium/src/WebDocument.cpp 2012-12-06 21:15:45 UTC (rev 136877)
+++ trunk/Source/WebKit/chromium/src/WebDocument.cpp 2012-12-06 21:19:12 UTC (rev 136878)
@@ -194,15 +194,17 @@
return WebDocumentType(constUnwrap<Document>()->doctype());
}
-void WebDocument::insertUserStyleSheet(const WebString& sourceCode, UserStyleLevel)
+void WebDocument::insertUserStyleSheet(const WebString& sourceCode, UserStyleLevel styleLevel)
{
RefPtr<Document> document = unwrap<Document>();
- // FIXME: We currently ignore the passed in UserStyleLevel. http://crbug.com/162096
RefPtr<StyleSheetContents> parsedSheet = StyleSheetContents::create(document.get());
- parsedSheet->setIsUserStyleSheet(true);
+ parsedSheet->setIsUserStyleSheet(styleLevel == UserStyleUserLevel);
parsedSheet->parseString(sourceCode);
- document->styleSheetCollection()->addUserSheet(parsedSheet.release());
+ if (parsedSheet->isUserStyleSheet())
+ document->styleSheetCollection()->addUserSheet(parsedSheet);
+ else
+ document->styleSheetCollection()->addAuthorSheet(parsedSheet);
}
void WebDocument::cancelFullScreen()
Modified: trunk/Source/WebKit2/ChangeLog (136877 => 136878)
--- trunk/Source/WebKit2/ChangeLog 2012-12-06 21:15:45 UTC (rev 136877)
+++ trunk/Source/WebKit2/ChangeLog 2012-12-06 21:19:12 UTC (rev 136878)
@@ -1,3 +1,14 @@
+2012-12-06 Tony Chang <t...@chromium.org>
+
+ REGRESSION(r135082): Restore the ability to insert author level style sheets from script
+ https://bugs.webkit.org/show_bug.cgi?id=104042
+
+ Reviewed by Antti Koivisto.
+
+ Update exports for Internals.cpp.
+
+ * win/WebKit2.def.in:
+
2012-12-06 Andras Becsi <andras.be...@digia.com>
[Qt][WK2] Fix QWebKitTest's notification of device pixel ratio change
Modified: trunk/Source/WebKit2/win/WebKit2.def.in (136877 => 136878)
--- trunk/Source/WebKit2/win/WebKit2.def.in 2012-12-06 21:15:45 UTC (rev 136877)
+++ trunk/Source/WebKit2/win/WebKit2.def.in 2012-12-06 21:19:12 UTC (rev 136878)
@@ -379,3 +379,11 @@
?solidColor@BitmapImage@WebCore@@MBE?AVColor@2@XZ
?draw@BitmapImage@WebCore@@MAEXPAVGraphicsContext@2@ABVFloatRect@2@1W4ColorSpace@2@W4CompositeOperator@2@W4RespectImageOrientationEnum@2@@Z
?frameCount@BitmapImage@WebCore@@MAEIXZ
+ ?addAuthorSheet@DocumentStyleSheetCollection@WebCore@@QAEXV?$PassRefPtr@VStyleSheetContents@WebCore@@@WTF@@@Z
+ ?parseString@StyleSheetContents@WebCore@@QAE_NABVString@WTF@@@Z
+ ??0CSSParserContext@WebCore@@QAE@PAVDocument@1@ABVKURL@1@ABVString@WTF@@@Z
+ ?emptyString@WTF@@YAABVString@1@XZ
+ ?invalidate@KURL@WebCore@@AAEXXZ
+ ??0StyleSheetContents@WebCore@@AAE@PAVStyleRuleImport@1@ABVString@WTF@@ABUCSSParserContext@1@@Z
+ ?addUserSheet@DocumentStyleSheetCollection@WebCore@@QAEXV?$PassRefPtr@VStyleSheetContents@WebCore@@@WTF@@@Z
+ ??1StyleSheetContents@WebCore@@QAE@XZ
Modified: trunk/Source/autotools/symbols.filter (136877 => 136878)
--- trunk/Source/autotools/symbols.filter 2012-12-06 21:15:45 UTC (rev 136877)
+++ trunk/Source/autotools/symbols.filter 2012-12-06 21:19:12 UTC (rev 136878)
@@ -225,6 +225,13 @@
_ZN7WebCore21SerializedScriptValue11deserializeEPN3JSC9ExecStateEPNS1_14JSGlobalObjectEPN3WTF6VectorINS6_6RefPtrINS_11MessagePortEEELm1EEENS_22SerializationErrorModeE;
_ZN7WebCore21SerializedScriptValueD1Ev;
_ZNK7WebCore21SerializedScriptValue12toWireStringEv;
+_ZN7WebCore16CSSParserContextC1EPNS_8DocumentERKNS_4KURLERKN3WTF6StringE;
+_ZN7WebCore18StyleSheetContents11parseStringERKN3WTF6StringE;
+_ZN7WebCore18StyleSheetContentsC1EPNS_15StyleRuleImportERKN3WTF6StringERKNS_16CSSParserContextE;
+_ZN7WebCore18StyleSheetContentsD1Ev;
+_ZN7WebCore28DocumentStyleSheetCollection12addUserSheetEN3WTF10PassRefPtrINS_18StyleSheetContentsEEE;
+_ZN7WebCore28DocumentStyleSheetCollection14addAuthorSheetEN3WTF10PassRefPtrINS_18StyleSheetContentsEEE;
+_ZN7WebCore4KURL10invalidateEv;
local:
_Z*;