Upstream version 7.35.139.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / rendering / compositing / CompositedLayerMapping.cpp
index f03f626..1899c7f 100644 (file)
@@ -587,7 +587,9 @@ void CompositedLayerMapping::adjustBoundsForSubPixelAccumulation(const RenderLay
 {
     LayoutRect localRawCompositingBounds = compositedBounds();
     LayoutPoint rawDelta = computeOffsetFromCompositedAncestor(&m_owningLayer, compositedAncestor);
-    delta = flooredIntPoint(rawDelta);
+    // We call toInt and not floor here because toInt truncates, but floor will floor negative numbers
+    // down e.g. floor(-1.1) would become -2.
+    delta = IntPoint(rawDelta.x().toInt(), rawDelta.y().toInt());
     m_subpixelAccumulation = toLayoutSize(rawDelta).fraction();
     RELEASE_ASSERT(m_subpixelAccumulation.width() < 1 && m_subpixelAccumulation.height() < 1);
 
@@ -724,7 +726,9 @@ GraphicsLayerUpdater::UpdateType CompositedLayerMapping::updateGraphicsLayerGeom
     }
 
     if (compAncestor && m_ancestorClippingLayer) {
-        ClipRectsContext clipRectsContext(compAncestor, CompositingClipRects, IgnoreOverlayScrollbarSize, IgnoreOverflowClip);
+        // FIXME: this should use cached clip rects, but this sometimes give
+        // inaccurate results (and trips the ASSERTS in RenderLayerClipper).
+        ClipRectsContext clipRectsContext(compAncestor, TemporaryClipRects, IgnoreOverlayScrollbarSize, IgnoreOverflowClip);
         IntRect parentClipRect = pixelSnappedIntRect(m_owningLayer.clipper().backgroundClipRect(clipRectsContext).rect());
         ASSERT(parentClipRect != PaintInfo::infiniteRect());
         m_ancestorClippingLayer->setPosition(FloatPoint(parentClipRect.location() - graphicsLayerParentLocation));
@@ -1286,9 +1290,16 @@ bool CompositedLayerMapping::updateForegroundLayer(bool needsForegroundLayer)
             m_foregroundLayer = createGraphicsLayer(CompositingReasonLayerForForeground);
             m_foregroundLayer->setDrawsContent(true);
             m_foregroundLayer->setPaintingPhase(GraphicsLayerPaintForeground);
+            // If the foreground layer pops content out of the graphics
+            // layer, then the graphics layer needs to be repainted.
+            // FIXME: This is conservative, as m_foregroundLayer could
+            // be smaller than m_graphicsLayer due to clipping.
+            m_graphicsLayer->setNeedsDisplay();
             layerChanged = true;
         }
     } else if (m_foregroundLayer) {
+        FloatRect repaintRect(FloatPoint(), m_foregroundLayer->size());
+        m_graphicsLayer->setNeedsDisplayInRect(repaintRect);
         m_foregroundLayer->removeFromParent();
         m_foregroundLayer = nullptr;
         layerChanged = true;