| 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 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1589 FloatSize decoration_size = relative_compositing_bounds_size; | 1589 FloatSize decoration_size = relative_compositing_bounds_size; |
| 1590 decoration_outline_layer_->SetPosition(FloatPoint()); | 1590 decoration_outline_layer_->SetPosition(FloatPoint()); |
| 1591 if (decoration_size != decoration_outline_layer_->Size()) { | 1591 if (decoration_size != decoration_outline_layer_->Size()) { |
| 1592 decoration_outline_layer_->SetSize(decoration_size); | 1592 decoration_outline_layer_->SetSize(decoration_size); |
| 1593 decoration_outline_layer_->SetNeedsDisplay(); | 1593 decoration_outline_layer_->SetNeedsDisplay(); |
| 1594 } | 1594 } |
| 1595 decoration_outline_layer_->SetOffsetFromLayoutObject( | 1595 decoration_outline_layer_->SetOffsetFromLayoutObject( |
| 1596 graphics_layer_->OffsetFromLayoutObject()); | 1596 graphics_layer_->OffsetFromLayoutObject()); |
| 1597 } | 1597 } |
| 1598 | 1598 |
| 1599 void CompositedLayerMapping::RegisterScrollingLayers() { | |
| 1600 // Register fixed position layers and their containers with the scrolling | |
| 1601 // coordinator. | |
| 1602 ScrollingCoordinator* scrolling_coordinator = | |
| 1603 owning_layer_.GetScrollingCoordinator(); | |
| 1604 if (!scrolling_coordinator) | |
| 1605 return; | |
| 1606 | |
| 1607 scrolling_coordinator->UpdateLayerPositionConstraint(&owning_layer_); | |
| 1608 | |
| 1609 // Page scale is applied as a transform on the root layout view layer. Because | |
| 1610 // the scroll layer is further up in the hierarchy, we need to avoid marking | |
| 1611 // the root layout view layer as a container. | |
| 1612 bool is_container = | |
| 1613 owning_layer_.GetLayoutObject().CanContainFixedPositionObjects() && | |
| 1614 !owning_layer_.IsRootLayer(); | |
| 1615 scrolling_coordinator->SetLayerIsContainerForFixedPositionLayers( | |
| 1616 graphics_layer_.get(), is_container); | |
| 1617 } | |
| 1618 | |
| 1619 void CompositedLayerMapping::UpdateInternalHierarchy() { | 1599 void CompositedLayerMapping::UpdateInternalHierarchy() { |
| 1620 // m_foregroundLayer has to be inserted in the correct order with child | 1600 // m_foregroundLayer has to be inserted in the correct order with child |
| 1621 // layers, so it's not inserted here. | 1601 // layers, so it's not inserted here. |
| 1622 if (ancestor_clipping_layer_) | 1602 if (ancestor_clipping_layer_) |
| 1623 ancestor_clipping_layer_->RemoveAllChildren(); | 1603 ancestor_clipping_layer_->RemoveAllChildren(); |
| 1624 | 1604 |
| 1625 graphics_layer_->RemoveFromParent(); | 1605 graphics_layer_->RemoveFromParent(); |
| 1626 | 1606 |
| 1627 if (ancestor_clipping_layer_) | 1607 if (ancestor_clipping_layer_) |
| 1628 ancestor_clipping_layer_->AddChild(graphics_layer_.get()); | 1608 ancestor_clipping_layer_->AddChild(graphics_layer_.get()); |
| (...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2483 topmost_layer, clip_parent, | 2463 topmost_layer, clip_parent, |
| 2484 scrolling_coordinator); | 2464 scrolling_coordinator); |
| 2485 UpdateClipParentForGraphicsLayer(ancestor_clipping_layer_.get(), | 2465 UpdateClipParentForGraphicsLayer(ancestor_clipping_layer_.get(), |
| 2486 topmost_layer, clip_parent, | 2466 topmost_layer, clip_parent, |
| 2487 scrolling_coordinator); | 2467 scrolling_coordinator); |
| 2488 UpdateClipParentForGraphicsLayer(graphics_layer_.get(), topmost_layer, | 2468 UpdateClipParentForGraphicsLayer(graphics_layer_.get(), topmost_layer, |
| 2489 clip_parent, scrolling_coordinator); | 2469 clip_parent, scrolling_coordinator); |
| 2490 } | 2470 } |
| 2491 } | 2471 } |
| 2492 | 2472 |
| 2473 void CompositedLayerMapping::RegisterScrollingLayers() { |
| 2474 // Register fixed position layers and their containers with the scrolling |
| 2475 // coordinator. |
| 2476 ScrollingCoordinator* scrolling_coordinator = |
| 2477 owning_layer_.GetScrollingCoordinator(); |
| 2478 if (!scrolling_coordinator) |
| 2479 return; |
| 2480 |
| 2481 scrolling_coordinator->UpdateLayerPositionConstraint(&owning_layer_); |
| 2482 |
| 2483 // Page scale is applied as a transform on the root layout view layer. Because |
| 2484 // the scroll layer is further up in the hierarchy, we need to avoid marking |
| 2485 // the root layout view layer as a container. |
| 2486 bool is_container = |
| 2487 owning_layer_.GetLayoutObject().CanContainFixedPositionObjects() && |
| 2488 !owning_layer_.IsRootLayer(); |
| 2489 scrolling_coordinator->SetLayerIsContainerForFixedPositionLayers( |
| 2490 graphics_layer_.get(), is_container); |
| 2491 // Fixed-pos descendants inherits the space that has all CSS property applied, |
| 2492 // including perspective, overflow scroll/clip. Thus we also mark every layers |
| 2493 // below the main graphics layer so transforms implemented by them don't get |
| 2494 // skipped. |
| 2495 ApplyToGraphicsLayers( |
| 2496 this, |
| 2497 [scrolling_coordinator, is_container](GraphicsLayer* layer) { |
| 2498 scrolling_coordinator->SetLayerIsContainerForFixedPositionLayers( |
| 2499 layer, is_container); |
| 2500 }, |
| 2501 kApplyToChildContainingLayers); |
| 2502 } |
| 2503 |
| 2493 bool CompositedLayerMapping::UpdateSquashingLayers( | 2504 bool CompositedLayerMapping::UpdateSquashingLayers( |
| 2494 bool needs_squashing_layers) { | 2505 bool needs_squashing_layers) { |
| 2495 bool layers_changed = false; | 2506 bool layers_changed = false; |
| 2496 | 2507 |
| 2497 if (needs_squashing_layers) { | 2508 if (needs_squashing_layers) { |
| 2498 if (!squashing_layer_) { | 2509 if (!squashing_layer_) { |
| 2499 squashing_layer_ = | 2510 squashing_layer_ = |
| 2500 CreateGraphicsLayer(kCompositingReasonLayerForSquashingContents); | 2511 CreateGraphicsLayer(kCompositingReasonLayerForSquashingContents); |
| 2501 squashing_layer_->SetDrawsContent(true); | 2512 squashing_layer_->SetDrawsContent(true); |
| 2502 layers_changed = true; | 2513 layers_changed = true; |
| (...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3604 } else if (graphics_layer == decoration_outline_layer_.get()) { | 3615 } else if (graphics_layer == decoration_outline_layer_.get()) { |
| 3605 name = "Decoration Layer"; | 3616 name = "Decoration Layer"; |
| 3606 } else { | 3617 } else { |
| 3607 NOTREACHED(); | 3618 NOTREACHED(); |
| 3608 } | 3619 } |
| 3609 | 3620 |
| 3610 return name; | 3621 return name; |
| 3611 } | 3622 } |
| 3612 | 3623 |
| 3613 } // namespace blink | 3624 } // namespace blink |
| OLD | NEW |