| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 } | 192 } |
| 193 | 193 |
| 194 static void clearPositionConstraintExceptForLayer(GraphicsLayer* layer, Graphics
Layer* except) | 194 static void clearPositionConstraintExceptForLayer(GraphicsLayer* layer, Graphics
Layer* except) |
| 195 { | 195 { |
| 196 if (layer && layer != except && toWebLayer(layer)) | 196 if (layer && layer != except && toWebLayer(layer)) |
| 197 toWebLayer(layer)->setPositionConstraint(WebLayerPositionConstraint()); | 197 toWebLayer(layer)->setPositionConstraint(WebLayerPositionConstraint()); |
| 198 } | 198 } |
| 199 | 199 |
| 200 static WebLayerPositionConstraint computePositionConstraint(const RenderLayer* l
ayer) | 200 static WebLayerPositionConstraint computePositionConstraint(const RenderLayer* l
ayer) |
| 201 { | 201 { |
| 202 ASSERT(layer->hasCompositedLayerMapping()); | 202 ASSERT(layer->compositedLayerMapping()); |
| 203 do { | 203 do { |
| 204 if (layer->renderer()->style()->position() == FixedPosition) { | 204 if (layer->renderer()->style()->position() == FixedPosition) { |
| 205 const RenderObject* fixedPositionObject = layer->renderer(); | 205 const RenderObject* fixedPositionObject = layer->renderer(); |
| 206 bool fixedToRight = !fixedPositionObject->style()->right().isAuto(); | 206 bool fixedToRight = !fixedPositionObject->style()->right().isAuto(); |
| 207 bool fixedToBottom = !fixedPositionObject->style()->bottom().isAuto(
); | 207 bool fixedToBottom = !fixedPositionObject->style()->bottom().isAuto(
); |
| 208 return WebLayerPositionConstraint::fixedPosition(fixedToRight, fixed
ToBottom); | 208 return WebLayerPositionConstraint::fixedPosition(fixedToRight, fixed
ToBottom); |
| 209 } | 209 } |
| 210 | 210 |
| 211 layer = layer->parent(); | 211 layer = layer->parent(); |
| 212 | 212 |
| 213 // Composited layers that inherit a fixed position state will be positio
ned with respect to the nearest compositedLayerMapping's GraphicsLayer. | 213 // Composited layers that inherit a fixed position state will be positio
ned with respect to the nearest compositedLayerMapping's GraphicsLayer. |
| 214 // So, once we find a layer that has its own compositedLayerMapping, we
can stop searching for a fixed position RenderObject. | 214 // So, once we find a layer that has its own compositedLayerMapping, we
can stop searching for a fixed position RenderObject. |
| 215 } while (layer && !layer->hasCompositedLayerMapping()); | 215 } while (layer && !layer->compositedLayerMapping()); |
| 216 return WebLayerPositionConstraint(); | 216 return WebLayerPositionConstraint(); |
| 217 } | 217 } |
| 218 | 218 |
| 219 void ScrollingCoordinator::updateLayerPositionConstraint(RenderLayer* layer) | 219 void ScrollingCoordinator::updateLayerPositionConstraint(RenderLayer* layer) |
| 220 { | 220 { |
| 221 ASSERT(layer->hasCompositedLayerMapping()); | |
| 222 CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMappi
ng(); | 221 CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMappi
ng(); |
| 222 ASSERT(compositedLayerMapping); |
| 223 GraphicsLayer* mainLayer = compositedLayerMapping->childForSuperlayers(); | 223 GraphicsLayer* mainLayer = compositedLayerMapping->childForSuperlayers(); |
| 224 | 224 |
| 225 // Avoid unnecessary commits | 225 // Avoid unnecessary commits |
| 226 clearPositionConstraintExceptForLayer(compositedLayerMapping->squashingConta
inmentLayer(), mainLayer); | 226 clearPositionConstraintExceptForLayer(compositedLayerMapping->squashingConta
inmentLayer(), mainLayer); |
| 227 clearPositionConstraintExceptForLayer(compositedLayerMapping->ancestorClippi
ngLayer(), mainLayer); | 227 clearPositionConstraintExceptForLayer(compositedLayerMapping->ancestorClippi
ngLayer(), mainLayer); |
| 228 clearPositionConstraintExceptForLayer(compositedLayerMapping->mainGraphicsLa
yer(), mainLayer); | 228 clearPositionConstraintExceptForLayer(compositedLayerMapping->mainGraphicsLa
yer(), mainLayer); |
| 229 | 229 |
| 230 if (WebLayer* scrollableLayer = toWebLayer(mainLayer)) | 230 if (WebLayer* scrollableLayer = toWebLayer(mainLayer)) |
| 231 scrollableLayer->setPositionConstraint(computePositionConstraint(layer))
; | 231 scrollableLayer->setPositionConstraint(computePositionConstraint(layer))
; |
| 232 } | 232 } |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 RenderView* renderView = m_page->deprecatedLocalMainFrame()->contentRenderer
(); | 599 RenderView* renderView = m_page->deprecatedLocalMainFrame()->contentRenderer
(); |
| 600 if (renderView && renderView->compositor() && renderView->compositor()->stal
eInCompositingMode()) | 600 if (renderView && renderView->compositor() && renderView->compositor()->stal
eInCompositingMode()) |
| 601 m_page->deprecatedLocalMainFrame()->view()->scheduleAnimation(); | 601 m_page->deprecatedLocalMainFrame()->view()->scheduleAnimation(); |
| 602 | 602 |
| 603 m_touchEventTargetRectsAreDirty = true; | 603 m_touchEventTargetRectsAreDirty = true; |
| 604 } | 604 } |
| 605 | 605 |
| 606 void ScrollingCoordinator::updateScrollParentForGraphicsLayer(GraphicsLayer* chi
ld, RenderLayer* parent) | 606 void ScrollingCoordinator::updateScrollParentForGraphicsLayer(GraphicsLayer* chi
ld, RenderLayer* parent) |
| 607 { | 607 { |
| 608 WebLayer* scrollParentWebLayer = nullptr; | 608 WebLayer* scrollParentWebLayer = nullptr; |
| 609 if (parent && parent->hasCompositedLayerMapping()) | 609 |
| 610 scrollParentWebLayer = toWebLayer(parent->compositedLayerMapping()->scro
llingContentsLayer()); | 610 if (parent) { |
| 611 CompositedLayerMapping* compositedLayerMapping = parent->compositedLayer
Mapping(); |
| 612 if (compositedLayerMapping) |
| 613 scrollParentWebLayer = toWebLayer(compositedLayerMapping->scrollingC
ontentsLayer()); |
| 614 } |
| 611 | 615 |
| 612 child->setScrollParent(scrollParentWebLayer); | 616 child->setScrollParent(scrollParentWebLayer); |
| 613 } | 617 } |
| 614 | 618 |
| 615 void ScrollingCoordinator::updateClipParentForGraphicsLayer(GraphicsLayer* child
, RenderLayer* parent) | 619 void ScrollingCoordinator::updateClipParentForGraphicsLayer(GraphicsLayer* child
, RenderLayer* parent) |
| 616 { | 620 { |
| 617 WebLayer* clipParentWebLayer = nullptr; | 621 WebLayer* clipParentWebLayer = nullptr; |
| 618 if (parent && parent->hasCompositedLayerMapping()) | 622 |
| 619 clipParentWebLayer = toWebLayer(parent->compositedLayerMapping()->parent
ForSublayers()); | 623 if (parent) { |
| 624 CompositedLayerMapping* compositedLayerMapping = parent->compositedLayer
Mapping(); |
| 625 if (compositedLayerMapping) |
| 626 clipParentWebLayer = toWebLayer(compositedLayerMapping->parentForSub
layers()); |
| 627 } |
| 620 | 628 |
| 621 child->setClipParent(clipParentWebLayer); | 629 child->setClipParent(clipParentWebLayer); |
| 622 } | 630 } |
| 623 | 631 |
| 624 void ScrollingCoordinator::willDestroyRenderLayer(RenderLayer* layer) | 632 void ScrollingCoordinator::willDestroyRenderLayer(RenderLayer* layer) |
| 625 { | 633 { |
| 626 m_layersWithTouchRects.remove(layer); | 634 m_layersWithTouchRects.remove(layer); |
| 627 } | 635 } |
| 628 | 636 |
| 629 void ScrollingCoordinator::updateHaveWheelEventHandlers() | 637 void ScrollingCoordinator::updateHaveWheelEventHandlers() |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 bool frameIsScrollable = frameView && frameView->isScrollable(); | 1000 bool frameIsScrollable = frameView && frameView->isScrollable(); |
| 993 if (frameIsScrollable != m_wasFrameScrollable) | 1001 if (frameIsScrollable != m_wasFrameScrollable) |
| 994 return true; | 1002 return true; |
| 995 | 1003 |
| 996 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : nullptr) | 1004 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : nullptr) |
| 997 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); | 1005 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); |
| 998 return false; | 1006 return false; |
| 999 } | 1007 } |
| 1000 | 1008 |
| 1001 } // namespace blink | 1009 } // namespace blink |
| OLD | NEW |