Title: [102983] trunk/Source/WebCore
Revision
102983
Author
[email protected]
Date
2011-12-15 14:00:09 -0800 (Thu, 15 Dec 2011)

Log Message

WebCore has two (disconnected) ways to keep track of updated widgets, should be unified
https://bugs.webkit.org/show_bug.cgi?id=74367

Reviewed by Adam Barth.

It seems the FrameView updateWidgets set is needed for now,
so just making FrameView::addWidgetToUpdate mark the DOM node
as needing a widget update and later when it goes to call
updateWidget() checking first if it needs an update.

No new tests, just adding an assert.

* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::updateWidget):
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::updateWidget):
* html/HTMLPlugInImageElement.h:
(WebCore::HTMLPlugInImageElement::needsWidgetUpdate):
(WebCore::HTMLPlugInImageElement::setNeedsWidgetUpdate):
* page/FrameView.cpp:
(WebCore::FrameView::addWidgetToUpdate):
(WebCore::FrameView::updateWidget):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (102982 => 102983)


--- trunk/Source/WebCore/ChangeLog	2011-12-15 21:56:15 UTC (rev 102982)
+++ trunk/Source/WebCore/ChangeLog	2011-12-15 22:00:09 UTC (rev 102983)
@@ -1,3 +1,28 @@
+2011-12-15  Eric Seidel  <[email protected]>
+
+        WebCore has two (disconnected) ways to keep track of updated widgets, should be unified
+        https://bugs.webkit.org/show_bug.cgi?id=74367
+
+        Reviewed by Adam Barth.
+
+        It seems the FrameView updateWidgets set is needed for now,
+        so just making FrameView::addWidgetToUpdate mark the DOM node
+        as needing a widget update and later when it goes to call
+        updateWidget() checking first if it needs an update.
+
+        No new tests, just adding an assert.
+
+        * html/HTMLEmbedElement.cpp:
+        (WebCore::HTMLEmbedElement::updateWidget):
+        * html/HTMLObjectElement.cpp:
+        (WebCore::HTMLObjectElement::updateWidget):
+        * html/HTMLPlugInImageElement.h:
+        (WebCore::HTMLPlugInImageElement::needsWidgetUpdate):
+        (WebCore::HTMLPlugInImageElement::setNeedsWidgetUpdate):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::addWidgetToUpdate):
+        (WebCore::FrameView::updateWidget):
+
 2011-12-15  Alexandru Chiculita  <[email protected]>
 
         Windows project file is broken. It has a missing </File> enclosing tag

Modified: trunk/Source/WebCore/html/HTMLEmbedElement.cpp (102982 => 102983)


