Changeset 18320 in webkit
- Timestamp:
- Dec 19, 2006 10:56:45 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r18315 r18320 1 2006-12-19 Alexey Proskuryakov <ap@webkit.org> 2 3 Reviewed by Darin. 4 5 http://bugs.webkit.org/show_bug.cgi?id=7296 6 JavaScript error not thrown when trying to set a CSS property to an invalid value 7 8 * fast/block/positioning/relayout-on-position-change.html: This test was setting 9 position property to an invalid value, expecting that it will be removed. Changed 10 it to set the property to an empty value (now the test passes in Firefox, too). 11 12 * fast/dom/css-set-property-exception-expected.txt: 13 * fast/dom/css-set-property-exception.html: 14 Updated the results, added a new case and made the output more verbose. 15 1 16 2006-12-18 Nikolas Zimmermann <zimmermann@kde.org> 2 17 -
trunk/LayoutTests/fast/block/positioning/relayout-on-position-change.html
r12682 r18320 5 5 { 6 6 document.body.offsetTop; // force layout 7 document.getElementById('change').style.position = " none";7 document.getElementById('change').style.position = ""; 8 8 } 9 9 </script> -
trunk/LayoutTests/fast/dom/css-set-property-exception-expected.txt
r11962 r18320 1 T his test checks to see whether you get exceptions when setting a property with a "bad value". We preserve our historic behavior of never raising an exception when you set a CSS property using JavaScript property syntax. But we do raise exceptions when setting a property with setProperty.1 Test for bug 7296. 2 2 3 Th e results below should show four successes, followed by two exceptions.3 This test checks to see whether you get exceptions when setting a property with a "bad value". Setting using JavaScript property syntax and with setProperty() should behave the same. 4 4 5 Th is is the test element.5 The results below should show success in cases 1, 3, 5, and 7. 6 6 7 Successfully set display to "block"; value is now "block". 8 Successfully set display to ""; value is now "". 9 Successfully set display to null; value is now "". 10 Successfully set display to "block" with setProperty; value is now "block". 11 Got exception trying to set display to "" with setProperty; value is now "". 12 Got exception trying to set display to null with setProperty; value is now "". 7 It is OK if the order of properties changes from the expected results - IE 6 and Firefox 2 don't agree on it anyway. 13 8 9 Successfully set display to "block"; cssText is now: "top: 0px; bottom: 1px; display: block; ". 10 Got exception trying to set display to "foobar"; cssText is now: "top: 0px; display: none; bottom: 1px; ". 11 Successfully set display to ""; cssText is now: "top: 0px; bottom: 1px; ". 12 Got exception trying to set display to null; cssText is now: "top: 0px; display: none; bottom: 1px; ". 13 Successfully set display to "block" with setProperty; cssText is now: "top: 0px; bottom: 1px; display: block; ". 14 Got exception trying to set display to "foobar" with setProperty; cssText is now: "top: 0px; display: none; bottom: 1px; ". 15 Successfully set display to "" with setProperty; cssText is now: "top: 0px; bottom: 1px; ". 16 Got exception trying to set display to null with setProperty; cssText is now: "top: 0px; display: none; bottom: 1px; ". 17 -
trunk/LayoutTests/fast/dom/css-set-property-exception.html
r11995 r18320 8 8 document.getElementById("console").appendChild(item); 9 9 } 10 function setInitialStyleForE() 11 { 12 var e = document.getElementById('e'); 13 14 e.style.top = "0px"; 15 e.style.bottom = ""; 16 e.style.display = "none"; 17 e.style.bottom = "1px"; 18 } 10 19 function test() 11 20 { … … 15 24 var e = document.getElementById('e'); 16 25 17 e.style.display = "none";26 setInitialStyleForE(); 18 27 try { 19 28 e.style.display = "block"; 20 log("Successfully set display to \"block\"; value is now \"" + e.style.display+ "\".");29 log("Successfully set display to \"block\"; cssText is now: \"" + e.style.cssText + "\"."); 21 30 } catch (exception) { 22 log("Got exception trying to set display to \"block\"; value is now \"" + e.style.display+ "\".");31 log("Got exception trying to set display to \"block\"; cssText is now: \"" + e.style.cssText + "\"."); 23 32 } 24 33 25 e.style.display = "none"; 34 setInitialStyleForE(); 35 try { 36 e.style.display = "foobar"; 37 log("Successfully set display to \"foobar\"; cssText is now: \"" + e.style.cssText + "\"."); 38 } catch (exception) { 39 log("Got exception trying to set display to \"foobar\"; cssText is now: \"" + e.style.cssText + "\"."); 40 } 41 42 setInitialStyleForE(); 26 43 try { 27 44 e.style.display = ""; 28 log("Successfully set display to \"\"; value is now \"" + e.style.display+ "\".");45 log("Successfully set display to \"\"; cssText is now: \"" + e.style.cssText + "\"."); 29 46 } catch (exception) { 30 log("Got exception trying to set display to \"\"; value is now \"" + e.style.display+ "\".");47 log("Got exception trying to set display to \"\"; cssText is now: \"" + e.style.cssText + "\"."); 31 48 } 32 49 33 e.style.display = "none";50 setInitialStyleForE(); 34 51 try { 35 52 e.style.display = null; 36 log("Successfully set display to null; value is now \"" + e.style.display+ "\".");53 log("Successfully set display to null; cssText is now: \"" + e.style.cssText + "\"."); 37 54 } catch (exception) { 38 log("Got exception trying to set display to null; value is now \"" + e.style.display+ "\".");55 log("Got exception trying to set display to null; cssText is now: \"" + e.style.cssText + "\"."); 39 56 } 40 57 41 e.style.display = "none";58 setInitialStyleForE(); 42 59 try { 43 60 e.style.setProperty("display", "block", ""); 44 log("Successfully set display to \"block\" with setProperty; value is now \"" + e.style.display+ "\".");61 log("Successfully set display to \"block\" with setProperty; cssText is now: \"" + e.style.cssText + "\"."); 45 62 } catch (exception) { 46 log("Got exception trying to set display to \"block\" with setProperty; value is now \"" + e.style.display+ "\".");63 log("Got exception trying to set display to \"block\" with setProperty; cssText is now: \"" + e.style.cssText + "\"."); 47 64 } 48 65 49 e.style.display = "none"; 66 setInitialStyleForE(); 67 try { 68 e.style.setProperty("display", "foobar", ""); 69 log("Successfully set display to \"foobar\" with setProperty; cssText is now: \"" + e.style.cssText + "\"."); 70 } catch (exception) { 71 log("Got exception trying to set display to \"foobar\" with setProperty; cssText is now: \"" + e.style.cssText + "\"."); 72 } 73 74 setInitialStyleForE(); 50 75 try { 51 76 e.style.setProperty("display", "", ""); 52 log("Successfully set display to \"\" with setProperty; value is now \"" + e.style.display+ "\".");77 log("Successfully set display to \"\" with setProperty; cssText is now: \"" + e.style.cssText + "\"."); 53 78 } catch (exception) { 54 log("Got exception trying to set display to \"\" with setProperty; value is now \"" + e.style.display+ "\".");79 log("Got exception trying to set display to \"\" with setProperty; cssText is now: \"" + e.style.cssText + "\"."); 55 80 } 56 81 57 e.style.display = "none";82 setInitialStyleForE(); 58 83 try { 59 84 e.style.setProperty("display", null, ""); 60 log("Successfully set display to null with setProperty; value is now \"" + e.style.display+ "\".");85 log("Successfully set display to null with setProperty; cssText is now: \"" + e.style.cssText + "\"."); 61 86 } catch (exception) { 62 log("Got exception trying to set display to null with setProperty; value is now \"" + e.style.display+ "\".");87 log("Got exception trying to set display to null with setProperty; cssText is now: \"" + e.style.cssText + "\"."); 63 88 } 64 89 } … … 66 91 </head> 67 92 <body onload="test();"> 93 <p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=7296">bug 7296</a>.</p> 68 94 <p>This test checks to see whether you get exceptions when setting a property with a "bad value". 69 We preserve our historic behavior of never raising an exception when you set a CSS property using JavaScript property syntax. 70 But we do raise exceptions when setting a property with setProperty.</p>71 < p>The results below should show four successes, followed by two exceptions.</p>95 Setting using JavaScript property syntax and with setProperty() should behave the same.</p> 96 <p>The results below should show success in cases 1, 3, 5, and 7.</p> 97 <P>It is OK if the order of properties changes from the expected results - IE 6 and Firefox 2 don't agree on it anyway.</p> 72 98 <hr> 73 99 <p id="e">This is the test element.</p> -
trunk/WebCore/ChangeLog
r18319 r18320 1 2006-12-19 Alexey Proskuryakov <ap@webkit.org> 2 3 Reviewed by Darin. 4 5 http://bugs.webkit.org/show_bug.cgi?id=7296 6 JavaScript error not thrown when trying to set a CSS property to an invalid value 7 8 * bindings/js/kjs_css.cpp: 9 (KJS::DOMCSSStyleDeclaration::put): When not in Dashboard compatibility mode, 10 raise exception for invalid values. Also removed an unnecessary call to 11 removeProperty(), which prevented the property value from being preserved in 12 error case. 13 14 * css/CSSMutableStyleDeclaration.cpp: 15 (WebCore::CSSMutableStyleDeclaration::setProperty): Moved the handling of 16 empty property values here. Also removed an unnecessary call to removeProperty(). 17 1 18 2006-12-19 Anders Carlsson <acarlsson@apple.com> 2 19 -
trunk/WebCore/bindings/js/kjs_css.cpp
r16217 r18320 35 35 #include "CSSValueList.h" 36 36 #include "Document.h" 37 #include "Frame.h" 37 38 #include "HTMLNames.h" 38 39 #include "HTMLStyleElement.h" … … 43 44 #include "JSCSSValueList.h" 44 45 #include "MediaList.h" 46 #include "Settings.h" 45 47 #include "StyleSheetList.h" 46 48 #include "kjs_dom.h" … … 212 214 bool pixelOrPos; 213 215 String prop = cssPropertyName(propertyName, &pixelOrPos); 214 String prop value = value->toString(exec);216 String propValue = value->toString(exec); 215 217 if (pixelOrPos) 216 prop value += "px";218 propValue += "px"; 217 219 #ifdef KJS_VERBOSE 218 220 kdDebug(6070) << "DOMCSSStyleDeclaration: prop=" << prop << " propvalue=" << propvalue << endl; 219 221 #endif 220 styleDecl.removeProperty(prop, exception); 221 if (!exception && !propvalue.isEmpty()) { 222 // We have to ignore exceptions here, because of the following unfortunate situation: 223 // 1) Older versions ignored exceptions here by accident, because the put function 224 // that translated exceptions did not translate CSS exceptions. 225 // 2) Gecko does not raise an exception in this case, although WinIE does. 226 // 3) At least some Dashboard widgets are depending on this behavior. 227 // It would be nice to fix this some day, perhaps with some kind of "quirks mode", 228 // but it's likely that the Dashboard widgets are already using a strict mode DOCTYPE. 229 ExceptionCode ec = 0; 230 styleDecl.setProperty(prop, propvalue, ec); 231 } 222 ASSERT(styleDecl.stylesheet()->isCSSStyleSheet()); 223 if (Frame* frame = static_cast<CSSStyleSheet*>(styleDecl.stylesheet())->doc()->frame()) 224 if (frame->settings()->shouldUseDashboardBackwardCompatibilityMode()) { 225 styleDecl.removeProperty(prop, exception); 226 if (!exception) { 227 ExceptionCode exceptionIgnored = 0; 228 styleDecl.setProperty(prop, propValue, exceptionIgnored); 229 return; 230 } 231 } 232 styleDecl.setProperty(prop, propValue, exception); 232 233 } else { 233 234 DOMObject::put(exec, propertyName, value, attr); -
trunk/WebCore/css/CSSMutableStyleDeclaration.cpp
r14407 r18320 298 298 ec = 0; 299 299 300 removeProperty(propertyID); 301 300 // Setting the value to an empty string just removes the property in both IE and Gecko. 301 if (value.isEmpty()) { 302 removeProperty(propertyID, notifyChanged, ec); 303 return ec == 0; 304 } 305 306 // When replacing an existing property value, this moves the property to the end of the list. 307 // Firefox preserves the position, and MSIE moves the property to the beginning. 302 308 CSSParser parser(useStrictParsing()); 303 309 bool success = parser.parseValue(this, propertyID, value, important);
Note: See TracChangeset
for help on using the changeset viewer.