Changeset 117716 in webkit
- Timestamp:
- May 20, 2012 5:50:01 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r117713 r117716 1 2012-05-20 Takashi Sakamoto <tasak@google.com> 2 3 Needs style recalculation by changing applyAuthorStyles dynamically 4 https://bugs.webkit.org/show_bug.cgi?id=84251 5 6 Reviewed by Hajime Morita. 7 8 * fast/dom/shadow/shadow-root-applyAuthorStyles-expected.html: 9 * fast/dom/shadow/shadow-root-applyAuthorStyles.html: 10 1 11 2012-05-20 Philip Rogers <pdr@google.com> 2 12 -
trunk/LayoutTests/fast/dom/shadow/shadow-root-applyAuthorStyles-expected.html
r116521 r117716 6 6 <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> 7 7 <div id="try-to-overide-important"><input type="file" /></div> 8 <div id="change-apply-author-style-from-true-to-false"><div><span></span></div></div> 9 <div id="change-apply-author-style-from-false-to-true"><div><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> 8 10 </body> 9 11 </html> -
trunk/LayoutTests/fast/dom/shadow/shadow-root-applyAuthorStyles.html
r116521 r117716 26 26 <div id="with-inline-style-declaration"></div> 27 27 <div id="try-to-override-important"></div> 28 <div id="change-apply-author-style-from-true-to-false"></div> 29 <div id="change-apply-author-style-from-false-to-true"></div> 28 30 29 31 <script> 32 function shouldBe(a, b) 33 { 34 if (a != b) { 35 throw "failure:" + a + ": should be " + b; 36 } 37 } 38 39 function shouldNotBe(a, b) 40 { 41 if (a == b) { 42 throw "failure:" + a + ": should not be " + b; 43 } 44 } 45 30 46 function assertTrue(id, actual) { 31 47 if (!actual) { … … 84 100 } 85 101 102 function testChangingApplyAuthorStyleFromTrueToFalse() { 103 var div = document.createElement('div'); 104 document.getElementById('change-apply-author-style-from-true-to-false').appendChild(div); 105 106 var shadowRoot = new WebKitShadowRoot(div); 107 assertFalse('default applyAuthorStyles', shadowRoot.applyAuthorStyles); 108 shadowRoot.applyAuthorStyles = true; 109 assertTrue('applyAuthorStyles should be true', shadowRoot.applyAuthorStyles); 110 shadowRoot.innerHTML = '<div><span id="test1"></span></div>'; 111 div.offsetLeft; 112 var target = shadowRoot.getElementById('test1'); 113 shouldBe(window.getComputedStyle(target).getPropertyValue('font-size'), "24px"); 114 shouldBe(window.getComputedStyle(target).getPropertyValue('text-decoration'), "underline"); 115 116 shadowRoot.applyAuthorStyles = false; 117 assertFalse('applyAuthorStyles should be false', shadowRoot.applyAuthorStyles); 118 div.offsetLeft; 119 shouldNotBe(window.getComputedStyle(target).getPropertyValue('font-size'), "24px"); 120 shouldNotBe(window.getComputedStyle(target).getPropertyValue('text-decoration'), "underline"); 121 } 122 123 function testChangingApplyAuthorStyleFromFalseToTrue() { 124 var div = document.createElement('div'); 125 document.getElementById('change-apply-author-style-from-false-to-true').appendChild(div); 126 127 var shadowRoot = new WebKitShadowRoot(div); 128 shadowRoot.applyAuthorStyles = false; 129 assertFalse('applyAuthorStyles should be false', shadowRoot.applyAuthorStyles); 130 shadowRoot.innerHTML = '<div><span id="test2"></span></div>'; 131 div.offsetLeft; 132 var target = shadowRoot.getElementById('test2'); 133 shouldNotBe(window.getComputedStyle(target).getPropertyValue('font-size'), "24px"); 134 shouldNotBe(window.getComputedStyle(target).getPropertyValue('text-decoration'), "underline"); 135 136 shadowRoot.applyAuthorStyles = true; 137 assertTrue('applyAuthorStyles should be true', shadowRoot.applyAuthorStyles); 138 div.offsetLeft; 139 shouldBe(window.getComputedStyle(target).getPropertyValue('font-size'), "24px"); 140 shouldBe(window.getComputedStyle(target).getPropertyValue('text-decoration'), "underline"); 141 } 142 86 143 renderApplyAuthorStyleCase(); 87 144 renderNoApplyAuthorStyleCase(); 88 145 renderApplyAuthorStyleWithInlineStyleDeclarationCase(); 89 146 renderApplyAuthorStyleWithOverridingImportantPropertyCase(); 147 testChangingApplyAuthorStyleFromTrueToFalse(); 148 testChangingApplyAuthorStyleFromFalseToTrue(); 90 149 </script> 91 150 </body> -
trunk/Source/WebCore/ChangeLog
r117711 r117716 1 2012-05-20 Takashi Sakamoto <tasak@google.com> 2 3 Needs style recalculation by changing applyAuthorStyles dynamically 4 https://bugs.webkit.org/show_bug.cgi?id=84251 5 6 Modifying setApplyAuthorStyles to invoke owner()'s 7 setNeedsRedistributing if applyAuthorStyles changes. 8 9 Reviewed by Hajime Morita. 10 11 No new tests. Adding new tests to existing 12 fast/dom/shadow/shadow-root-applyAuthorStyles.html to test this 13 feature. 14 15 * dom/ShadowRoot.cpp: 16 (WebCore::ShadowRoot::setApplyAuthorStyles): 17 If applyAuthorStyles changes, invoke owner's setNeedsRedistributing to 18 recalculate styles of the shadow root's child elements. 19 1 20 2012-05-20 Philip Rogers <pdr@google.com> 2 21 -
trunk/Source/WebCore/dom/ShadowRoot.cpp
r117421 r117716 189 189 void ShadowRoot::setApplyAuthorStyles(bool value) 190 190 { 191 m_applyAuthorStyles = value; 191 if (m_applyAuthorStyles != value) { 192 m_applyAuthorStyles = value; 193 if (attached() && owner()) 194 owner()->setNeedsRedistributing(); 195 } 192 196 } 193 197
Note: See TracChangeset
for help on using the changeset viewer.