Bug 88727 - image border modified by javascript is not refreshed by the khtml engine
Summary: image border modified by javascript is not refreshed by the khtml engine
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml ecma (show other bugs)
Version: unspecified
Platform: RedHat Enterprise Linux Linux
: NOR wishlist
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-03 00:58 UTC by Patrick Vander Linden
Modified: 2005-03-29 03:50 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Testcase mentioned above (837 bytes, text/html)
2004-09-20 08:30 UTC, Rob Buis
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Vander Linden 2004-09-03 00:58:21 UTC
Version:            (using KDE KDE 3.3.0)
Installed from:    RedHat RPMs
OS:                Linux

When you modify the border attribute of a img tag with javascript, the khtml engine doesn't refresh the display for this image. For instance, when you set the border, which was previously set to 0, to 3, a border appears in the display (normal behavior). When you set it again to 0; the image border doesn't disappear, even if checking the img border property with javascript shows the right value (0).
Comment 1 Patrick Vander Linden 2004-09-03 01:12:06 UTC
Here is a example:<html>
  <head>
    <title>KHTML Javascript Bug</title>
    <script language="javascript" type="text/javascript">
      function setImgBorder() {
        if (document.images.unxbsd.border == 3) {
          document.images.unxbsd.border = 0;
        } else if (document.images.unxbsd.border == 0) {
          document.images.unxbsd.border = 3;
        } else {
          alert('no way');
        }
        alert('The img border is ' + document.images.unxbsd.border);
      }
    </script>
  </head>

  <body>
    <form>
    <h1>KHTML Javascript Bug</h1>
    <p/>
    <img alt="KDE Homepage" src="http://www.kde.org/media/images/kde_logo.jpg" name="unxbsd" width="296" height="79" border="0" />
    <p/>
    <input type="button" value="Change Img border" onClick="setImgBorder()" />
    </form>
  </body>
</html>
Comment 2 Rob Buis 2004-09-20 08:30:07 UTC
Created attachment 7588 [details]
Testcase mentioned above
Comment 3 Leo Savernik 2005-02-14 00:20:38 UTC
Confirmed. Setting the border works. Clearing the border doesn't.
Comment 4 Sebastian Sauer 2005-03-20 01:54:05 UTC
Confirmed. With border > 0 it just works as expected. Could it be possible, that the problem is located at kdelibs/html/html/html_imageimpl.cpp line 95 at the
if(attr->value().toInt()) 
condition cause if 0 addCSSLength(CSS_PROP_BORDER_WIDTH, attr->value()); just don't got executed? 
Just an idear cause other areas like html/html_objectimpl.cpp line 262 don't check if attr->value().toInt() == 0 :-)
Comment 5 Germain Garand 2005-03-29 03:50:46 UTC
CVS commit by ggarand: 

remove CSS border properties when our image's border attribute translates to zero.

BUG: 88727


  M +6 -0      html_imageimpl.cpp   1.151


--- kdelibs/khtml/html/html_imageimpl.cpp  #1.150:1.151
@@ -99,4 +99,10 @@ void HTMLImageElementImpl::parseAttribut
             addCSSProperty( CSS_PROP_BORDER_BOTTOM_STYLE, CSS_VAL_SOLID );
             addCSSProperty( CSS_PROP_BORDER_LEFT_STYLE, CSS_VAL_SOLID );
+        } else {
+             removeCSSProperty( CSS_PROP_BORDER_WIDTH );
+             removeCSSProperty( CSS_PROP_BORDER_TOP_STYLE );
+             removeCSSProperty( CSS_PROP_BORDER_RIGHT_STYLE );
+             removeCSSProperty( CSS_PROP_BORDER_BOTTOM_STYLE );
+             removeCSSProperty( CSS_PROP_BORDER_LEFT_STYLE );                                          
         }
         break;