Commit 7071b53f authored by zeeshanq@chromium.org's avatar zeeshanq@chromium.org

Report correct touch hit rects when

RuntimeEnabledFeatures::overlayFullscreenVideoEnabled is true and have a touch
handler on the document or body.

We had an optimization in the cc touch hit rect calculation that if there was a
handler on the document or body then we'd short circuit the computation and
report a single rect at the root layer covering the whole page. Now when making
an HTML5 video element fullscreen with this flag turned on the
RenderLayerCompositor removes the root cc::layer and reattaches the video layer
causing the compositor to think that there are no handlers registered.


BUG=372314

Review URL: https://codereview.chromium.org/317373007

git-svn-id: svn://svn.chromium.org/blink/trunk@176071 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent b981fd6e
This test makes sure that touch hit rects are reported for fullscreen HTML5 video control elements even when there is a document handler.
Should have single rect on document before fullscreen
handler: #document (0, 0, 800, 600)
EVENT(webkitfullscreenchange)
Should keep rect on document
handler: #document (0, 0, 800, 600)
END OF TEST
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="../fast/events/touch/resources/compositor-touch-hit-rects.css">
</head>
<body>
<p id="discription">
This test makes sure that touch hit rects are reported for fullscreen HTML5
video control elements even when there is a document handler.
</p>
<video id="video" width="300"></video>
<script src="full-screen-test.js"></script>
<script src="../fast/events/touch/resources/compositor-touch-hit-rects.js"></script>
<script>
var log = consoleWrite;
if (window.testRunner)
testRunner.dumpAsText();
window.onload = function () {
document.addEventListener('touchstart', function() { });
consoleWrite("Should have single rect on document before fullscreen");
logRects('handler');
waitForEvent(document, 'webkitfullscreenchange', function() {
if (window.internals.runtimeFlags.overlayFullscreenVideoEnabled)
consoleWrite("Should report another rect which is not on the document");
else
consoleWrite("Should keep rect on document");
logRects('handler');
endTest();
});
runWithKeyDown(function(){document.querySelector('#video').webkitRequestFullScreen()});
}
</script>
</body>
</html>
This test makes sure that touch hit rects are reported for fullscreen HTML5 video control elements even when there is a document handler.
Should have single rect on document before fullscreen
handler: #document (0, 0, 800, 600)
EVENT(webkitfullscreenchange)
Should report another rect which is not on the document
handler: DIV (42, 3, 671, 24)
END OF TEST
...@@ -793,13 +793,19 @@ static void accumulateDocumentTouchEventTargetRects(LayerHitTestRects& rects, co ...@@ -793,13 +793,19 @@ static void accumulateDocumentTouchEventTargetRects(LayerHitTestRects& rects, co
// then we can quickly mark the entire document and skip looking at any other handlers. // then we can quickly mark the entire document and skip looking at any other handlers.
// Note that technically a handler on the body doesn't cover the whole document, but it's // Note that technically a handler on the body doesn't cover the whole document, but it's
// reasonable to be conservative and report the whole document anyway. // reasonable to be conservative and report the whole document anyway.
for (TouchEventTargetSet::const_iterator iter = targets->begin(); iter != targets->end(); ++iter) { //
Node* target = iter->key; // Fullscreen HTML5 video when OverlayFullscreenVideo is enabled is implemented by replacing the
if (target == document || target == document->documentElement() || target == document->body()) { // root cc::layer with the video layer so doing this optimization causes the compositor to think
if (RenderView* rendererView = document->renderView()) { // that there are no handlers, therefore skip it.
rendererView->computeLayerHitTestRects(rects); if (!document->renderView()->compositor()->inOverlayFullscreenVideo()) {
for (TouchEventTargetSet::const_iterator iter = targets->begin(); iter != targets->end(); ++iter) {
Node* target = iter->key;
if (target == document || target == document->documentElement() || target == document->body()) {
if (RenderView* rendererView = document->renderView()) {
rendererView->computeLayerHitTestRects(rects);
}
return;
} }
return;
} }
} }
...@@ -808,8 +814,7 @@ static void accumulateDocumentTouchEventTargetRects(LayerHitTestRects& rects, co ...@@ -808,8 +814,7 @@ static void accumulateDocumentTouchEventTargetRects(LayerHitTestRects& rects, co
if (!target->inDocument()) if (!target->inDocument())
continue; continue;
if (target->isDocumentNode()) { if (target->isDocumentNode() && target != document) {
ASSERT(target != document);
accumulateDocumentTouchEventTargetRects(rects, toDocument(target)); accumulateDocumentTouchEventTargetRects(rects, toDocument(target));
} else if (RenderObject* renderer = target->renderer()) { } else if (RenderObject* renderer = target->renderer()) {
// If the set also contains one of our ancestor nodes then processing // If the set also contains one of our ancestor nodes then processing
......
...@@ -67,6 +67,7 @@ RenderLayerCompositor::RenderLayerCompositor(RenderView& renderView) ...@@ -67,6 +67,7 @@ RenderLayerCompositor::RenderLayerCompositor(RenderView& renderView)
, m_needsUpdateFixedBackground(false) , m_needsUpdateFixedBackground(false)
, m_isTrackingRepaints(false) , m_isTrackingRepaints(false)
, m_rootLayerAttachment(RootLayerUnattached) , m_rootLayerAttachment(RootLayerUnattached)
, m_inOverlayFullscreenVideo(false)
{ {
updateAcceleratedCompositingSettings(); updateAcceleratedCompositingSettings();
} }
...@@ -256,6 +257,7 @@ void RenderLayerCompositor::assertNoUnresolvedDirtyBits() ...@@ -256,6 +257,7 @@ void RenderLayerCompositor::assertNoUnresolvedDirtyBits()
void RenderLayerCompositor::applyOverlayFullscreenVideoAdjustment() void RenderLayerCompositor::applyOverlayFullscreenVideoAdjustment()
{ {
m_inOverlayFullscreenVideo = false;
if (!m_rootContentLayer) if (!m_rootContentLayer)
return; return;
...@@ -284,6 +286,7 @@ void RenderLayerCompositor::applyOverlayFullscreenVideoAdjustment() ...@@ -284,6 +286,7 @@ void RenderLayerCompositor::applyOverlayFullscreenVideoAdjustment()
m_overflowControlsHostLayer->addChild(videoLayer); m_overflowControlsHostLayer->addChild(videoLayer);
if (GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer()) if (GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer())
backgroundLayer->removeFromParent(); backgroundLayer->removeFromParent();
m_inOverlayFullscreenVideo = true;
} }
void RenderLayerCompositor::updateIfNeeded() void RenderLayerCompositor::updateIfNeeded()
......
...@@ -183,6 +183,8 @@ public: ...@@ -183,6 +183,8 @@ public:
void setOverlayLayer(GraphicsLayer*); void setOverlayLayer(GraphicsLayer*);
bool inOverlayFullscreenVideo() const { return m_inOverlayFullscreenVideo; }
private: private:
class OverlapMap; class OverlapMap;
...@@ -274,6 +276,8 @@ private: ...@@ -274,6 +276,8 @@ private:
#if USE(RUBBER_BANDING) #if USE(RUBBER_BANDING)
OwnPtr<GraphicsLayer> m_layerForOverhangShadow; OwnPtr<GraphicsLayer> m_layerForOverhangShadow;
#endif #endif
bool m_inOverlayFullscreenVideo;
}; };
} // namespace WebCore } // namespace WebCore
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment