Title: [105932] trunk/Source/WebCore
- Revision
- 105932
- Author
- [email protected]
- Date
- 2012-01-25 15:29:53 -0800 (Wed, 25 Jan 2012)
Log Message
Share more code between updateWidget implementations in HTMLEmbedElement and HTMLObjectElement
https://bugs.webkit.org/show_bug.cgi?id=74340
Reviewed by Adam Barth.
I'm preparing to unify these two methods, and starting by sharing more code between them.
* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::updateWidget):
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::updateWidget):
* html/HTMLPlugInElement.cpp:
(WebCore::HTMLPlugInElement::guardedDispatchBeforeLoadEvent):
* html/HTMLPlugInElement.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (105931 => 105932)
--- trunk/Source/WebCore/ChangeLog 2012-01-25 23:11:46 UTC (rev 105931)
+++ trunk/Source/WebCore/ChangeLog 2012-01-25 23:29:53 UTC (rev 105932)
@@ -1,3 +1,20 @@
+2012-01-25 Eric Seidel <[email protected]>
+
+ Share more code between updateWidget implementations in HTMLEmbedElement and HTMLObjectElement
+ https://bugs.webkit.org/show_bug.cgi?id=74340
+
+ Reviewed by Adam Barth.
+
+ I'm preparing to unify these two methods, and starting by sharing more code between them.
+
+ * html/HTMLEmbedElement.cpp:
+ (WebCore::HTMLEmbedElement::updateWidget):
+ * html/HTMLObjectElement.cpp:
+ (WebCore::HTMLObjectElement::updateWidget):
+ * html/HTMLPlugInElement.cpp:
+ (WebCore::HTMLPlugInElement::guardedDispatchBeforeLoadEvent):
+ * html/HTMLPlugInElement.h:
+
2012-01-25 Eric Uhrhane <[email protected]>
Add full support for filesystem URLs.
Modified: trunk/Source/WebCore/html/HTMLEmbedElement.cpp (105931 => 105932)
--- trunk/Source/WebCore/html/HTMLEmbedElement.cpp 2012-01-25 23:11:46 UTC (rev 105931)
+++ trunk/Source/WebCore/html/HTMLEmbedElement.cpp 2012-01-25 23:29:53 UTC (rev 105932)
@@ -154,11 +154,7 @@
Vector<String> paramValues;
parametersForPlugin(paramNames, paramValues);
- ASSERT(!m_inBeforeLoadEventHandler);
- m_inBeforeLoadEventHandler = true;
- bool beforeLoadAllowedLoad = dispatchBeforeLoadEvent(m_url);
- m_inBeforeLoadEventHandler = false;
-
+ bool beforeLoadAllowedLoad = guardedDispatchBeforeLoadEvent(m_url);
if (!beforeLoadAllowedLoad) {
if (document()->isPluginDocument()) {
// Plugins inside plugin documents load differently than other plugins. By the time
Modified: trunk/Source/WebCore/html/HTMLObjectElement.cpp (105931 => 105932)
--- trunk/Source/WebCore/html/HTMLObjectElement.cpp 2012-01-25 23:11:46 UTC (rev 105931)
+++ trunk/Source/WebCore/html/HTMLObjectElement.cpp 2012-01-25 23:29:53 UTC (rev 105932)
@@ -289,11 +289,7 @@
if (pluginCreationOption == CreateOnlyNonNetscapePlugins && wouldLoadAsNetscapePlugin(url, serviceType))
return;
- ASSERT(!m_inBeforeLoadEventHandler);
- m_inBeforeLoadEventHandler = true;
- bool beforeLoadAllowedLoad = dispatchBeforeLoadEvent(url);
- m_inBeforeLoadEventHandler = false;
-
+ bool beforeLoadAllowedLoad = guardedDispatchBeforeLoadEvent(url);
// beforeload events can modify the DOM, potentially causing
// RenderWidget::destroy() to be called. Ensure we haven't been
// destroyed before continuing.
Modified: trunk/Source/WebCore/html/HTMLPlugInElement.cpp (105931 => 105932)
--- trunk/Source/WebCore/html/HTMLPlugInElement.cpp 2012-01-25 23:11:46 UTC (rev 105931)
+++ trunk/Source/WebCore/html/HTMLPlugInElement.cpp 2012-01-25 23:29:53 UTC (rev 105932)
@@ -110,6 +110,17 @@
return m_instance;
}
+bool HTMLPlugInElement::guardedDispatchBeforeLoadEvent(const String& sourceURL)
+{
+ ASSERT(!m_inBeforeLoadEventHandler);
+ m_inBeforeLoadEventHandler = true;
+ // static_cast is used to avoid a compile error since dispatchBeforeLoadEvent
+ // is intentionally undefined on this class.
+ bool beforeLoadAllowedLoad = static_cast<HTMLFrameOwnerElement*>(this)->dispatchBeforeLoadEvent(sourceURL);
+ m_inBeforeLoadEventHandler = false;
+ return beforeLoadAllowedLoad;
+}
+
Widget* HTMLPlugInElement::pluginWidget()
{
if (m_inBeforeLoadEventHandler) {
Modified: trunk/Source/WebCore/html/HTMLPlugInElement.h (105931 => 105932)
--- trunk/Source/WebCore/html/HTMLPlugInElement.h 2012-01-25 23:11:46 UTC (rev 105931)
+++ trunk/Source/WebCore/html/HTMLPlugInElement.h 2012-01-25 23:29:53 UTC (rev 105932)
@@ -62,8 +62,12 @@
virtual void parseMappedAttribute(Attribute*);
bool m_inBeforeLoadEventHandler;
+ // Subclasses should use guardedDispatchBeforeLoadEvent instead of calling dispatchBeforeLoadEvent directly.
+ bool guardedDispatchBeforeLoadEvent(const String& sourceURL);
private:
+ bool dispatchBeforeLoadEvent(const String& sourceURL); // Not implemented, generates a compile error if subclasses call this by mistake.
+
virtual void defaultEventHandler(Event*);
virtual RenderWidget* renderWidgetForJSBindings() = 0;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes