| OLD | NEW | 
|     1 /* |     1 /* | 
|     2  * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. |     2  * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. | 
|     3  * |     3  * | 
|     4  * Redistribution and use in source and binary forms, with or without |     4  * Redistribution and use in source and binary forms, with or without | 
|     5  * modification, are permitted provided that the following conditions |     5  * modification, are permitted provided that the following conditions | 
|     6  * are met: |     6  * are met: | 
|     7  * 1. Redistributions of source code must retain the above copyright |     7  * 1. Redistributions of source code must retain the above copyright | 
|     8  *    notice, this list of conditions and the following disclaimer. |     8  *    notice, this list of conditions and the following disclaimer. | 
|     9  * 2. Redistributions in binary form must reproduce the above copyright |     9  * 2. Redistributions in binary form must reproduce the above copyright | 
|    10  *    notice, this list of conditions and the following disclaimer in the |    10  *    notice, this list of conditions and the following disclaimer in the | 
| (...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1102       // The controls are in the same 2D space as the compositing container, so |  1102       // The controls are in the same 2D space as the compositing container, so | 
|  1103       // we can map them into the space of the container. |  1103       // we can map them into the space of the container. | 
|  1104       TransformState transformState(TransformState::ApplyTransformDirection, |  1104       TransformState transformState(TransformState::ApplyTransformDirection, | 
|  1105                                     FloatPoint()); |  1105                                     FloatPoint()); | 
|  1106       m_owningLayer.layoutObject()->mapLocalToAncestor( |  1106       m_owningLayer.layoutObject()->mapLocalToAncestor( | 
|  1107           compositingStackingContext->layoutObject(), transformState, |  1107           compositingStackingContext->layoutObject(), transformState, | 
|  1108           ApplyContainerFlip); |  1108           ApplyContainerFlip); | 
|  1109       transformState.flatten(); |  1109       transformState.flatten(); | 
|  1110       hostLayerPosition = LayoutPoint(transformState.lastPlanarPoint()); |  1110       hostLayerPosition = LayoutPoint(transformState.lastPlanarPoint()); | 
|  1111       if (PaintLayerScrollableArea* scrollableArea = |  1111       if (PaintLayerScrollableArea* scrollableArea = | 
|  1112               compositingStackingContext->getScrollableArea()) |  1112               compositingStackingContext->getScrollableArea()) { | 
|  1113         hostLayerPosition.move( |  1113         hostLayerPosition.move( | 
|  1114             LayoutSize(scrollableArea->adjustedScrollOffset())); |  1114             LayoutSize(toFloatSize(scrollableArea->scrollPosition()))); | 
 |  1115       } | 
|  1115       hostLayerPosition.move(-stackingOffsetFromLayoutObject); |  1116       hostLayerPosition.move(-stackingOffsetFromLayoutObject); | 
|  1116     } |  1117     } | 
|  1117   } else { |  1118   } else { | 
|  1118     hostLayerPosition.move(-m_graphicsLayer->offsetFromLayoutObject()); |  1119     hostLayerPosition.move(-m_graphicsLayer->offsetFromLayoutObject()); | 
|  1119   } |  1120   } | 
|  1120  |  1121  | 
|  1121   m_overflowControlsHostLayer->setPosition(FloatPoint(hostLayerPosition)); |  1122   m_overflowControlsHostLayer->setPosition(FloatPoint(hostLayerPosition)); | 
|  1122  |  1123  | 
|  1123   const IntRect borderBox = |  1124   const IntRect borderBox = | 
|  1124       toLayoutBox(m_owningLayer.layoutObject())->pixelSnappedBorderBoxRect(); |  1125       toLayoutBox(m_owningLayer.layoutObject())->pixelSnappedBorderBoxRect(); | 
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1214  |  1215  | 
|  1215 void CompositedLayerMapping::updateScrollingLayerGeometry( |  1216 void CompositedLayerMapping::updateScrollingLayerGeometry( | 
|  1216     const IntRect& localCompositingBounds) { |  1217     const IntRect& localCompositingBounds) { | 
|  1217   if (!m_scrollingLayer) |  1218   if (!m_scrollingLayer) | 
|  1218     return; |  1219     return; | 
|  1219  |  1220  | 
|  1220   ASSERT(m_scrollingContentsLayer); |  1221   ASSERT(m_scrollingContentsLayer); | 
|  1221   LayoutBox* layoutBox = toLayoutBox(layoutObject()); |  1222   LayoutBox* layoutBox = toLayoutBox(layoutObject()); | 
|  1222   IntRect overflowClipRect = |  1223   IntRect overflowClipRect = | 
|  1223       enclosingIntRect(layoutBox->overflowClipRect(LayoutPoint())); |  1224       enclosingIntRect(layoutBox->overflowClipRect(LayoutPoint())); | 
|  1224   DoubleSize adjustedScrollOffset = |  1225   FloatPoint scrollPosition = | 
|  1225       m_owningLayer.getScrollableArea()->adjustedScrollOffset(); |  1226       m_owningLayer.getScrollableArea()->scrollPosition(); | 
|  1226   m_scrollingLayer->setPosition(FloatPoint( |  1227   m_scrollingLayer->setPosition(FloatPoint( | 
|  1227       overflowClipRect.location() - localCompositingBounds.location() + |  1228       overflowClipRect.location() - localCompositingBounds.location() + | 
|  1228       roundedIntSize(m_owningLayer.subpixelAccumulation()))); |  1229       roundedIntSize(m_owningLayer.subpixelAccumulation()))); | 
|  1229   m_scrollingLayer->setSize(FloatSize(overflowClipRect.size())); |  1230   m_scrollingLayer->setSize(FloatSize(overflowClipRect.size())); | 
|  1230  |  1231  | 
|  1231   IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromLayoutObject(); |  1232   IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromLayoutObject(); | 
|  1232   m_scrollingLayer->setOffsetFromLayoutObject( |  1233   m_scrollingLayer->setOffsetFromLayoutObject( | 
|  1233       -toIntSize(overflowClipRect.location())); |  1234       -toIntSize(overflowClipRect.location())); | 
|  1234  |  1235  | 
|  1235   if (m_childClippingMaskLayer && !layoutObject()->style()->clipPath()) { |  1236   if (m_childClippingMaskLayer && !layoutObject()->style()->clipPath()) { | 
|  1236     m_childClippingMaskLayer->setPosition(m_scrollingLayer->position()); |  1237     m_childClippingMaskLayer->setPosition(m_scrollingLayer->position()); | 
|  1237     m_childClippingMaskLayer->setSize(m_scrollingLayer->size()); |  1238     m_childClippingMaskLayer->setSize(m_scrollingLayer->size()); | 
|  1238     m_childClippingMaskLayer->setOffsetFromLayoutObject( |  1239     m_childClippingMaskLayer->setOffsetFromLayoutObject( | 
|  1239         toIntSize(overflowClipRect.location())); |  1240         toIntSize(overflowClipRect.location())); | 
|  1240   } |  1241   } | 
|  1241  |  1242  | 
|  1242   bool overflowClipRectOffsetChanged = |  1243   bool overflowClipRectOffsetChanged = | 
|  1243       oldScrollingLayerOffset != m_scrollingLayer->offsetFromLayoutObject(); |  1244       oldScrollingLayerOffset != m_scrollingLayer->offsetFromLayoutObject(); | 
|  1244  |  1245  | 
|  1245   IntSize scrollSize(layoutBox->scrollWidth().toInt(), |  1246   IntSize scrollSize(layoutBox->scrollWidth().toInt(), | 
|  1246                      layoutBox->scrollHeight().toInt()); |  1247                      layoutBox->scrollHeight().toInt()); | 
|  1247   if (scrollSize != m_scrollingContentsLayer->size() || |  1248   if (scrollSize != m_scrollingContentsLayer->size() || | 
|  1248       overflowClipRectOffsetChanged) |  1249       overflowClipRectOffsetChanged) | 
|  1249     m_scrollingContentsLayer->setNeedsDisplay(); |  1250     m_scrollingContentsLayer->setNeedsDisplay(); | 
|  1250  |  1251  | 
|  1251   DoubleSize scrollingContentsOffset( |  1252   DoubleSize scrollingContentsOffset( | 
|  1252       overflowClipRect.location().x() - adjustedScrollOffset.width(), |  1253       overflowClipRect.location().x() - scrollPosition.x(), | 
|  1253       overflowClipRect.location().y() - adjustedScrollOffset.height()); |  1254       overflowClipRect.location().y() - scrollPosition.y()); | 
|  1254   // The scroll offset change is compared using floating point so that |  1255   // The scroll offset change is compared using floating point so that | 
|  1255   // fractional scroll offset change can be propagated to compositor. |  1256   // fractional scroll offset change can be propagated to compositor. | 
|  1256   if (scrollingContentsOffset != m_scrollingContentsOffset || |  1257   if (scrollingContentsOffset != m_scrollingContentsOffset || | 
|  1257       scrollSize != m_scrollingContentsLayer->size()) { |  1258       scrollSize != m_scrollingContentsLayer->size()) { | 
|  1258     bool coordinatorHandlesOffset = |  1259     bool coordinatorHandlesOffset = | 
|  1259         compositor()->scrollingLayerDidChange(&m_owningLayer); |  1260         compositor()->scrollingLayerDidChange(&m_owningLayer); | 
|  1260     m_scrollingContentsLayer->setPosition( |  1261     m_scrollingContentsLayer->setPosition( | 
|  1261         coordinatorHandlesOffset |  1262         coordinatorHandlesOffset ? FloatPoint() | 
|  1262             ? FloatPoint() |  1263                                  : FloatPoint(-toFloatSize(scrollPosition))); | 
|  1263             : FloatPoint(-toFloatSize(adjustedScrollOffset))); |  | 
|  1264   } |  1264   } | 
|  1265   m_scrollingContentsOffset = scrollingContentsOffset; |  1265   m_scrollingContentsOffset = scrollingContentsOffset; | 
|  1266  |  1266  | 
|  1267   m_scrollingContentsLayer->setSize(FloatSize(scrollSize)); |  1267   m_scrollingContentsLayer->setSize(FloatSize(scrollSize)); | 
|  1268  |  1268  | 
|  1269   IntPoint scrollingContentsLayerOffsetFromLayoutObject; |  1269   IntPoint scrollingContentsLayerOffsetFromLayoutObject; | 
|  1270   if (PaintLayerScrollableArea* scrollableArea = |  1270   if (PaintLayerScrollableArea* scrollableArea = | 
|  1271           m_owningLayer.getScrollableArea()) { |  1271           m_owningLayer.getScrollableArea()) { | 
|  1272     scrollingContentsLayerOffsetFromLayoutObject = |  1272     scrollingContentsLayerOffsetFromLayoutObject = | 
|  1273         -scrollableArea->scrollOrigin(); |  1273         -scrollableArea->scrollOrigin(); | 
| (...skipping 1612 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2886 } |  2886 } | 
|  2887  |  2887  | 
|  2888 void CompositedLayerMapping::adjustForCompositedScrolling( |  2888 void CompositedLayerMapping::adjustForCompositedScrolling( | 
|  2889     const GraphicsLayer* graphicsLayer, |  2889     const GraphicsLayer* graphicsLayer, | 
|  2890     IntSize& offset) const { |  2890     IntSize& offset) const { | 
|  2891   if (graphicsLayer == m_scrollingContentsLayer.get() || |  2891   if (graphicsLayer == m_scrollingContentsLayer.get() || | 
|  2892       graphicsLayer == m_foregroundLayer.get()) { |  2892       graphicsLayer == m_foregroundLayer.get()) { | 
|  2893     if (PaintLayerScrollableArea* scrollableArea = |  2893     if (PaintLayerScrollableArea* scrollableArea = | 
|  2894             m_owningLayer.getScrollableArea()) { |  2894             m_owningLayer.getScrollableArea()) { | 
|  2895       if (scrollableArea->usesCompositedScrolling()) { |  2895       if (scrollableArea->usesCompositedScrolling()) { | 
|  2896         // Note: this is just the scroll offset, *not* the "adjusted scroll |  2896         // Note: this is the offset from the beginning of flow of the block, not | 
|  2897         // offset". Scroll offset does not include the origin adjustment. That |  2897         // the offset from the top/left of the overflow rect. | 
|  2898         // is instead baked already into offsetFromLayoutObject. |  2898         // offsetFromLayoutObject adds the origin offset from top/left to the | 
|  2899         DoubleSize scrollOffset = scrollableArea->scrollOffset(); |  2899         // beginning of flow. | 
 |  2900         ScrollOffset scrollOffset = scrollableArea->scrollOffset(); | 
|  2900         offset.expand(-scrollOffset.width(), -scrollOffset.height()); |  2901         offset.expand(-scrollOffset.width(), -scrollOffset.height()); | 
|  2901       } |  2902       } | 
|  2902     } |  2903     } | 
|  2903   } |  2904   } | 
|  2904 } |  2905 } | 
|  2905  |  2906  | 
|  2906 void CompositedLayerMapping::paintContents( |  2907 void CompositedLayerMapping::paintContents( | 
|  2907     const GraphicsLayer* graphicsLayer, |  2908     const GraphicsLayer* graphicsLayer, | 
|  2908     GraphicsContext& context, |  2909     GraphicsContext& context, | 
|  2909     GraphicsLayerPaintingPhase graphicsLayerPaintingPhase, |  2910     GraphicsLayerPaintingPhase graphicsLayerPaintingPhase, | 
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3235   } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |  3236   } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 
|  3236     name = "Scrolling Contents Layer"; |  3237     name = "Scrolling Contents Layer"; | 
|  3237   } else { |  3238   } else { | 
|  3238     ASSERT_NOT_REACHED(); |  3239     ASSERT_NOT_REACHED(); | 
|  3239   } |  3240   } | 
|  3240  |  3241  | 
|  3241   return name; |  3242   return name; | 
|  3242 } |  3243 } | 
|  3243  |  3244  | 
|  3244 }  // namespace blink |  3245 }  // namespace blink | 
| OLD | NEW |