Changeset 144650 in webkit


Ignore:
Timestamp:
Mar 4, 2013, 11:20:55 AM (12 years ago)
Author:
Lucas Forschler
Message:

Merged r144577. <rdar://problem/13328176>

Location:
tags/Safari-537.31.13/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tags/Safari-537.31.13/Source/WebCore/ChangeLog

    r144480 r144650  
     12013-03-04  Lucas Forschler  <lforschler@apple.com>
     2
     3        Merge r144577
     4
     5    2013-03-03  Dean Jackson  <dino@apple.com>
     6
     7            Plug-ins that are appropriately large w.r.t page size should autostart
     8            https://bugs.webkit.org/show_bug.cgi?id=111242
     9
     10            Reviewed by Brady Eidson.
     11
     12            A "full-page" plug-in site should never snapshot. The trick is
     13            how to determine what is full-page. This change implements the
     14            following algorithm.
     15
     16            - The plug-in is in the main frame (not an iframe).
     17            - The plug-in is sized with width and height 100%.
     18            - The displayed area of the plug-in is more than 96% of the viewport area.
     19
     20            This is definitely not foolproof. For example, zombo.com has a slight
     21            border around its plug-in. As the window size gets smaller, the body margin
     22            takes up more than 5% of the width or height, and the plug-in doesn't pass
     23            the tests above.
     24
     25            * html/HTMLPlugInImageElement.cpp:
     26            (WebCore): New static constant: sizingFullPageThresholdPercentage
     27            (WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn): Implements
     28                the rules described above.
     29
    1302013-03-01  Lucas Forschler  <lforschler@apple.com>
    231
  • tags/Safari-537.31.13/Source/WebCore/html/HTMLPlugInImageElement.cpp

    r144348 r144650  
    5858static const int sizingMediumWidthThreshold = 450;
    5959static const int sizingMediumHeightThreshold = 300;
     60static const float sizingFullPageAreaRatioThreshold = 0.96;
    6061
    6162// This delay should not exceed the snapshot delay in PluginView.cpp
     
    415416        return;
    416417
    417     if (document()->isPluginDocument() && document()->frame() == document()->page()->mainFrame()) {
     418    bool inMainFrame = document()->frame() == document()->page()->mainFrame();
     419
     420    if (document()->isPluginDocument() && inMainFrame) {
    418421        LOG(Plugins, "%p Plug-in document in main frame", this);
    419422        return;
     
    425428    }
    426429
    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);
    432449        return;
    433450    }
     
    447464    }
    448465
    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);
    450467    // We may have got to this point by restarting a snapshotted plug-in, in which case we don't want to
    451468    // reset the display state.
Note: See TracChangeset for help on using the changeset viewer.