<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[174445] releases/WebKitGTK/webkit-2.6/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/174445">174445</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2014-10-08 06:11:20 -0700 (Wed, 08 Oct 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/174040">r174040</a> - HTMLPlugInElement::isUserObservable() is causing layout
https://bugs.webkit.org/show_bug.cgi?id=137156

Reviewed by Ryosuke Niwa.

While profiling the page load of nytimes.com, I noticed that we were
spending ~4-5% of cpu time in HTMLPlugInElement::isUserObservable().
The reason is that the function calls pluginWidget(), which causes a
layout update in HTMLObjectElement::renderWidgetForJSBindings(), to
make sure the plugin is loaded and its renderer is created.

HTMLPlugInElement::isUserObservable() shouldn't need to do a layout.
This patch does the following to address the problem:
- Rename renderWidgetForJSBindings() to renderWidgetLoadingPlugin()
  because this function is not always called from the JS Bindings
  nowadays. The new name makes it clearer that this will load the
  plugin if needed (to make sure the renderer is created, and by
  doing a layout).
- Add a PluginLoadingPolicy argument to
  HTMLPlugInElement::pluginWidget() to let the caller control if the
  plugin should be loaded or not.
- Update the call to pluginWidget() in isUserObservable() so that
  we do not attempt to load the plugin (thus not causing a layout).

No new tests, no behavior change.

* WebCore.exp.in:
* WebCore.order:
* html/HTMLAppletElement.cpp:
(WebCore::HTMLAppletElement::renderWidgetLoadingPlugin):
(WebCore::HTMLAppletElement::renderWidgetForJSBindings): Deleted.
* html/HTMLAppletElement.h:
* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::renderWidgetLoadingPlugin):
(WebCore::HTMLEmbedElement::renderWidgetForJSBindings): Deleted.
* html/HTMLEmbedElement.h:
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::renderWidgetLoadingPlugin):
(WebCore::HTMLObjectElement::renderWidgetForJSBindings): Deleted.
* html/HTMLObjectElement.h:
* html/HTMLPlugInElement.cpp:
(WebCore::HTMLPlugInElement::pluginWidget):
(WebCore::HTMLPlugInElement::isUserObservable):
* html/HTMLPlugInElement.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit26SourceWebCoreChangeLog">releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebCoreWebCoreexpin">releases/WebKitGTK/webkit-2.6/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebCoreWebCoreorder">releases/WebKitGTK/webkit-2.6/Source/WebCore/WebCore.order</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebCorehtmlHTMLAppletElementcpp">releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLAppletElement.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebCorehtmlHTMLAppletElementh">releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLAppletElement.h</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebCorehtmlHTMLEmbedElementcpp">releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLEmbedElement.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebCorehtmlHTMLEmbedElementh">releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLEmbedElement.h</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebCorehtmlHTMLObjectElementcpp">releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLObjectElement.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebCorehtmlHTMLObjectElementh">releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLObjectElement.h</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebCorehtmlHTMLPlugInElementcpp">releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLPlugInElement.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit26SourceWebCorehtmlHTMLPlugInElementh">releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLPlugInElement.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit26SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog (174444 => 174445)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog        2014-10-08 13:06:58 UTC (rev 174444)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog        2014-10-08 13:11:20 UTC (rev 174445)
</span><span class="lines">@@ -1,3 +1,50 @@
</span><ins>+2014-09-27  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        HTMLPlugInElement::isUserObservable() is causing layout
+        https://bugs.webkit.org/show_bug.cgi?id=137156
+
+        Reviewed by Ryosuke Niwa.
+
+        While profiling the page load of nytimes.com, I noticed that we were
+        spending ~4-5% of cpu time in HTMLPlugInElement::isUserObservable().
+        The reason is that the function calls pluginWidget(), which causes a
+        layout update in HTMLObjectElement::renderWidgetForJSBindings(), to
+        make sure the plugin is loaded and its renderer is created.
+
+        HTMLPlugInElement::isUserObservable() shouldn't need to do a layout.
+        This patch does the following to address the problem:
+        - Rename renderWidgetForJSBindings() to renderWidgetLoadingPlugin()
+          because this function is not always called from the JS Bindings
+          nowadays. The new name makes it clearer that this will load the
+          plugin if needed (to make sure the renderer is created, and by
+          doing a layout).
+        - Add a PluginLoadingPolicy argument to
+          HTMLPlugInElement::pluginWidget() to let the caller control if the
+          plugin should be loaded or not.
+        - Update the call to pluginWidget() in isUserObservable() so that
+          we do not attempt to load the plugin (thus not causing a layout).
+
+        No new tests, no behavior change.
+
+        * WebCore.exp.in:
+        * WebCore.order:
+        * html/HTMLAppletElement.cpp:
+        (WebCore::HTMLAppletElement::renderWidgetLoadingPlugin):
+        (WebCore::HTMLAppletElement::renderWidgetForJSBindings): Deleted.
+        * html/HTMLAppletElement.h:
+        * html/HTMLEmbedElement.cpp:
+        (WebCore::HTMLEmbedElement::renderWidgetLoadingPlugin):
+        (WebCore::HTMLEmbedElement::renderWidgetForJSBindings): Deleted.
+        * html/HTMLEmbedElement.h:
+        * html/HTMLObjectElement.cpp:
+        (WebCore::HTMLObjectElement::renderWidgetLoadingPlugin):
+        (WebCore::HTMLObjectElement::renderWidgetForJSBindings): Deleted.
+        * html/HTMLObjectElement.h:
+        * html/HTMLPlugInElement.cpp:
+        (WebCore::HTMLPlugInElement::pluginWidget):
+        (WebCore::HTMLPlugInElement::isUserObservable):
+        * html/HTMLPlugInElement.h:
+
</ins><span class="cx"> 2014-09-26  Brian J. Burg  &lt;burg@cs.washington.edu&gt;
</span><span class="cx"> 
</span><span class="cx">         StorageTracker::deleteOrigin being called off the main thread (ASSERTs in inspector/test-harness-trivially-works.html test)
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/WebCore.exp.in (174444 => 174445)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebCore/WebCore.exp.in        2014-10-08 13:06:58 UTC (rev 174444)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/WebCore.exp.in        2014-10-08 13:11:20 UTC (rev 174445)
</span><span class="lines">@@ -1784,7 +1784,6 @@
</span><span class="cx"> __ZNK7WebCore16VisibleSelection23isContentRichlyEditableEv
</span><span class="cx"> __ZNK7WebCore16VisibleSelection5isAllENS_27EditingBoundaryCrossingRuleE
</span><span class="cx"> __ZNK7WebCore17HTMLOptionElement4textEv
</span><del>-__ZNK7WebCore17HTMLPlugInElement12pluginWidgetEv
</del><span class="cx"> __ZNK7WebCore17HTMLSelectElement13selectedIndexEv
</span><span class="cx"> __ZNK7WebCore17HTMLSelectElement5valueEv
</span><span class="cx"> __ZNK7WebCore17HTMLSelectElement9listItemsEv
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebCoreWebCoreorder"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/WebCore.order (174444 => 174445)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebCore/WebCore.order        2014-10-08 13:06:58 UTC (rev 174444)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/WebCore.order        2014-10-08 13:11:20 UTC (rev 174445)
</span><span class="lines">@@ -9187,7 +9187,6 @@
</span><span class="cx"> __ZN7WebCore37pluginElementCustomGetOwnPropertySlotINS_19JSHTMLObjectElementENS_13JSHTMLElementEEEbPN3JSC9ExecStateENS3_12PropertyNameERNS3_12PropertySlotEPT_
</span><span class="cx"> __ZN7WebCore37runtimeObjectCustomGetOwnPropertySlotEPN3JSC9ExecStateENS0_12PropertyNameERNS0_12PropertySlotEPNS_13JSHTMLElementE
</span><span class="cx"> __ZN7WebCore18pluginScriptObjectEPN3JSC9ExecStateEPNS_13JSHTMLElementE
</span><del>-__ZNK7WebCore17HTMLPlugInElement12pluginWidgetEv
</del><span class="cx"> __ZNK7WebCore17HTMLObjectElement25renderWidgetForJSBindingsEv
</span><span class="cx"> __ZN7WebCore17HTMLPlugInElement11getInstanceEv
</span><span class="cx"> __ZN7WebCore28JSHTMLObjectElementPrototype18getOwnPropertySlotEPN3JSC6JSCellEPNS1_9ExecStateENS1_12PropertyNameERNS1_12PropertySlotE
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebCorehtmlHTMLAppletElementcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLAppletElement.cpp (174444 => 174445)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLAppletElement.cpp        2014-10-08 13:06:58 UTC (rev 174444)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLAppletElement.cpp        2014-10-08 13:11:20 UTC (rev 174445)
</span><span class="lines">@@ -83,10 +83,10 @@
</span><span class="cx">     return RenderEmbeddedObject::createForApplet(*this, WTF::move(style));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RenderWidget* HTMLAppletElement::renderWidgetForJSBindings() const
</del><ins>+RenderWidget* HTMLAppletElement::renderWidgetLoadingPlugin() const
</ins><span class="cx"> {
</span><span class="cx">     if (!canEmbedJava())
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx"> 
</span><span class="cx">     // Needs to load the plugin immediatedly because this function is called
</span><span class="cx">     // when JavaScript code accesses the plugin.
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebCorehtmlHTMLAppletElementh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLAppletElement.h (174444 => 174445)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLAppletElement.h        2014-10-08 13:06:58 UTC (rev 174444)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLAppletElement.h        2014-10-08 13:11:20 UTC (rev 174445)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx">     virtual bool rendererIsNeeded(const RenderStyle&amp;) override;
</span><span class="cx">     virtual RenderPtr&lt;RenderElement&gt; createElementRenderer(PassRef&lt;RenderStyle&gt;) override;
</span><span class="cx"> 
</span><del>-    virtual RenderWidget* renderWidgetForJSBindings() const override;
</del><ins>+    virtual RenderWidget* renderWidgetLoadingPlugin() const override;
</ins><span class="cx">     virtual void updateWidget(PluginCreationOption) override;
</span><span class="cx"> 
</span><span class="cx">     bool canEmbedJava() const;
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebCorehtmlHTMLEmbedElementcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLEmbedElement.cpp (174444 => 174445)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLEmbedElement.cpp        2014-10-08 13:06:58 UTC (rev 174444)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLEmbedElement.cpp        2014-10-08 13:11:20 UTC (rev 174445)
</span><span class="lines">@@ -68,7 +68,7 @@
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RenderWidget* HTMLEmbedElement::renderWidgetForJSBindings() const
</del><ins>+RenderWidget* HTMLEmbedElement::renderWidgetLoadingPlugin() const
</ins><span class="cx"> {
</span><span class="cx">     FrameView* view = document().view();
</span><span class="cx">     if (!view || (!view-&gt;isInLayout() &amp;&amp; !view-&gt;isPainting())) {
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebCorehtmlHTMLEmbedElementh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLEmbedElement.h (174444 => 174445)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLEmbedElement.h        2014-10-08 13:06:58 UTC (rev 174444)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLEmbedElement.h        2014-10-08 13:11:20 UTC (rev 174445)
</span><span class="lines">@@ -43,7 +43,7 @@
</span><span class="cx">     virtual bool isURLAttribute(const Attribute&amp;) const override;
</span><span class="cx">     virtual const AtomicString&amp; imageSourceURL() const override;
</span><span class="cx"> 
</span><del>-    virtual RenderWidget* renderWidgetForJSBindings() const override;
</del><ins>+    virtual RenderWidget* renderWidgetLoadingPlugin() const override;
</ins><span class="cx"> 
</span><span class="cx">     virtual void updateWidget(PluginCreationOption) override;
</span><span class="cx"> 
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebCorehtmlHTMLObjectElementcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLObjectElement.cpp (174444 => 174445)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLObjectElement.cpp        2014-10-08 13:06:58 UTC (rev 174444)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLObjectElement.cpp        2014-10-08 13:11:20 UTC (rev 174445)
</span><span class="lines">@@ -81,7 +81,7 @@
</span><span class="cx">     return adoptRef(new HTMLObjectElement(tagName, document, form, createdByParser));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RenderWidget* HTMLObjectElement::renderWidgetForJSBindings() const
</del><ins>+RenderWidget* HTMLObjectElement::renderWidgetLoadingPlugin() const
</ins><span class="cx"> {
</span><span class="cx">     // Needs to load the plugin immediatedly because this function is called
</span><span class="cx">     // when JavaScript code accesses the plugin.
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebCorehtmlHTMLObjectElementh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLObjectElement.h (174444 => 174445)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLObjectElement.h        2014-10-08 13:06:58 UTC (rev 174444)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLObjectElement.h        2014-10-08 13:11:20 UTC (rev 174445)
</span><span class="lines">@@ -70,7 +70,7 @@
</span><span class="cx">     virtual bool isURLAttribute(const Attribute&amp;) const override;
</span><span class="cx">     virtual const AtomicString&amp; imageSourceURL() const override;
</span><span class="cx"> 
</span><del>-    virtual RenderWidget* renderWidgetForJSBindings() const override;
</del><ins>+    virtual RenderWidget* renderWidgetLoadingPlugin() const override;
</ins><span class="cx"> 
</span><span class="cx">     virtual void addSubresourceAttributeURLs(ListHashSet&lt;URL&gt;&amp;) const override;
</span><span class="cx"> 
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebCorehtmlHTMLPlugInElementcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLPlugInElement.cpp (174444 => 174445)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLPlugInElement.cpp        2014-10-08 13:06:58 UTC (rev 174444)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLPlugInElement.cpp        2014-10-08 13:11:20 UTC (rev 174445)
</span><span class="lines">@@ -158,17 +158,17 @@
</span><span class="cx">     return beforeLoadAllowedLoad;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Widget* HTMLPlugInElement::pluginWidget() const
</del><ins>+Widget* HTMLPlugInElement::pluginWidget(PluginLoadingPolicy loadPolicy) const
</ins><span class="cx"> {
</span><span class="cx">     if (m_inBeforeLoadEventHandler) {
</span><span class="cx">         // The plug-in hasn't loaded yet, and it makes no sense to try to load if beforeload handler happened to touch the plug-in element.
</span><span class="cx">         // That would recursively call beforeload for the same element.
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    RenderWidget* renderWidget = renderWidgetForJSBindings();
</del><ins>+    RenderWidget* renderWidget = loadPolicy == PluginLoadingPolicy::Load ? renderWidgetLoadingPlugin() : this-&gt;renderWidget();
</ins><span class="cx">     if (!renderWidget)
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx"> 
</span><span class="cx">     return renderWidget-&gt;widget();
</span><span class="cx"> }
</span><span class="lines">@@ -256,7 +256,7 @@
</span><span class="cx"> bool HTMLPlugInElement::isUserObservable() const
</span><span class="cx"> {
</span><span class="cx">     // No widget - can't be anything to see or hear here.
</span><del>-    Widget* widget = pluginWidget();
</del><ins>+    Widget* widget = pluginWidget(PluginLoadingPolicy::DoNotLoad);
</ins><span class="cx">     if (!widget || !widget-&gt;isPluginViewBase())
</span><span class="cx">         return false;
</span><span class="cx"> 
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit26SourceWebCorehtmlHTMLPlugInElementh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLPlugInElement.h (174444 => 174445)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLPlugInElement.h        2014-10-08 13:06:58 UTC (rev 174444)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/html/HTMLPlugInElement.h        2014-10-08 13:11:20 UTC (rev 174445)
</span><span class="lines">@@ -51,7 +51,8 @@
</span><span class="cx"> 
</span><span class="cx">     PassRefPtr&lt;JSC::Bindings::Instance&gt; getInstance();
</span><span class="cx"> 
</span><del>-    WEBCORE_EXPORT Widget* pluginWidget() const;
</del><ins>+    enum class PluginLoadingPolicy { DoNotLoad, Load };
+    WEBCORE_EXPORT Widget* pluginWidget(PluginLoadingPolicy = PluginLoadingPolicy::Load) const;
</ins><span class="cx"> 
</span><span class="cx">     enum DisplayState {
</span><span class="cx">         WaitingForSnapshot,
</span><span class="lines">@@ -116,7 +117,8 @@
</span><span class="cx"> 
</span><span class="cx">     bool dispatchBeforeLoadEvent(const String&amp; sourceURL); // Not implemented, generates a compile error if subclasses call this by mistake.
</span><span class="cx"> 
</span><del>-    virtual RenderWidget* renderWidgetForJSBindings() const = 0;
</del><ins>+    // This will load the plugin if necessary.
+    virtual RenderWidget* renderWidgetLoadingPlugin() const = 0;
</ins><span class="cx"> 
</span><span class="cx">     virtual bool supportsFocus() const override;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>