[CherryPick] [EFL][Qt][WK2] Fixed position elements are not always fixed
authorkenneth@webkit.org <kenneth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Dec 2012 00:04:52 +0000 (00:04 +0000)
committerHurnjoo Lee <hurnjoo.lee@samsung.com>
Fri, 3 May 2013 02:35:06 +0000 (11:35 +0900)
[Issue#] N_SE-36822
[Problem] Display error occur when go to " http://www.samsung.com/global/ativ/ativ_s.html
[Cause] Fixed position elements are not always fixed
[Solution] Cherry picked.

[EFL][Qt][WK2] Fixed position elements are not always fixed
https://bugs.webkit.org/show_bug.cgi?id=103452

Reviewed by Simon Fraser.

The code figuring out whether fixed position layers are inside
the visible viewport, assumes that the visible viewport is always
the size of the layout viewport. This assumption doesn't hold with
how the Qt and EFL tiled backing store and coordinated graphics
works, so instead using the visibleContentsRect(), which provides
the right values in all cases.

* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::requiresCompositingForPosition):

    Use visibleContentsRect instead of scrollOffsetForFixedPosition().

    scrollOffsetForFixedPosition() is needed sometimes in the Mac code
    because visibleContentRect() will return negative offsets when you
    are in the rubber-band phase of a scroll on the Mac.

    However that is not an issue here.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@136452 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Conflicts:
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayerCompositor.cpp

Change-Id: Ia2fcdcc376e3cf72edd016ae574b062c0f0e32cf

Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebCore/rendering/RenderLayerCompositor.h

index 548186d..2049a15 100644 (file)
@@ -640,7 +640,7 @@ void RenderLayerCompositor::repaintInCompositedAncestor(RenderLayer* layer, cons
 
 // The bounds of the GraphicsLayer created for a compositing layer is the union of the bounds of all the descendant
 // RenderLayers that are rendered by the composited RenderLayer.
-IntRect RenderLayerCompositor::calculateCompositedBounds(const RenderLayer* layer, const RenderLayer* ancestorLayer)
+IntRect RenderLayerCompositor::calculateCompositedBounds(const RenderLayer* layer, const RenderLayer* ancestorLayer) const
 {
     if (!canBeComposited(layer))
         return IntRect();
@@ -1892,9 +1892,12 @@ bool RenderLayerCompositor::requiresCompositingForPosition(RenderObject* rendere
         return false;
 
     // Fixed position elements that are invisible in the current view don't get their own layer.
-    FrameView* frameView = m_renderView->frameView();
-    if (frameView && !layer->absoluteBoundingBox().intersects(IntRect(IntPoint(frameView->scrollOffsetForFixedPosition()), frameView->layoutSize())))
-        return false;
+    if (FrameView* frameView = m_renderView->frameView()) {
+        IntRect viewBounds = frameView->visibleContentRect();
+        IntRect layerBounds = calculateCompositedBounds(layer, rootRenderLayer());
+        if (!viewBounds.intersects(layerBounds))
+            return false;
+    }
 
     return true;
 }
index 6e145dd..41e1c97 100644 (file)
@@ -123,7 +123,7 @@ public:
     bool needsContentsCompositingLayer(const RenderLayer*) const;
     // Return the bounding box required for compositing layer and its childern, relative to ancestorLayer.
     // If layerBoundingBox is not 0, on return it contains the bounding box of this layer only.
-    IntRect calculateCompositedBounds(const RenderLayer*, const RenderLayer* ancestorLayer);
+    IntRect calculateCompositedBounds(const RenderLayer*, const RenderLayer* ancestorLayer) const;
 
     // Repaint the appropriate layers when the given RenderLayer starts or stops being composited.
     void repaintOnCompositingChange(RenderLayer*);