| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/layout/PaintInvalidationState.h" | 5 #include "core/layout/PaintInvalidationState.h" |
| 6 | 6 |
| 7 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
| 8 #include "core/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
| 9 #include "core/frame/Settings.h" | 9 #include "core/frame/Settings.h" |
| 10 #include "core/layout/LayoutInline.h" | 10 #include "core/layout/LayoutInline.h" |
| 11 #include "core/layout/LayoutPart.h" | 11 #include "core/layout/LayoutPart.h" |
| 12 #include "core/layout/LayoutView.h" | 12 #include "core/layout/LayoutView.h" |
| 13 #include "core/layout/api/LayoutAPIShim.h" | 13 #include "core/layout/api/LayoutAPIShim.h" |
| 14 #include "core/layout/api/LayoutPartItem.h" | 14 #include "core/layout/api/LayoutPartItem.h" |
| 15 #include "core/layout/svg/LayoutSVGRoot.h" | 15 #include "core/layout/svg/LayoutSVGRoot.h" |
| 16 #include "core/layout/svg/SVGLayoutSupport.h" | 16 #include "core/layout/svg/SVGLayoutSupport.h" |
| 17 #include "core/paint/PaintInvalidator.h" | 17 #include "core/paint/PaintInvalidator.h" |
| 18 #include "core/paint/PaintLayer.h" | 18 #include "core/paint/PaintLayer.h" |
| 19 #include "core/paint/PaintPropertyTreeBuilder.h" | 19 #include "core/paint/PaintPropertyTreeBuilder.h" |
| 20 | 20 |
| 21 namespace blink { | 21 namespace blink { |
| 22 | 22 |
| 23 DISABLE_CFI_PERF |
| 23 static bool supportsCachedOffsets(const LayoutObject& object) { | 24 static bool supportsCachedOffsets(const LayoutObject& object) { |
| 24 // Can't compute paint offsets across objects with transforms, but if they are | 25 // Can't compute paint offsets across objects with transforms, but if they are |
| 25 // paint invalidation containers, we don't actually need to compute *across* | 26 // paint invalidation containers, we don't actually need to compute *across* |
| 26 // the container, just up to it. (Also, such objects are the containing block | 27 // the container, just up to it. (Also, such objects are the containing block |
| 27 // for all children.) | 28 // for all children.) |
| 28 return !(object.hasTransformRelatedProperty() && | 29 return !(object.hasTransformRelatedProperty() && |
| 29 !object.isPaintInvalidationContainer()) && | 30 !object.isPaintInvalidationContainer()) && |
| 30 !object.hasFilterInducingProperty() && !object.isLayoutFlowThread() && | 31 !object.hasFilterInducingProperty() && !object.isLayoutFlowThread() && |
| 31 !object.isLayoutMultiColumnSpannerPlaceholder() && | 32 !object.isLayoutMultiColumnSpannerPlaceholder() && |
| 32 !object.styleRef().isFlippedBlocksWritingMode() && | 33 !object.styleRef().isFlippedBlocksWritingMode() && |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 object.localToAncestorPoint(point, &ancestor, TraverseDocumentBoundaries); | 411 object.localToAncestorPoint(point, &ancestor, TraverseDocumentBoundaries); |
| 411 // Paint invalidation does not include scroll of the ancestor. | 412 // Paint invalidation does not include scroll of the ancestor. |
| 412 if (ancestor.isBox()) { | 413 if (ancestor.isBox()) { |
| 413 const LayoutBox* box = toLayoutBox(&ancestor); | 414 const LayoutBox* box = toLayoutBox(&ancestor); |
| 414 if (box->hasOverflowClip()) | 415 if (box->hasOverflowClip()) |
| 415 result.move(box->scrolledContentOffset()); | 416 result.move(box->scrolledContentOffset()); |
| 416 } | 417 } |
| 417 return result; | 418 return result; |
| 418 } | 419 } |
| 419 | 420 |
| 421 DISABLE_CFI_PERF |
| 420 LayoutPoint | 422 LayoutPoint |
| 421 PaintInvalidationState::computePositionFromPaintInvalidationBacking() const { | 423 PaintInvalidationState::computePositionFromPaintInvalidationBacking() const { |
| 422 #if ENABLE(ASSERT) | 424 #if ENABLE(ASSERT) |
| 423 DCHECK(!m_didUpdateForChildren); | 425 DCHECK(!m_didUpdateForChildren); |
| 424 #endif | 426 #endif |
| 425 | 427 |
| 426 FloatPoint point; | 428 FloatPoint point; |
| 427 if (m_paintInvalidationContainer != &m_currentObject) { | 429 if (m_paintInvalidationContainer != &m_currentObject) { |
| 428 if (m_cachedOffsetsEnabled) { | 430 if (m_cachedOffsetsEnabled) { |
| 429 if (m_currentObject.isSVG() && !m_currentObject.isSVGRoot()) | 431 if (m_currentObject.isSVG() && !m_currentObject.isSVGRoot()) |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 } | 636 } |
| 635 | 637 |
| 636 void PaintInvalidatorContextAdapter::mapLocalRectToPaintInvalidationBacking( | 638 void PaintInvalidatorContextAdapter::mapLocalRectToPaintInvalidationBacking( |
| 637 const LayoutObject& object, | 639 const LayoutObject& object, |
| 638 LayoutRect& rect) const { | 640 LayoutRect& rect) const { |
| 639 DCHECK(&object == &m_paintInvalidationState.currentObject()); | 641 DCHECK(&object == &m_paintInvalidationState.currentObject()); |
| 640 m_paintInvalidationState.mapLocalRectToPaintInvalidationBacking(rect); | 642 m_paintInvalidationState.mapLocalRectToPaintInvalidationBacking(rect); |
| 641 } | 643 } |
| 642 | 644 |
| 643 } // namespace blink | 645 } // namespace blink |
| OLD | NEW |