Modified: tags/Safari-537.31.13/Source/WebCore/ChangeLog (144649 => 144650)
--- tags/Safari-537.31.13/Source/WebCore/ChangeLog 2013-03-04 19:04:27 UTC (rev 144649)
+++ tags/Safari-537.31.13/Source/WebCore/ChangeLog 2013-03-04 19:20:55 UTC (rev 144650)
@@ -1,3 +1,32 @@
+2013-03-04 Lucas Forschler <lforsch...@apple.com>
+
+ Merge r144577
+
+ 2013-03-03 Dean Jackson <d...@apple.com>
+
+ Plug-ins that are appropriately large w.r.t page size should autostart
+ https://bugs.webkit.org/show_bug.cgi?id=111242
+
+ Reviewed by Brady Eidson.
+
+ A "full-page" plug-in site should never snapshot. The trick is
+ how to determine what is full-page. This change implements the
+ following algorithm.
+
+ - The plug-in is in the main frame (not an iframe).
+ - The plug-in is sized with width and height 100%.
+ - The displayed area of the plug-in is more than 96% of the viewport area.
+
+ This is definitely not foolproof. For example, zombo.com has a slight
+ border around its plug-in. As the window size gets smaller, the body margin
+ takes up more than 5% of the width or height, and the plug-in doesn't pass
+ the tests above.
+
+ * html/HTMLPlugInImageElement.cpp:
+ (WebCore): New static constant: sizingFullPageThresholdPercentage
+ (WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn): Implements
+ the rules described above.
+
2013-03-01 Lucas Forschler <lforsch...@apple.com>
Merge r144397
Modified: tags/Safari-537.31.13/Source/WebCore/html/HTMLPlugInImageElement.cpp (144649 => 144650)
--- tags/Safari-537.31.13/Source/WebCore/html/HTMLPlugInImageElement.cpp 2013-03-04 19:04:27 UTC (rev 144649)
+++ tags/Safari-537.31.13/Source/WebCore/html/HTMLPlugInImageElement.cpp 2013-03-04 19:20:55 UTC (rev 144650)
@@ -57,6 +57,7 @@
static const int sizingSmallWidthThreshold = 250;
static const int sizingMediumWidthThreshold = 450;
static const int sizingMediumHeightThreshold = 300;
+static const float sizingFullPageAreaRatioThreshold = 0.96;
// This delay should not exceed the snapshot delay in PluginView.cpp
static const double simulatedMouseClickTimerDelay = .75;
@@ -414,7 +415,9 @@
|| !document()->page()->settings()->plugInSnapshottingEnabled())
return;
- if (document()->isPluginDocument() && document()->frame() == document()->page()->mainFrame()) {
+ bool inMainFrame = document()->frame() == document()->page()->mainFrame();
+
+ if (document()->isPluginDocument() && inMainFrame) {
LOG(Plugins, "%p Plug-in document in main frame", this);
return;
}
@@ -424,14 +427,28 @@
return;
}
- LayoutRect rect = toRenderEmbeddedObject(renderer())->contentBoxRect();
- int width = rect.width();
- int height = rect.height();
- if (width <= sizingTinyDimensionThreshold || height <= sizingTinyDimensionThreshold) {
- LOG(Plugins, "%p Plug-in is %dx%d, set to play", this, width, height);
+ RenderBox* renderEmbeddedObject = toRenderBox(renderer());
+ Length styleWidth = renderEmbeddedObject->style()->width();
+ Length styleHeight = renderEmbeddedObject->style()->height();
+ LayoutRect contentBoxRect = renderEmbeddedObject->contentBoxRect();
+ int contentWidth = contentBoxRect.width();
+ int contentHeight = contentBoxRect.height();
+ int contentArea = contentWidth * contentHeight;
+ IntSize visibleViewSize = document()->frame()->view()->visibleSize();
+ int visibleArea = visibleViewSize.width() * visibleViewSize.height();
+
+ if (inMainFrame && styleWidth.isPercent() && (styleWidth.percent() == 100)
+ && styleHeight.isPercent() && (styleHeight.percent() == 100)
+ && (static_cast<float>(contentArea) / visibleArea > sizingFullPageAreaRatioThreshold)) {
+ LOG(Plugins, "%p Plug-in is top level full page, set to play", this);
return;
}
+ if (contentWidth <= sizingTinyDimensionThreshold || contentHeight <= sizingTinyDimensionThreshold) {
+ LOG(Plugins, "%p Plug-in is %dx%d, set to play", this, contentWidth, contentHeight);
+ return;
+ }
+
if (!document()->page() || !document()->page()->plugInClient()) {
setDisplayState(WaitingForSnapshot);
return;
@@ -446,7 +463,7 @@
return;
}
- LOG(Plugins, "%p Plug-in hash %x is %dx%d, origin is not auto-start, set to wait for snapshot", this, m_plugInOriginHash, width, height);
+ LOG(Plugins, "%p Plug-in hash %x is %dx%d, origin is not auto-start, set to wait for snapshot", this, m_plugInOriginHash, contentWidth, contentHeight);
// We may have got to this point by restarting a snapshotted plug-in, in which case we don't want to
// reset the display state.
if (displayState() != PlayingWithPendingMouseClick)