[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

hyatt hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:40:04 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 97e9d21d8fc7f8bf79c8c52dae3fa4770f012255
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri May 14 19:28:42 2004 +0000

    	Fix image loading for <input type=image> and <object>.  Make sure it works dynamically and make sure
    	the renderer is properly null-checked at attach time.
    
            Reviewed by darin
    
            * khtml/html/html_formimpl.cpp:
            (HTMLInputElementImpl::HTMLInputElementImpl):
            (HTMLInputElementImpl::~HTMLInputElementImpl):
            (HTMLInputElementImpl::parseHTMLAttribute):
            (HTMLInputElementImpl::attach):
            * khtml/html/html_formimpl.h:
            * khtml/html/html_objectimpl.cpp:
            (HTMLObjectElementImpl::HTMLObjectElementImpl):
            (HTMLObjectElementImpl::~HTMLObjectElementImpl):
            (HTMLObjectElementImpl::parseHTMLAttribute):
            (HTMLObjectElementImpl::attach):
            * khtml/html/html_objectimpl.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6601 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index be25f3e..489caa5 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,23 @@
+2004-05-13  David Hyatt  <hyatt at apple.com>
+
+	Fix image loading for <input type=image> and <object>.  Make sure it works dynamically and make sure
+	the renderer is properly null-checked at attach time.
+	
+        Reviewed by darin
+
+        * khtml/html/html_formimpl.cpp:
+        (HTMLInputElementImpl::HTMLInputElementImpl):
+        (HTMLInputElementImpl::~HTMLInputElementImpl):
+        (HTMLInputElementImpl::parseHTMLAttribute):
+        (HTMLInputElementImpl::attach):
+        * khtml/html/html_formimpl.h:
+        * khtml/html/html_objectimpl.cpp:
+        (HTMLObjectElementImpl::HTMLObjectElementImpl):
+        (HTMLObjectElementImpl::~HTMLObjectElementImpl):
+        (HTMLObjectElementImpl::parseHTMLAttribute):
+        (HTMLObjectElementImpl::attach):
+        * khtml/html/html_objectimpl.h:
+
 === Safari-140 ===
 
 2004-05-14  Chris Blumenberg  <cblu at apple.com>
diff --git a/WebCore/khtml/html/html_formimpl.cpp b/WebCore/khtml/html/html_formimpl.cpp
index e499fb4..a184c87 100644
--- a/WebCore/khtml/html/html_formimpl.cpp
+++ b/WebCore/khtml/html/html_formimpl.cpp
@@ -31,6 +31,7 @@
 #include "khtmlview.h"
 #include "khtml_part.h"
 #include "html/html_documentimpl.h"
+#include "html_imageimpl.h"
 #include "khtml_settings.h"
 #include "misc/htmlhashes.h"
 
@@ -1159,7 +1160,7 @@ RenderObject* HTMLFieldSetElementImpl::createRenderer(RenderArena* arena, Render
 // -------------------------------------------------------------------------
 
 HTMLInputElementImpl::HTMLInputElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
-    : HTMLGenericFormElementImpl(doc, f)
+    : HTMLGenericFormElementImpl(doc, f), m_imageLoader(0)
 {
     m_type = TEXT;
     m_maxLen = -1;
@@ -1187,6 +1188,7 @@ HTMLInputElementImpl::HTMLInputElementImpl(DocumentPtr *doc, HTMLFormElementImpl
 HTMLInputElementImpl::~HTMLInputElementImpl()
 {
     if (getDocument()) getDocument()->deregisterMaintainsState(this);
+    delete m_imageLoader;
 }
 
 NodeImpl::Id HTMLInputElementImpl::id() const
@@ -1410,6 +1412,10 @@ void HTMLInputElementImpl::parseHTMLAttribute(HTMLAttributeImpl *attr)
         break;
     case ATTR_TYPE:
         setType(attr->value());
+        if (m_type != IMAGE && m_imageLoader) {
+            delete m_imageLoader;
+            m_imageLoader = 0;
+        }
         break;
     case ATTR_VALUE:
         if (m_value.isNull()) // We only need to setChanged if the form is looking
@@ -1428,8 +1434,15 @@ void HTMLInputElementImpl::parseHTMLAttribute(HTMLAttributeImpl *attr)
         m_size = !attr->isNull() ? attr->value().toInt() : 20;
         break;
     case ATTR_ALT:
+        if (m_render && m_type == IMAGE)
+            static_cast<RenderImage*>(m_render)->updateAltText();
+        break;
     case ATTR_SRC:
-        if (m_render && m_type == IMAGE) m_render->updateFromElement();
+        if (m_render && m_type == IMAGE) {
+            if (!m_imageLoader)
+                m_imageLoader = new HTMLImageLoader(this);
+            m_imageLoader->updateFromElement();
+        }
         break;
     case ATTR_USEMAP:
     case ATTR_ACCESSKEY:
@@ -1581,6 +1594,16 @@ void HTMLInputElementImpl::attach()
 
     HTMLGenericFormElementImpl::attach();
 
+    if (m_type == IMAGE) {
+        if (!m_imageLoader)
+            m_imageLoader = new HTMLImageLoader(this);
+        m_imageLoader->updateFromElement();
+        if (renderer()) {
+            RenderImage* imageObj = static_cast<RenderImage*>(renderer());
+            imageObj->setImage(m_imageLoader->image());    
+        }
+    }
+
 #if APPLE_CHANGES
     // note we don't deal with calling passwordFieldRemoved() on detach, because the timing
     // was such that it cleared our state too early
diff --git a/WebCore/khtml/html/html_formimpl.h b/WebCore/khtml/html/html_formimpl.h
index bf21352..093d291 100644
--- a/WebCore/khtml/html/html_formimpl.h
+++ b/WebCore/khtml/html/html_formimpl.h
@@ -57,6 +57,7 @@ class HTMLFormElement;
 class DOMString;
 class HTMLGenericFormElementImpl;
 class HTMLOptionElementImpl;
+class HTMLImageLoader;
 
 // -------------------------------------------------------------------------
 
@@ -360,6 +361,8 @@ protected:
     short     m_maxResults;
 #endif
 
+    HTMLImageLoader* m_imageLoader;
+
     typeEnum m_type : 4;
     bool m_checked : 1;
     bool m_defaultChecked : 1;
diff --git a/WebCore/khtml/html/html_objectimpl.cpp b/WebCore/khtml/html/html_objectimpl.cpp
index 5ef77e7..c7e9568 100644
--- a/WebCore/khtml/html/html_objectimpl.cpp
+++ b/WebCore/khtml/html/html_objectimpl.cpp
@@ -340,13 +340,14 @@ bool HTMLEmbedElementImpl::isURLAttribute(AttributeImpl *attr) const
 // -------------------------------------------------------------------------
 
 HTMLObjectElementImpl::HTMLObjectElementImpl(DocumentPtr *doc) 
-: HTMLElementImpl(doc), m_imageLoader(this)
+: HTMLElementImpl(doc), m_imageLoader(0)
 {
     needWidgetUpdate = false;
 }
 
 HTMLObjectElementImpl::~HTMLObjectElementImpl()
 {
+    delete m_imageLoader;
 }
 
 NodeImpl::Id HTMLObjectElementImpl::id() const
@@ -385,10 +386,19 @@ void HTMLObjectElementImpl::parseHTMLAttribute(HTMLAttributeImpl *attr)
       if ( pos!=-1 )
           serviceType = serviceType.left( pos );
       needWidgetUpdate = true;
+      if (!canRenderImageType(serviceType) && m_imageLoader) {
+          delete m_imageLoader;
+          m_imageLoader = 0;
+      }
       break;
     case ATTR_DATA:
       url = khtml::parseURL(  val ).string();
       needWidgetUpdate = true;
+      if (m_render && canRenderImageType(serviceType)) {
+          if (!m_imageLoader)
+              m_imageLoader = new HTMLImageLoader(this);
+          m_imageLoader->updateFromElement();
+      }
       break;
     case ATTR_WIDTH:
       addCSSLength( attr, CSS_PROP_WIDTH, attr->value());
@@ -456,9 +466,13 @@ void HTMLObjectElementImpl::attach()
 
     if (m_render) {
         if (canRenderImageType(serviceType)) {
-            m_imageLoader.updateFromElement();
-            RenderImage* imageObj = static_cast<RenderImage*>(renderer());
-            imageObj->setImage(m_imageLoader.image());
+            if (!m_imageLoader)
+                m_imageLoader = new HTMLImageLoader(this);
+            m_imageLoader->updateFromElement();
+            if (renderer()) {
+                RenderImage* imageObj = static_cast<RenderImage*>(renderer());
+                imageObj->setImage(m_imageLoader->image());
+            }
         } else {
             // If we are already cleared, then it means that we were attach()-ed previously
             // with no renderer. We will actually need to do an update in order to ensure
diff --git a/WebCore/khtml/html/html_objectimpl.h b/WebCore/khtml/html/html_objectimpl.h
index 33fac92..9798f0f 100644
--- a/WebCore/khtml/html/html_objectimpl.h
+++ b/WebCore/khtml/html/html_objectimpl.h
@@ -129,7 +129,7 @@ public:
     QString url;
     QString classId;
     bool needWidgetUpdate;
-    HTMLImageLoader m_imageLoader;
+    HTMLImageLoader* m_imageLoader;
 };
 
 // -------------------------------------------------------------------------

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list