Changeset 201001 in webkit


Ignore:
Timestamp:
May 17, 2016 1:46:49 AM (8 years ago)
Author:
bshafiei@apple.com
Message:

Merge r200778. rdar://problem/25840861

Location:
branches/safari-602.1.32-branch
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-602.1.32-branch/LayoutTests/ChangeLog

    r200590 r201001  
     12016-05-17  Babak Shafiei  <bshafiei@apple.com>
     2
     3        Merge r200778. rdar://problem/25840861
     4
     5    2016-05-12  Eric Carlson  <eric.carlson@apple.com>
     6
     7            Adjust "main content" video heuristic
     8            https://bugs.webkit.org/show_bug.cgi?id=157532
     9
     10            Reviewed by Darin Adler.
     11
     12            * media/video-main-content-allow.html:
     13            * media/video-main-content-autoplay-expected.txt: Added.
     14            * media/video-main-content-autoplay.html: Added.
     15            * media/video-main-content-deny-too-small.html:
     16
    1172016-05-09  Simon Fraser  <simon.fraser@apple.com>
    218
  • branches/safari-602.1.32-branch/LayoutTests/media/video-main-content-allow.html

    r197953 r201001  
    2323    <style>
    2424    video {
    25         width: 600px;
    26         height: 400px;
     25        width: 270px;
     26        height: 480px;
    2727    }
    2828    </style>
  • branches/safari-602.1.32-branch/LayoutTests/media/video-main-content-deny-too-small.html

    r197953 r201001  
    88    function go() {
    99        video = document.createElement('video');
     10        video.controls = ""
    1011        run('internals.setMediaElementRestrictions(video, "RequireUserGestureForVideoRateChange,OverrideUserGestureRequirementForMainContent")');
    1112        document.body.appendChild(video);
     
    2829    <style>
    2930    video {
    30         width: 200px;
    31         height: 100px;
     31        width: 400px;
     32        height: 299px;
    3233    }
    3334    </style>
  • branches/safari-602.1.32-branch/Source/WebCore/ChangeLog

    r200989 r201001  
     12016-05-17  Babak Shafiei  <bshafiei@apple.com>
     2
     3        Merge r200778. rdar://problem/25840861
     4
     5    2016-05-12  Eric Carlson  <eric.carlson@apple.com>
     6
     7            Adjust "main content" video heuristic
     8            https://bugs.webkit.org/show_bug.cgi?id=157532
     9            <rdar://problem/25840861>
     10
     11            Reviewed by Darin Adler.
     12
     13            Test: media/video-main-content-autoplay.html, plus existing tests updated.
     14
     15            * html/MediaElementSession.cpp:
     16            (WebCore::MediaElementSession::canControlControlsManager): Use isElementLargeEnoughForMainContent.
     17            (WebCore::isMainContent): Ditto.
     18            (WebCore::isElementLargeEnoughForMainContent): Check video area and aspect ratio.
     19            (WebCore::MediaElementSession::mainContentCheckTimerFired): Call result.setToNonUserAgentShadowAncestor
     20              so it doesn't hit test the video controls in the shadow DOM.
     21
    1222016-05-16  Dean Jackson  <dino@apple.com>
    223
  • branches/safari-602.1.32-branch/Source/WebCore/html/MediaElementSession.cpp

    r200540 r201001  
    5555namespace WebCore {
    5656
    57 static const int elementMainContentMinimumWidth = 400;
    58 static const int elementMainContentMinimumHeight = 300;
    5957static const double elementMainContentCheckInterval = .250;
    6058
    6159static bool isMainContent(const HTMLMediaElement&);
     60static bool isElementLargeEnoughForMainContent(const HTMLMediaElement&);
    6261
    6362#if !LOG_DISABLED
     
    225224        return false;
    226225
    227     if (element.hasVideo() && renderer->clientWidth() >= elementMainContentMinimumWidth && renderer->clientHeight() >= elementMainContentMinimumHeight)
    228             return true;
     226    if (isElementLargeEnoughForMainContent(element))
     227        return true;
    229228
    230229    if (ScriptController::processingUserGestureForMedia())
     
    507506        return false;
    508507
    509     if (renderer->clientWidth() < elementMainContentMinimumWidth
    510         || renderer->clientHeight() < elementMainContentMinimumHeight)
     508    if (!isElementLargeEnoughForMainContent(element))
    511509        return false;
    512510
     
    536534    // Elements which are obscured by other elements cannot be main content.
    537535    mainRenderView.hitTest(request, result);
     536    result.setToNonUserAgentShadowAncestor();
    538537    Element* hitElement = result.innerElement();
    539538    if (hitElement != &element)
     
    543542}
    544543
     544static bool isElementLargeEnoughForMainContent(const HTMLMediaElement& element)
     545{
     546    static const double elementMainContentAreaMinimum = 400 * 300;
     547    static const double maximumAspectRatio = 1.8; // Slightly larger than 16:9.
     548    static const double minimumAspectRatio = .5; // Slightly smaller than 16:9.
     549
     550    // Elements which have not yet been laid out, or which are not yet in the DOM, cannot be main content.
     551    RenderBox* renderer = downcast<RenderBox>(element.renderer());
     552    if (!renderer)
     553        return false;
     554
     555    double width = renderer->clientWidth();
     556    double height = renderer->clientHeight();
     557    double area = width * height;
     558    double aspectRatio = width / height;
     559    return area >= elementMainContentAreaMinimum && aspectRatio >= minimumAspectRatio && aspectRatio <= maximumAspectRatio;
     560}
     561
    545562void MediaElementSession::mainContentCheckTimerFired()
    546563{
Note: See TracChangeset for help on using the changeset viewer.