Changeset 144577 in webkit
- Timestamp:
- Mar 3, 2013, 11:36:33 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r144575 r144577 1 2013-03-03 Dean Jackson <dino@apple.com> 2 3 Plug-ins that are appropriately large w.r.t page size should autostart 4 https://bugs.webkit.org/show_bug.cgi?id=111242 5 6 Reviewed by Brady Eidson. 7 8 A "full-page" plug-in site should never snapshot. The trick is 9 how to determine what is full-page. This change implements the 10 following algorithm. 11 12 - The plug-in is in the main frame (not an iframe). 13 - The plug-in is sized with width and height 100%. 14 - The displayed area of the plug-in is more than 96% of the viewport area. 15 16 This is definitely not foolproof. For example, zombo.com has a slight 17 border around its plug-in. As the window size gets smaller, the body margin 18 takes up more than 5% of the width or height, and the plug-in doesn't pass 19 the tests above. 20 21 * html/HTMLPlugInImageElement.cpp: 22 (WebCore): New static constant: sizingFullPageThresholdPercentage 23 (WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn): Implements 24 the rules described above. 25 1 26 2013-03-03 Ryosuke Niwa <rniwa@webkit.org> 2 27 -
trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp
r144067 r144577 58 58 static const int sizingMediumWidthThreshold = 450; 59 59 static const int sizingMediumHeightThreshold = 300; 60 static const float sizingFullPageAreaRatioThreshold = 0.96; 60 61 61 62 // This delay should not exceed the snapshot delay in PluginView.cpp … … 415 416 return; 416 417 417 if (document()->isPluginDocument() && document()->frame() == document()->page()->mainFrame()) { 418 bool inMainFrame = document()->frame() == document()->page()->mainFrame(); 419 420 if (document()->isPluginDocument() && inMainFrame) { 418 421 LOG(Plugins, "%p Plug-in document in main frame", this); 419 422 return; … … 425 428 } 426 429 427 LayoutRect rect = toRenderEmbeddedObject(renderer())->contentBoxRect(); 428 int width = rect.width(); 429 int height = rect.height(); 430 if (width <= sizingTinyDimensionThreshold || height <= sizingTinyDimensionThreshold) { 431 LOG(Plugins, "%p Plug-in is %dx%d, set to play", this, width, height); 430 RenderBox* renderEmbeddedObject = toRenderBox(renderer()); 431 Length styleWidth = renderEmbeddedObject->style()->width(); 432 Length styleHeight = renderEmbeddedObject->style()->height(); 433 LayoutRect contentBoxRect = renderEmbeddedObject->contentBoxRect(); 434 int contentWidth = contentBoxRect.width(); 435 int contentHeight = contentBoxRect.height(); 436 int contentArea = contentWidth * contentHeight; 437 IntSize visibleViewSize = document()->frame()->view()->visibleSize(); 438 int visibleArea = visibleViewSize.width() * visibleViewSize.height(); 439 440 if (inMainFrame && styleWidth.isPercent() && (styleWidth.percent() == 100) 441 && styleHeight.isPercent() && (styleHeight.percent() == 100) 442 && (static_cast<float>(contentArea) / visibleArea > sizingFullPageAreaRatioThreshold)) { 443 LOG(Plugins, "%p Plug-in is top level full page, set to play", this); 444 return; 445 } 446 447 if (contentWidth <= sizingTinyDimensionThreshold || contentHeight <= sizingTinyDimensionThreshold) { 448 LOG(Plugins, "%p Plug-in is %dx%d, set to play", this, contentWidth, contentHeight); 432 449 return; 433 450 } … … 447 464 } 448 465 449 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);466 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); 450 467 // We may have got to this point by restarting a snapshotted plug-in, in which case we don't want to 451 468 // reset the display state.
Note:
See TracChangeset
for help on using the changeset viewer.