| 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 30 matching lines...) Expand all Loading... |
| 41 #include "core/inspector/InspectorInstrumentation.h" | 41 #include "core/inspector/InspectorInstrumentation.h" |
| 42 #include "core/layout/LayoutEmbeddedObject.h" | 42 #include "core/layout/LayoutEmbeddedObject.h" |
| 43 #include "core/layout/LayoutHTMLCanvas.h" | 43 #include "core/layout/LayoutHTMLCanvas.h" |
| 44 #include "core/layout/LayoutImage.h" | 44 #include "core/layout/LayoutImage.h" |
| 45 #include "core/layout/LayoutPart.h" | 45 #include "core/layout/LayoutPart.h" |
| 46 #include "core/layout/LayoutVideo.h" | 46 #include "core/layout/LayoutVideo.h" |
| 47 #include "core/layout/LayoutView.h" | 47 #include "core/layout/LayoutView.h" |
| 48 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h" | 48 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h" |
| 49 #include "core/page/ChromeClient.h" | 49 #include "core/page/ChromeClient.h" |
| 50 #include "core/page/Page.h" | 50 #include "core/page/Page.h" |
| 51 #include "core/page/scrolling/ScrollingConstraints.h" |
| 51 #include "core/page/scrolling/ScrollingCoordinator.h" | 52 #include "core/page/scrolling/ScrollingCoordinator.h" |
| 52 #include "core/paint/DeprecatedPaintLayerPainter.h" | 53 #include "core/paint/DeprecatedPaintLayerPainter.h" |
| 53 #include "core/paint/DeprecatedPaintLayerStackingNodeIterator.h" | 54 #include "core/paint/DeprecatedPaintLayerStackingNodeIterator.h" |
| 54 #include "core/paint/ScrollableAreaPainter.h" | 55 #include "core/paint/ScrollableAreaPainter.h" |
| 55 #include "core/paint/TransformRecorder.h" | 56 #include "core/paint/TransformRecorder.h" |
| 56 #include "core/plugins/PluginView.h" | 57 #include "core/plugins/PluginView.h" |
| 57 #include "platform/LengthFunctions.h" | 58 #include "platform/LengthFunctions.h" |
| 58 #include "platform/RuntimeEnabledFeatures.h" | 59 #include "platform/RuntimeEnabledFeatures.h" |
| 59 #include "platform/fonts/FontCache.h" | 60 #include "platform/fonts/FontCache.h" |
| 60 #include "platform/geometry/TransformState.h" | 61 #include "platform/geometry/TransformState.h" |
| 61 #include "platform/graphics/BitmapImage.h" | 62 #include "platform/graphics/BitmapImage.h" |
| 62 #include "platform/graphics/GraphicsContext.h" | 63 #include "platform/graphics/GraphicsContext.h" |
| 63 #include "platform/graphics/paint/ClipDisplayItem.h" | 64 #include "platform/graphics/paint/ClipDisplayItem.h" |
| 64 #include "platform/graphics/paint/DisplayItemList.h" | 65 #include "platform/graphics/paint/DisplayItemList.h" |
| 65 #include "platform/graphics/paint/TransformDisplayItem.h" | 66 #include "platform/graphics/paint/TransformDisplayItem.h" |
| 67 #include "public/platform/WebLayerPositionConstraint.h" |
| 66 #include "wtf/CurrentTime.h" | 68 #include "wtf/CurrentTime.h" |
| 67 #include "wtf/text/StringBuilder.h" | 69 #include "wtf/text/StringBuilder.h" |
| 68 | 70 |
| 69 namespace blink { | 71 namespace blink { |
| 70 | 72 |
| 71 using namespace HTMLNames; | 73 using namespace HTMLNames; |
| 72 | 74 |
| 73 static IntRect clipBox(LayoutBox* layoutObject); | 75 static IntRect clipBox(LayoutBox* layoutObject); |
| 74 | 76 |
| 75 static IntRect contentsRect(const LayoutObject* layoutObject) | 77 static IntRect contentsRect(const LayoutObject* layoutObject) |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 } | 224 } |
| 223 | 225 |
| 224 void CompositedDeprecatedPaintLayerMapping::createPrimaryGraphicsLayer() | 226 void CompositedDeprecatedPaintLayerMapping::createPrimaryGraphicsLayer() |
| 225 { | 227 { |
| 226 m_graphicsLayer = createGraphicsLayer(m_owningLayer.compositingReasons()); | 228 m_graphicsLayer = createGraphicsLayer(m_owningLayer.compositingReasons()); |
| 227 | 229 |
| 228 updateOpacity(layoutObject()->styleRef()); | 230 updateOpacity(layoutObject()->styleRef()); |
| 229 updateTransform(layoutObject()->styleRef()); | 231 updateTransform(layoutObject()->styleRef()); |
| 230 updateFilters(layoutObject()->styleRef()); | 232 updateFilters(layoutObject()->styleRef()); |
| 231 updateBackdropFilters(layoutObject()->styleRef()); | 233 updateBackdropFilters(layoutObject()->styleRef()); |
| 234 updateStickyConstraints(layoutObject()->styleRef()); |
| 232 | 235 |
| 233 if (RuntimeEnabledFeatures::cssCompositingEnabled()) { | 236 if (RuntimeEnabledFeatures::cssCompositingEnabled()) { |
| 234 updateLayerBlendMode(layoutObject()->styleRef()); | 237 updateLayerBlendMode(layoutObject()->styleRef()); |
| 235 updateIsRootForIsolatedGroup(); | 238 updateIsRootForIsolatedGroup(); |
| 236 } | 239 } |
| 237 } | 240 } |
| 238 | 241 |
| 239 void CompositedDeprecatedPaintLayerMapping::destroyGraphicsLayers() | 242 void CompositedDeprecatedPaintLayerMapping::destroyGraphicsLayers() |
| 240 { | 243 { |
| 241 if (m_graphicsLayer) | 244 if (m_graphicsLayer) |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 void CompositedDeprecatedPaintLayerMapping::updateBackdropFilters(const Computed
Style& style) | 284 void CompositedDeprecatedPaintLayerMapping::updateBackdropFilters(const Computed
Style& style) |
| 282 { | 285 { |
| 283 m_graphicsLayer->setBackdropFilters(owningLayer().computeBackdropFilterOpera
tions(style)); | 286 m_graphicsLayer->setBackdropFilters(owningLayer().computeBackdropFilterOpera
tions(style)); |
| 284 } | 287 } |
| 285 | 288 |
| 286 void CompositedDeprecatedPaintLayerMapping::updateLayerBlendMode(const ComputedS
tyle& style) | 289 void CompositedDeprecatedPaintLayerMapping::updateLayerBlendMode(const ComputedS
tyle& style) |
| 287 { | 290 { |
| 288 setBlendMode(style.blendMode()); | 291 setBlendMode(style.blendMode()); |
| 289 } | 292 } |
| 290 | 293 |
| 294 void CompositedDeprecatedPaintLayerMapping::updateStickyConstraints(const Comput
edStyle& style) |
| 295 { |
| 296 bool sticky = style.position() == EPosition::StickyPosition; |
| 297 if (sticky) { |
| 298 const DeprecatedPaintLayer* ancestorScrollingLayer = m_owningLayer.ances
torScrollingLayer(); |
| 299 if (ancestorScrollingLayer) { |
| 300 sticky = ancestorScrollingLayer->needsCompositedScrolling(); |
| 301 } else { |
| 302 // If there's no ancestor scrolling layer the viewport is our ancest
or scroller. |
| 303 sticky = layoutObject()->view()->frameView()->isScrollable(); |
| 304 } |
| 305 } |
| 306 |
| 307 WebLayerStickyPositionConstraint webConstraint; |
| 308 if (sticky) { |
| 309 LayoutBoxModelObject* boxModelObject = m_owningLayer.layoutObject(); |
| 310 LayoutRect containingRect = boxModelObject->computeStickyConstrainingRec
t(); |
| 311 StickyPositionViewportConstraints constraints; |
| 312 boxModelObject->computeStickyPositionConstraints(constraints, containing
Rect); |
| 313 |
| 314 webConstraint.isSticky = true; |
| 315 |
| 316 webConstraint.isAnchoredLeft = constraints.anchorEdges() & ViewportConst
raints::AnchorEdgeLeft; |
| 317 webConstraint.isAnchoredRight = constraints.anchorEdges() & ViewportCons
traints::AnchorEdgeRight; |
| 318 webConstraint.isAnchoredTop = constraints.anchorEdges() & ViewportConstr
aints::AnchorEdgeTop; |
| 319 webConstraint.isAnchoredBottom = constraints.anchorEdges() & ViewportCon
straints::AnchorEdgeBottom; |
| 320 |
| 321 webConstraint.leftOffset = constraints.leftOffset().toFloat(); |
| 322 webConstraint.rightOffset = constraints.rightOffset().toFloat(); |
| 323 webConstraint.topOffset = constraints.topOffset().toFloat(); |
| 324 webConstraint.bottomOffset = constraints.bottomOffset().toFloat(); |
| 325 |
| 326 webConstraint.absoluteStickyBoxRect = enclosingIntRect(constraints.absol
uteStickyBoxRect()); |
| 327 webConstraint.absoluteContainingBlockRect = enclosingIntRect(constraints
.absoluteContainingBlockRect()); |
| 328 } |
| 329 |
| 330 m_graphicsLayer->platformLayer()->setStickyPositionConstraint(webConstraint)
; |
| 331 } |
| 332 |
| 291 void CompositedDeprecatedPaintLayerMapping::updateIsRootForIsolatedGroup() | 333 void CompositedDeprecatedPaintLayerMapping::updateIsRootForIsolatedGroup() |
| 292 { | 334 { |
| 293 bool isolate = m_owningLayer.shouldIsolateCompositedDescendants(); | 335 bool isolate = m_owningLayer.shouldIsolateCompositedDescendants(); |
| 294 | 336 |
| 295 // non stacking context layers should never isolate | 337 // non stacking context layers should never isolate |
| 296 ASSERT(m_owningLayer.stackingNode()->isStackingContext() || !isolate); | 338 ASSERT(m_owningLayer.stackingNode()->isStackingContext() || !isolate); |
| 297 | 339 |
| 298 m_graphicsLayer->setIsRootForIsolatedGroup(isolate); | 340 m_graphicsLayer->setIsRootForIsolatedGroup(isolate); |
| 299 } | 341 } |
| 300 | 342 |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 updateBackgroundColor(); | 766 updateBackgroundColor(); |
| 725 updateDrawsContent(); | 767 updateDrawsContent(); |
| 726 updateContentsOpaque(); | 768 updateContentsOpaque(); |
| 727 updateAfterPartResize(); | 769 updateAfterPartResize(); |
| 728 updateRenderingContext(); | 770 updateRenderingContext(); |
| 729 updateShouldFlattenTransform(); | 771 updateShouldFlattenTransform(); |
| 730 updateChildrenTransform(); | 772 updateChildrenTransform(); |
| 731 updateScrollParent(scrollParent()); | 773 updateScrollParent(scrollParent()); |
| 732 registerScrollingLayers(); | 774 registerScrollingLayers(); |
| 733 | 775 |
| 776 updateStickyConstraints(layoutObject()->styleRef()); |
| 777 |
| 734 updateCompositingReasons(); | 778 updateCompositingReasons(); |
| 735 } | 779 } |
| 736 | 780 |
| 737 void CompositedDeprecatedPaintLayerMapping::updateMainGraphicsLayerGeometry(cons
t IntRect& relativeCompositingBounds, const IntRect& localCompositingBounds, con
st IntPoint& graphicsLayerParentLocation) | 781 void CompositedDeprecatedPaintLayerMapping::updateMainGraphicsLayerGeometry(cons
t IntRect& relativeCompositingBounds, const IntRect& localCompositingBounds, con
st IntPoint& graphicsLayerParentLocation) |
| 738 { | 782 { |
| 739 m_graphicsLayer->setPosition(FloatPoint(relativeCompositingBounds.location()
- graphicsLayerParentLocation)); | 783 m_graphicsLayer->setPosition(FloatPoint(relativeCompositingBounds.location()
- graphicsLayerParentLocation)); |
| 740 m_graphicsLayer->setOffsetFromLayoutObject(toIntSize(localCompositingBounds.
location())); | 784 m_graphicsLayer->setOffsetFromLayoutObject(toIntSize(localCompositingBounds.
location())); |
| 741 | 785 |
| 742 FloatSize oldSize = m_graphicsLayer->size(); | 786 FloatSize oldSize = m_graphicsLayer->size(); |
| 743 const IntSize& contentsSize = relativeCompositingBounds.size(); | 787 const IntSize& contentsSize = relativeCompositingBounds.size(); |
| (...skipping 1653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2397 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { | 2441 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { |
| 2398 name = "Scrolling Block Selection Layer"; | 2442 name = "Scrolling Block Selection Layer"; |
| 2399 } else { | 2443 } else { |
| 2400 ASSERT_NOT_REACHED(); | 2444 ASSERT_NOT_REACHED(); |
| 2401 } | 2445 } |
| 2402 | 2446 |
| 2403 return name; | 2447 return name; |
| 2404 } | 2448 } |
| 2405 | 2449 |
| 2406 } // namespace blink | 2450 } // namespace blink |
| OLD | NEW |