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

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

Issue 1636563003: Put rare PaintLayer fields into PaintLayerRareData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 } 342 }
343 } 343 }
344 344
345 void CompositedLayerMapping::updateCompositingReasons() 345 void CompositedLayerMapping::updateCompositingReasons()
346 { 346 {
347 // All other layers owned by this mapping will have the same compositing rea son 347 // All other layers owned by this mapping will have the same compositing rea son
348 // for their lifetime, so they are initialized only when created. 348 // for their lifetime, so they are initialized only when created.
349 m_graphicsLayer->setCompositingReasons(m_owningLayer.compositingReasons()); 349 m_graphicsLayer->setCompositingReasons(m_owningLayer.compositingReasons());
350 } 350 }
351 351
352 bool CompositedLayerMapping::owningLayerClippedByLayerNotAboveCompositedAncestor (PaintLayer* scrollParent) 352 bool CompositedLayerMapping::owningLayerClippedByLayerNotAboveCompositedAncestor (const PaintLayer* scrollParent)
353 { 353 {
354 if (!m_owningLayer.parent()) 354 if (!m_owningLayer.parent())
355 return false; 355 return false;
356 356
357 const PaintLayer* compositingAncestor = m_owningLayer.enclosingLayerWithComp ositedLayerMapping(ExcludeSelf); 357 const PaintLayer* compositingAncestor = m_owningLayer.enclosingLayerWithComp ositedLayerMapping(ExcludeSelf);
358 if (!compositingAncestor) 358 if (!compositingAncestor)
359 return false; 359 return false;
360 360
361 const LayoutObject* clippingContainer = m_owningLayer.clippingContainer(); 361 const LayoutObject* clippingContainer = m_owningLayer.clippingContainer();
362 if (!clippingContainer) 362 if (!clippingContainer)
(...skipping 12 matching lines...) Expand all
375 // updateAncestorClippingLayerGeometry will fail as the clip rect will be 375 // updateAncestorClippingLayerGeometry will fail as the clip rect will be
376 // infinite. 376 // infinite.
377 // FIXME: this should use cached clip rects, but this sometimes give 377 // FIXME: this should use cached clip rects, but this sometimes give
378 // inaccurate results (and trips the ASSERTS in PaintLayerClipper). 378 // inaccurate results (and trips the ASSERTS in PaintLayerClipper).
379 ClipRectsContext clipRectsContext(compositingAncestor, UncachedClipRects, Ig noreOverlayScrollbarSize); 379 ClipRectsContext clipRectsContext(compositingAncestor, UncachedClipRects, Ig noreOverlayScrollbarSize);
380 clipRectsContext.setIgnoreOverflowClip(); 380 clipRectsContext.setIgnoreOverflowClip();
381 IntRect parentClipRect = pixelSnappedIntRect(m_owningLayer.clipper().backgro undClipRect(clipRectsContext).rect()); 381 IntRect parentClipRect = pixelSnappedIntRect(m_owningLayer.clipper().backgro undClipRect(clipRectsContext).rect());
382 return parentClipRect != LayoutRect::infiniteIntRect(); 382 return parentClipRect != LayoutRect::infiniteIntRect();
383 } 383 }
384 384
385 PaintLayer* CompositedLayerMapping::scrollParent() 385 const PaintLayer* CompositedLayerMapping::scrollParent()
386 { 386 {
387 PaintLayer* scrollParent = m_owningLayer.scrollParent(); 387 const PaintLayer* scrollParent = m_owningLayer.scrollParent();
388 if (scrollParent && !scrollParent->needsCompositedScrolling()) 388 if (scrollParent && !scrollParent->needsCompositedScrolling())
389 return nullptr; 389 return nullptr;
390 return scrollParent; 390 return scrollParent;
391 } 391 }
392 392
393 bool CompositedLayerMapping::updateGraphicsLayerConfiguration() 393 bool CompositedLayerMapping::updateGraphicsLayerConfiguration()
394 { 394 {
395 ASSERT(m_owningLayer.compositor()->lifecycle().state() == DocumentLifecycle: :InCompositingUpdate); 395 ASSERT(m_owningLayer.compositor()->lifecycle().state() == DocumentLifecycle: :InCompositingUpdate);
396 396
397 // Note carefully: here we assume that the compositing state of all descenda nts have been updated already, 397 // Note carefully: here we assume that the compositing state of all descenda nts have been updated already,
(...skipping 17 matching lines...) Expand all
415 415
416 if (updateForegroundLayer(compositor->needsContentsCompositingLayer(&m_ownin gLayer))) 416 if (updateForegroundLayer(compositor->needsContentsCompositingLayer(&m_ownin gLayer)))
417 layerConfigChanged = true; 417 layerConfigChanged = true;
418 418
419 bool needsDescendantsClippingLayer = compositor->clipsCompositingDescendants (&m_owningLayer); 419 bool needsDescendantsClippingLayer = compositor->clipsCompositingDescendants (&m_owningLayer);
420 420
421 // Our scrolling layer will clip. 421 // Our scrolling layer will clip.
422 if (m_owningLayer.needsCompositedScrolling()) 422 if (m_owningLayer.needsCompositedScrolling())
423 needsDescendantsClippingLayer = false; 423 needsDescendantsClippingLayer = false;
424 424
425 PaintLayer* scrollParent = this->scrollParent(); 425 const PaintLayer* scrollParent = this->scrollParent();
426 426
427 // This is required because compositing layers are parented according to the z-order hierarchy, yet 427 // This is required because compositing layers are parented according to the z-order hierarchy, yet
428 // clipping goes down the layoutObject hierarchy. Thus, a PaintLayer can be clipped by a 428 // clipping goes down the layoutObject hierarchy. Thus, a PaintLayer can be clipped by a
429 // PaintLayer that is an ancestor in the layoutObject hierarchy, but a sibli ng in the z-order 429 // PaintLayer that is an ancestor in the layoutObject hierarchy, but a sibli ng in the z-order
430 // hierarchy. Further, that sibling need not be composited at all. In such s cenarios, an ancestor 430 // hierarchy. Further, that sibling need not be composited at all. In such s cenarios, an ancestor
431 // clipping layer is necessary to apply the composited clip for this layer. 431 // clipping layer is necessary to apply the composited clip for this layer.
432 bool needsAncestorClip = owningLayerClippedByLayerNotAboveCompositedAncestor (scrollParent); 432 bool needsAncestorClip = owningLayerClippedByLayerNotAboveCompositedAncestor (scrollParent);
433 433
434 if (updateClippingLayers(needsAncestorClip, needsDescendantsClippingLayer)) 434 if (updateClippingLayers(needsAncestorClip, needsDescendantsClippingLayer))
435 layerConfigChanged = true; 435 layerConfigChanged = true;
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1658 layerChanged = true; 1658 layerChanged = true;
1659 if (scrollingCoordinator) { 1659 if (scrollingCoordinator) {
1660 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_owningLay er.scrollableArea()); 1660 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_owningLay er.scrollableArea());
1661 scrollingCoordinator->scrollableAreasDidChange(); 1661 scrollingCoordinator->scrollableAreasDidChange();
1662 } 1662 }
1663 } 1663 }
1664 1664
1665 return layerChanged; 1665 return layerChanged;
1666 } 1666 }
1667 1667
1668 static void updateScrollParentForGraphicsLayer(GraphicsLayer* layer, GraphicsLay er* topmostLayer, PaintLayer* scrollParent, ScrollingCoordinator* scrollingCoord inator) 1668 static void updateScrollParentForGraphicsLayer(GraphicsLayer* layer, GraphicsLay er* topmostLayer, const PaintLayer* scrollParent, ScrollingCoordinator* scrollin gCoordinator)
1669 { 1669 {
1670 if (!layer) 1670 if (!layer)
1671 return; 1671 return;
1672 1672
1673 // Only the topmost layer has a scroll parent. All other layers have a null scroll parent. 1673 // Only the topmost layer has a scroll parent. All other layers have a null scroll parent.
1674 if (layer != topmostLayer) 1674 if (layer != topmostLayer)
1675 scrollParent = 0; 1675 scrollParent = 0;
1676 1676
1677 scrollingCoordinator->updateScrollParentForGraphicsLayer(layer, scrollParent ); 1677 scrollingCoordinator->updateScrollParentForGraphicsLayer(layer, scrollParent );
1678 } 1678 }
1679 1679
1680 void CompositedLayerMapping::updateScrollParent(PaintLayer* scrollParent) 1680 void CompositedLayerMapping::updateScrollParent(const PaintLayer* scrollParent)
1681 { 1681 {
1682 if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLay er(m_owningLayer)) { 1682 if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLay er(m_owningLayer)) {
1683 GraphicsLayer* topmostLayer = childForSuperlayers(); 1683 GraphicsLayer* topmostLayer = childForSuperlayers();
1684 updateScrollParentForGraphicsLayer(m_squashingContainmentLayer.get(), to pmostLayer, scrollParent, scrollingCoordinator); 1684 updateScrollParentForGraphicsLayer(m_squashingContainmentLayer.get(), to pmostLayer, scrollParent, scrollingCoordinator);
1685 updateScrollParentForGraphicsLayer(m_ancestorClippingLayer.get(), topmos tLayer, scrollParent, scrollingCoordinator); 1685 updateScrollParentForGraphicsLayer(m_ancestorClippingLayer.get(), topmos tLayer, scrollParent, scrollingCoordinator);
1686 updateScrollParentForGraphicsLayer(m_graphicsLayer.get(), topmostLayer, scrollParent, scrollingCoordinator); 1686 updateScrollParentForGraphicsLayer(m_graphicsLayer.get(), topmostLayer, scrollParent, scrollingCoordinator);
1687 } 1687 }
1688 } 1688 }
1689 1689
1690 static void updateClipParentForGraphicsLayer(GraphicsLayer* layer, GraphicsLayer * topmostLayer, PaintLayer* clipParent, ScrollingCoordinator* scrollingCoordinat or) 1690 static void updateClipParentForGraphicsLayer(GraphicsLayer* layer, GraphicsLayer * topmostLayer, const PaintLayer* clipParent, ScrollingCoordinator* scrollingCoo rdinator)
1691 { 1691 {
1692 if (!layer) 1692 if (!layer)
1693 return; 1693 return;
1694 1694
1695 // Only the topmost layer has a scroll parent. All other layers have a null scroll parent. 1695 // Only the topmost layer has a scroll parent. All other layers have a null scroll parent.
1696 if (layer != topmostLayer) 1696 if (layer != topmostLayer)
1697 clipParent = 0; 1697 clipParent = 0;
1698 1698
1699 scrollingCoordinator->updateClipParentForGraphicsLayer(layer, clipParent); 1699 scrollingCoordinator->updateClipParentForGraphicsLayer(layer, clipParent);
1700 } 1700 }
1701 1701
1702 void CompositedLayerMapping::updateClipParent(PaintLayer* scrollParent) 1702 void CompositedLayerMapping::updateClipParent(const PaintLayer* scrollParent)
1703 { 1703 {
1704 if (owningLayerClippedByLayerNotAboveCompositedAncestor(scrollParent)) 1704 if (owningLayerClippedByLayerNotAboveCompositedAncestor(scrollParent))
1705 return; 1705 return;
1706 1706
1707 PaintLayer* clipParent = m_owningLayer.clipParent(); 1707 const PaintLayer* clipParent = m_owningLayer.clipParent();
1708 if (clipParent) 1708 if (clipParent)
1709 clipParent = clipParent->enclosingLayerWithCompositedLayerMapping(Includ eSelf); 1709 clipParent = clipParent->enclosingLayerWithCompositedLayerMapping(Includ eSelf);
1710 1710
1711 if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLay er(m_owningLayer)) { 1711 if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLay er(m_owningLayer)) {
1712 GraphicsLayer* topmostLayer = childForSuperlayers(); 1712 GraphicsLayer* topmostLayer = childForSuperlayers();
1713 updateClipParentForGraphicsLayer(m_squashingContainmentLayer.get(), topm ostLayer, clipParent, scrollingCoordinator); 1713 updateClipParentForGraphicsLayer(m_squashingContainmentLayer.get(), topm ostLayer, clipParent, scrollingCoordinator);
1714 updateClipParentForGraphicsLayer(m_ancestorClippingLayer.get(), topmostL ayer, clipParent, scrollingCoordinator); 1714 updateClipParentForGraphicsLayer(m_ancestorClippingLayer.get(), topmostL ayer, clipParent, scrollingCoordinator);
1715 updateClipParentForGraphicsLayer(m_graphicsLayer.get(), topmostLayer, cl ipParent, scrollingCoordinator); 1715 updateClipParentForGraphicsLayer(m_graphicsLayer.get(), topmostLayer, cl ipParent, scrollingCoordinator);
1716 } 1716 }
1717 } 1717 }
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
2582 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { 2582 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) {
2583 name = "Scrolling Block Selection Layer"; 2583 name = "Scrolling Block Selection Layer";
2584 } else { 2584 } else {
2585 ASSERT_NOT_REACHED(); 2585 ASSERT_NOT_REACHED();
2586 } 2586 }
2587 2587
2588 return name; 2588 return name;
2589 } 2589 }
2590 2590
2591 } // namespace blink 2591 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698