Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Side by Side Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp

Issue 2846313002: [blink] Perspective layer should be considered fixed-pos container layer (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/transforms/perspective-fixed-pos-descendant-expected.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1575 matching lines...) Expand 10 before | Expand all | Expand 10 after
1586 FloatSize decoration_size = relative_compositing_bounds_size; 1586 FloatSize decoration_size = relative_compositing_bounds_size;
1587 decoration_outline_layer_->SetPosition(FloatPoint()); 1587 decoration_outline_layer_->SetPosition(FloatPoint());
1588 if (decoration_size != decoration_outline_layer_->Size()) { 1588 if (decoration_size != decoration_outline_layer_->Size()) {
1589 decoration_outline_layer_->SetSize(decoration_size); 1589 decoration_outline_layer_->SetSize(decoration_size);
1590 decoration_outline_layer_->SetNeedsDisplay(); 1590 decoration_outline_layer_->SetNeedsDisplay();
1591 } 1591 }
1592 decoration_outline_layer_->SetOffsetFromLayoutObject( 1592 decoration_outline_layer_->SetOffsetFromLayoutObject(
1593 graphics_layer_->OffsetFromLayoutObject()); 1593 graphics_layer_->OffsetFromLayoutObject());
1594 } 1594 }
1595 1595
1596 void CompositedLayerMapping::RegisterScrollingLayers() {
1597 // Register fixed position layers and their containers with the scrolling
1598 // coordinator.
1599 ScrollingCoordinator* scrolling_coordinator =
1600 owning_layer_.GetScrollingCoordinator();
1601 if (!scrolling_coordinator)
1602 return;
1603
1604 scrolling_coordinator->UpdateLayerPositionConstraint(&owning_layer_);
1605
1606 // Page scale is applied as a transform on the root layout view layer. Because
1607 // the scroll layer is further up in the hierarchy, we need to avoid marking
1608 // the root layout view layer as a container.
1609 bool is_container =
1610 owning_layer_.GetLayoutObject().CanContainFixedPositionObjects() &&
1611 !owning_layer_.IsRootLayer();
1612 scrolling_coordinator->SetLayerIsContainerForFixedPositionLayers(
1613 graphics_layer_.get(), is_container);
1614 }
1615
1616 void CompositedLayerMapping::UpdateInternalHierarchy() { 1596 void CompositedLayerMapping::UpdateInternalHierarchy() {
1617 // m_foregroundLayer has to be inserted in the correct order with child 1597 // m_foregroundLayer has to be inserted in the correct order with child
1618 // layers, so it's not inserted here. 1598 // layers, so it's not inserted here.
1619 if (ancestor_clipping_layer_) 1599 if (ancestor_clipping_layer_)
1620 ancestor_clipping_layer_->RemoveAllChildren(); 1600 ancestor_clipping_layer_->RemoveAllChildren();
1621 1601
1622 graphics_layer_->RemoveFromParent(); 1602 graphics_layer_->RemoveFromParent();
1623 1603
1624 if (ancestor_clipping_layer_) 1604 if (ancestor_clipping_layer_)
1625 ancestor_clipping_layer_->AddChild(graphics_layer_.get()); 1605 ancestor_clipping_layer_->AddChild(graphics_layer_.get());
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
2480 topmost_layer, clip_parent, 2460 topmost_layer, clip_parent,
2481 scrolling_coordinator); 2461 scrolling_coordinator);
2482 UpdateClipParentForGraphicsLayer(ancestor_clipping_layer_.get(), 2462 UpdateClipParentForGraphicsLayer(ancestor_clipping_layer_.get(),
2483 topmost_layer, clip_parent, 2463 topmost_layer, clip_parent,
2484 scrolling_coordinator); 2464 scrolling_coordinator);
2485 UpdateClipParentForGraphicsLayer(graphics_layer_.get(), topmost_layer, 2465 UpdateClipParentForGraphicsLayer(graphics_layer_.get(), topmost_layer,
2486 clip_parent, scrolling_coordinator); 2466 clip_parent, scrolling_coordinator);
2487 } 2467 }
2488 } 2468 }
2489 2469
2470 void CompositedLayerMapping::RegisterScrollingLayers() {
2471 // Register fixed position layers and their containers with the scrolling
2472 // coordinator.
2473 ScrollingCoordinator* scrolling_coordinator =
2474 owning_layer_.GetScrollingCoordinator();
2475 if (!scrolling_coordinator)
2476 return;
2477
2478 scrolling_coordinator->UpdateLayerPositionConstraint(&owning_layer_);
2479
2480 // Page scale is applied as a transform on the root layout view layer. Because
2481 // the scroll layer is further up in the hierarchy, we need to avoid marking
2482 // the root layout view layer as a container.
2483 bool is_container =
2484 owning_layer_.GetLayoutObject().CanContainFixedPositionObjects() &&
2485 !owning_layer_.IsRootLayer();
2486 scrolling_coordinator->SetLayerIsContainerForFixedPositionLayers(
2487 graphics_layer_.get(), is_container);
2488 // Fixed-pos descendants inherits the space that has all CSS property applied,
2489 // including perspective, overflow scroll/clip. Thus we also mark every layers
2490 // below the main graphics layer so transforms implemented by them don't get
2491 // skipped.
2492 ApplyToGraphicsLayers(
2493 this,
2494 [scrolling_coordinator, is_container](GraphicsLayer* layer) {
2495 scrolling_coordinator->SetLayerIsContainerForFixedPositionLayers(
2496 layer, is_container);
2497 },
2498 kApplyToChildContainingLayers);
2499 }
2500
2490 bool CompositedLayerMapping::UpdateSquashingLayers( 2501 bool CompositedLayerMapping::UpdateSquashingLayers(
2491 bool needs_squashing_layers) { 2502 bool needs_squashing_layers) {
2492 bool layers_changed = false; 2503 bool layers_changed = false;
2493 2504
2494 if (needs_squashing_layers) { 2505 if (needs_squashing_layers) {
2495 if (!squashing_layer_) { 2506 if (!squashing_layer_) {
2496 squashing_layer_ = 2507 squashing_layer_ =
2497 CreateGraphicsLayer(kCompositingReasonLayerForSquashingContents); 2508 CreateGraphicsLayer(kCompositingReasonLayerForSquashingContents);
2498 squashing_layer_->SetDrawsContent(true); 2509 squashing_layer_->SetDrawsContent(true);
2499 layers_changed = true; 2510 layers_changed = true;
(...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after
3601 } else if (graphics_layer == decoration_outline_layer_.get()) { 3612 } else if (graphics_layer == decoration_outline_layer_.get()) {
3602 name = "Decoration Layer"; 3613 name = "Decoration Layer";
3603 } else { 3614 } else {
3604 NOTREACHED(); 3615 NOTREACHED();
3605 } 3616 }
3606 3617
3607 return name; 3618 return name;
3608 } 3619 }
3609 3620
3610 } // namespace blink 3621 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/transforms/perspective-fixed-pos-descendant-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698