Commit 864dbca9 authored by thatcher's avatar thatcher

LayoutTests:

        Reviewed by Hyatt, checked in by Tim H.

        Adding testcase for bug 8223.

        * fast/dom/css-inline-style-important-expected.checksum: Added.
        * fast/dom/css-inline-style-important-expected.png: Added.
        * fast/dom/css-inline-style-important-expected.txt: Added.
        * fast/dom/css-inline-style-important.html: Added.

WebCore:

        Reviewed by Hyatt, checked in by Tim H.

        http://bugzilla.opendarwin.org/show_bug.cgi?id=8223
        WebKit fails to update style on element via DOM

        Handle !important by detecting it and using a different code
        path from normal priority.

        * bindings/js/kjs_css.cpp:
        (KJS::DOMCSSStyleDeclaration::put):
        * css/CSSStyleDeclaration.cpp:
        (WebCore::CSSStyleDeclaration::setProperty):
        * css/CSSStyleDeclaration.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@14700 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8fb7021f
2006-06-02 Rob Buis <buis@kde.org>
Reviewed by Hyatt, checked in by Tim H.
Adding testcase for bug 8223.
* fast/dom/css-inline-style-important-expected.checksum: Added.
* fast/dom/css-inline-style-important-expected.png: Added.
* fast/dom/css-inline-style-important-expected.txt: Added.
* fast/dom/css-inline-style-important.html: Added.
2006-06-02 Rémi Zara <remi_zara@mac.com>
Reviewed by Hyatt.
7471406368f5f1a8ad59d58eefa8e53b
\ No newline at end of file
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x576
RenderBlock {P} at (0,0) size 784x36
RenderText {#text} at (0,0) size 780x36
text run at (0,0) width 780: "This test checks to see whether setting a css value including !important on an inline style property works. The text should be"
text run at (0,18) width 120: "green if successful."
RenderBlock {HR} at (0,52) size 784x2 [border: (1px inset #000000)]
RenderBlock {P} at (0,70) size 784x18 [color=#008000]
RenderText {#text} at (0,0) size 147x18
text run at (0,0) width 147: "This is the test element."
RenderBlock {HR} at (0,104) size 784x2 [border: (1px inset #000000)]
RenderBlock {OL} at (0,122) size 784x0
<html>
<head>
<style type="text/css">
#e { color:red; }
</style>
<script>
function log(message)
{
var item = document.createElement("li");
item.appendChild(document.createTextNode(message));
document.getElementById("console").appendChild(item);
}
function test()
{
var e = document.getElementById('e');
e.style.color = "green !important";
}
</script>
</head>
<body onload="test();">
<p>This test checks to see whether setting a css value including !important on an inline style property works. The text should be green if successful.
<hr>
<p id="e">This is the test element.</p>
<hr>
<ol id="console"></ol>
</body>
</html>
2006-06-02 Rob Buis <buis@kde.org>
Reviewed by Hyatt, checked in by Tim H.
http://bugzilla.opendarwin.org/show_bug.cgi?id=8223
WebKit fails to update style on element via DOM
Handle !important by detecting it and using a different code
path from normal priority.
* bindings/js/kjs_css.cpp:
(KJS::DOMCSSStyleDeclaration::put):
* css/CSSStyleDeclaration.cpp:
(WebCore::CSSStyleDeclaration::setProperty):
* css/CSSStyleDeclaration.h:
2006-06-02 Darin Adler <darin@apple.com>
Reviewed by Geoff, checked in by Maciej.
......
......@@ -218,7 +218,7 @@ void DOMCSSStyleDeclaration::put(ExecState* exec, const Identifier &propertyName
// It would be nice to fix this some day, perhaps with some kind of "quirks mode",
// but it's likely that the Dashboard widgets are already using a strict mode DOCTYPE.
ExceptionCode ec = 0;
styleDecl.setProperty(prop, propvalue, "", ec);
styleDecl.setProperty(prop, propvalue, ec);
}
} else {
DOMObject::put(exec, propertyName, value, attr);
......
......@@ -113,6 +113,15 @@ bool CSSStyleDeclaration::isPropertyImplicit(const String &propertyName)
return isPropertyImplicit(propID);
}
void CSSStyleDeclaration::setProperty(const String& propertyName, const String& value, ExceptionCode& ec)
{
int important = value.find("!important", 0, false);
if (important == -1)
setProperty(propertyName, value, "", ec);
else
setProperty(propertyName, value.left(important - 1), "important", ec);
}
void CSSStyleDeclaration::setProperty(const String& propertyName, const String& value, const String& priority, ExceptionCode& ec)
{
int propID = propertyID(propertyName);
......
......@@ -60,6 +60,7 @@ public:
virtual int getPropertyShorthand(int propertyID) const = 0;
virtual bool isPropertyImplicit(int propertyID) const = 0;
void setProperty(const String& propertyName, const String& value, ExceptionCode&);
void setProperty(const String& propertyName, const String& value, const String& priority, ExceptionCode&);
String removeProperty(const String& propertyName, ExceptionCode&);
virtual void setProperty(int propertyId, const String& value, bool important, ExceptionCode&) = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment