<!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>[163082] trunk/Source</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/163082">163082</a></dd>
<dt>Author</dt> <dd>antti@apple.com</dd>
<dt>Date</dt> <dd>2014-01-30 07:49:54 -0800 (Thu, 30 Jan 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>WebPage::determinePrimarySnapshottedPlugIn is slow
https://bugs.webkit.org/show_bug.cgi?id=127905
Source/WebCore:
Reviewed by Anders Carlsson.
* WebCore.exp.in: New exports
* WebCore.xcodeproj/project.pbxproj:
* html/HTMLPlugInImageElement.h:
(WebCore::HTMLPlugInImageElement>): Add isElementOfType<>
Source/WebKit2:
Reviewed by Anders Carlsson.
PLT before:
132.0ms 0.8% 0,0 WebKit::WebPage::determinePrimarySnapshottedPlugIn()
130.0ms 0.8% 0,0 WebCore::RenderView::hitTest(WebCore::HitTestRequest const&, WebCore::HitTestResult&)
After:
7.0ms 0.0% 0,0 WebKit::WebPage::determinePrimarySnapshottedPlugIn()
3.0ms 0.0% 0,0 WebCore::RenderView::hitTest(WebCore::HitTestRequest const&, WebCore::HitTestResult&)
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::determinePrimarySnapshottedPlugIn):
Instead of shotgunning the page with hit tests, do a DOM crawl for plugins
and hit test the centers.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLPlugInImageElementh">trunk/Source/WebCore/html/HTMLPlugInImageElement.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (163081 => 163082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-01-30 14:04:28 UTC (rev 163081)
+++ trunk/Source/WebCore/ChangeLog        2014-01-30 15:49:54 UTC (rev 163082)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-01-30 Antti Koivisto <antti@apple.com>
+
+ WebPage::determinePrimarySnapshottedPlugIn is slow
+ https://bugs.webkit.org/show_bug.cgi?id=127905
+
+ Reviewed by Anders Carlsson.
+
+ * WebCore.exp.in: New exports
+ * WebCore.xcodeproj/project.pbxproj:
+ * html/HTMLPlugInImageElement.h:
+ (WebCore::HTMLPlugInImageElement>): Add isElementOfType<>
+
</ins><span class="cx"> 2014-01-30 Csaba Osztrogonác <ossy@webkit.org>
</span><span class="cx">
</span><span class="cx"> [SOUP] Fix the build if !ENABLE(WEB_TIMING)
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (163081 => 163082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-01-30 14:04:28 UTC (rev 163081)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-01-30 15:49:54 UTC (rev 163082)
</span><span class="lines">@@ -291,6 +291,7 @@
</span><span class="cx"> __ZN7WebCore13KeyboardEventC1ERKNS_21PlatformKeyboardEventEPNS_9DOMWindowE
</span><span class="cx"> __ZN7WebCore13NodeTraversal13deepLastChildEPNS_4NodeE
</span><span class="cx"> __ZN7WebCore13NodeTraversal19nextAncestorSiblingEPKNS_4NodeE
</span><ins>+__ZN7WebCore13NodeTraversal19nextAncestorSiblingEPKNS_4NodeES3_
</ins><span class="cx"> __ZN7WebCore13PageThrottler22reportInterestingEventEv
</span><span class="cx"> __ZN7WebCore13PageThrottlerD1Ev
</span><span class="cx"> __ZN7WebCore13QualifiedNameD1Ev
</span><span class="lines">@@ -1762,6 +1763,7 @@
</span><span class="cx"> __ZNK7WebCore6Widget25convertToContainingWindowERKNS_7IntRectE
</span><span class="cx"> __ZNK7WebCore6Widget25convertToContainingWindowERKNS_8IntPointE
</span><span class="cx"> __ZNK7WebCore6Widget9frameRectEv
</span><ins>+__ZNK7WebCore7Element10clientRectEv
</ins><span class="cx"> __ZNK7WebCore7Element10screenRectEv
</span><span class="cx"> __ZNK7WebCore7Element10shadowRootEv
</span><span class="cx"> __ZNK7WebCore7Element12getAttributeERKN3WTF12AtomicStringE
</span><span class="lines">@@ -2543,6 +2545,7 @@
</span><span class="cx">
</span><span class="cx"> #if !defined(NDEBUG)
</span><span class="cx"> __ZN7WebCore14SQLiteDatabase22disableThreadingChecksEv
</span><ins>+__ZN7WebCore24NoEventDispatchAssertion7s_countE
</ins><span class="cx"> __ZNK7WebCore7Element26fastAttributeLookupAllowedERKNS_13QualifiedNameE
</span><span class="cx"> #endif
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (163081 => 163082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-01-30 14:04:28 UTC (rev 163081)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-01-30 15:49:54 UTC (rev 163082)
</span><span class="lines">@@ -5886,7 +5886,7 @@
</span><span class="cx">                 E1FF8F681807460800132674 /* JSSubtleCryptoCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1FF8F661807460800132674 /* JSSubtleCryptoCustom.cpp */; };
</span><span class="cx">                 E1FF8F6C180DB5BE00132674 /* CryptoAlgorithmRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1FF8F6A180DB5BE00132674 /* CryptoAlgorithmRegistry.cpp */; };
</span><span class="cx">                 E1FF8F6D180DB5BE00132674 /* CryptoAlgorithmRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = E1FF8F6B180DB5BE00132674 /* CryptoAlgorithmRegistry.h */; };
</span><del>-                E401C27517CE53EC00C41A35 /* ElementIteratorAssertions.h in Headers */ = {isa = PBXBuildFile; fileRef = E401C27417CE53EC00C41A35 /* ElementIteratorAssertions.h */; };
</del><ins>+                E401C27517CE53EC00C41A35 /* ElementIteratorAssertions.h in Headers */ = {isa = PBXBuildFile; fileRef = E401C27417CE53EC00C41A35 /* ElementIteratorAssertions.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 E424A39E1330DF0100CF6DC9 /* TileGridTile.h in Headers */ = {isa = PBXBuildFile; fileRef = E424A39D1330DF0100CF6DC9 /* TileGridTile.h */; };
</span><span class="cx">                 E424A3A01330DF1E00CF6DC9 /* TileGridTile.mm in Sources */ = {isa = PBXBuildFile; fileRef = E424A39F1330DF1E00CF6DC9 /* TileGridTile.mm */; };
</span><span class="cx">                 E425A49A18292B840020CFCF /* CollectionIndexCache.h in Headers */ = {isa = PBXBuildFile; fileRef = E425A49918292B840020CFCF /* CollectionIndexCache.h */; };
</span><span class="lines">@@ -5944,8 +5944,8 @@
</span><span class="cx">                 E453904D0EAFD637003695C8 /* WidgetIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = E453903C0EAFD637003695C8 /* WidgetIOS.mm */; };
</span><span class="cx">                 E45390AE0EAFF4B5003695C8 /* SystemMemoryIOS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E45390AD0EAFF4B5003695C8 /* SystemMemoryIOS.cpp */; };
</span><span class="cx">                 E462A4A1113E71BE004A4220 /* IntPointHash.h in Headers */ = {isa = PBXBuildFile; fileRef = E462A4A0113E71BE004A4220 /* IntPointHash.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                E46A2B1C17CA65B9000DBCD8 /* ElementDescendantIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E46A2B1B17CA65B9000DBCD8 /* ElementDescendantIterator.h */; };
-                E46A2B1E17CA76B1000DBCD8 /* ElementChildIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E46A2B1D17CA76B1000DBCD8 /* ElementChildIterator.h */; };
</del><ins>+                E46A2B1C17CA65B9000DBCD8 /* ElementDescendantIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E46A2B1B17CA65B9000DBCD8 /* ElementDescendantIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                E46A2B1E17CA76B1000DBCD8 /* ElementChildIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E46A2B1D17CA76B1000DBCD8 /* ElementChildIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 E47127CA163438A100ED6F5A /* StyleInvalidationAnalysis.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E47A97CE163059FC005DCD99 /* StyleInvalidationAnalysis.cpp */; };
</span><span class="cx">                 E47127CB163438AE00ED6F5A /* StyleInvalidationAnalysis.h in Headers */ = {isa = PBXBuildFile; fileRef = E47A97CF163059FC005DCD99 /* StyleInvalidationAnalysis.h */; };
</span><span class="cx">                 E4778B7F115A581A00B5D372 /* JSCustomEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4778B7D115A581A00B5D372 /* JSCustomEvent.cpp */; };
</span><span class="lines">@@ -5960,8 +5960,8 @@
</span><span class="cx">                 E4946EAF156E64DD00D3297F /* StyleRuleImport.h in Headers */ = {isa = PBXBuildFile; fileRef = E4946EAD156E64DD00D3297F /* StyleRuleImport.h */; };
</span><span class="cx">                 E49BD9FA131FD2ED003C56F0 /* CSSValuePool.h in Headers */ = {isa = PBXBuildFile; fileRef = E49BD9F9131FD2ED003C56F0 /* CSSValuePool.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 E49BDA0B131FD3E5003C56F0 /* CSSValuePool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E49BDA0A131FD3E5003C56F0 /* CSSValuePool.cpp */; };
</span><del>-                E4AE7C1617D1BB950009FB31 /* ElementIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AE7C1517D1BB950009FB31 /* ElementIterator.h */; };
-                E4AE7C1A17D232350009FB31 /* ElementAncestorIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AE7C1917D232350009FB31 /* ElementAncestorIterator.h */; };
</del><ins>+                E4AE7C1617D1BB950009FB31 /* ElementIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AE7C1517D1BB950009FB31 /* ElementIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                E4AE7C1A17D232350009FB31 /* ElementAncestorIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AE7C1917D232350009FB31 /* ElementAncestorIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 E4AFCFA50DAF29A300F5F55C /* UnitBezier.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AFCFA40DAF29A300F5F55C /* UnitBezier.h */; };
</span><span class="cx">                 E4AFD00B0DAF335400F5F55C /* SMILTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4AFD0050DAF335400F5F55C /* SMILTime.cpp */; };
</span><span class="cx">                 E4AFD00C0DAF335400F5F55C /* SMILTime.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AFD0060DAF335400F5F55C /* SMILTime.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -5991,7 +5991,7 @@
</span><span class="cx">                 E4D58EB517B4DBDC00CBDCA8 /* StyleResolveForDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = E4D58EB317B4DBDC00CBDCA8 /* StyleResolveForDocument.h */; };
</span><span class="cx">                 E4D58EB817B4ED8900CBDCA8 /* StyleFontSizeFunctions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4D58EB617B4ED8900CBDCA8 /* StyleFontSizeFunctions.cpp */; };
</span><span class="cx">                 E4D58EB917B4ED8900CBDCA8 /* StyleFontSizeFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = E4D58EB717B4ED8900CBDCA8 /* StyleFontSizeFunctions.h */; };
</span><del>-                E4D58EBB17B8F12800CBDCA8 /* ElementTraversal.h in Headers */ = {isa = PBXBuildFile; fileRef = E4D58EBA17B8F12800CBDCA8 /* ElementTraversal.h */; };
</del><ins>+                E4D58EBB17B8F12800CBDCA8 /* ElementTraversal.h in Headers */ = {isa = PBXBuildFile; fileRef = E4D58EBA17B8F12800CBDCA8 /* ElementTraversal.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 E4D687770ED7AE3D006EA978 /* PurgeableBufferMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4D687760ED7AE3D006EA978 /* PurgeableBufferMac.cpp */; };
</span><span class="cx">                 E4D687790ED7AE4F006EA978 /* PurgeableBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = E4D687780ED7AE4F006EA978 /* PurgeableBuffer.h */; };
</span><span class="cx">                 E4D988B417BFD1F60084FB88 /* TextNodeTraversal.h in Headers */ = {isa = PBXBuildFile; fileRef = E4D988B317BFD1F60084FB88 /* TextNodeTraversal.h */; };
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLPlugInImageElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLPlugInImageElement.h (163081 => 163082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLPlugInImageElement.h        2014-01-30 14:04:28 UTC (rev 163081)
+++ trunk/Source/WebCore/html/HTMLPlugInImageElement.h        2014-01-30 15:49:54 UTC (rev 163082)
</span><span class="lines">@@ -172,6 +172,7 @@
</span><span class="cx"> void isHTMLPlugInImageElement(const HTMLPlugInImageElement&); // Catch unnecessary runtime check of type known at compile time.
</span><span class="cx"> inline bool isHTMLPlugInImageElement(const HTMLPlugInElement& element) { return element.isPlugInImageElement(); }
</span><span class="cx"> inline bool isHTMLPlugInImageElement(const Node& node) { return node.isPluginElement() && toHTMLPlugInElement(node).isPlugInImageElement(); }
</span><ins>+template <> inline bool isElementOfType<const HTMLPlugInImageElement>(const Element& element) { return isHTMLPlugInImageElement(element); }
</ins><span class="cx"> NODE_TYPE_CASTS(HTMLPlugInImageElement)
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (163081 => 163082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-01-30 14:04:28 UTC (rev 163081)
+++ trunk/Source/WebKit2/ChangeLog        2014-01-30 15:49:54 UTC (rev 163082)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2014-01-30 Antti Koivisto <antti@apple.com>
+
+ WebPage::determinePrimarySnapshottedPlugIn is slow
+ https://bugs.webkit.org/show_bug.cgi?id=127905
+
+ Reviewed by Anders Carlsson.
+
+ PLT before:
+ 132.0ms 0.8% 0,0 WebKit::WebPage::determinePrimarySnapshottedPlugIn()
+ 130.0ms 0.8% 0,0 WebCore::RenderView::hitTest(WebCore::HitTestRequest const&, WebCore::HitTestResult&)
+
+ After:
+ 7.0ms 0.0% 0,0 WebKit::WebPage::determinePrimarySnapshottedPlugIn()
+ 3.0ms 0.0% 0,0 WebCore::RenderView::hitTest(WebCore::HitTestRequest const&, WebCore::HitTestResult&)
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::determinePrimarySnapshottedPlugIn):
+
+ Instead of shotgunning the page with hit tests, do a DOM crawl for plugins
+ and hit test the centers.
+
</ins><span class="cx"> 2014-01-30 Andrei Bucur <abucur@adobe.com>
</span><span class="cx">
</span><span class="cx"> Remove the ACCELERATED_COMPOSITING flag
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (163081 => 163082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-01-30 14:04:28 UTC (rev 163081)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-01-30 15:49:54 UTC (rev 163082)
</span><span class="lines">@@ -98,6 +98,7 @@
</span><span class="cx"> #include <WebCore/DragController.h>
</span><span class="cx"> #include <WebCore/DragData.h>
</span><span class="cx"> #include <WebCore/DragSession.h>
</span><ins>+#include <WebCore/ElementIterator.h>
</ins><span class="cx"> #include <WebCore/EventHandler.h>
</span><span class="cx"> #include <WebCore/FocusController.h>
</span><span class="cx"> #include <WebCore/FormState.h>
</span><span class="lines">@@ -3992,7 +3993,6 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
</span><span class="cx"> static int primarySnapshottedPlugInSearchLimit = 3000;
</span><del>-static int primarySnapshottedPlugInSearchGap = 200;
</del><span class="cx"> static float primarySnapshottedPlugInSearchBucketSize = 1.1;
</span><span class="cx"> static int primarySnapshottedPlugInMinimumWidth = 400;
</span><span class="cx"> static int primarySnapshottedPlugInMinimumHeight = 300;
</span><span class="lines">@@ -4035,59 +4035,59 @@
</span><span class="cx">
</span><span class="cx"> ++m_numberOfPrimarySnapshotDetectionAttempts;
</span><span class="cx">
</span><del>- RenderView* renderView = corePage()->mainFrame().view()->renderView();
</del><ins>+ MainFrame& mainFrame = corePage()->mainFrame();
+ if (!mainFrame.view())
+ return;
+ if (!mainFrame.view()->renderView())
+ return;
+ RenderView& mainRenderView = *mainFrame.view()->renderView();
</ins><span class="cx">
</span><span class="cx"> IntRect searchRect = IntRect(IntPoint(), corePage()->mainFrame().view()->contentsSize());
</span><span class="cx"> searchRect.intersect(IntRect(IntPoint(), IntSize(primarySnapshottedPlugInSearchLimit, primarySnapshottedPlugInSearchLimit)));
</span><span class="cx">
</span><span class="cx"> HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::AllowChildFrameContent | HitTestRequest::IgnoreClipping | HitTestRequest::DisallowShadowContent);
</span><span class="cx">
</span><del>- HashSet<RenderObject*> seenRenderers;
- HTMLPlugInImageElement* candidatePlugIn = 0;
</del><ins>+ HTMLPlugInImageElement* candidatePlugIn = nullptr;
</ins><span class="cx"> unsigned candidatePlugInArea = 0;
</span><span class="cx">
</span><del>- for (int x = searchRect.x(); x <= searchRect.width(); x += primarySnapshottedPlugInSearchGap) {
- for (int y = searchRect.y(); y <= searchRect.height(); y += primarySnapshottedPlugInSearchGap) {
- HitTestResult hitTestResult = HitTestResult(LayoutPoint(x, y));
- renderView->hitTest(request, hitTestResult);
-
- Element* element = hitTestResult.innerElement();
- if (!element)
</del><ins>+ for (Frame* frame = &mainFrame; frame; frame = frame->tree().traverseNext()) {
+ if (!frame->loader().subframeLoader().containsPlugins())
+ continue;
+ if (!frame->document() || !frame->view())
+ continue;
+ for (auto& plugInImageElement : descendantsOfType<HTMLPlugInImageElement>(*frame->document())) {
+ if (plugInImageElement.displayState() == HTMLPlugInElement::Playing)
</ins><span class="cx"> continue;
</span><span class="cx">
</span><del>- RenderObject* renderer = element->renderer();
- if (!renderer || !renderer->isBox())
</del><ins>+ IntRect plugInRectRelativeToView = plugInImageElement.clientRect();
+ if (plugInRectRelativeToView.isEmpty())
</ins><span class="cx"> continue;
</span><del>-
- RenderBox* renderBox = toRenderBox(renderer);
-
- if (!seenRenderers.add(renderer).isNewEntry)
</del><ins>+ IntSize scrollOffset = mainFrame.view()->scrollOffsetRelativeToDocument();
+ IntRect plugInRectRelativeToTopDocument(plugInRectRelativeToView.location() + scrollOffset, plugInRectRelativeToView.size());
+ if (!plugInRectRelativeToTopDocument.intersects(searchRect))
</ins><span class="cx"> continue;
</span><span class="cx">
</span><del>- if (!element->isPluginElement())
- continue;
</del><ins>+ HitTestResult hitTestResult(plugInRectRelativeToTopDocument.center());
+ mainRenderView.hitTest(request, hitTestResult);
</ins><span class="cx">
</span><del>- HTMLPlugInElement* plugInElement = toHTMLPlugInElement(element);
- if (!plugInElement->isPlugInImageElement())
</del><ins>+ Element* element = hitTestResult.innerElement();
+ if (element != &plugInImageElement)
</ins><span class="cx"> continue;
</span><span class="cx">
</span><del>- HTMLPlugInImageElement* plugInImageElement = toHTMLPlugInImageElement(plugInElement);
-
- if (plugInElement->displayState() == HTMLPlugInElement::Playing)
</del><ins>+ auto renderer = plugInImageElement.renderer();
+ if (!renderer || !renderer->isBox())
</ins><span class="cx"> continue;
</span><del>-
- if (renderBox->contentWidth() < primarySnapshottedPlugInMinimumWidth || renderBox->contentHeight() < primarySnapshottedPlugInMinimumHeight)
</del><ins>+ auto& renderBox = toRenderBox(*renderer);
+ if (renderBox.contentWidth() < primarySnapshottedPlugInMinimumWidth || renderBox.contentHeight() < primarySnapshottedPlugInMinimumHeight)
</ins><span class="cx"> continue;
</span><span class="cx">
</span><del>- LayoutUnit contentArea = renderBox->contentWidth() * renderBox->contentHeight();
-
</del><ins>+ LayoutUnit contentArea = renderBox.contentWidth() * renderBox.contentHeight();
</ins><span class="cx"> if (contentArea > candidatePlugInArea * primarySnapshottedPlugInSearchBucketSize) {
</span><del>- candidatePlugIn = plugInImageElement;
</del><ins>+ candidatePlugIn = &plugInImageElement;
</ins><span class="cx"> candidatePlugInArea = contentArea;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-
</del><span class="cx"> if (!candidatePlugIn) {
</span><span class="cx"> LOG(Plugins, "Primary Plug-In Detection: fail - did not find a candidate plug-in.");
</span><span class="cx"> if (m_numberOfPrimarySnapshotDetectionAttempts < maxPrimarySnapshottedPlugInDetectionAttempts) {
</span></span></pre>
</div>
</div>
</body>
</html>