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

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

Issue 2745063005: Remove document.rootScroller compositing clipping effects. (Closed)
Patch Set: Fix Rebase Created 3 years, 9 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
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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 return; 531 return;
532 532
533 const LayoutBoxModelObject* clippingContainer = 533 const LayoutBoxModelObject* clippingContainer =
534 m_owningLayer.clippingContainer(); 534 m_owningLayer.clippingContainer();
535 if (!clippingContainer) 535 if (!clippingContainer)
536 return; 536 return;
537 537
538 if (clippingContainer->enclosingLayer() == scrollParent) 538 if (clippingContainer->enclosingLayer() == scrollParent)
539 return; 539 return;
540 540
541 if (clippingContainer->enclosingLayer()->hasRootScrollerAsDescendant())
542 return;
543
544 if (compositingAncestor->layoutObject().isDescendantOf(clippingContainer)) 541 if (compositingAncestor->layoutObject().isDescendantOf(clippingContainer))
545 return; 542 return;
546 543
547 // We ignore overflow clip here; we want composited overflow content to 544 // We ignore overflow clip here; we want composited overflow content to
548 // behave as if it lives in an unclipped universe so it can prepaint, etc. 545 // behave as if it lives in an unclipped universe so it can prepaint, etc.
549 // This means that we need to check if we are actually clipped before 546 // This means that we need to check if we are actually clipped before
550 // setting up m_ancestorClippingLayer otherwise 547 // setting up m_ancestorClippingLayer otherwise
551 // updateAncestorClippingLayerGeometry will fail as the clip rect will be 548 // updateAncestorClippingLayerGeometry will fail as the clip rect will be
552 // infinite. 549 // infinite.
553 // FIXME: this should use cached clip rects, but this sometimes give 550 // FIXME: this should use cached clip rects, but this sometimes give
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 compositor->needsContentsCompositingLayer(&m_owningLayer))) 600 compositor->needsContentsCompositingLayer(&m_owningLayer)))
604 layerConfigChanged = true; 601 layerConfigChanged = true;
605 602
606 bool needsDescendantsClippingLayer = 603 bool needsDescendantsClippingLayer =
607 compositor->clipsCompositingDescendants(&m_owningLayer); 604 compositor->clipsCompositingDescendants(&m_owningLayer);
608 605
609 // Our scrolling layer will clip. 606 // Our scrolling layer will clip.
610 if (m_owningLayer.needsCompositedScrolling()) 607 if (m_owningLayer.needsCompositedScrolling())
611 needsDescendantsClippingLayer = false; 608 needsDescendantsClippingLayer = false;
612 609
613 // We disable clipping on ancestor layers of the root scroller to give it
614 // the same behavior w.r.t browser controls as the real root layer. See the
615 // RootScrollerController class for more details.
616 if (m_owningLayer.hasRootScrollerAsDescendant())
617 needsDescendantsClippingLayer = false;
618
619 const PaintLayer* scrollParent = this->scrollParent(); 610 const PaintLayer* scrollParent = this->scrollParent();
620 611
621 // This is required because compositing layers are parented according to the 612 // This is required because compositing layers are parented according to the
622 // z-order hierarchy, yet clipping goes down the layoutObject hierarchy. Thus, 613 // z-order hierarchy, yet clipping goes down the layoutObject hierarchy. Thus,
623 // a PaintLayer can be clipped by a PaintLayer that is an ancestor in the 614 // a PaintLayer can be clipped by a PaintLayer that is an ancestor in the
624 // layoutObject hierarchy, but a sibling in the z-order hierarchy. Further, 615 // layoutObject hierarchy, but a sibling in the z-order hierarchy. Further,
625 // that sibling need not be composited at all. In such scenarios, an ancestor 616 // that sibling need not be composited at all. In such scenarios, an ancestor
626 // clipping layer is necessary to apply the composited clip for this layer. 617 // clipping layer is necessary to apply the composited clip for this layer.
627 bool needsAncestorClip = false; 618 bool needsAncestorClip = false;
628 bool needsAncestorClippingMask = false; 619 bool needsAncestorClippingMask = false;
(...skipping 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after
2294 ScrollingCoordinator* scrollingCoordinator = 2285 ScrollingCoordinator* scrollingCoordinator =
2295 scrollingCoordinatorFromLayer(m_owningLayer); 2286 scrollingCoordinatorFromLayer(m_owningLayer);
2296 2287
2297 bool layerChanged = false; 2288 bool layerChanged = false;
2298 if (needsScrollingLayers) { 2289 if (needsScrollingLayers) {
2299 if (!m_scrollingLayer) { 2290 if (!m_scrollingLayer) {
2300 // Outer layer which corresponds with the scroll view. 2291 // Outer layer which corresponds with the scroll view.
2301 m_scrollingLayer = 2292 m_scrollingLayer =
2302 createGraphicsLayer(CompositingReasonLayerForScrollingContainer); 2293 createGraphicsLayer(CompositingReasonLayerForScrollingContainer);
2303 m_scrollingLayer->setDrawsContent(false); 2294 m_scrollingLayer->setDrawsContent(false);
2295 m_scrollingLayer->setMasksToBounds(true);
2304 2296
2305 // Inner layer which renders the content that scrolls. 2297 // Inner layer which renders the content that scrolls.
2306 m_scrollingContentsLayer = 2298 m_scrollingContentsLayer =
2307 createGraphicsLayer(CompositingReasonLayerForScrollingContents); 2299 createGraphicsLayer(CompositingReasonLayerForScrollingContents);
2308 2300
2309 if (Node* owningNode = m_owningLayer.layoutObject().node()) 2301 if (Node* owningNode = m_owningLayer.layoutObject().node())
2310 m_scrollingContentsLayer->setElementId(createCompositorElementId( 2302 m_scrollingContentsLayer->setElementId(createCompositorElementId(
2311 DOMNodeIds::idForNode(owningNode), CompositorSubElementId::Scroll)); 2303 DOMNodeIds::idForNode(owningNode), CompositorSubElementId::Scroll));
2312 2304
2313 m_scrollingLayer->addChild(m_scrollingContentsLayer.get()); 2305 m_scrollingLayer->addChild(m_scrollingContentsLayer.get());
2314 2306
2315 layerChanged = true; 2307 layerChanged = true;
2316 if (scrollingCoordinator) { 2308 if (scrollingCoordinator) {
2317 scrollingCoordinator->scrollableAreaScrollLayerDidChange( 2309 scrollingCoordinator->scrollableAreaScrollLayerDidChange(
2318 m_owningLayer.getScrollableArea()); 2310 m_owningLayer.getScrollableArea());
2319 scrollingCoordinator->scrollableAreasDidChange(); 2311 scrollingCoordinator->scrollableAreasDidChange();
2320 } 2312 }
2321 } 2313 }
2322
2323 m_scrollingLayer->setMasksToBounds(
2324 !m_owningLayer.hasRootScrollerAsDescendant());
2325 } else if (m_scrollingLayer) { 2314 } else if (m_scrollingLayer) {
2326 m_scrollingLayer = nullptr; 2315 m_scrollingLayer = nullptr;
2327 m_scrollingContentsLayer = nullptr; 2316 m_scrollingContentsLayer = nullptr;
2328 layerChanged = true; 2317 layerChanged = true;
2329 if (scrollingCoordinator) { 2318 if (scrollingCoordinator) {
2330 scrollingCoordinator->scrollableAreaScrollLayerDidChange( 2319 scrollingCoordinator->scrollableAreaScrollLayerDidChange(
2331 m_owningLayer.getScrollableArea()); 2320 m_owningLayer.getScrollableArea());
2332 scrollingCoordinator->scrollableAreasDidChange(); 2321 scrollingCoordinator->scrollableAreasDidChange();
2333 } 2322 }
2334 } 2323 }
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after
3509 } else if (graphicsLayer == m_decorationOutlineLayer.get()) { 3498 } else if (graphicsLayer == m_decorationOutlineLayer.get()) {
3510 name = "Decoration Layer"; 3499 name = "Decoration Layer";
3511 } else { 3500 } else {
3512 ASSERT_NOT_REACHED(); 3501 ASSERT_NOT_REACHED();
3513 } 3502 }
3514 3503
3515 return name; 3504 return name;
3516 } 3505 }
3517 3506
3518 } // namespace blink 3507 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698