--- trunk/Source/WebCore/html/HTMLEmbedElement.cpp	2011-12-15 21:56:15 UTC (rev 102982)
+++ trunk/Source/WebCore/html/HTMLEmbedElement.cpp	2011-12-15 22:00:09 UTC (rev 102983)
@@ -141,9 +141,7 @@
 void HTMLEmbedElement::updateWidget(PluginCreationOption pluginCreationOption)
 {
     ASSERT(!renderEmbeddedObject()->pluginCrashedOrWasMissing());
-    // FIXME: We should ASSERT(needsWidgetUpdate()), but currently
-    // FrameView::updateWidget() calls updateWidget(false) without checking if
-    // the widget actually needs updating!
+    ASSERT(needsWidgetUpdate());
     setNeedsWidgetUpdate(false);
 
     if (m_url.isEmpty() && m_serviceType.isEmpty())

Modified: trunk/Source/WebCore/html/HTMLObjectElement.cpp (102982 => 102983)


--- trunk/Source/WebCore/html/HTMLObjectElement.cpp	2011-12-15 21:56:15 UTC (rev 102982)
+++ trunk/Source/WebCore/html/HTMLObjectElement.cpp	2011-12-15 22:00:09 UTC (rev 102983)
@@ -290,9 +290,7 @@
 void HTMLObjectElement::updateWidget(PluginCreationOption pluginCreationOption)
 {
     ASSERT(!renderEmbeddedObject()->pluginCrashedOrWasMissing());
-    // FIXME: We should ASSERT(needsWidgetUpdate()), but currently
-    // FrameView::updateWidget() calls updateWidget(false) without checking if
-    // the widget actually needs updating!
+    ASSERT(needsWidgetUpdate());
     setNeedsWidgetUpdate(false);
     // FIXME: This should ASSERT isFinishedParsingChildren() instead.
     if (!isFinishedParsingChildren())

Modified: trunk/Source/WebCore/html/HTMLPlugInImageElement.h (102982 => 102983)


--- trunk/Source/WebCore/html/HTMLPlugInImageElement.h	2011-12-15 21:56:15 UTC (rev 102982)
+++ trunk/Source/WebCore/html/HTMLPlugInImageElement.h	2011-12-15 22:00:09 UTC (rev 102983)
@@ -54,6 +54,10 @@
     const String& url() const { return m_url; }
     bool shouldPreferPlugInsForImages() const { return m_shouldPreferPlugInsForImages; }
 
+    // Public for FrameView::addWidgetToUpdate()
+    bool needsWidgetUpdate() const { return m_needsWidgetUpdate; }
+    void setNeedsWidgetUpdate(bool needsWidgetUpdate) { m_needsWidgetUpdate = needsWidgetUpdate; }
+
 protected:
     HTMLPlugInImageElement(const QualifiedName& tagName, Document*, bool createdByParser, PreferPlugInsForImagesOption);
 
@@ -67,9 +71,6 @@
     virtual void attach();
     virtual void detach();
 
-    bool needsWidgetUpdate() const { return m_needsWidgetUpdate; }
-    void setNeedsWidgetUpdate(bool needsWidgetUpdate) { m_needsWidgetUpdate = needsWidgetUpdate; }
-
     bool allowedToLoadFrameURL(const String& url);
     bool wouldLoadAsNetscapePlugin(const String& url, const String& serviceType);
 

Modified: trunk/Source/WebCore/page/FrameView.cpp (102982 => 102983)


--- trunk/Source/WebCore/page/FrameView.cpp	2011-12-15 21:56:15 UTC (rev 102982)
+++ trunk/Source/WebCore/page/FrameView.cpp	2011-12-15 22:00:09 UTC (rev 102983)
@@ -1232,6 +1232,13 @@
     if (!m_widgetUpdateSet)
         m_widgetUpdateSet = adoptPtr(new RenderEmbeddedObjectSet);
 
+    // Tell the DOM element that it needs a widget update.
+    Node* node = object->node();
+    if (node->hasTagName(objectTag) || node->hasTagName(embedTag)) {
+        HTMLPlugInImageElement* pluginElement = static_cast<HTMLPlugInImageElement*>(node);
+        pluginElement->setNeedsWidgetUpdate(true);
+    }
+
     m_widgetUpdateSet->add(object);
 }
 
@@ -2213,9 +2220,12 @@
         return;
 
     // FIXME: This could turn into a real virtual dispatch if we defined
-    // updateWidget(bool) on HTMLElement.
-    if (ownerElement->hasTagName(objectTag) || ownerElement->hasTagName(embedTag))
-        static_cast<HTMLPlugInImageElement*>(ownerElement)->updateWidget(CreateAnyWidgetType);
+    // updateWidget(PluginCreationOption) on HTMLElement.
+    if (ownerElement->hasTagName(objectTag) || ownerElement->hasTagName(embedTag)) {
+        HTMLPlugInImageElement* pluginElement = static_cast<HTMLPlugInImageElement*>(ownerElement);
+        if (pluginElement->needsWidgetUpdate())
+            pluginElement->updateWidget(CreateAnyWidgetType);
+    }
     // FIXME: It is not clear that Media elements need or want this updateWidget() call.
 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
     else if (ownerElement->isMediaElement())
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to