Changeset 167441 in webkit


Ignore:
Timestamp:
Apr 17, 2014 10:59:26 AM (10 years ago)
Author:
jer.noble@apple.com
Message:

Fullscreen media controls are unusable in pagination mode
https://bugs.webkit.org/show_bug.cgi?id=131705

Reviewed by Darin Adler.

Source/WebCore:
When pagination mode is enabled, the full screen media will (depending on the width of the
pagination columns) overflow its column, and hit testing will be clipped to the column. In extreme
cases, where the column width < 0.5 * media element width, the media controls will be entirely
unclickable.

Rather than making the RenderFullScreen a child of the full screen element's parent's renderer,
make it a child of the RenderView, putting it outside of the columns entirely. Always create and
insert the fullscreenRenderer's placeholder, using it as the remembered insertion point for the
fullscreen element's renderer when we exit full screen.

Drive-by fix: don't wrap the full screen element's renderer in webkitWillEnterFullScreenForElement();
it will just be re-wrapped in createRendererIfNeeded().

  • dom/Document.cpp:

(WebCore::Document::webkitWillEnterFullScreenForElement): Don't wrap the full screen element's renderer.
(WebCore::Document::setFullScreenRenderer): Call setPlaceholderStyle.

  • rendering/RenderFullScreen.cpp:

(WebCore::RenderFullScreenPlaceholder::willBeDestroyed): Call clearPlaceholder.
(WebCore::RenderFullScreen::wrapRenderer): Make fullscreenRenderer a child of the view().
(WebCore::RenderFullScreen::unwrapRenderer): Return the children to the parent of the placeholder().
(WebCore::RenderFullScreen::clearPlaceholder): Renamed from setPlaceholder().
(WebCore::RenderFullScreen::ensurePlaceholder): Added.
(WebCore::RenderFullScreen::setPlaceholderStyle): Renamed from createPlaceholder().
(WebCore::RenderFullScreen::setPlaceholder): Deleted.
(WebCore::RenderFullScreen::createPlaceholder): Deleted.

  • rendering/RenderFullScreen.h:

LayoutTests:

  • fullscreen/full-screen-no-style-sharing-expected.txt: Rebaselined.
  • fullscreen/video-cursor-auto-hide.html: Corrected test to move cursor

