- Revision
- 116521
- Author
- [email protected]
- Date
- 2012-05-09 05:53:42 -0700 (Wed, 09 May 2012)
Log Message
ShadowRoot needs applyAuthorStyles
https://bugs.webkit.org/show_bug.cgi?id=78472
Patch by Takashi Sakamoto <[email protected]> on 2012-05-09
Reviewed by Hajime Morita.
Source/WebCore:
Implemented applyAuthorStyles attribute defined in the following spec:
http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#shadow-root-attributes
Since applyAuthorSheets attribute has been already implemented,
renamed all applyAuthorSheets to applyAuthorStyles and
added applyAuthorStyles to ShadowRoot.idl.
Currently, changing dynamically applyAuthorStyles doesn't work. I will fix this isse in bugs:84215: https://bugs.webkit.org/show_bug.cgi?id=84251
Test: fast/dom/shadow/shadow-root-applyAuthorStyles.html
fast/dom/shadow/shadow-root-applyAuthorStyles-expected.html
* css/StyleResolver.cpp:
(WebCore::StyleResolver::collectMatchingRulesForList):
* dom/ShadowRoot.cpp:
(WebCore::ShadowRoot::ShadowRoot):
(WebCore::ShadowRoot::applyAuthorStyles):
(WebCore::ShadowRoot::setApplyAuthorStyles):
* dom/ShadowRoot.h:
* dom/TreeScope.cpp:
(WebCore::TreeScope::applyAuthorStyles):
* dom/TreeScope.h:
(TreeScope):
Changed all applyAuthorSheets to applyAuthorSytles.
(ShadowRoot):
* dom/ShadowRoot.idl:
Added a new attribute, boolean applyAuthorStyles.
LayoutTests:
* fast/dom/shadow/shadow-root-applyAuthorStyles.html:
* fast/dom/shadow/shadow-root-applyAuthorStyles-expected.html:
Tested four cases:
case 1: applyAuthorStyles is false,
case 2: applyAuthorStyles is true with <script>..</script>,
case 3: applyAuthorStyles is true with inline script declaration, and
case 4: applyAuthorStyles is true with important UA property.
The case 1, 2 and 3 specify "span { ... }" with author styles and
verify rendering results.
The case 4 specifies '<input type="file" />' with an author style,
text-align: end, and verify rendering result.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (116520 => 116521)
--- trunk/LayoutTests/ChangeLog 2012-05-09 12:39:39 UTC (rev 116520)
+++ trunk/LayoutTests/ChangeLog 2012-05-09 12:53:42 UTC (rev 116521)
@@ -1,3 +1,22 @@
+2012-05-09 Takashi Sakamoto <[email protected]>
+
+ ShadowRoot needs applyAuthorStyles
+ https://bugs.webkit.org/show_bug.cgi?id=78472
+
+ Reviewed by Hajime Morita.
+
+ * fast/dom/shadow/shadow-root-applyAuthorStyles.html:
+ * fast/dom/shadow/shadow-root-applyAuthorStyles-expected.html:
+ Tested four cases:
+ case 1: applyAuthorStyles is false,
+ case 2: applyAuthorStyles is true with <script>..</script>,
+ case 3: applyAuthorStyles is true with inline script declaration, and
+ case 4: applyAuthorStyles is true with important UA property.
+ The case 1, 2 and 3 specify "span { ... }" with author styles and
+ verify rendering results.
+ The case 4 specifies '<input type="file" />' with an author style,
+ text-align: end, and verify rendering result.
+
2012-05-09 Mikhail Pozdnyakov <[email protected]>
[EFL] fast/overflow/scroll-div-hide-show.html testcase does not pass
Added: trunk/LayoutTests/fast/dom/shadow/shadow-root-applyAuthorStyles-expected.html (0 => 116521)
--- trunk/LayoutTests/fast/dom/shadow/shadow-root-applyAuthorStyles-expected.html (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/shadow-root-applyAuthorStyles-expected.html 2012-05-09 12:53:42 UTC (rev 116521)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<body>
+<div id="apply-author-style"><span style="background-color:#eef;border:solid;color:#fee;display:boxed-inline;font-size:24px;margin:2px;outline-color:#f00;padding-left:5px;text-align:start;text-decoration:underline;"></span></div>
+<div id="no-apply-author-style"><span></span></div>
+<div id="with-inline-style-declaration"><span style="background-color:#eef;border:none;color:#daa;display:boxed-inline;font-size:18px;margin:2px;outline-color:#f00;padding-left:5px;text-align:start;text-decoration:none;"></span></div>
+<div id="try-to-overide-important"><input type="file" /></div>
+</body>
+</html>
Added: trunk/LayoutTests/fast/dom/shadow/shadow-root-applyAuthorStyles.html (0 => 116521)
--- trunk/LayoutTests/fast/dom/shadow/shadow-root-applyAuthorStyles.html (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/shadow-root-applyAuthorStyles.html 2012-05-09 12:53:42 UTC (rev 116521)
@@ -0,0 +1,92 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+span {
+ background-color: #eef;
+ border: solid;
+ color: #fee;
+ display: boxed-inline;
+ font-size: 24px;
+ margin: 2px;
+ outline-color: #f00;
+ padding-left: 5px;
+ text-align: start;
+ text-decoration: underline;
+}
+input[type="file"] {
+ text-align: end;
+}
+</style>
+<script src=""
+</head>
+<body>
+<div id="apply-author-style"></div>
+<div id="no-apply-author-style"></div>
+<div id="with-inline-style-declaration"></div>
+<div id="try-to-override-important"></div>
+
+<script>
+function assertTrue(id, actual) {
+ if (!actual) {
+ throw "failure:" + id + ": assertTrue failed";
+ }
+}
+
+function assertFalse(id, actual) {
+ if (actual) {
+ throw "failure:" + id + ": assertFalse failed";
+ }
+}
+
+function renderApplyAuthorStyleCase() {
+ var div = document.createElement('div');
+ document.getElementById('apply-author-style').appendChild(div);
+
+ var shadowRoot = new WebKitShadowRoot(div);
+ assertFalse('default applyAuthorStyles', shadowRoot.applyAuthorStyles);
+ shadowRoot.applyAuthorStyles = true;
+ assertTrue('applyAuthorStyles should be true', shadowRoot.applyAuthorStyles);
+ shadowRoot.innerHTML = '<span></span>';
+}
+
+function renderNoApplyAuthorStyleCase() {
+ var div = document.createElement('div');
+ document.getElementById('no-apply-author-style').appendChild(div);
+
+ var shadowRoot = new WebKitShadowRoot(div);
+ assertFalse('default applyAuthorStyles', shadowRoot.applyAuthorStyles);
+ shadowRoot.applyAuthorStyles = false;
+ assertFalse('applyAuthorStyles should be false', shadowRoot.applyAuthorStyles);
+ shadowRoot.innerHTML = '<span></span>';
+}
+
+function renderApplyAuthorStyleWithInlineStyleDeclarationCase() {
+ var div = document.createElement('div');
+ document.getElementById('with-inline-style-declaration').appendChild(div);
+
+ var shadowRoot = new WebKitShadowRoot(div);
+ assertFalse('default applyAuthorStyles', shadowRoot.applyAuthorStyles);
+ shadowRoot.applyAuthorStyles = true;
+ assertTrue('applyAuthorStyles should be true', shadowRoot.applyAuthorStyles);
+ shadowRoot.innerHTML = '<span style="border:none; color:#daa; font-size:18px; text-decoration:none"></span>';
+}
+
+function renderApplyAuthorStyleWithOverridingImportantPropertyCase() {
+ var div = document.createElement('div');
+ document.getElementById('try-to-override-important').appendChild(div);
+
+ var shadowRoot = new WebKitShadowRoot(div);
+ assertFalse('default applyAuthorStyles', shadowRoot.applyAuthorStyles);
+ shadowRoot.applyAuthorStyles = true;
+ assertTrue('applyAuthorStyles should be true', shadowRoot.applyAuthorStyles);
+ shadowRoot.innerHTML = '<input type="file" />';
+}
+
+renderApplyAuthorStyleCase();
+renderNoApplyAuthorStyleCase();
+renderApplyAuthorStyleWithInlineStyleDeclarationCase();
+renderApplyAuthorStyleWithOverridingImportantPropertyCase();
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (116520 => 116521)
--- trunk/Source/WebCore/ChangeLog 2012-05-09 12:39:39 UTC (rev 116520)
+++ trunk/Source/WebCore/ChangeLog 2012-05-09 12:53:42 UTC (rev 116521)
@@ -1,3 +1,36 @@
+2012-05-09 Takashi Sakamoto <[email protected]>
+
+ ShadowRoot needs applyAuthorStyles
+ https://bugs.webkit.org/show_bug.cgi?id=78472
+
+ Reviewed by Hajime Morita.
+
+ Implemented applyAuthorStyles attribute defined in the following spec:
+ http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#shadow-root-attributes
+ Since applyAuthorSheets attribute has been already implemented,
+ renamed all applyAuthorSheets to applyAuthorStyles and
+ added applyAuthorStyles to ShadowRoot.idl.
+ Currently, changing dynamically applyAuthorStyles doesn't work. I will fix this isse in bugs:84215: https://bugs.webkit.org/show_bug.cgi?id=84251
+
+ Test: fast/dom/shadow/shadow-root-applyAuthorStyles.html
+ fast/dom/shadow/shadow-root-applyAuthorStyles-expected.html
+
+ * css/StyleResolver.cpp:
+ (WebCore::StyleResolver::collectMatchingRulesForList):
+ * dom/ShadowRoot.cpp:
+ (WebCore::ShadowRoot::ShadowRoot):
+ (WebCore::ShadowRoot::applyAuthorStyles):
+ (WebCore::ShadowRoot::setApplyAuthorStyles):
+ * dom/ShadowRoot.h:
+ * dom/TreeScope.cpp:
+ (WebCore::TreeScope::applyAuthorStyles):
+ * dom/TreeScope.h:
+ (TreeScope):
+ Changed all applyAuthorSheets to applyAuthorSytles.
+ (ShadowRoot):
+ * dom/ShadowRoot.idl:
+ Added a new attribute, boolean applyAuthorStyles.
+
2012-05-09 Yoshifumi Inoue <[email protected]>
[Chromium][Forms] HTMLOptionsCollection doesn't have indexed properties on property enumeration
Modified: trunk/Source/WebCore/css/StyleResolver.cpp (116520 => 116521)
--- trunk/Source/WebCore/css/StyleResolver.cpp 2012-05-09 12:39:39 UTC (rev 116520)
+++ trunk/Source/WebCore/css/StyleResolver.cpp 2012-05-09 12:53:42 UTC (rev 116521)
@@ -1038,7 +1038,7 @@
// d) the rule contains shadow-ID pseudo elements
TreeScope* treeScope = m_element->treeScope();
if (!MatchingUARulesScope::isMatchingUARules()
- && !treeScope->applyAuthorSheets()
+ && !treeScope->applyAuthorStyles()
#if ENABLE(STYLE_SCOPED)
&& (!options.scope || options.scope->treeScope() != treeScope)
#endif
Modified: trunk/Source/WebCore/dom/ShadowRoot.cpp (116520 => 116521)
--- trunk/Source/WebCore/dom/ShadowRoot.cpp 2012-05-09 12:39:39 UTC (rev 116520)
+++ trunk/Source/WebCore/dom/ShadowRoot.cpp 2012-05-09 12:53:42 UTC (rev 116521)
@@ -49,7 +49,7 @@
, TreeScope(this)
, m_prev(0)
, m_next(0)
- , m_applyAuthorSheets(false)
+ , m_applyAuthorStyles(false)
, m_insertionPointAssignedTo(0)
{
ASSERT(document);
@@ -188,14 +188,14 @@
return false;
}
-bool ShadowRoot::applyAuthorSheets() const
+bool ShadowRoot::applyAuthorStyles() const
{
- return m_applyAuthorSheets;
+ return m_applyAuthorStyles;
}
-void ShadowRoot::setApplyAuthorSheets(bool value)
+void ShadowRoot::setApplyAuthorStyles(bool value)
{
- m_applyAuthorSheets = value;
+ m_applyAuthorStyles = value;
}
void ShadowRoot::attach()
Modified: trunk/Source/WebCore/dom/ShadowRoot.h (116520 => 116521)
--- trunk/Source/WebCore/dom/ShadowRoot.h 2012-05-09 12:39:39 UTC (rev 116520)
+++ trunk/Source/WebCore/dom/ShadowRoot.h 2012-05-09 12:53:42 UTC (rev 116521)
@@ -67,8 +67,8 @@
InsertionPoint* insertionPointFor(Node*) const;
void hostChildrenChanged();
- virtual bool applyAuthorSheets() const;
- void setApplyAuthorSheets(bool);
+ virtual bool applyAuthorStyles() const OVERRIDE;
+ void setApplyAuthorStyles(bool);
Element* host() const { return shadowHost(); }
ElementShadow* owner() const;
@@ -104,7 +104,7 @@
ShadowRoot* m_prev;
ShadowRoot* m_next;
- bool m_applyAuthorSheets : 1;
+ bool m_applyAuthorStyles : 1;
InsertionPoint* m_insertionPointAssignedTo;
};
Modified: trunk/Source/WebCore/dom/ShadowRoot.idl (116520 => 116521)
--- trunk/Source/WebCore/dom/ShadowRoot.idl 2012-05-09 12:39:39 UTC (rev 116520)
+++ trunk/Source/WebCore/dom/ShadowRoot.idl 2012-05-09 12:53:42 UTC (rev 116521)
@@ -35,6 +35,7 @@
readonly attribute Element host;
readonly attribute Element activeElement;
readonly attribute DOMSelection selection;
+ attribute boolean applyAuthorStyles;
attribute [TreatNullAs=NullString] DOMString innerHTML
setter raises(DOMException);
Modified: trunk/Source/WebCore/dom/TreeScope.cpp (116520 => 116521)
--- trunk/Source/WebCore/dom/TreeScope.cpp 2012-05-09 12:39:39 UTC (rev 116520)
+++ trunk/Source/WebCore/dom/TreeScope.cpp 2012-05-09 12:53:42 UTC (rev 116521)
@@ -139,7 +139,7 @@
return 0;
}
-bool TreeScope::applyAuthorSheets() const
+bool TreeScope::applyAuthorStyles() const
{
return true;
}
Modified: trunk/Source/WebCore/dom/TreeScope.h (116520 => 116521)
--- trunk/Source/WebCore/dom/TreeScope.h 2012-05-09 12:39:39 UTC (rev 116520)
+++ trunk/Source/WebCore/dom/TreeScope.h 2012-05-09 12:53:42 UTC (rev 116521)
@@ -69,7 +69,7 @@
// quirks mode for historical compatibility reasons.
Element* findAnchor(const String& name);
- virtual bool applyAuthorSheets() const;
+ virtual bool applyAuthorStyles() const;
// Used by the basic DOM mutation methods (e.g., appendChild()).
void adoptIfNeeded(Node*);