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

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

Issue 2748103015: Replace ASSERT with DCHECK in core/layout/<sub dirs> (Closed)
Patch Set: Rebase with latest Created 3 years, 8 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 189
190 CompositedLayerMapping::~CompositedLayerMapping() { 190 CompositedLayerMapping::~CompositedLayerMapping() {
191 // Hits in compositing/squashing/squash-onto-nephew.html. 191 // Hits in compositing/squashing/squash-onto-nephew.html.
192 DisableCompositingQueryAsserts disabler; 192 DisableCompositingQueryAsserts disabler;
193 193
194 // Do not leave the destroyed pointer dangling on any Layers that painted to 194 // Do not leave the destroyed pointer dangling on any Layers that painted to
195 // this mapping's squashing layer. 195 // this mapping's squashing layer.
196 for (size_t i = 0; i < m_squashedLayers.size(); ++i) { 196 for (size_t i = 0; i < m_squashedLayers.size(); ++i) {
197 PaintLayer* oldSquashedLayer = m_squashedLayers[i].paintLayer; 197 PaintLayer* oldSquashedLayer = m_squashedLayers[i].paintLayer;
198 // Assert on incorrect mappings between layers and groups 198 // Assert on incorrect mappings between layers and groups
199 ASSERT(oldSquashedLayer->groupedMapping() == this); 199 DCHECK_EQ(oldSquashedLayer->groupedMapping(), this);
200 if (oldSquashedLayer->groupedMapping() == this) { 200 if (oldSquashedLayer->groupedMapping() == this) {
201 oldSquashedLayer->setGroupedMapping( 201 oldSquashedLayer->setGroupedMapping(
202 0, PaintLayer::DoNotInvalidateLayerAndRemoveFromMapping); 202 0, PaintLayer::DoNotInvalidateLayerAndRemoveFromMapping);
203 oldSquashedLayer->setLostGroupedMapping(true); 203 oldSquashedLayer->setLostGroupedMapping(true);
204 } 204 }
205 } 205 }
206 206
207 updateClippingLayers(false, false, false); 207 updateClippingLayers(false, false, false);
208 updateOverflowControlsLayers(false, false, false, false); 208 updateOverflowControlsLayers(false, false, false, false);
209 updateChildTransformLayer(false); 209 updateChildTransformLayer(false);
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 } 400 }
401 401
402 void CompositedLayerMapping::updateLayerBlendMode(const ComputedStyle& style) { 402 void CompositedLayerMapping::updateLayerBlendMode(const ComputedStyle& style) {
403 setBlendMode(style.blendMode()); 403 setBlendMode(style.blendMode());
404 } 404 }
405 405
406 void CompositedLayerMapping::updateIsRootForIsolatedGroup() { 406 void CompositedLayerMapping::updateIsRootForIsolatedGroup() {
407 bool isolate = m_owningLayer.shouldIsolateCompositedDescendants(); 407 bool isolate = m_owningLayer.shouldIsolateCompositedDescendants();
408 408
409 // non stacking context layers should never isolate 409 // non stacking context layers should never isolate
410 ASSERT(m_owningLayer.stackingNode()->isStackingContext() || !isolate); 410 DCHECK(m_owningLayer.stackingNode()->isStackingContext() || !isolate);
411 411
412 m_graphicsLayer->setIsRootForIsolatedGroup(isolate); 412 m_graphicsLayer->setIsRootForIsolatedGroup(isolate);
413 } 413 }
414 414
415 void CompositedLayerMapping:: 415 void CompositedLayerMapping::
416 updateBackgroundPaintsOntoScrollingContentsLayer() { 416 updateBackgroundPaintsOntoScrollingContentsLayer() {
417 // We can only paint the background onto the scrolling contents layer if 417 // We can only paint the background onto the scrolling contents layer if
418 // it would be visually correct and we are using composited scrolling meaning 418 // it would be visually correct and we are using composited scrolling meaning
419 // we have a scrolling contents layer to paint it into. 419 // we have a scrolling contents layer to paint it into.
420 BackgroundPaintLocation paintLocation = 420 BackgroundPaintLocation paintLocation =
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 } else { 499 } else {
500 if (hasScrollingLayer()) 500 if (hasScrollingLayer())
501 m_scrollingContentsLayer->setContentsOpaque(false); 501 m_scrollingContentsLayer->setContentsOpaque(false);
502 m_graphicsLayer->setContentsOpaque( 502 m_graphicsLayer->setContentsOpaque(
503 m_owningLayer.backgroundIsKnownToBeOpaqueInRect(compositedBounds())); 503 m_owningLayer.backgroundIsKnownToBeOpaqueInRect(compositedBounds()));
504 } 504 }
505 } 505 }
506 } 506 }
507 507
508 void CompositedLayerMapping::updateCompositedBounds() { 508 void CompositedLayerMapping::updateCompositedBounds() {
509 ASSERT(m_owningLayer.compositor()->lifecycle().state() == 509 DCHECK_EQ(m_owningLayer.compositor()->lifecycle().state(),
510 DocumentLifecycle::InCompositingUpdate); 510 DocumentLifecycle::InCompositingUpdate);
511 // FIXME: if this is really needed for performance, it would be better to 511 // FIXME: if this is really needed for performance, it would be better to
512 // store it on Layer. 512 // store it on Layer.
513 m_compositedBounds = m_owningLayer.boundingBoxForCompositing(); 513 m_compositedBounds = m_owningLayer.boundingBoxForCompositing();
514 m_contentOffsetInCompositingLayerDirty = true; 514 m_contentOffsetInCompositingLayerDirty = true;
515 } 515 }
516 516
517 void CompositedLayerMapping::updateAfterPartResize() { 517 void CompositedLayerMapping::updateAfterPartResize() {
518 if (layoutObject().isLayoutPart()) { 518 if (layoutObject().isLayoutPart()) {
519 if (PaintLayerCompositor* innerCompositor = 519 if (PaintLayerCompositor* innerCompositor =
520 PaintLayerCompositor::frameContentsCompositor( 520 PaintLayerCompositor::frameContentsCompositor(
521 toLayoutPart(layoutObject()))) { 521 toLayoutPart(layoutObject()))) {
522 innerCompositor->frameViewDidChangeSize(); 522 innerCompositor->frameViewDidChangeSize();
523 // We can floor this point because our frameviews are always aligned to 523 // We can floor this point because our frameviews are always aligned to
524 // pixel boundaries. 524 // pixel boundaries.
525 ASSERT(m_compositedBounds.location() == 525 DCHECK(m_compositedBounds.location() ==
526 flooredIntPoint(m_compositedBounds.location())); 526 flooredIntPoint(m_compositedBounds.location()));
527 innerCompositor->frameViewDidChangeLocation( 527 innerCompositor->frameViewDidChangeLocation(
528 flooredIntPoint(contentsBox().location())); 528 flooredIntPoint(contentsBox().location()));
529 } 529 }
530 } 530 }
531 } 531 }
532 532
533 void CompositedLayerMapping::updateCompositingReasons() { 533 void CompositedLayerMapping::updateCompositingReasons() {
534 // All other layers owned by this mapping will have the same compositing 534 // All other layers owned by this mapping will have the same compositing
535 // reason for their lifetime, so they are initialized only when created. 535 // reason for their lifetime, so they are initialized only when created.
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 } 613 }
614 614
615 const PaintLayer* CompositedLayerMapping::scrollParent() { 615 const PaintLayer* CompositedLayerMapping::scrollParent() {
616 const PaintLayer* scrollParent = m_owningLayer.scrollParent(); 616 const PaintLayer* scrollParent = m_owningLayer.scrollParent();
617 if (scrollParent && !scrollParent->needsCompositedScrolling()) 617 if (scrollParent && !scrollParent->needsCompositedScrolling())
618 return nullptr; 618 return nullptr;
619 return scrollParent; 619 return scrollParent;
620 } 620 }
621 621
622 bool CompositedLayerMapping::updateGraphicsLayerConfiguration() { 622 bool CompositedLayerMapping::updateGraphicsLayerConfiguration() {
623 ASSERT(m_owningLayer.compositor()->lifecycle().state() == 623 DCHECK_EQ(m_owningLayer.compositor()->lifecycle().state(),
624 DocumentLifecycle::InCompositingUpdate); 624 DocumentLifecycle::InCompositingUpdate);
625 625
626 // Note carefully: here we assume that the compositing state of all 626 // Note carefully: here we assume that the compositing state of all
627 // descendants have been updated already, so it is legitimate to compute and 627 // descendants have been updated already, so it is legitimate to compute and
628 // cache the composited bounds for this layer. 628 // cache the composited bounds for this layer.
629 updateCompositedBounds(); 629 updateCompositedBounds();
630 630
631 PaintLayerCompositor* compositor = this->compositor(); 631 PaintLayerCompositor* compositor = this->compositor();
632 LayoutObject& layoutObject = this->layoutObject(); 632 LayoutObject& layoutObject = this->layoutObject();
633 const ComputedStyle& style = layoutObject.styleRef(); 633 const ComputedStyle& style = layoutObject.styleRef();
634 634
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 1016
1017 for (size_t i = 0; i < layers.size(); ++i) 1017 for (size_t i = 0; i < layers.size(); ++i)
1018 layers[i].localClipRectForSquashedLayer = 1018 layers[i].localClipRectForSquashedLayer =
1019 localClipRectForSquashedLayer(m_owningLayer, layers[i], layers); 1019 localClipRectForSquashedLayer(m_owningLayer, layers[i], layers);
1020 } 1020 }
1021 1021
1022 void CompositedLayerMapping::updateGraphicsLayerGeometry( 1022 void CompositedLayerMapping::updateGraphicsLayerGeometry(
1023 const PaintLayer* compositingContainer, 1023 const PaintLayer* compositingContainer,
1024 const PaintLayer* compositingStackingContext, 1024 const PaintLayer* compositingStackingContext,
1025 Vector<PaintLayer*>& layersNeedingPaintInvalidation) { 1025 Vector<PaintLayer*>& layersNeedingPaintInvalidation) {
1026 ASSERT(m_owningLayer.compositor()->lifecycle().state() == 1026 DCHECK_EQ(m_owningLayer.compositor()->lifecycle().state(),
1027 DocumentLifecycle::InCompositingUpdate); 1027 DocumentLifecycle::InCompositingUpdate);
1028 1028
1029 // Set transform property, if it is not animating. We have to do this here 1029 // Set transform property, if it is not animating. We have to do this here
1030 // because the transform is affected by the layer dimensions. 1030 // because the transform is affected by the layer dimensions.
1031 if (!layoutObject().style()->isRunningTransformAnimationOnCompositor()) 1031 if (!layoutObject().style()->isRunningTransformAnimationOnCompositor())
1032 updateTransform(layoutObject().styleRef()); 1032 updateTransform(layoutObject().styleRef());
1033 1033
1034 // Set opacity, if it is not animating. 1034 // Set opacity, if it is not animating.
1035 if (!layoutObject().style()->isRunningOpacityAnimationOnCompositor()) 1035 if (!layoutObject().style()->isRunningOpacityAnimationOnCompositor())
1036 updateOpacity(layoutObject().styleRef()); 1036 updateOpacity(layoutObject().styleRef());
1037 1037
1038 if (!layoutObject().style()->isRunningFilterAnimationOnCompositor()) 1038 if (!layoutObject().style()->isRunningFilterAnimationOnCompositor())
1039 updateFilters(layoutObject().styleRef()); 1039 updateFilters(layoutObject().styleRef());
1040 1040
1041 if (!layoutObject().style()->isRunningBackdropFilterAnimationOnCompositor()) 1041 if (!layoutObject().style()->isRunningBackdropFilterAnimationOnCompositor())
1042 updateBackdropFilters(layoutObject().styleRef()); 1042 updateBackdropFilters(layoutObject().styleRef());
1043 1043
1044 // We compute everything relative to the enclosing compositing layer. 1044 // We compute everything relative to the enclosing compositing layer.
1045 IntRect ancestorCompositingBounds; 1045 IntRect ancestorCompositingBounds;
1046 if (compositingContainer) { 1046 if (compositingContainer) {
1047 ASSERT(compositingContainer->hasCompositedLayerMapping()); 1047 DCHECK(compositingContainer->hasCompositedLayerMapping());
1048 ancestorCompositingBounds = compositingContainer->compositedLayerMapping() 1048 ancestorCompositingBounds = compositingContainer->compositedLayerMapping()
1049 ->pixelSnappedCompositedBounds(); 1049 ->pixelSnappedCompositedBounds();
1050 } 1050 }
1051 1051
1052 IntRect localCompositingBounds; 1052 IntRect localCompositingBounds;
1053 IntRect relativeCompositingBounds; 1053 IntRect relativeCompositingBounds;
1054 LayoutPoint offsetFromCompositedAncestor; 1054 LayoutPoint offsetFromCompositedAncestor;
1055 IntPoint snappedOffsetFromCompositedAncestor; 1055 IntPoint snappedOffsetFromCompositedAncestor;
1056 computeBoundsOfOwningLayer( 1056 computeBoundsOfOwningLayer(
1057 compositingContainer, localCompositingBounds, relativeCompositingBounds, 1057 compositingContainer, localCompositingBounds, relativeCompositingBounds,
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
1398 relativeCompositingBounds.height() * 0.5f, 0.f); 1398 relativeCompositingBounds.height() * 0.5f, 0.f);
1399 m_graphicsLayer->setTransformOrigin(compositedTransformOrigin); 1399 m_graphicsLayer->setTransformOrigin(compositedTransformOrigin);
1400 } 1400 }
1401 } 1401 }
1402 1402
1403 void CompositedLayerMapping::updateScrollingLayerGeometry( 1403 void CompositedLayerMapping::updateScrollingLayerGeometry(
1404 const IntRect& localCompositingBounds) { 1404 const IntRect& localCompositingBounds) {
1405 if (!m_scrollingLayer) 1405 if (!m_scrollingLayer)
1406 return; 1406 return;
1407 1407
1408 ASSERT(m_scrollingContentsLayer); 1408 DCHECK(m_scrollingContentsLayer);
1409 LayoutBox& layoutBox = toLayoutBox(layoutObject()); 1409 LayoutBox& layoutBox = toLayoutBox(layoutObject());
1410 IntRect overflowClipRect = 1410 IntRect overflowClipRect =
1411 pixelSnappedIntRect(layoutBox.overflowClipRect(LayoutPoint())); 1411 pixelSnappedIntRect(layoutBox.overflowClipRect(LayoutPoint()));
1412 1412
1413 // When a m_childTransformLayer exists, local content offsets for the 1413 // When a m_childTransformLayer exists, local content offsets for the
1414 // m_scrollingLayer have already been applied. Otherwise, we apply them here. 1414 // m_scrollingLayer have already been applied. Otherwise, we apply them here.
1415 IntSize localContentOffset(0, 0); 1415 IntSize localContentOffset(0, 0);
1416 if (!m_childTransformLayer) { 1416 if (!m_childTransformLayer) {
1417 localContentOffset = roundedIntPoint(m_owningLayer.subpixelAccumulation()) - 1417 localContentOffset = roundedIntPoint(m_owningLayer.subpixelAccumulation()) -
1418 localCompositingBounds.location(); 1418 localCompositingBounds.location();
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1627 m_overflowControlsHostLayer->addChild(m_layerForVerticalScrollbar.get()); 1627 m_overflowControlsHostLayer->addChild(m_layerForVerticalScrollbar.get());
1628 if (m_layerForScrollCorner) 1628 if (m_layerForScrollCorner)
1629 m_overflowControlsHostLayer->addChild(m_layerForScrollCorner.get()); 1629 m_overflowControlsHostLayer->addChild(m_layerForScrollCorner.get());
1630 1630
1631 // Now add the DecorationOutlineLayer as a subtree to GraphicsLayer 1631 // Now add the DecorationOutlineLayer as a subtree to GraphicsLayer
1632 if (m_decorationOutlineLayer.get()) 1632 if (m_decorationOutlineLayer.get())
1633 m_graphicsLayer->addChild(m_decorationOutlineLayer.get()); 1633 m_graphicsLayer->addChild(m_decorationOutlineLayer.get());
1634 1634
1635 // The squashing containment layer, if it exists, becomes a no-op parent. 1635 // The squashing containment layer, if it exists, becomes a no-op parent.
1636 if (m_squashingLayer) { 1636 if (m_squashingLayer) {
1637 ASSERT((m_ancestorClippingLayer && !m_squashingContainmentLayer) || 1637 DCHECK((m_ancestorClippingLayer && !m_squashingContainmentLayer) ||
1638 (!m_ancestorClippingLayer && m_squashingContainmentLayer)); 1638 (!m_ancestorClippingLayer && m_squashingContainmentLayer));
1639 1639
1640 if (m_squashingContainmentLayer) { 1640 if (m_squashingContainmentLayer) {
1641 m_squashingContainmentLayer->removeAllChildren(); 1641 m_squashingContainmentLayer->removeAllChildren();
1642 m_squashingContainmentLayer->addChild(m_graphicsLayer.get()); 1642 m_squashingContainmentLayer->addChild(m_graphicsLayer.get());
1643 m_squashingContainmentLayer->addChild(m_squashingLayer.get()); 1643 m_squashingContainmentLayer->addChild(m_squashingLayer.get());
1644 } else { 1644 } else {
1645 // The ancestor clipping layer is already set up and has m_graphicsLayer 1645 // The ancestor clipping layer is already set up and has m_graphicsLayer
1646 // under it. 1646 // under it.
1647 m_ancestorClippingLayer->addChild(m_squashingLayer.get()); 1647 m_ancestorClippingLayer->addChild(m_squashingLayer.get());
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
2018 ApplyToContentLayers | 2018 ApplyToContentLayers |
2019 ApplyToScrollingContentLayers | 2019 ApplyToScrollingContentLayers |
2020 ApplyToDecorationOutlineLayer) 2020 ApplyToDecorationOutlineLayer)
2021 }; 2021 };
2022 typedef unsigned ApplyToGraphicsLayersMode; 2022 typedef unsigned ApplyToGraphicsLayersMode;
2023 2023
2024 template <typename Func> 2024 template <typename Func>
2025 static void ApplyToGraphicsLayers(const CompositedLayerMapping* mapping, 2025 static void ApplyToGraphicsLayers(const CompositedLayerMapping* mapping,
2026 const Func& f, 2026 const Func& f,
2027 ApplyToGraphicsLayersMode mode) { 2027 ApplyToGraphicsLayersMode mode) {
2028 ASSERT(mode); 2028 DCHECK(mode);
2029 2029
2030 if ((mode & ApplyToLayersAffectedByPreserve3D) && 2030 if ((mode & ApplyToLayersAffectedByPreserve3D) &&
2031 mapping->childTransformLayer()) 2031 mapping->childTransformLayer())
2032 f(mapping->childTransformLayer()); 2032 f(mapping->childTransformLayer());
2033 if (((mode & ApplyToLayersAffectedByPreserve3D) || 2033 if (((mode & ApplyToLayersAffectedByPreserve3D) ||
2034 (mode & ApplyToContentLayers) || 2034 (mode & ApplyToContentLayers) ||
2035 (mode & ApplyToNonScrollingContentLayers)) && 2035 (mode & ApplyToNonScrollingContentLayers)) &&
2036 mapping->mainGraphicsLayer()) 2036 mapping->mainGraphicsLayer())
2037 f(mapping->mainGraphicsLayer()); 2037 f(mapping->mainGraphicsLayer());
2038 if (((mode & ApplyToLayersAffectedByPreserve3D) || 2038 if (((mode & ApplyToLayersAffectedByPreserve3D) ||
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
2453 } 2453 }
2454 } else { 2454 } else {
2455 if (!m_squashingContainmentLayer) { 2455 if (!m_squashingContainmentLayer) {
2456 m_squashingContainmentLayer = 2456 m_squashingContainmentLayer =
2457 createGraphicsLayer(CompositingReasonLayerForSquashingContainer); 2457 createGraphicsLayer(CompositingReasonLayerForSquashingContainer);
2458 m_squashingContainmentLayer->setShouldFlattenTransform(false); 2458 m_squashingContainmentLayer->setShouldFlattenTransform(false);
2459 layersChanged = true; 2459 layersChanged = true;
2460 } 2460 }
2461 } 2461 }
2462 2462
2463 ASSERT((m_ancestorClippingLayer && !m_squashingContainmentLayer) || 2463 DCHECK((m_ancestorClippingLayer && !m_squashingContainmentLayer) ||
2464 (!m_ancestorClippingLayer && m_squashingContainmentLayer)); 2464 (!m_ancestorClippingLayer && m_squashingContainmentLayer));
2465 ASSERT(m_squashingLayer); 2465 DCHECK(m_squashingLayer);
2466 } else { 2466 } else {
2467 if (m_squashingLayer) { 2467 if (m_squashingLayer) {
2468 m_squashingLayer->removeFromParent(); 2468 m_squashingLayer->removeFromParent();
2469 m_squashingLayer = nullptr; 2469 m_squashingLayer = nullptr;
2470 layersChanged = true; 2470 layersChanged = true;
2471 } 2471 }
2472 if (m_squashingContainmentLayer) { 2472 if (m_squashingContainmentLayer) {
2473 m_squashingContainmentLayer->removeFromParent(); 2473 m_squashingContainmentLayer->removeFromParent();
2474 m_squashingContainmentLayer = nullptr; 2474 m_squashingContainmentLayer = nullptr;
2475 layersChanged = true; 2475 layersChanged = true;
2476 } 2476 }
2477 ASSERT(!m_squashingLayer && !m_squashingContainmentLayer); 2477 DCHECK(!m_squashingLayer);
2478 DCHECK(!m_squashingContainmentLayer);
2478 } 2479 }
2479 2480
2480 return layersChanged; 2481 return layersChanged;
2481 } 2482 }
2482 2483
2483 GraphicsLayerPaintingPhase 2484 GraphicsLayerPaintingPhase
2484 CompositedLayerMapping::paintingPhaseForPrimaryLayer() const { 2485 CompositedLayerMapping::paintingPhaseForPrimaryLayer() const {
2485 unsigned phase = 0; 2486 unsigned phase = 0;
2486 if (!m_backgroundLayer) 2487 if (!m_backgroundLayer)
2487 phase |= GraphicsLayerPaintBackground; 2488 phase |= GraphicsLayerPaintBackground;
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
2706 origin.setY( 2707 origin.setY(
2707 floatValueForLength(style.transformOriginY(), borderBox.height())); 2708 floatValueForLength(style.transformOriginY(), borderBox.height()));
2708 origin.setZ(style.transformOriginZ()); 2709 origin.setZ(style.transformOriginZ());
2709 2710
2710 return origin; 2711 return origin;
2711 } 2712 }
2712 2713
2713 // Return the offset from the top-left of this compositing layer at which the 2714 // Return the offset from the top-left of this compositing layer at which the
2714 // LayoutObject's contents are painted. 2715 // LayoutObject's contents are painted.
2715 LayoutSize CompositedLayerMapping::contentOffsetInCompositingLayer() const { 2716 LayoutSize CompositedLayerMapping::contentOffsetInCompositingLayer() const {
2716 ASSERT(!m_contentOffsetInCompositingLayerDirty); 2717 DCHECK(!m_contentOffsetInCompositingLayerDirty);
2717 return m_contentOffsetInCompositingLayer; 2718 return m_contentOffsetInCompositingLayer;
2718 } 2719 }
2719 2720
2720 LayoutRect CompositedLayerMapping::contentsBox() const { 2721 LayoutRect CompositedLayerMapping::contentsBox() const {
2721 LayoutRect contentsBox = LayoutRect(contentsRect(layoutObject())); 2722 LayoutRect contentsBox = LayoutRect(contentsRect(layoutObject()));
2722 contentsBox.move(contentOffsetInCompositingLayer()); 2723 contentsBox.move(contentOffsetInCompositingLayer());
2723 return contentsBox; 2724 return contentsBox;
2724 } 2725 }
2725 2726
2726 bool CompositedLayerMapping::needsToReparentOverflowControls() const { 2727 bool CompositedLayerMapping::needsToReparentOverflowControls() const {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
2829 const DisplayItemClient& client; 2830 const DisplayItemClient& client;
2830 }; 2831 };
2831 2832
2832 void CompositedLayerMapping::setContentsNeedDisplayInRect( 2833 void CompositedLayerMapping::setContentsNeedDisplayInRect(
2833 const LayoutRect& r, 2834 const LayoutRect& r,
2834 PaintInvalidationReason invalidationReason, 2835 PaintInvalidationReason invalidationReason,
2835 const DisplayItemClient& client) { 2836 const DisplayItemClient& client) {
2836 DCHECK(!m_owningLayer.layoutObject().usesCompositedScrolling()); 2837 DCHECK(!m_owningLayer.layoutObject().usesCompositedScrolling());
2837 // TODO(wangxianzhu): Enable the following assert after paint invalidation for 2838 // TODO(wangxianzhu): Enable the following assert after paint invalidation for
2838 // spv2 is ready. 2839 // spv2 is ready.
2839 // ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); 2840 // DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled());
2840 2841
2841 SetContentsNeedsDisplayInRectFunctor functor = { 2842 SetContentsNeedsDisplayInRectFunctor functor = {
2842 enclosingIntRect(LayoutRect( 2843 enclosingIntRect(LayoutRect(
2843 r.location() + m_owningLayer.subpixelAccumulation(), r.size())), 2844 r.location() + m_owningLayer.subpixelAccumulation(), r.size())),
2844 invalidationReason, client}; 2845 invalidationReason, client};
2845 ApplyToGraphicsLayers(this, functor, ApplyToContentLayers); 2846 ApplyToGraphicsLayers(this, functor, ApplyToContentLayers);
2846 } 2847 }
2847 2848
2848 void CompositedLayerMapping::setNonScrollingContentsNeedDisplayInRect( 2849 void CompositedLayerMapping::setNonScrollingContentsNeedDisplayInRect(
2849 const LayoutRect& r, 2850 const LayoutRect& r,
2850 PaintInvalidationReason invalidationReason, 2851 PaintInvalidationReason invalidationReason,
2851 const DisplayItemClient& client) { 2852 const DisplayItemClient& client) {
2852 DCHECK(m_owningLayer.layoutObject().usesCompositedScrolling()); 2853 DCHECK(m_owningLayer.layoutObject().usesCompositedScrolling());
2853 // TODO(wangxianzhu): Enable the following assert after paint invalidation for 2854 // TODO(wangxianzhu): Enable the following assert after paint invalidation for
2854 // spv2 is ready. 2855 // spv2 is ready.
2855 // ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); 2856 // DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled());
2856 2857
2857 SetContentsNeedsDisplayInRectFunctor functor = { 2858 SetContentsNeedsDisplayInRectFunctor functor = {
2858 enclosingIntRect(LayoutRect( 2859 enclosingIntRect(LayoutRect(
2859 r.location() + m_owningLayer.subpixelAccumulation(), r.size())), 2860 r.location() + m_owningLayer.subpixelAccumulation(), r.size())),
2860 invalidationReason, client}; 2861 invalidationReason, client};
2861 ApplyToGraphicsLayers(this, functor, ApplyToNonScrollingContentLayers); 2862 ApplyToGraphicsLayers(this, functor, ApplyToNonScrollingContentLayers);
2862 } 2863 }
2863 2864
2864 void CompositedLayerMapping::setScrollingContentsNeedDisplayInRect( 2865 void CompositedLayerMapping::setScrollingContentsNeedDisplayInRect(
2865 const LayoutRect& r, 2866 const LayoutRect& r,
2866 PaintInvalidationReason invalidationReason, 2867 PaintInvalidationReason invalidationReason,
2867 const DisplayItemClient& client) { 2868 const DisplayItemClient& client) {
2868 DCHECK(m_owningLayer.layoutObject().usesCompositedScrolling()); 2869 DCHECK(m_owningLayer.layoutObject().usesCompositedScrolling());
2869 // TODO(wangxianzhu): Enable the following assert after paint invalidation for 2870 // TODO(wangxianzhu): Enable the following assert after paint invalidation for
2870 // spv2 is ready. 2871 // spv2 is ready.
2871 // ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); 2872 // DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled());
2872 2873
2873 SetContentsNeedsDisplayInRectFunctor functor = { 2874 SetContentsNeedsDisplayInRectFunctor functor = {
2874 enclosingIntRect(LayoutRect( 2875 enclosingIntRect(LayoutRect(
2875 r.location() + m_owningLayer.subpixelAccumulation(), r.size())), 2876 r.location() + m_owningLayer.subpixelAccumulation(), r.size())),
2876 invalidationReason, client}; 2877 invalidationReason, client};
2877 ApplyToGraphicsLayers(this, functor, ApplyToScrollingContentLayers); 2878 ApplyToGraphicsLayers(this, functor, ApplyToScrollingContentLayers);
2878 } 2879 }
2879 2880
2880 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer( 2881 const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(
2881 const LayoutObject* layoutObject, 2882 const LayoutObject* layoutObject,
(...skipping 17 matching lines...) Expand all
2899 2900
2900 IntRect CompositedLayerMapping::localClipRectForSquashedLayer( 2901 IntRect CompositedLayerMapping::localClipRectForSquashedLayer(
2901 const PaintLayer& referenceLayer, 2902 const PaintLayer& referenceLayer,
2902 const GraphicsLayerPaintInfo& paintInfo, 2903 const GraphicsLayerPaintInfo& paintInfo,
2903 const Vector<GraphicsLayerPaintInfo>& layers) { 2904 const Vector<GraphicsLayerPaintInfo>& layers) {
2904 const LayoutObject* clippingContainer = 2905 const LayoutObject* clippingContainer =
2905 paintInfo.paintLayer->clippingContainer(); 2906 paintInfo.paintLayer->clippingContainer();
2906 if (clippingContainer == referenceLayer.clippingContainer()) 2907 if (clippingContainer == referenceLayer.clippingContainer())
2907 return LayoutRect::infiniteIntRect(); 2908 return LayoutRect::infiniteIntRect();
2908 2909
2909 ASSERT(clippingContainer); 2910 DCHECK(clippingContainer);
2910 2911
2911 const GraphicsLayerPaintInfo* ancestorPaintInfo = 2912 const GraphicsLayerPaintInfo* ancestorPaintInfo =
2912 containingSquashedLayer(clippingContainer, layers, layers.size()); 2913 containingSquashedLayer(clippingContainer, layers, layers.size());
2913 // Must be there, otherwise 2914 // Must be there, otherwise
2914 // CompositingLayerAssigner::canSquashIntoCurrentSquashingOwner would have 2915 // CompositingLayerAssigner::canSquashIntoCurrentSquashingOwner would have
2915 // disallowed squashing. 2916 // disallowed squashing.
2916 ASSERT(ancestorPaintInfo); 2917 DCHECK(ancestorPaintInfo);
2917 2918
2918 // FIXME: this is a potential performance issue. We should consider caching 2919 // FIXME: this is a potential performance issue. We should consider caching
2919 // these clip rects or otherwise optimizing. 2920 // these clip rects or otherwise optimizing.
2920 ClipRectsContext clipRectsContext(ancestorPaintInfo->paintLayer, 2921 ClipRectsContext clipRectsContext(ancestorPaintInfo->paintLayer,
2921 UncachedClipRects); 2922 UncachedClipRects);
2922 ClipRect parentClipRect; 2923 ClipRect parentClipRect;
2923 paintInfo.paintLayer->clipper(PaintLayer::DoNotUseGeometryMapper) 2924 paintInfo.paintLayer->clipper(PaintLayer::DoNotUseGeometryMapper)
2924 .calculateBackgroundClipRect(clipRectsContext, parentClipRect); 2925 .calculateBackgroundClipRect(clipRectsContext, parentClipRect);
2925 2926
2926 IntRect snappedParentClipRect(pixelSnappedIntRect(parentClipRect.rect())); 2927 IntRect snappedParentClipRect(pixelSnappedIntRect(parentClipRect.rect()));
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
3043 // yet m_squashedLayers.size() == 0. There must be a bug elsewhere. 3044 // yet m_squashedLayers.size() == 0. There must be a bug elsewhere.
3044 if (m_squashedLayers.size() == 0) 3045 if (m_squashedLayers.size() == 0)
3045 return IntRect(); 3046 return IntRect();
3046 // All squashed layers have the same clip and transform space, so we can use 3047 // All squashed layers have the same clip and transform space, so we can use
3047 // the first squashed layer's layoutObject to map the squashing layer's 3048 // the first squashed layer's layoutObject to map the squashing layer's
3048 // bounds into viewport space, with offsetFromAnchorLayoutObject to 3049 // bounds into viewport space, with offsetFromAnchorLayoutObject to
3049 // translate squashing layer's bounds into the first squashed layer's space. 3050 // translate squashing layer's bounds into the first squashed layer's space.
3050 anchorLayoutObject = &m_squashedLayers[0].paintLayer->layoutObject(); 3051 anchorLayoutObject = &m_squashedLayers[0].paintLayer->layoutObject();
3051 offsetFromAnchorLayoutObject = m_squashedLayers[0].offsetFromLayoutObject; 3052 offsetFromAnchorLayoutObject = m_squashedLayers[0].offsetFromLayoutObject;
3052 } else { 3053 } else {
3053 ASSERT(graphicsLayer == m_graphicsLayer.get() || 3054 DCHECK(graphicsLayer == m_graphicsLayer.get() ||
3054 graphicsLayer == m_scrollingContentsLayer.get()); 3055 graphicsLayer == m_scrollingContentsLayer.get());
3055 anchorLayoutObject = &m_owningLayer.layoutObject(); 3056 anchorLayoutObject = &m_owningLayer.layoutObject();
3056 offsetFromAnchorLayoutObject = graphicsLayer->offsetFromLayoutObject(); 3057 offsetFromAnchorLayoutObject = graphicsLayer->offsetFromLayoutObject();
3057 adjustForCompositedScrolling(graphicsLayer, offsetFromAnchorLayoutObject); 3058 adjustForCompositedScrolling(graphicsLayer, offsetFromAnchorLayoutObject);
3058 } 3059 }
3059 3060
3060 // Start with the bounds of the graphics layer in the space of the anchor 3061 // Start with the bounds of the graphics layer in the space of the anchor
3061 // LayoutObject. 3062 // LayoutObject.
3062 FloatRect graphicsLayerBoundsInObjectSpace(graphicsLayerBounds); 3063 FloatRect graphicsLayerBoundsInObjectSpace(graphicsLayerBounds);
3063 graphicsLayerBoundsInObjectSpace.move(offsetFromAnchorLayoutObject); 3064 graphicsLayerBoundsInObjectSpace.move(offsetFromAnchorLayoutObject);
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
3439 3440
3440 void CompositedLayerMapping::removeLayerFromSquashingGraphicsLayer( 3441 void CompositedLayerMapping::removeLayerFromSquashingGraphicsLayer(
3441 const PaintLayer* layer) { 3442 const PaintLayer* layer) {
3442 size_t layerIndex = 0; 3443 size_t layerIndex = 0;
3443 for (; layerIndex < m_squashedLayers.size(); ++layerIndex) { 3444 for (; layerIndex < m_squashedLayers.size(); ++layerIndex) {
3444 if (m_squashedLayers[layerIndex].paintLayer == layer) 3445 if (m_squashedLayers[layerIndex].paintLayer == layer)
3445 break; 3446 break;
3446 } 3447 }
3447 3448
3448 // Assert on incorrect mappings between layers and groups 3449 // Assert on incorrect mappings between layers and groups
3449 ASSERT(layerIndex < m_squashedLayers.size()); 3450 DCHECK_LT(layerIndex, m_squashedLayers.size());
3450 if (layerIndex == m_squashedLayers.size()) 3451 if (layerIndex == m_squashedLayers.size())
3451 return; 3452 return;
3452 3453
3453 m_squashedLayers.remove(layerIndex); 3454 m_squashedLayers.remove(layerIndex);
3454 } 3455 }
3455 3456
3456 #if DCHECK_IS_ON() 3457 #if DCHECK_IS_ON()
3457 bool CompositedLayerMapping::verifyLayerInSquashingVector( 3458 bool CompositedLayerMapping::verifyLayerInSquashingVector(
3458 const PaintLayer* layer) { 3459 const PaintLayer* layer) {
3459 for (size_t layerIndex = 0; layerIndex < m_squashedLayers.size(); 3460 for (size_t layerIndex = 0; layerIndex < m_squashedLayers.size();
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
3532 } else if (graphicsLayer == m_decorationOutlineLayer.get()) { 3533 } else if (graphicsLayer == m_decorationOutlineLayer.get()) {
3533 name = "Decoration Layer"; 3534 name = "Decoration Layer";
3534 } else { 3535 } else {
3535 NOTREACHED(); 3536 NOTREACHED();
3536 } 3537 }
3537 3538
3538 return name; 3539 return name;
3539 } 3540 }
3540 3541
3541 } // namespace blink 3542 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698