to the middle of the video element.

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r167440 r167441  
     12014-04-16  Jer Noble  <jer.noble@apple.com>
     2
     3        Fullscreen media controls are unusable in pagination mode
     4        https://bugs.webkit.org/show_bug.cgi?id=131705
     5
     6        Reviewed by Darin Adler.
     7
     8        * fullscreen/full-screen-no-style-sharing-expected.txt: Rebaselined.
     9        * fullscreen/video-cursor-auto-hide.html: Corrected test to move cursor
     10            to the middle of the video element.
     11
    1122014-04-16  Jer Noble  <jer.noble@apple.com>
    213
  • trunk/LayoutTests/fullscreen/full-screen-no-style-sharing-expected.txt

    r158743 r167441  
    1  
     1  
    22EVENT(webkitfullscreenchange) TEST(video2.clientWidth==document.body.clientWidth) OK
    33END OF TEST
  • trunk/LayoutTests/fullscreen/video-cursor-auto-hide.html

    r158113 r167441  
    77    <script>
    88        var wrapper = document.getElementById('wrapper');
     9        var video = document.getElementById('video');
    910
    1011        function checkForHiddenMouse()
     
    1819            if (window.internals) {
    1920                internals.settings.setTimeWithoutMouseMovementBeforeHidingControls(0);
    20                 wrapperBox = internals.boundingBox(wrapper);
    21                 eventSender.mouseMoveTo(wrapperBox.left + wrapperBox.width / 2, wrapperBox.top + wrapperBox.height / 2);
     21                videoBox = internals.boundingBox(video);
     22                eventSender.mouseMoveTo(videoBox.left + videoBox.width / 2, videoBox.top + videoBox.height / 2);
    2223                testExpected('window.internals.getCurrentCursorInfo()', 'type=Pointer hotSpot=0,0');
    2324                setTimeout(checkForHiddenMouse, 0);
  • trunk/Source/WebCore/ChangeLog

    r167440 r167441  
     12014-04-15  Jer Noble  <jer.noble@apple.com>
     2
     3        Fullscreen media controls are unusable in pagination mode
     4        https://bugs.webkit.org/show_bug.cgi?id=131705
     5
     6        Reviewed by Darin Adler.
     7
     8        When pagination mode is enabled, the full screen media will (depending on the width of the
     9        pagination columns) overflow its column, and hit testing will be clipped to the column. In extreme
     10        cases, where the column width < 0.5 * media element width, the media controls will be entirely
     11        unclickable.
     12
     13        Rather than making the RenderFullScreen a child of the full screen element's parent's renderer,
     14        make it a child of the RenderView, putting it outside of the columns entirely. Always create and
     15        insert the fullscreenRenderer's placeholder, using it as the remembered insertion point for the
     16        fullscreen element's renderer when we exit full screen.
     17
     18        Drive-by fix: don't wrap the full screen element's renderer in webkitWillEnterFullScreenForElement();
     19        it will just be re-wrapped in createRendererIfNeeded().
     20
     21        * dom/Document.cpp:
     22        (WebCore::Document::webkitWillEnterFullScreenForElement): Don't wrap the full screen element's renderer.
     23        (WebCore::Document::setFullScreenRenderer): Call setPlaceholderStyle.
     24        * rendering/RenderFullScreen.cpp:
     25        (WebCore::RenderFullScreenPlaceholder::willBeDestroyed): Call clearPlaceholder.
     26        (WebCore::RenderFullScreen::wrapRenderer): Make fullscreenRenderer a child of the view().
     27        (WebCore::RenderFullScreen::unwrapRenderer): Return the children to the parent of the placeholder().
     28        (WebCore::RenderFullScreen::clearPlaceholder): Renamed from setPlaceholder().
     29        (WebCore::RenderFullScreen::ensurePlaceholder): Added.
     30        (WebCore::RenderFullScreen::setPlaceholderStyle): Renamed from createPlaceholder().
     31        (WebCore::RenderFullScreen::setPlaceholder): Deleted.
     32        (WebCore::RenderFullScreen::createPlaceholder): Deleted.
     33        * rendering/RenderFullScreen.h:
     34
    1352014-04-16  Jer Noble  <jer.noble@apple.com>
    236
  • trunk/Source/WebCore/dom/Document.cpp

    r167406 r167441  
    53665366    }
    53675367
    5368     if (m_fullScreenElement != documentElement())
    5369         RenderFullScreen::wrapRenderer(renderer, renderer ? renderer->parent() : nullptr, *this);
    5370 
    53715368    m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(true);
    53725369   
     
    54335430
    54345431    if (renderer && m_savedPlaceholderRenderStyle)
    5435         renderer->createPlaceholder(m_savedPlaceholderRenderStyle.releaseNonNull(), m_savedPlaceholderFrameRect);
     5432        renderer->setPlaceholderStyle(m_savedPlaceholderRenderStyle.releaseNonNull(), m_savedPlaceholderFrameRect);
    54365433    else if (renderer && m_fullScreenRenderer && m_fullScreenRenderer->placeholder()) {
    54375434        RenderBlock* placeholder = m_fullScreenRenderer->placeholder();
    5438         renderer->createPlaceholder(RenderStyle::clone(&placeholder->style()), placeholder->frameRect());
     5435        renderer->setPlaceholderStyle(RenderStyle::clone(&placeholder->style()), placeholder->frameRect());
    54395436    }
    54405437
  • trunk/Source/WebCore/rendering/RenderFullScreen.cpp

    r163079 r167441  
    3232#include "RenderLayer.h"
    3333#include "RenderLayerCompositor.h"
     34#include "RenderView.h"
    3435
    3536namespace WebCore {
     
    5152void RenderFullScreenPlaceholder::willBeDestroyed()
    5253{
    53     m_owner.setPlaceholder(0);
     54    m_owner.clearPlaceholder();
    5455    RenderBlockFlow::willBeDestroyed();
    5556}
     
    105106}
    106107
    107 RenderFullScreen* RenderFullScreen::wrapRenderer(RenderObject* object, RenderElement* parent, Document& document)
     108RenderElement* RenderFullScreen::wrapRenderer(RenderObject* object, RenderElement* parent, Document& document)
    108109{
    109110    RenderFullScreen* fullscreenRenderer = new RenderFullScreen(document, createFullScreenStyle());
     
    119120            RenderBlock* containingBlock = object->containingBlock();
    120121            ASSERT(containingBlock);
     122
    121123            // Since we are moving the |object| to a new parent |fullscreenRenderer|,
    122124            // the line box tree underneath our |containingBlock| is not longer valid.
    123125            containingBlock->deleteLines();
    124126
    125             parent->addChild(fullscreenRenderer, object);
     127            parent->addChild(fullscreenRenderer->ensurePlaceholder(), object);
    126128            object->removeFromParent();
    127129           
     
    132134            containingBlock->setNeedsLayoutAndPrefWidthsRecalc();
    133135        }
     136
     137        object->view().addChild(fullscreenRenderer);
    134138        fullscreenRenderer->addChild(object);
    135         fullscreenRenderer->setNeedsLayoutAndPrefWidthsRecalc();
    136139    }
    137140    document.setFullScreenRenderer(fullscreenRenderer);
    138     return fullscreenRenderer;
     141    return fullscreenRenderer->ensurePlaceholder();
    139142}
    140143
    141144void RenderFullScreen::unwrapRenderer()
    142145{
    143     if (parent()) {
     146    if (placeholder() && placeholder()->parent()) {
    144147        RenderObject* child;
    145148        while ((child = firstChild())) {
     
    150153                toRenderBox(child)->clearOverrideSize();
    151154            child->removeFromParent();
    152             parent()->addChild(child, this);
    153             parent()->setNeedsLayoutAndPrefWidthsRecalc();
     155            placeholder()->parent()->addChild(child, m_placeholder);
    154156        }
     157
     158        placeholder()->removeFromParent();
    155159    }
    156     if (placeholder())
    157         placeholder()->removeFromParent();
    158160    removeFromParent();
    159161    document().setFullScreenRenderer(0);
    160162}
    161163
    162 void RenderFullScreen::setPlaceholder(RenderBlock* placeholder)
     164void RenderFullScreen::clearPlaceholder()
    163165{
    164     m_placeholder = placeholder;
     166    m_placeholder = nullptr;
    165167}
    166168
    167 void RenderFullScreen::createPlaceholder(PassRef<RenderStyle> style, const LayoutRect& frameRect)
     169RenderBlock* RenderFullScreen::ensurePlaceholder()
     170{
     171    if (m_placeholder)
     172        return m_placeholder;
     173
     174    m_placeholder = new RenderFullScreenPlaceholder(*this, RenderStyle::create());
     175    m_placeholder->initializeStyle();
     176    return m_placeholder;
     177}
     178
     179void RenderFullScreen::setPlaceholderStyle(PassRef<RenderStyle> style, const LayoutRect& frameRect)
    168180{
    169181    if (style.get().width().isAuto())
     
    172184        style.get().setHeight(Length(frameRect.height(), Fixed));
    173185
    174     if (m_placeholder) {
    175         m_placeholder->setStyle(std::move(style));
    176         return;
    177     }
    178 
    179     m_placeholder = new RenderFullScreenPlaceholder(*this, std::move(style));
    180     m_placeholder->initializeStyle();
    181     if (parent()) {
    182         parent()->addChild(m_placeholder, this);
    183         parent()->setNeedsLayoutAndPrefWidthsRecalc();
    184     }
     186    ensurePlaceholder()->setStyle(std::move(style));
    185187}
    186188
  • trunk/Source/WebCore/rendering/RenderFullScreen.h

    r162158 r167441  
    4040    virtual const char* renderName() const override { return "RenderFullScreen"; }
    4141
    42     void setPlaceholder(RenderBlock*);
     42    void clearPlaceholder();
     43    RenderBlock* ensurePlaceholder();
    4344    RenderBlock* placeholder() { return m_placeholder; }
    44     void createPlaceholder(PassRef<RenderStyle>, const LayoutRect& frameRect);
     45    void setPlaceholderStyle(PassRef<RenderStyle>, const LayoutRect& frameRect);
    4546
    46     static RenderFullScreen* wrapRenderer(RenderObject*, RenderElement*, Document&);
     47    static RenderElement* wrapRenderer(RenderObject*, RenderElement*, Document&);
    4748    void unwrapRenderer();
    4849
Note: See TracChangeset for help on using the changeset viewer.