| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 } | 153 } |
| 154 | 154 |
| 155 static inline bool IsAcceleratedContents(LayoutObject& layout_object) { | 155 static inline bool IsAcceleratedContents(LayoutObject& layout_object) { |
| 156 return IsCompositedCanvas(layout_object) || | 156 return IsCompositedCanvas(layout_object) || |
| 157 (layout_object.IsEmbeddedObject() && | 157 (layout_object.IsEmbeddedObject() && |
| 158 ToLayoutEmbeddedObject(layout_object) | 158 ToLayoutEmbeddedObject(layout_object) |
| 159 .RequiresAcceleratedCompositing()) || | 159 .RequiresAcceleratedCompositing()) || |
| 160 layout_object.IsVideo(); | 160 layout_object.IsVideo(); |
| 161 } | 161 } |
| 162 | 162 |
| 163 // Get the scrolling coordinator in a way that works inside | |
| 164 // CompositedLayerMapping's destructor. | |
| 165 static ScrollingCoordinator* ScrollingCoordinatorFromLayer(PaintLayer& layer) { | |
| 166 Page* page = layer.GetLayoutObject().GetFrame()->GetPage(); | |
| 167 return (!page) ? nullptr : page->GetScrollingCoordinator(); | |
| 168 } | |
| 169 | |
| 170 CompositedLayerMapping::CompositedLayerMapping(PaintLayer& layer) | 163 CompositedLayerMapping::CompositedLayerMapping(PaintLayer& layer) |
| 171 : owning_layer_(layer), | 164 : owning_layer_(layer), |
| 172 content_offset_in_compositing_layer_dirty_(false), | 165 content_offset_in_compositing_layer_dirty_(false), |
| 173 pending_update_scope_(kGraphicsLayerUpdateNone), | 166 pending_update_scope_(kGraphicsLayerUpdateNone), |
| 174 is_main_frame_layout_view_layer_(false), | 167 is_main_frame_layout_view_layer_(false), |
| 175 background_layer_paints_fixed_root_background_(false), | 168 background_layer_paints_fixed_root_background_(false), |
| 176 scrolling_contents_are_empty_(false), | 169 scrolling_contents_are_empty_(false), |
| 177 background_paints_onto_scrolling_contents_layer_(false), | 170 background_paints_onto_scrolling_contents_layer_(false), |
| 178 background_paints_onto_graphics_layer_(false), | 171 background_paints_onto_graphics_layer_(false), |
| 179 draws_background_onto_content_layer_(false) { | 172 draws_background_onto_content_layer_(false) { |
| (...skipping 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1597 decoration_outline_layer_->SetNeedsDisplay(); | 1590 decoration_outline_layer_->SetNeedsDisplay(); |
| 1598 } | 1591 } |
| 1599 decoration_outline_layer_->SetOffsetFromLayoutObject( | 1592 decoration_outline_layer_->SetOffsetFromLayoutObject( |
| 1600 graphics_layer_->OffsetFromLayoutObject()); | 1593 graphics_layer_->OffsetFromLayoutObject()); |
| 1601 } | 1594 } |
| 1602 | 1595 |
| 1603 void CompositedLayerMapping::RegisterScrollingLayers() { | 1596 void CompositedLayerMapping::RegisterScrollingLayers() { |
| 1604 // Register fixed position layers and their containers with the scrolling | 1597 // Register fixed position layers and their containers with the scrolling |
| 1605 // coordinator. | 1598 // coordinator. |
| 1606 ScrollingCoordinator* scrolling_coordinator = | 1599 ScrollingCoordinator* scrolling_coordinator = |
| 1607 ScrollingCoordinatorFromLayer(owning_layer_); | 1600 owning_layer_.GetScrollingCoordinator(); |
| 1608 if (!scrolling_coordinator) | 1601 if (!scrolling_coordinator) |
| 1609 return; | 1602 return; |
| 1610 | 1603 |
| 1611 scrolling_coordinator->UpdateLayerPositionConstraint(&owning_layer_); | 1604 scrolling_coordinator->UpdateLayerPositionConstraint(&owning_layer_); |
| 1612 | 1605 |
| 1613 // Page scale is applied as a transform on the root layout view layer. Because | 1606 // Page scale is applied as a transform on the root layout view layer. Because |
| 1614 // the scroll layer is further up in the hierarchy, we need to avoid marking | 1607 // the scroll layer is further up in the hierarchy, we need to avoid marking |
| 1615 // the root layout view layer as a container. | 1608 // the root layout view layer as a container. |
| 1616 bool is_container = | 1609 bool is_container = |
| 1617 owning_layer_.GetLayoutObject().CanContainFixedPositionObjects() && | 1610 owning_layer_.GetLayoutObject().CanContainFixedPositionObjects() && |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1932 std::unique_ptr<GraphicsLayer>& layer, | 1925 std::unique_ptr<GraphicsLayer>& layer, |
| 1933 bool needs_layer, | 1926 bool needs_layer, |
| 1934 CompositingReasons reason) { | 1927 CompositingReasons reason) { |
| 1935 if (needs_layer == !!layer) | 1928 if (needs_layer == !!layer) |
| 1936 return false; | 1929 return false; |
| 1937 layer = needs_layer ? CreateGraphicsLayer(reason) : nullptr; | 1930 layer = needs_layer ? CreateGraphicsLayer(reason) : nullptr; |
| 1938 | 1931 |
| 1939 if (PaintLayerScrollableArea* scrollable_area = | 1932 if (PaintLayerScrollableArea* scrollable_area = |
| 1940 owning_layer_.GetScrollableArea()) { | 1933 owning_layer_.GetScrollableArea()) { |
| 1941 if (ScrollingCoordinator* scrolling_coordinator = | 1934 if (ScrollingCoordinator* scrolling_coordinator = |
| 1942 ScrollingCoordinatorFromLayer(owning_layer_)) { | 1935 owning_layer_.GetScrollingCoordinator()) { |
| 1943 if (reason == kCompositingReasonLayerForHorizontalScrollbar) | 1936 if (reason == kCompositingReasonLayerForHorizontalScrollbar) |
| 1944 scrolling_coordinator->ScrollableAreaScrollbarLayerDidChange( | 1937 scrolling_coordinator->ScrollableAreaScrollbarLayerDidChange( |
| 1945 scrollable_area, kHorizontalScrollbar); | 1938 scrollable_area, kHorizontalScrollbar); |
| 1946 else if (reason == kCompositingReasonLayerForVerticalScrollbar) | 1939 else if (reason == kCompositingReasonLayerForVerticalScrollbar) |
| 1947 scrolling_coordinator->ScrollableAreaScrollbarLayerDidChange( | 1940 scrolling_coordinator->ScrollableAreaScrollbarLayerDidChange( |
| 1948 scrollable_area, kVerticalScrollbar); | 1941 scrollable_area, kVerticalScrollbar); |
| 1949 } | 1942 } |
| 1950 } | 1943 } |
| 1951 return true; | 1944 return true; |
| 1952 } | 1945 } |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2368 kGraphicsLayerPaintChildClippingMask); | 2361 kGraphicsLayerPaintChildClippingMask); |
| 2369 } | 2362 } |
| 2370 return; | 2363 return; |
| 2371 } | 2364 } |
| 2372 child_clipping_mask_layer_ = nullptr; | 2365 child_clipping_mask_layer_ = nullptr; |
| 2373 } | 2366 } |
| 2374 | 2367 |
| 2375 bool CompositedLayerMapping::UpdateScrollingLayers( | 2368 bool CompositedLayerMapping::UpdateScrollingLayers( |
| 2376 bool needs_scrolling_layers) { | 2369 bool needs_scrolling_layers) { |
| 2377 ScrollingCoordinator* scrolling_coordinator = | 2370 ScrollingCoordinator* scrolling_coordinator = |
| 2378 ScrollingCoordinatorFromLayer(owning_layer_); | 2371 owning_layer_.GetScrollingCoordinator(); |
| 2379 | 2372 |
| 2380 bool layer_changed = false; | 2373 bool layer_changed = false; |
| 2381 if (needs_scrolling_layers) { | 2374 if (needs_scrolling_layers) { |
| 2382 if (!scrolling_layer_) { | 2375 if (!scrolling_layer_) { |
| 2383 // Outer layer which corresponds with the scroll view. | 2376 // Outer layer which corresponds with the scroll view. |
| 2384 scrolling_layer_ = | 2377 scrolling_layer_ = |
| 2385 CreateGraphicsLayer(kCompositingReasonLayerForScrollingContainer); | 2378 CreateGraphicsLayer(kCompositingReasonLayerForScrollingContainer); |
| 2386 scrolling_layer_->SetDrawsContent(false); | 2379 scrolling_layer_->SetDrawsContent(false); |
| 2387 scrolling_layer_->SetMasksToBounds(true); | 2380 scrolling_layer_->SetMasksToBounds(true); |
| 2388 | 2381 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2431 if (layer != topmost_layer) | 2424 if (layer != topmost_layer) |
| 2432 scroll_parent = 0; | 2425 scroll_parent = 0; |
| 2433 | 2426 |
| 2434 scrolling_coordinator->UpdateScrollParentForGraphicsLayer(layer, | 2427 scrolling_coordinator->UpdateScrollParentForGraphicsLayer(layer, |
| 2435 scroll_parent); | 2428 scroll_parent); |
| 2436 } | 2429 } |
| 2437 | 2430 |
| 2438 void CompositedLayerMapping::UpdateScrollParent( | 2431 void CompositedLayerMapping::UpdateScrollParent( |
| 2439 const PaintLayer* scroll_parent) { | 2432 const PaintLayer* scroll_parent) { |
| 2440 if (ScrollingCoordinator* scrolling_coordinator = | 2433 if (ScrollingCoordinator* scrolling_coordinator = |
| 2441 ScrollingCoordinatorFromLayer(owning_layer_)) { | 2434 owning_layer_.GetScrollingCoordinator()) { |
| 2442 GraphicsLayer* topmost_layer = ChildForSuperlayers(); | 2435 GraphicsLayer* topmost_layer = ChildForSuperlayers(); |
| 2443 UpdateScrollParentForGraphicsLayer(squashing_containment_layer_.get(), | 2436 UpdateScrollParentForGraphicsLayer(squashing_containment_layer_.get(), |
| 2444 topmost_layer, scroll_parent, | 2437 topmost_layer, scroll_parent, |
| 2445 scrolling_coordinator); | 2438 scrolling_coordinator); |
| 2446 UpdateScrollParentForGraphicsLayer(ancestor_clipping_layer_.get(), | 2439 UpdateScrollParentForGraphicsLayer(ancestor_clipping_layer_.get(), |
| 2447 topmost_layer, scroll_parent, | 2440 topmost_layer, scroll_parent, |
| 2448 scrolling_coordinator); | 2441 scrolling_coordinator); |
| 2449 UpdateScrollParentForGraphicsLayer(graphics_layer_.get(), topmost_layer, | 2442 UpdateScrollParentForGraphicsLayer(graphics_layer_.get(), topmost_layer, |
| 2450 scroll_parent, scrolling_coordinator); | 2443 scroll_parent, scrolling_coordinator); |
| 2451 } | 2444 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 2474 OwningLayerClippedOrMaskedByLayerNotAboveCompositedAncestor( | 2467 OwningLayerClippedOrMaskedByLayerNotAboveCompositedAncestor( |
| 2475 scroll_parent, have_ancestor_clip_layer, have_ancestor_mask_layer); | 2468 scroll_parent, have_ancestor_clip_layer, have_ancestor_mask_layer); |
| 2476 if (!have_ancestor_clip_layer) { | 2469 if (!have_ancestor_clip_layer) { |
| 2477 clip_parent = owning_layer_.ClipParent(); | 2470 clip_parent = owning_layer_.ClipParent(); |
| 2478 if (clip_parent) | 2471 if (clip_parent) |
| 2479 clip_parent = | 2472 clip_parent = |
| 2480 clip_parent->EnclosingLayerWithCompositedLayerMapping(kIncludeSelf); | 2473 clip_parent->EnclosingLayerWithCompositedLayerMapping(kIncludeSelf); |
| 2481 } | 2474 } |
| 2482 | 2475 |
| 2483 if (ScrollingCoordinator* scrolling_coordinator = | 2476 if (ScrollingCoordinator* scrolling_coordinator = |
| 2484 ScrollingCoordinatorFromLayer(owning_layer_)) { | 2477 owning_layer_.GetScrollingCoordinator()) { |
| 2485 GraphicsLayer* topmost_layer = ChildForSuperlayers(); | 2478 GraphicsLayer* topmost_layer = ChildForSuperlayers(); |
| 2486 UpdateClipParentForGraphicsLayer(squashing_containment_layer_.get(), | 2479 UpdateClipParentForGraphicsLayer(squashing_containment_layer_.get(), |
| 2487 topmost_layer, clip_parent, | 2480 topmost_layer, clip_parent, |
| 2488 scrolling_coordinator); | 2481 scrolling_coordinator); |
| 2489 UpdateClipParentForGraphicsLayer(ancestor_clipping_layer_.get(), | 2482 UpdateClipParentForGraphicsLayer(ancestor_clipping_layer_.get(), |
| 2490 topmost_layer, clip_parent, | 2483 topmost_layer, clip_parent, |
| 2491 scrolling_coordinator); | 2484 scrolling_coordinator); |
| 2492 UpdateClipParentForGraphicsLayer(graphics_layer_.get(), topmost_layer, | 2485 UpdateClipParentForGraphicsLayer(graphics_layer_.get(), topmost_layer, |
| 2493 clip_parent, scrolling_coordinator); | 2486 clip_parent, scrolling_coordinator); |
| 2494 } | 2487 } |
| (...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3608 } else if (graphics_layer == decoration_outline_layer_.get()) { | 3601 } else if (graphics_layer == decoration_outline_layer_.get()) { |
| 3609 name = "Decoration Layer"; | 3602 name = "Decoration Layer"; |
| 3610 } else { | 3603 } else { |
| 3611 NOTREACHED(); | 3604 NOTREACHED(); |
| 3612 } | 3605 } |
| 3613 | 3606 |
| 3614 return name; | 3607 return name; |
| 3615 } | 3608 } |
| 3616 | 3609 |
| 3617 } // namespace blink | 3610 } // namespace blink |
| OLD | NEW |