| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * | 4 * |
| 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
| 6 * | 6 * |
| 7 * Other contributors: | 7 * Other contributors: |
| 8 * Robert O'Callahan <roc+@cs.cmu.edu> | 8 * Robert O'Callahan <roc+@cs.cmu.edu> |
| 9 * David Baron <dbaron@fas.harvard.edu> | 9 * David Baron <dbaron@fas.harvard.edu> |
| 10 * Christian Biesinger <cbiesinger@web.de> | 10 * Christian Biesinger <cbiesinger@web.de> |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 static CompositingQueryMode gCompositingQueryMode = | 99 static CompositingQueryMode gCompositingQueryMode = |
| 100 CompositingQueriesAreOnlyAllowedInCertainDocumentLifecyclePhases; | 100 CompositingQueriesAreOnlyAllowedInCertainDocumentLifecyclePhases; |
| 101 | 101 |
| 102 struct SameSizeAsPaintLayer : DisplayItemClient { | 102 struct SameSizeAsPaintLayer : DisplayItemClient { |
| 103 int bitFields; | 103 int bitFields; |
| 104 void* pointers[10]; | 104 void* pointers[10]; |
| 105 LayoutUnit layoutUnits[4]; | 105 LayoutUnit layoutUnits[4]; |
| 106 IntSize size; | 106 IntSize size; |
| 107 Persistent<PaintLayerScrollableArea> scrollableArea; | 107 Persistent<PaintLayerScrollableArea> scrollableArea; |
| 108 struct { | 108 struct { |
| 109 IntRect rect; | 109 IntRect rect, rect2; |
| 110 void* pointers[2]; | 110 void* pointers[2]; |
| 111 } ancestorCompositingInputs; | 111 } ancestorCompositingInputs; |
| 112 struct { | 112 struct { |
| 113 IntSize size; | 113 IntSize size; |
| 114 void* pointer; | 114 void* pointer; |
| 115 LayoutRect rect; | 115 LayoutRect rect; |
| 116 } previousPaintStatus; | 116 } previousPaintStatus; |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 static_assert(sizeof(PaintLayer) == sizeof(SameSizeAsPaintLayer), | 119 static_assert(sizeof(PaintLayer) == sizeof(SameSizeAsPaintLayer), |
| (...skipping 13 matching lines...) Expand all Loading... |
| 133 PaintLayerRareData::~PaintLayerRareData() {} | 133 PaintLayerRareData::~PaintLayerRareData() {} |
| 134 | 134 |
| 135 PaintLayer::PaintLayer(LayoutBoxModelObject* layoutObject) | 135 PaintLayer::PaintLayer(LayoutBoxModelObject* layoutObject) |
| 136 : m_hasSelfPaintingLayerDescendant(false), | 136 : m_hasSelfPaintingLayerDescendant(false), |
| 137 m_hasSelfPaintingLayerDescendantDirty(false), | 137 m_hasSelfPaintingLayerDescendantDirty(false), |
| 138 m_isRootLayer(layoutObject->isLayoutView()), | 138 m_isRootLayer(layoutObject->isLayoutView()), |
| 139 m_isVisibleContentDirty(true), | 139 m_isVisibleContentDirty(true), |
| 140 m_hasVisibleContent(false), | 140 m_hasVisibleContent(false), |
| 141 m_isVisibleDescendantDirty(false), | 141 m_isVisibleDescendantDirty(false), |
| 142 m_hasVisibleDescendant(false), | 142 m_hasVisibleDescendant(false), |
| 143 #if ENABLE(ASSERT) | 143 #if DCHECK_IS_ON() |
| 144 m_needsPositionUpdate(true), | 144 m_needsPositionUpdate(true), |
| 145 #endif | 145 #endif |
| 146 m_is3DTransformedDescendantDirty(true), | 146 m_is3DTransformedDescendantDirty(true), |
| 147 m_has3DTransformedDescendant(false), | 147 m_has3DTransformedDescendant(false), |
| 148 m_containsDirtyOverlayScrollbars(false), | 148 m_containsDirtyOverlayScrollbars(false), |
| 149 m_needsAncestorDependentCompositingInputsUpdate(true), | 149 m_needsAncestorDependentCompositingInputsUpdate(true), |
| 150 m_needsDescendantDependentCompositingInputsUpdate(true), | 150 m_needsDescendantDependentCompositingInputsUpdate(true), |
| 151 m_childNeedsCompositingInputsUpdate(true), | 151 m_childNeedsCompositingInputsUpdate(true), |
| 152 m_hasCompositingDescendant(false), | 152 m_hasCompositingDescendant(false), |
| 153 m_isAllScrollingContentComposited(false), | 153 m_isAllScrollingContentComposited(false), |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 // FIXME: We should be able to remove this call because we don't care about | 311 // FIXME: We should be able to remove this call because we don't care about |
| 312 // any descendant-dependent flags, but code somewhere else is reading these | 312 // any descendant-dependent flags, but code somewhere else is reading these |
| 313 // flags and depending on us to update them. | 313 // flags and depending on us to update them. |
| 314 updateDescendantDependentFlags(); | 314 updateDescendantDependentFlags(); |
| 315 | 315 |
| 316 for (PaintLayer* child = firstChild(); child; child = child->nextSibling()) | 316 for (PaintLayer* child = firstChild(); child; child = child->nextSibling()) |
| 317 child->updateLayerPositionRecursive(); | 317 child->updateLayerPositionRecursive(); |
| 318 } | 318 } |
| 319 | 319 |
| 320 void PaintLayer::updateHasSelfPaintingLayerDescendant() const { | 320 void PaintLayer::updateHasSelfPaintingLayerDescendant() const { |
| 321 ASSERT(m_hasSelfPaintingLayerDescendantDirty); | 321 DCHECK(m_hasSelfPaintingLayerDescendantDirty); |
| 322 | 322 |
| 323 m_hasSelfPaintingLayerDescendant = false; | 323 m_hasSelfPaintingLayerDescendant = false; |
| 324 | 324 |
| 325 for (PaintLayer* child = firstChild(); child; child = child->nextSibling()) { | 325 for (PaintLayer* child = firstChild(); child; child = child->nextSibling()) { |
| 326 if (child->isSelfPaintingLayer() || | 326 if (child->isSelfPaintingLayer() || |
| 327 child->hasSelfPaintingLayerDescendant()) { | 327 child->hasSelfPaintingLayerDescendant()) { |
| 328 m_hasSelfPaintingLayerDescendant = true; | 328 m_hasSelfPaintingLayerDescendant = true; |
| 329 break; | 329 break; |
| 330 } | 330 } |
| 331 } | 331 } |
| 332 | 332 |
| 333 m_hasSelfPaintingLayerDescendantDirty = false; | 333 m_hasSelfPaintingLayerDescendantDirty = false; |
| 334 } | 334 } |
| 335 | 335 |
| 336 void PaintLayer::dirtyAncestorChainHasSelfPaintingLayerDescendantStatus() { | 336 void PaintLayer::dirtyAncestorChainHasSelfPaintingLayerDescendantStatus() { |
| 337 for (PaintLayer* layer = this; layer; layer = layer->parent()) { | 337 for (PaintLayer* layer = this; layer; layer = layer->parent()) { |
| 338 layer->m_hasSelfPaintingLayerDescendantDirty = true; | 338 layer->m_hasSelfPaintingLayerDescendantDirty = true; |
| 339 // If we have reached a self-painting layer, we know our parent should have | 339 // If we have reached a self-painting layer, we know our parent should have |
| 340 // a self-painting descendant in this case, there is no need to dirty our | 340 // a self-painting descendant in this case, there is no need to dirty our |
| 341 // ancestors further. | 341 // ancestors further. |
| 342 if (layer->isSelfPaintingLayer()) { | 342 if (layer->isSelfPaintingLayer()) { |
| 343 ASSERT(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty || | 343 DCHECK(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty || |
| 344 parent()->m_hasSelfPaintingLayerDescendant); | 344 parent()->m_hasSelfPaintingLayerDescendant); |
| 345 break; | 345 break; |
| 346 } | 346 } |
| 347 } | 347 } |
| 348 } | 348 } |
| 349 | 349 |
| 350 bool PaintLayer::scrollsWithViewport() const { | 350 bool PaintLayer::scrollsWithViewport() const { |
| 351 return (layoutObject()->style()->position() == FixedPosition && | 351 return (layoutObject()->style()->position() == FixedPosition && |
| 352 layoutObject()->containerForFixedPosition() == | 352 layoutObject()->containerForFixedPosition() == |
| 353 layoutObject()->view()) || | 353 layoutObject()->view()) || |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 for (PaintLayer* child = firstChild(); child; child = child->nextSibling()) { | 388 for (PaintLayer* child = firstChild(); child; child = child->nextSibling()) { |
| 389 child->updateLayerPositionsAfterScrollRecursive( | 389 child->updateLayerPositionsAfterScrollRecursive( |
| 390 scrollDelta, paintInvalidationContainerWasScrolled && | 390 scrollDelta, paintInvalidationContainerWasScrolled && |
| 391 !child->isPaintInvalidationContainer()); | 391 !child->isPaintInvalidationContainer()); |
| 392 } | 392 } |
| 393 } | 393 } |
| 394 | 394 |
| 395 void PaintLayer::updateTransformationMatrix() { | 395 void PaintLayer::updateTransformationMatrix() { |
| 396 if (TransformationMatrix* transform = this->transform()) { | 396 if (TransformationMatrix* transform = this->transform()) { |
| 397 LayoutBox* box = layoutBox(); | 397 LayoutBox* box = layoutBox(); |
| 398 ASSERT(box); | 398 DCHECK(box); |
| 399 transform->makeIdentity(); | 399 transform->makeIdentity(); |
| 400 box->style()->applyTransform( | 400 box->style()->applyTransform( |
| 401 *transform, box->size(), ComputedStyle::IncludeTransformOrigin, | 401 *transform, box->size(), ComputedStyle::IncludeTransformOrigin, |
| 402 ComputedStyle::IncludeMotionPath, | 402 ComputedStyle::IncludeMotionPath, |
| 403 ComputedStyle::IncludeIndependentTransformProperties); | 403 ComputedStyle::IncludeIndependentTransformProperties); |
| 404 makeMatrixRenderable(*transform, compositor()->hasAcceleratedCompositing()); | 404 makeMatrixRenderable(*transform, compositor()->hasAcceleratedCompositing()); |
| 405 } | 405 } |
| 406 } | 406 } |
| 407 | 407 |
| 408 void PaintLayer::updateTransform(const ComputedStyle* oldStyle, | 408 void PaintLayer::updateTransform(const ComputedStyle* oldStyle, |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 return matrix; | 499 return matrix; |
| 500 } | 500 } |
| 501 | 501 |
| 502 return *transform; | 502 return *transform; |
| 503 } | 503 } |
| 504 | 504 |
| 505 void PaintLayer::convertFromFlowThreadToVisualBoundingBoxInAncestor( | 505 void PaintLayer::convertFromFlowThreadToVisualBoundingBoxInAncestor( |
| 506 const PaintLayer* ancestorLayer, | 506 const PaintLayer* ancestorLayer, |
| 507 LayoutRect& rect) const { | 507 LayoutRect& rect) const { |
| 508 PaintLayer* paginationLayer = enclosingPaginationLayer(); | 508 PaintLayer* paginationLayer = enclosingPaginationLayer(); |
| 509 ASSERT(paginationLayer); | 509 DCHECK(paginationLayer); |
| 510 LayoutFlowThread* flowThread = | 510 LayoutFlowThread* flowThread = |
| 511 toLayoutFlowThread(paginationLayer->layoutObject()); | 511 toLayoutFlowThread(paginationLayer->layoutObject()); |
| 512 | 512 |
| 513 // First make the flow thread rectangle relative to the flow thread, not to | 513 // First make the flow thread rectangle relative to the flow thread, not to |
| 514 // |layer|. | 514 // |layer|. |
| 515 LayoutPoint offsetWithinPaginationLayer; | 515 LayoutPoint offsetWithinPaginationLayer; |
| 516 convertToLayerCoords(paginationLayer, offsetWithinPaginationLayer); | 516 convertToLayerCoords(paginationLayer, offsetWithinPaginationLayer); |
| 517 rect.moveBy(offsetWithinPaginationLayer); | 517 rect.moveBy(offsetWithinPaginationLayer); |
| 518 | 518 |
| 519 // Then make the rectangle visual, relative to the fragmentation context. | 519 // Then make the rectangle visual, relative to the fragmentation context. |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 localPoint.move(newOffset); | 859 localPoint.move(newOffset); |
| 860 } else if (m_rareData) { | 860 } else if (m_rareData) { |
| 861 m_rareData->offsetForInFlowPosition = LayoutSize(); | 861 m_rareData->offsetForInFlowPosition = LayoutSize(); |
| 862 } | 862 } |
| 863 | 863 |
| 864 if (m_location != localPoint) { | 864 if (m_location != localPoint) { |
| 865 setNeedsRepaint(); | 865 setNeedsRepaint(); |
| 866 } | 866 } |
| 867 m_location = localPoint; | 867 m_location = localPoint; |
| 868 | 868 |
| 869 #if ENABLE(ASSERT) | 869 #if DCHECK_IS_ON() |
| 870 m_needsPositionUpdate = false; | 870 m_needsPositionUpdate = false; |
| 871 #endif | 871 #endif |
| 872 } | 872 } |
| 873 | 873 |
| 874 TransformationMatrix PaintLayer::perspectiveTransform() const { | 874 TransformationMatrix PaintLayer::perspectiveTransform() const { |
| 875 if (!layoutObject()->hasTransformRelatedProperty()) | 875 if (!layoutObject()->hasTransformRelatedProperty()) |
| 876 return TransformationMatrix(); | 876 return TransformationMatrix(); |
| 877 | 877 |
| 878 const ComputedStyle& style = layoutObject()->styleRef(); | 878 const ComputedStyle& style = layoutObject()->styleRef(); |
| 879 if (!style.hasPerspective()) | 879 if (!style.hasPerspective()) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 895 borderBox.width().toFloat()), | 895 borderBox.width().toFloat()), |
| 896 floatValueForLength(style.perspectiveOriginY(), | 896 floatValueForLength(style.perspectiveOriginY(), |
| 897 borderBox.height().toFloat())); | 897 borderBox.height().toFloat())); |
| 898 } | 898 } |
| 899 | 899 |
| 900 PaintLayer* PaintLayer::containingLayerForOutOfFlowPositioned( | 900 PaintLayer* PaintLayer::containingLayerForOutOfFlowPositioned( |
| 901 const PaintLayer* ancestor, | 901 const PaintLayer* ancestor, |
| 902 bool* skippedAncestor) const { | 902 bool* skippedAncestor) const { |
| 903 // If we have specified an ancestor, surely the caller needs to know whether | 903 // If we have specified an ancestor, surely the caller needs to know whether |
| 904 // we skipped it. | 904 // we skipped it. |
| 905 ASSERT(!ancestor || skippedAncestor); | 905 DCHECK(!ancestor || skippedAncestor); |
| 906 if (skippedAncestor) | 906 if (skippedAncestor) |
| 907 *skippedAncestor = false; | 907 *skippedAncestor = false; |
| 908 if (layoutObject()->style()->position() == FixedPosition) { | 908 if (layoutObject()->style()->position() == FixedPosition) { |
| 909 PaintLayer* curr = parent(); | 909 PaintLayer* curr = parent(); |
| 910 while (curr && !curr->layoutObject()->canContainFixedPositionObjects()) { | 910 while (curr && !curr->layoutObject()->canContainFixedPositionObjects()) { |
| 911 if (skippedAncestor && curr == ancestor) | 911 if (skippedAncestor && curr == ancestor) |
| 912 *skippedAncestor = true; | 912 *skippedAncestor = true; |
| 913 curr = curr->parent(); | 913 curr = curr->parent(); |
| 914 } | 914 } |
| 915 | 915 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 bool PaintLayer::isPaintInvalidationContainer() const { | 956 bool PaintLayer::isPaintInvalidationContainer() const { |
| 957 return compositingState() == PaintsIntoOwnBacking || | 957 return compositingState() == PaintsIntoOwnBacking || |
| 958 compositingState() == PaintsIntoGroupedBacking; | 958 compositingState() == PaintsIntoGroupedBacking; |
| 959 } | 959 } |
| 960 | 960 |
| 961 // Note: enclosingCompositingLayer does not include squashed layers. Compositing | 961 // Note: enclosingCompositingLayer does not include squashed layers. Compositing |
| 962 // stacking children of squashed layers receive graphics layers that are | 962 // stacking children of squashed layers receive graphics layers that are |
| 963 // parented to the compositing ancestor of the squashed layer. | 963 // parented to the compositing ancestor of the squashed layer. |
| 964 PaintLayer* PaintLayer::enclosingLayerWithCompositedLayerMapping( | 964 PaintLayer* PaintLayer::enclosingLayerWithCompositedLayerMapping( |
| 965 IncludeSelfOrNot includeSelf) const { | 965 IncludeSelfOrNot includeSelf) const { |
| 966 ASSERT(isAllowedToQueryCompositingState()); | 966 DCHECK(isAllowedToQueryCompositingState()); |
| 967 | 967 |
| 968 if ((includeSelf == IncludeSelf) && compositingState() != NotComposited && | 968 if ((includeSelf == IncludeSelf) && compositingState() != NotComposited && |
| 969 compositingState() != PaintsIntoGroupedBacking) | 969 compositingState() != PaintsIntoGroupedBacking) |
| 970 return const_cast<PaintLayer*>(this); | 970 return const_cast<PaintLayer*>(this); |
| 971 | 971 |
| 972 for (PaintLayer* curr = compositingContainer(); curr; | 972 for (PaintLayer* curr = compositingContainer(); curr; |
| 973 curr = curr->compositingContainer()) { | 973 curr = curr->compositingContainer()) { |
| 974 if (curr->compositingState() != NotComposited && | 974 if (curr->compositingState() != NotComposited && |
| 975 curr->compositingState() != PaintsIntoGroupedBacking) | 975 curr->compositingState() != PaintsIntoGroupedBacking) |
| 976 return curr; | 976 return curr; |
| 977 } | 977 } |
| 978 | 978 |
| 979 return nullptr; | 979 return nullptr; |
| 980 } | 980 } |
| 981 | 981 |
| 982 // Return the enclosingCompositedLayerForPaintInvalidation for the given Layer | 982 // Return the enclosingCompositedLayerForPaintInvalidation for the given Layer |
| 983 // including crossing frame boundaries. | 983 // including crossing frame boundaries. |
| 984 PaintLayer* | 984 PaintLayer* |
| 985 PaintLayer::enclosingLayerForPaintInvalidationCrossingFrameBoundaries() const { | 985 PaintLayer::enclosingLayerForPaintInvalidationCrossingFrameBoundaries() const { |
| 986 const PaintLayer* layer = this; | 986 const PaintLayer* layer = this; |
| 987 PaintLayer* compositedLayer = 0; | 987 PaintLayer* compositedLayer = 0; |
| 988 while (!compositedLayer) { | 988 while (!compositedLayer) { |
| 989 compositedLayer = layer->enclosingLayerForPaintInvalidation(); | 989 compositedLayer = layer->enclosingLayerForPaintInvalidation(); |
| 990 if (!compositedLayer) { | 990 if (!compositedLayer) { |
| 991 RELEASE_ASSERT(layer->layoutObject()->frame()); | 991 CHECK(layer->layoutObject()->frame()); |
| 992 LayoutItem owner = layer->layoutObject()->frame()->ownerLayoutItem(); | 992 LayoutItem owner = layer->layoutObject()->frame()->ownerLayoutItem(); |
| 993 if (owner.isNull()) | 993 if (owner.isNull()) |
| 994 break; | 994 break; |
| 995 layer = owner.enclosingLayer(); | 995 layer = owner.enclosingLayer(); |
| 996 } | 996 } |
| 997 } | 997 } |
| 998 return compositedLayer; | 998 return compositedLayer; |
| 999 } | 999 } |
| 1000 | 1000 |
| 1001 PaintLayer* PaintLayer::enclosingLayerForPaintInvalidation() const { | 1001 PaintLayer* PaintLayer::enclosingLayerForPaintInvalidation() const { |
| 1002 ASSERT(isAllowedToQueryCompositingState()); | 1002 DCHECK(isAllowedToQueryCompositingState()); |
| 1003 | 1003 |
| 1004 if (isPaintInvalidationContainer()) | 1004 if (isPaintInvalidationContainer()) |
| 1005 return const_cast<PaintLayer*>(this); | 1005 return const_cast<PaintLayer*>(this); |
| 1006 | 1006 |
| 1007 for (PaintLayer* curr = compositingContainer(); curr; | 1007 for (PaintLayer* curr = compositingContainer(); curr; |
| 1008 curr = curr->compositingContainer()) { | 1008 curr = curr->compositingContainer()) { |
| 1009 if (curr->isPaintInvalidationContainer()) | 1009 if (curr->isPaintInvalidationContainer()) |
| 1010 return curr; | 1010 return curr; |
| 1011 } | 1011 } |
| 1012 | 1012 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1045 bool hasNonIsolatedDescendantWithBlendMode, | 1045 bool hasNonIsolatedDescendantWithBlendMode, |
| 1046 bool hasRootScrollerAsDescendant) { | 1046 bool hasRootScrollerAsDescendant) { |
| 1047 m_hasDescendantWithClipPath = hasDescendantWithClipPath; | 1047 m_hasDescendantWithClipPath = hasDescendantWithClipPath; |
| 1048 m_hasNonIsolatedDescendantWithBlendMode = | 1048 m_hasNonIsolatedDescendantWithBlendMode = |
| 1049 hasNonIsolatedDescendantWithBlendMode; | 1049 hasNonIsolatedDescendantWithBlendMode; |
| 1050 m_hasRootScrollerAsDescendant = hasRootScrollerAsDescendant; | 1050 m_hasRootScrollerAsDescendant = hasRootScrollerAsDescendant; |
| 1051 m_needsDescendantDependentCompositingInputsUpdate = false; | 1051 m_needsDescendantDependentCompositingInputsUpdate = false; |
| 1052 } | 1052 } |
| 1053 | 1053 |
| 1054 void PaintLayer::didUpdateCompositingInputs() { | 1054 void PaintLayer::didUpdateCompositingInputs() { |
| 1055 ASSERT(!needsCompositingInputsUpdate()); | 1055 DCHECK(!needsCompositingInputsUpdate()); |
| 1056 m_childNeedsCompositingInputsUpdate = false; | 1056 m_childNeedsCompositingInputsUpdate = false; |
| 1057 if (m_scrollableArea) | 1057 if (m_scrollableArea) |
| 1058 m_scrollableArea->updateNeedsCompositedScrolling(); | 1058 m_scrollableArea->updateNeedsCompositedScrolling(); |
| 1059 } | 1059 } |
| 1060 | 1060 |
| 1061 bool PaintLayer::hasNonIsolatedDescendantWithBlendMode() const { | 1061 bool PaintLayer::hasNonIsolatedDescendantWithBlendMode() const { |
| 1062 ASSERT(!m_needsDescendantDependentCompositingInputsUpdate); | 1062 DCHECK(!m_needsDescendantDependentCompositingInputsUpdate); |
| 1063 if (m_hasNonIsolatedDescendantWithBlendMode) | 1063 if (m_hasNonIsolatedDescendantWithBlendMode) |
| 1064 return true; | 1064 return true; |
| 1065 if (layoutObject()->isSVGRoot()) | 1065 if (layoutObject()->isSVGRoot()) |
| 1066 return toLayoutSVGRoot(layoutObject())->hasNonIsolatedBlendingDescendants(); | 1066 return toLayoutSVGRoot(layoutObject())->hasNonIsolatedBlendingDescendants(); |
| 1067 return false; | 1067 return false; |
| 1068 } | 1068 } |
| 1069 | 1069 |
| 1070 void PaintLayer::setCompositingReasons(CompositingReasons reasons, | 1070 void PaintLayer::setCompositingReasons(CompositingReasons reasons, |
| 1071 CompositingReasons mask) { | 1071 CompositingReasons mask) { |
| 1072 CompositingReasons oldReasons = | 1072 CompositingReasons oldReasons = |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1236 void PaintLayer::operator delete(void* ptr) { | 1236 void PaintLayer::operator delete(void* ptr) { |
| 1237 partitionFree(ptr); | 1237 partitionFree(ptr); |
| 1238 } | 1238 } |
| 1239 | 1239 |
| 1240 void PaintLayer::addChild(PaintLayer* child, PaintLayer* beforeChild) { | 1240 void PaintLayer::addChild(PaintLayer* child, PaintLayer* beforeChild) { |
| 1241 PaintLayer* prevSibling = | 1241 PaintLayer* prevSibling = |
| 1242 beforeChild ? beforeChild->previousSibling() : lastChild(); | 1242 beforeChild ? beforeChild->previousSibling() : lastChild(); |
| 1243 if (prevSibling) { | 1243 if (prevSibling) { |
| 1244 child->setPreviousSibling(prevSibling); | 1244 child->setPreviousSibling(prevSibling); |
| 1245 prevSibling->setNextSibling(child); | 1245 prevSibling->setNextSibling(child); |
| 1246 ASSERT(prevSibling != child); | 1246 DCHECK(prevSibling != child); |
| 1247 } else { | 1247 } else { |
| 1248 setFirstChild(child); | 1248 setFirstChild(child); |
| 1249 } | 1249 } |
| 1250 | 1250 |
| 1251 if (beforeChild) { | 1251 if (beforeChild) { |
| 1252 beforeChild->setPreviousSibling(child); | 1252 beforeChild->setPreviousSibling(child); |
| 1253 child->setNextSibling(beforeChild); | 1253 child->setNextSibling(beforeChild); |
| 1254 ASSERT(beforeChild != child); | 1254 DCHECK(beforeChild != child); |
| 1255 } else { | 1255 } else { |
| 1256 setLastChild(child); | 1256 setLastChild(child); |
| 1257 } | 1257 } |
| 1258 | 1258 |
| 1259 child->m_parent = this; | 1259 child->m_parent = this; |
| 1260 | 1260 |
| 1261 // The ancestor overflow layer is calculated during compositing inputs update | 1261 // The ancestor overflow layer is calculated during compositing inputs update |
| 1262 // and should not be set yet. | 1262 // and should not be set yet. |
| 1263 ASSERT(!child->ancestorOverflowLayer()); | 1263 DCHECK(!child->ancestorOverflowLayer()); |
| 1264 | 1264 |
| 1265 setNeedsCompositingInputsUpdate(); | 1265 setNeedsCompositingInputsUpdate(); |
| 1266 | 1266 |
| 1267 if (!child->stackingNode()->isStacked() && | 1267 if (!child->stackingNode()->isStacked() && |
| 1268 !layoutObject()->documentBeingDestroyed()) | 1268 !layoutObject()->documentBeingDestroyed()) |
| 1269 compositor()->setNeedsCompositingUpdate(CompositingUpdateRebuildTree); | 1269 compositor()->setNeedsCompositingUpdate(CompositingUpdateRebuildTree); |
| 1270 | 1270 |
| 1271 if (child->stackingNode()->isStacked() || child->firstChild()) { | 1271 if (child->stackingNode()->isStacked() || child->firstChild()) { |
| 1272 // Dirty the z-order list in which we are contained. The | 1272 // Dirty the z-order list in which we are contained. The |
| 1273 // ancestorStackingContextNode() can be null in the case where we're | 1273 // ancestorStackingContextNode() can be null in the case where we're |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1384 // Remove us from the parent. | 1384 // Remove us from the parent. |
| 1385 m_parent->removeChild(this); | 1385 m_parent->removeChild(this); |
| 1386 m_layoutObject->destroyLayer(); | 1386 m_layoutObject->destroyLayer(); |
| 1387 } | 1387 } |
| 1388 | 1388 |
| 1389 void PaintLayer::insertOnlyThisLayerAfterStyleChange() { | 1389 void PaintLayer::insertOnlyThisLayerAfterStyleChange() { |
| 1390 if (!m_parent && layoutObject()->parent()) { | 1390 if (!m_parent && layoutObject()->parent()) { |
| 1391 // We need to connect ourselves when our layoutObject() has a parent. | 1391 // We need to connect ourselves when our layoutObject() has a parent. |
| 1392 // Find our enclosingLayer and add ourselves. | 1392 // Find our enclosingLayer and add ourselves. |
| 1393 PaintLayer* parentLayer = layoutObject()->parent()->enclosingLayer(); | 1393 PaintLayer* parentLayer = layoutObject()->parent()->enclosingLayer(); |
| 1394 ASSERT(parentLayer); | 1394 DCHECK(parentLayer); |
| 1395 PaintLayer* beforeChild = | 1395 PaintLayer* beforeChild = |
| 1396 layoutObject()->parent()->findNextLayer(parentLayer, layoutObject()); | 1396 layoutObject()->parent()->findNextLayer(parentLayer, layoutObject()); |
| 1397 parentLayer->addChild(this, beforeChild); | 1397 parentLayer->addChild(this, beforeChild); |
| 1398 } | 1398 } |
| 1399 | 1399 |
| 1400 // Remove all descendant layers from the hierarchy and add them to the new | 1400 // Remove all descendant layers from the hierarchy and add them to the new |
| 1401 // position. | 1401 // position. |
| 1402 for (LayoutObject* curr = layoutObject()->slowFirstChild(); curr; | 1402 for (LayoutObject* curr = layoutObject()->slowFirstChild(); curr; |
| 1403 curr = curr->nextSibling()) | 1403 curr = curr->nextSibling()) |
| 1404 curr->moveLayers(m_parent, this); | 1404 curr->moveLayers(m_parent, this); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1430 | 1430 |
| 1431 // Clear out all the clip rects. | 1431 // Clear out all the clip rects. |
| 1432 clipper().clearClipRectsIncludingDescendants(); | 1432 clipper().clearClipRectsIncludingDescendants(); |
| 1433 } | 1433 } |
| 1434 | 1434 |
| 1435 // Returns the layer reached on the walk up towards the ancestor. | 1435 // Returns the layer reached on the walk up towards the ancestor. |
| 1436 static inline const PaintLayer* accumulateOffsetTowardsAncestor( | 1436 static inline const PaintLayer* accumulateOffsetTowardsAncestor( |
| 1437 const PaintLayer* layer, | 1437 const PaintLayer* layer, |
| 1438 const PaintLayer* ancestorLayer, | 1438 const PaintLayer* ancestorLayer, |
| 1439 LayoutPoint& location) { | 1439 LayoutPoint& location) { |
| 1440 ASSERT(ancestorLayer != layer); | 1440 DCHECK(ancestorLayer != layer); |
| 1441 | 1441 |
| 1442 const LayoutBoxModelObject* layoutObject = layer->layoutObject(); | 1442 const LayoutBoxModelObject* layoutObject = layer->layoutObject(); |
| 1443 EPosition position = layoutObject->style()->position(); | 1443 EPosition position = layoutObject->style()->position(); |
| 1444 | 1444 |
| 1445 if (position == FixedPosition && | 1445 if (position == FixedPosition && |
| 1446 (!ancestorLayer || ancestorLayer == layoutObject->view()->layer())) { | 1446 (!ancestorLayer || ancestorLayer == layoutObject->view()->layer())) { |
| 1447 // If the fixed layer's container is the root, just add in the offset of the | 1447 // If the fixed layer's container is the root, just add in the offset of the |
| 1448 // view. We can obtain this by calling localToAbsolute() on the LayoutView. | 1448 // view. We can obtain this by calling localToAbsolute() on the LayoutView. |
| 1449 FloatPoint absPos = layoutObject->localToAbsolute(); | 1449 FloatPoint absPos = layoutObject->localToAbsolute(); |
| 1450 location += LayoutSize(absPos.x(), absPos.y()); | 1450 location += LayoutSize(absPos.x(), absPos.y()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1465 layer->convertToLayerCoords(parentLayer, thisCoords); | 1465 layer->convertToLayerCoords(parentLayer, thisCoords); |
| 1466 | 1466 |
| 1467 LayoutPoint ancestorCoords; | 1467 LayoutPoint ancestorCoords; |
| 1468 ancestorLayer->convertToLayerCoords(parentLayer, ancestorCoords); | 1468 ancestorLayer->convertToLayerCoords(parentLayer, ancestorCoords); |
| 1469 | 1469 |
| 1470 location += (thisCoords - ancestorCoords); | 1470 location += (thisCoords - ancestorCoords); |
| 1471 return ancestorLayer; | 1471 return ancestorLayer; |
| 1472 } | 1472 } |
| 1473 } else if (layoutObject->isColumnSpanAll()) { | 1473 } else if (layoutObject->isColumnSpanAll()) { |
| 1474 LayoutBlock* multicolContainer = layoutObject->containingBlock(); | 1474 LayoutBlock* multicolContainer = layoutObject->containingBlock(); |
| 1475 ASSERT(toLayoutBlockFlow(multicolContainer)->multiColumnFlowThread()); | 1475 DCHECK(toLayoutBlockFlow(multicolContainer)->multiColumnFlowThread()); |
| 1476 parentLayer = multicolContainer->layer(); | 1476 parentLayer = multicolContainer->layer(); |
| 1477 ASSERT(parentLayer); | 1477 DCHECK(parentLayer); |
| 1478 } else { | 1478 } else { |
| 1479 parentLayer = layer->parent(); | 1479 parentLayer = layer->parent(); |
| 1480 } | 1480 } |
| 1481 | 1481 |
| 1482 if (!parentLayer) | 1482 if (!parentLayer) |
| 1483 return nullptr; | 1483 return nullptr; |
| 1484 | 1484 |
| 1485 location += layer->location(); | 1485 location += layer->location(); |
| 1486 return parentLayer; | 1486 return parentLayer; |
| 1487 } | 1487 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1541 | 1541 |
| 1542 // If the floating object becomes non-self-painting, so some ancestor should | 1542 // If the floating object becomes non-self-painting, so some ancestor should |
| 1543 // paint it; if it becomes self-painting, it should paint itself and no | 1543 // paint it; if it becomes self-painting, it should paint itself and no |
| 1544 // ancestor should paint it. | 1544 // ancestor should paint it. |
| 1545 if (wasSelfPaintingLayer != isSelfPaintingLayer() && | 1545 if (wasSelfPaintingLayer != isSelfPaintingLayer() && |
| 1546 m_layoutObject->isFloating()) | 1546 m_layoutObject->isFloating()) |
| 1547 LayoutBlockFlow::setAncestorShouldPaintFloatingObject(*layoutBox()); | 1547 LayoutBlockFlow::setAncestorShouldPaintFloatingObject(*layoutBox()); |
| 1548 } | 1548 } |
| 1549 | 1549 |
| 1550 void PaintLayer::updateStackingNode() { | 1550 void PaintLayer::updateStackingNode() { |
| 1551 ASSERT(!m_stackingNode); | 1551 DCHECK(!m_stackingNode); |
| 1552 if (requiresStackingNode()) | 1552 if (requiresStackingNode()) |
| 1553 m_stackingNode = wrapUnique(new PaintLayerStackingNode(this)); | 1553 m_stackingNode = wrapUnique(new PaintLayerStackingNode(this)); |
| 1554 else | 1554 else |
| 1555 m_stackingNode = nullptr; | 1555 m_stackingNode = nullptr; |
| 1556 } | 1556 } |
| 1557 | 1557 |
| 1558 void PaintLayer::updateScrollableArea() { | 1558 void PaintLayer::updateScrollableArea() { |
| 1559 ASSERT(!m_scrollableArea); | 1559 DCHECK(!m_scrollableArea); |
| 1560 if (requiresScrollableArea()) | 1560 if (requiresScrollableArea()) |
| 1561 m_scrollableArea = PaintLayerScrollableArea::create(*this); | 1561 m_scrollableArea = PaintLayerScrollableArea::create(*this); |
| 1562 } | 1562 } |
| 1563 | 1563 |
| 1564 bool PaintLayer::hasOverflowControls() const { | 1564 bool PaintLayer::hasOverflowControls() const { |
| 1565 return m_scrollableArea && (m_scrollableArea->hasScrollbar() || | 1565 return m_scrollableArea && (m_scrollableArea->hasScrollbar() || |
| 1566 m_scrollableArea->scrollCorner() || | 1566 m_scrollableArea->scrollCorner() || |
| 1567 layoutObject()->style()->resize() != RESIZE_NONE); | 1567 layoutObject()->style()->resize() != RESIZE_NONE); |
| 1568 } | 1568 } |
| 1569 | 1569 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1737 | 1737 |
| 1738 static inline LayoutRect frameVisibleRect(LayoutObject* layoutObject) { | 1738 static inline LayoutRect frameVisibleRect(LayoutObject* layoutObject) { |
| 1739 FrameView* frameView = layoutObject->document().view(); | 1739 FrameView* frameView = layoutObject->document().view(); |
| 1740 if (!frameView) | 1740 if (!frameView) |
| 1741 return LayoutRect(); | 1741 return LayoutRect(); |
| 1742 | 1742 |
| 1743 return LayoutRect(frameView->visibleContentRect()); | 1743 return LayoutRect(frameView->visibleContentRect()); |
| 1744 } | 1744 } |
| 1745 | 1745 |
| 1746 bool PaintLayer::hitTest(HitTestResult& result) { | 1746 bool PaintLayer::hitTest(HitTestResult& result) { |
| 1747 ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant()); | 1747 DCHECK(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant()); |
| 1748 | 1748 |
| 1749 // LayoutView should make sure to update layout before entering hit testing | 1749 // LayoutView should make sure to update layout before entering hit testing |
| 1750 ASSERT(!layoutObject()->frame()->view()->layoutPending()); | 1750 DCHECK(!layoutObject()->frame()->view()->layoutPending()); |
| 1751 ASSERT(!layoutObject()->document().layoutViewItem().needsLayout()); | 1751 DCHECK(!layoutObject()->document().layoutViewItem().needsLayout()); |
| 1752 | 1752 |
| 1753 const HitTestRequest& request = result.hitTestRequest(); | 1753 const HitTestRequest& request = result.hitTestRequest(); |
| 1754 const HitTestLocation& hitTestLocation = result.hitTestLocation(); | 1754 const HitTestLocation& hitTestLocation = result.hitTestLocation(); |
| 1755 | 1755 |
| 1756 // Start with frameVisibleRect to ensure we include the scrollbars. | 1756 // Start with frameVisibleRect to ensure we include the scrollbars. |
| 1757 LayoutRect hitTestArea = frameVisibleRect(layoutObject()); | 1757 LayoutRect hitTestArea = frameVisibleRect(layoutObject()); |
| 1758 if (request.ignoreClipping()) | 1758 if (request.ignoreClipping()) |
| 1759 hitTestArea.unite(LayoutRect(layoutObject()->view()->documentRect())); | 1759 hitTestArea.unite(LayoutRect(layoutObject()->view()->documentRect())); |
| 1760 | 1760 |
| 1761 PaintLayer* insideLayer = | 1761 PaintLayer* insideLayer = |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1882 if (!hitLayer) | 1882 if (!hitLayer) |
| 1883 return false; | 1883 return false; |
| 1884 | 1884 |
| 1885 // The hit layer is depth-sorting with other layers, so just say that it was | 1885 // The hit layer is depth-sorting with other layers, so just say that it was |
| 1886 // hit. | 1886 // hit. |
| 1887 if (canDepthSort) | 1887 if (canDepthSort) |
| 1888 return true; | 1888 return true; |
| 1889 | 1889 |
| 1890 // We need to look at z-depth to decide if this layer was hit. | 1890 // We need to look at z-depth to decide if this layer was hit. |
| 1891 if (zOffset) { | 1891 if (zOffset) { |
| 1892 ASSERT(transformState); | 1892 DCHECK(transformState); |
| 1893 // This is actually computing our z, but that's OK because the hitLayer is | 1893 // This is actually computing our z, but that's OK because the hitLayer is |
| 1894 // coplanar with us. | 1894 // coplanar with us. |
| 1895 double childZOffset = computeZOffset(*transformState); | 1895 double childZOffset = computeZOffset(*transformState); |
| 1896 if (childZOffset > *zOffset) { | 1896 if (childZOffset > *zOffset) { |
| 1897 *zOffset = childZOffset; | 1897 *zOffset = childZOffset; |
| 1898 return true; | 1898 return true; |
| 1899 } | 1899 } |
| 1900 return false; | 1900 return false; |
| 1901 } | 1901 } |
| 1902 | 1902 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1963 // Ensure our lists and 3d status are up to date. | 1963 // Ensure our lists and 3d status are up to date. |
| 1964 m_stackingNode->updateLayerListsIfNeeded(); | 1964 m_stackingNode->updateLayerListsIfNeeded(); |
| 1965 update3DTransformedDescendantStatus(); | 1965 update3DTransformedDescendantStatus(); |
| 1966 | 1966 |
| 1967 // The natural thing would be to keep HitTestingTransformState on the stack, | 1967 // The natural thing would be to keep HitTestingTransformState on the stack, |
| 1968 // but it's big, so we heap-allocate. | 1968 // but it's big, so we heap-allocate. |
| 1969 RefPtr<HitTestingTransformState> localTransformState; | 1969 RefPtr<HitTestingTransformState> localTransformState; |
| 1970 if (appliedTransform) { | 1970 if (appliedTransform) { |
| 1971 // We computed the correct state in the caller (above code), so just | 1971 // We computed the correct state in the caller (above code), so just |
| 1972 // reference it. | 1972 // reference it. |
| 1973 ASSERT(transformState); | 1973 DCHECK(transformState); |
| 1974 localTransformState = const_cast<HitTestingTransformState*>(transformState); | 1974 localTransformState = const_cast<HitTestingTransformState*>(transformState); |
| 1975 } else if (transformState || m_has3DTransformedDescendant || preserves3D()) { | 1975 } else if (transformState || m_has3DTransformedDescendant || preserves3D()) { |
| 1976 // We need transform state for the first time, or to offset the container | 1976 // We need transform state for the first time, or to offset the container |
| 1977 // state, so create it here. | 1977 // state, so create it here. |
| 1978 localTransformState = | 1978 localTransformState = |
| 1979 createLocalTransformState(rootLayer, containerLayer, hitTestRect, | 1979 createLocalTransformState(rootLayer, containerLayer, hitTestRect, |
| 1980 hitTestLocation, transformState); | 1980 hitTestLocation, transformState); |
| 1981 } | 1981 } |
| 1982 | 1982 |
| 1983 // Check for hit test on backface if backface-visibility is 'hidden' | 1983 // Check for hit test on backface if backface-visibility is 'hidden' |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2248 // Now do a hit test with the root layer shifted to be us. | 2248 // Now do a hit test with the root layer shifted to be us. |
| 2249 return hitTestLayer(this, containerLayer, result, localHitTestRect, | 2249 return hitTestLayer(this, containerLayer, result, localHitTestRect, |
| 2250 newHitTestLocation, true, newTransformState.get(), | 2250 newHitTestLocation, true, newTransformState.get(), |
| 2251 zOffset); | 2251 zOffset); |
| 2252 } | 2252 } |
| 2253 | 2253 |
| 2254 bool PaintLayer::hitTestContents(HitTestResult& result, | 2254 bool PaintLayer::hitTestContents(HitTestResult& result, |
| 2255 const LayoutRect& layerBounds, | 2255 const LayoutRect& layerBounds, |
| 2256 const HitTestLocation& hitTestLocation, | 2256 const HitTestLocation& hitTestLocation, |
| 2257 HitTestFilter hitTestFilter) const { | 2257 HitTestFilter hitTestFilter) const { |
| 2258 ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant()); | 2258 DCHECK(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant()); |
| 2259 | 2259 |
| 2260 if (!layoutObject()->hitTest( | 2260 if (!layoutObject()->hitTest( |
| 2261 result, hitTestLocation, | 2261 result, hitTestLocation, |
| 2262 toLayoutPoint(layerBounds.location() - layoutBoxLocation()), | 2262 toLayoutPoint(layerBounds.location() - layoutBoxLocation()), |
| 2263 hitTestFilter)) { | 2263 hitTestFilter)) { |
| 2264 // It's wrong to set innerNode, but then claim that you didn't hit anything, | 2264 // It's wrong to set innerNode, but then claim that you didn't hit anything, |
| 2265 // unless it is a rect-based test. | 2265 // unless it is a rect-based test. |
| 2266 ASSERT(!result.innerNode() || (result.hitTestRequest().listBased() && | 2266 DCHECK(!result.innerNode() || (result.hitTestRequest().listBased() && |
| 2267 result.listBasedTestResult().size())); | 2267 result.listBasedTestResult().size())); |
| 2268 return false; | 2268 return false; |
| 2269 } | 2269 } |
| 2270 | 2270 |
| 2271 if (!result.innerNode()) { | 2271 if (!result.innerNode()) { |
| 2272 // We hit something anonymous, and we didn't find a DOM node ancestor in | 2272 // We hit something anonymous, and we didn't find a DOM node ancestor in |
| 2273 // this layer. | 2273 // this layer. |
| 2274 | 2274 |
| 2275 if (layoutObject()->isLayoutFlowThread()) { | 2275 if (layoutObject()->isLayoutFlowThread()) { |
| 2276 // For a flow thread it's safe to just say that we didn't hit anything. | 2276 // For a flow thread it's safe to just say that we didn't hit anything. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2314 while (PaintLayerStackingNode* child = iterator.next()) { | 2314 while (PaintLayerStackingNode* child = iterator.next()) { |
| 2315 PaintLayer* childLayer = child->layer(); | 2315 PaintLayer* childLayer = child->layer(); |
| 2316 PaintLayer* hitLayer = 0; | 2316 PaintLayer* hitLayer = 0; |
| 2317 HitTestResult tempResult(result.hitTestRequest(), result.hitTestLocation()); | 2317 HitTestResult tempResult(result.hitTestRequest(), result.hitTestLocation()); |
| 2318 hitLayer = childLayer->hitTestLayer(rootLayer, this, tempResult, | 2318 hitLayer = childLayer->hitTestLayer(rootLayer, this, tempResult, |
| 2319 hitTestRect, hitTestLocation, false, | 2319 hitTestRect, hitTestLocation, false, |
| 2320 transformState, zOffsetForDescendants); | 2320 transformState, zOffsetForDescendants); |
| 2321 | 2321 |
| 2322 // If it is a list-based test, we can safely append the temporary result | 2322 // If it is a list-based test, we can safely append the temporary result |
| 2323 // since it might had hit nodes but not necesserily had hitLayer set. | 2323 // since it might had hit nodes but not necesserily had hitLayer set. |
| 2324 ASSERT(!result.isRectBasedTest() || result.hitTestRequest().listBased()); | 2324 DCHECK(!result.isRectBasedTest() || result.hitTestRequest().listBased()); |
| 2325 if (result.hitTestRequest().listBased()) | 2325 if (result.hitTestRequest().listBased()) |
| 2326 result.append(tempResult); | 2326 result.append(tempResult); |
| 2327 | 2327 |
| 2328 if (isHitCandidate(hitLayer, depthSortDescendants, zOffset, | 2328 if (isHitCandidate(hitLayer, depthSortDescendants, zOffset, |
| 2329 unflattenedTransformState)) { | 2329 unflattenedTransformState)) { |
| 2330 resultLayer = hitLayer; | 2330 resultLayer = hitLayer; |
| 2331 if (!result.hitTestRequest().listBased()) | 2331 if (!result.hitTestRequest().listBased()) |
| 2332 result = tempResult; | 2332 result = tempResult; |
| 2333 if (!depthSortDescendants) | 2333 if (!depthSortDescendants) |
| 2334 break; | 2334 break; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2404 const LayoutPoint& offsetFromRoot) const { | 2404 const LayoutPoint& offsetFromRoot) const { |
| 2405 // Always examine the canvas and the root. | 2405 // Always examine the canvas and the root. |
| 2406 // FIXME: Could eliminate the isDocumentElement() check if we fix background | 2406 // FIXME: Could eliminate the isDocumentElement() check if we fix background |
| 2407 // painting so that the LayoutView paints the root's background. | 2407 // painting so that the LayoutView paints the root's background. |
| 2408 if (isRootLayer() || layoutObject()->isDocumentElement()) | 2408 if (isRootLayer() || layoutObject()->isDocumentElement()) |
| 2409 return true; | 2409 return true; |
| 2410 | 2410 |
| 2411 // If we aren't an inline flow, and our layer bounds do intersect the damage | 2411 // If we aren't an inline flow, and our layer bounds do intersect the damage |
| 2412 // rect, then we can go ahead and return true. | 2412 // rect, then we can go ahead and return true. |
| 2413 LayoutView* view = layoutObject()->view(); | 2413 LayoutView* view = layoutObject()->view(); |
| 2414 ASSERT(view); | 2414 DCHECK(view); |
| 2415 if (view && !layoutObject()->isLayoutInline()) { | 2415 if (view && !layoutObject()->isLayoutInline()) { |
| 2416 if (layerBounds.intersects(damageRect)) | 2416 if (layerBounds.intersects(damageRect)) |
| 2417 return true; | 2417 return true; |
| 2418 } | 2418 } |
| 2419 | 2419 |
| 2420 // Otherwise we need to compute the bounding box of this single layer and see | 2420 // Otherwise we need to compute the bounding box of this single layer and see |
| 2421 // if it intersects the damage rect. | 2421 // if it intersects the damage rect. |
| 2422 return physicalBoundingBox(offsetFromRoot).intersects(damageRect); | 2422 return physicalBoundingBox(offsetFromRoot).intersects(damageRect); |
| 2423 } | 2423 } |
| 2424 | 2424 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2477 } | 2477 } |
| 2478 | 2478 |
| 2479 bool PaintLayer::overlapBoundsIncludeChildren() const { | 2479 bool PaintLayer::overlapBoundsIncludeChildren() const { |
| 2480 return hasFilterThatMovesPixels(); | 2480 return hasFilterThatMovesPixels(); |
| 2481 } | 2481 } |
| 2482 | 2482 |
| 2483 static void expandRectForStackingChildren( | 2483 static void expandRectForStackingChildren( |
| 2484 const PaintLayer* ancestorLayer, | 2484 const PaintLayer* ancestorLayer, |
| 2485 LayoutRect& result, | 2485 LayoutRect& result, |
| 2486 PaintLayer::CalculateBoundsOptions options) { | 2486 PaintLayer::CalculateBoundsOptions options) { |
| 2487 ASSERT(ancestorLayer->stackingNode()->isStackingContext() || | 2487 DCHECK(ancestorLayer->stackingNode()->isStackingContext() || |
| 2488 !ancestorLayer->stackingNode()->hasPositiveZOrderList()); | 2488 !ancestorLayer->stackingNode()->hasPositiveZOrderList()); |
| 2489 | 2489 |
| 2490 #if ENABLE(ASSERT) | 2490 #if DCHECK_IS_ON() |
| 2491 LayerListMutationDetector mutationChecker( | 2491 LayerListMutationDetector mutationChecker( |
| 2492 const_cast<PaintLayer*>(ancestorLayer)->stackingNode()); | 2492 const_cast<PaintLayer*>(ancestorLayer)->stackingNode()); |
| 2493 #endif | 2493 #endif |
| 2494 | 2494 |
| 2495 PaintLayerStackingNodeIterator iterator(*ancestorLayer->stackingNode(), | 2495 PaintLayerStackingNodeIterator iterator(*ancestorLayer->stackingNode(), |
| 2496 AllChildren); | 2496 AllChildren); |
| 2497 while (PaintLayerStackingNode* node = iterator.next()) { | 2497 while (PaintLayerStackingNode* node = iterator.next()) { |
| 2498 // Here we exclude both directly composited layers and squashing layers | 2498 // Here we exclude both directly composited layers and squashing layers |
| 2499 // because those Layers don't paint into the graphics layer | 2499 // because those Layers don't paint into the graphics layer |
| 2500 // for this Layer. For example, the bounds of squashed Layers | 2500 // for this Layer. For example, the bounds of squashed Layers |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2576 convertFromFlowThreadToVisualBoundingBoxInAncestor(ancestorLayer, result); | 2576 convertFromFlowThreadToVisualBoundingBoxInAncestor(ancestorLayer, result); |
| 2577 return result; | 2577 return result; |
| 2578 } | 2578 } |
| 2579 LayoutPoint delta; | 2579 LayoutPoint delta; |
| 2580 convertToLayerCoords(ancestorLayer, delta); | 2580 convertToLayerCoords(ancestorLayer, delta); |
| 2581 result.moveBy(delta); | 2581 result.moveBy(delta); |
| 2582 return result; | 2582 return result; |
| 2583 } | 2583 } |
| 2584 | 2584 |
| 2585 CompositingState PaintLayer::compositingState() const { | 2585 CompositingState PaintLayer::compositingState() const { |
| 2586 ASSERT(isAllowedToQueryCompositingState()); | 2586 DCHECK(isAllowedToQueryCompositingState()); |
| 2587 | 2587 |
| 2588 // This is computed procedurally so there is no redundant state variable that | 2588 // This is computed procedurally so there is no redundant state variable that |
| 2589 // can get out of sync from the real actual compositing state. | 2589 // can get out of sync from the real actual compositing state. |
| 2590 | 2590 |
| 2591 if (groupedMapping()) { | 2591 if (groupedMapping()) { |
| 2592 ASSERT(!compositedLayerMapping()); | 2592 DCHECK(!compositedLayerMapping()); |
| 2593 return PaintsIntoGroupedBacking; | 2593 return PaintsIntoGroupedBacking; |
| 2594 } | 2594 } |
| 2595 | 2595 |
| 2596 if (!compositedLayerMapping()) | 2596 if (!compositedLayerMapping()) |
| 2597 return NotComposited; | 2597 return NotComposited; |
| 2598 | 2598 |
| 2599 return PaintsIntoOwnBacking; | 2599 return PaintsIntoOwnBacking; |
| 2600 } | 2600 } |
| 2601 | 2601 |
| 2602 bool PaintLayer::isAllowedToQueryCompositingState() const { | 2602 bool PaintLayer::isAllowedToQueryCompositingState() const { |
| 2603 if (gCompositingQueryMode == CompositingQueriesAreAllowed || | 2603 if (gCompositingQueryMode == CompositingQueriesAreAllowed || |
| 2604 RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 2604 RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| 2605 return true; | 2605 return true; |
| 2606 return layoutObject()->document().lifecycle().state() >= | 2606 return layoutObject()->document().lifecycle().state() >= |
| 2607 DocumentLifecycle::InCompositingUpdate; | 2607 DocumentLifecycle::InCompositingUpdate; |
| 2608 } | 2608 } |
| 2609 | 2609 |
| 2610 CompositedLayerMapping* PaintLayer::compositedLayerMapping() const { | 2610 CompositedLayerMapping* PaintLayer::compositedLayerMapping() const { |
| 2611 ASSERT(isAllowedToQueryCompositingState()); | 2611 DCHECK(isAllowedToQueryCompositingState()); |
| 2612 return m_rareData ? m_rareData->compositedLayerMapping.get() : nullptr; | 2612 return m_rareData ? m_rareData->compositedLayerMapping.get() : nullptr; |
| 2613 } | 2613 } |
| 2614 | 2614 |
| 2615 GraphicsLayer* PaintLayer::graphicsLayerBacking() const { | 2615 GraphicsLayer* PaintLayer::graphicsLayerBacking() const { |
| 2616 switch (compositingState()) { | 2616 switch (compositingState()) { |
| 2617 case NotComposited: | 2617 case NotComposited: |
| 2618 return 0; | 2618 return 0; |
| 2619 case PaintsIntoGroupedBacking: | 2619 case PaintsIntoGroupedBacking: |
| 2620 return groupedMapping()->squashingLayer(); | 2620 return groupedMapping()->squashingLayer(); |
| 2621 default: | 2621 default: |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2681 CompositedLayerMapping* oldGroupedMapping = this->groupedMapping(); | 2681 CompositedLayerMapping* oldGroupedMapping = this->groupedMapping(); |
| 2682 if (groupedMapping == oldGroupedMapping) | 2682 if (groupedMapping == oldGroupedMapping) |
| 2683 return; | 2683 return; |
| 2684 | 2684 |
| 2685 if (options == InvalidateLayerAndRemoveFromMapping && oldGroupedMapping) { | 2685 if (options == InvalidateLayerAndRemoveFromMapping && oldGroupedMapping) { |
| 2686 oldGroupedMapping->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSubtree); | 2686 oldGroupedMapping->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSubtree); |
| 2687 oldGroupedMapping->removeLayerFromSquashingGraphicsLayer(this); | 2687 oldGroupedMapping->removeLayerFromSquashingGraphicsLayer(this); |
| 2688 } | 2688 } |
| 2689 if (m_rareData || groupedMapping) | 2689 if (m_rareData || groupedMapping) |
| 2690 ensureRareData().groupedMapping = groupedMapping; | 2690 ensureRareData().groupedMapping = groupedMapping; |
| 2691 ASSERT(!groupedMapping || groupedMapping->verifyLayerInSquashingVector(this)); | 2691 #if DCHECK_IS_ON() |
| 2692 DCHECK(!groupedMapping || groupedMapping->verifyLayerInSquashingVector(this)); |
| 2693 #endif |
| 2692 if (options == InvalidateLayerAndRemoveFromMapping && groupedMapping) | 2694 if (options == InvalidateLayerAndRemoveFromMapping && groupedMapping) |
| 2693 groupedMapping->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSubtree); | 2695 groupedMapping->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSubtree); |
| 2694 } | 2696 } |
| 2695 | 2697 |
| 2696 bool PaintLayer::hasCompositedMask() const { | 2698 bool PaintLayer::hasCompositedMask() const { |
| 2697 return m_rareData && m_rareData->compositedLayerMapping && | 2699 return m_rareData && m_rareData->compositedLayerMapping && |
| 2698 m_rareData->compositedLayerMapping->hasMaskLayer(); | 2700 m_rareData->compositedLayerMapping->hasMaskLayer(); |
| 2699 } | 2701 } |
| 2700 | 2702 |
| 2701 bool PaintLayer::hasCompositedClippingMask() const { | 2703 bool PaintLayer::hasCompositedClippingMask() const { |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3049 | 3051 |
| 3050 FilterEffect* PaintLayer::updateFilterEffect() const { | 3052 FilterEffect* PaintLayer::updateFilterEffect() const { |
| 3051 // TODO(chrishtr): ensure (and assert) that compositing is clean here. | 3053 // TODO(chrishtr): ensure (and assert) that compositing is clean here. |
| 3052 | 3054 |
| 3053 if (!paintsWithFilters()) | 3055 if (!paintsWithFilters()) |
| 3054 return nullptr; | 3056 return nullptr; |
| 3055 | 3057 |
| 3056 PaintLayerFilterInfo* filterInfo = this->filterInfo(); | 3058 PaintLayerFilterInfo* filterInfo = this->filterInfo(); |
| 3057 | 3059 |
| 3058 // Should have been added by updateOrRemoveFilterEffect(). | 3060 // Should have been added by updateOrRemoveFilterEffect(). |
| 3059 ASSERT(filterInfo); | 3061 DCHECK(filterInfo); |
| 3060 | 3062 |
| 3061 if (filterInfo->lastEffect()) | 3063 if (filterInfo->lastEffect()) |
| 3062 return filterInfo->lastEffect(); | 3064 return filterInfo->lastEffect(); |
| 3063 | 3065 |
| 3064 const ComputedStyle& style = layoutObject()->styleRef(); | 3066 const ComputedStyle& style = layoutObject()->styleRef(); |
| 3065 FloatRect zoomedReferenceBox; | 3067 FloatRect zoomedReferenceBox; |
| 3066 if (style.filter().hasReferenceFilter()) | 3068 if (style.filter().hasReferenceFilter()) |
| 3067 zoomedReferenceBox = boxForFilter(); | 3069 zoomedReferenceBox = boxForFilter(); |
| 3068 FilterEffectBuilder builder(enclosingNode(), zoomedReferenceBox, | 3070 FilterEffectBuilder builder(enclosingNode(), zoomedReferenceBox, |
| 3069 style.effectiveZoom()); | 3071 style.effectiveZoom()); |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3267 } | 3269 } |
| 3268 | 3270 |
| 3269 void showLayerTree(const blink::LayoutObject* layoutObject) { | 3271 void showLayerTree(const blink::LayoutObject* layoutObject) { |
| 3270 if (!layoutObject) { | 3272 if (!layoutObject) { |
| 3271 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); | 3273 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); |
| 3272 return; | 3274 return; |
| 3273 } | 3275 } |
| 3274 showLayerTree(layoutObject->enclosingLayer()); | 3276 showLayerTree(layoutObject->enclosingLayer()); |
| 3275 } | 3277 } |
| 3276 #endif | 3278 #endif |
| OLD | NEW |