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 #include "platform/graphics/paint/GeometryMapper.h" |
20 | 21 |
21 namespace blink { | 22 namespace blink { |
22 | 23 |
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()) && |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 ASSERT_NOT_REACHED(); | 628 ASSERT_NOT_REACHED(); |
628 } | 629 } |
629 | 630 |
630 #endif // CHECK_FAST_PATH_SLOW_PATH_EQUALITY | 631 #endif // CHECK_FAST_PATH_SLOW_PATH_EQUALITY |
631 | 632 |
632 static const PaintPropertyTreeBuilderContext& dummyTreeBuilderContext() { | 633 static const PaintPropertyTreeBuilderContext& dummyTreeBuilderContext() { |
633 DEFINE_STATIC_LOCAL(PaintPropertyTreeBuilderContext, dummyContext, ()); | 634 DEFINE_STATIC_LOCAL(PaintPropertyTreeBuilderContext, dummyContext, ()); |
634 return dummyContext; | 635 return dummyContext; |
635 } | 636 } |
636 | 637 |
| 638 static GeometryMapper& dummyGeometryMapper() { |
| 639 DEFINE_STATIC_LOCAL(std::unique_ptr<GeometryMapper>, dummyMapper, |
| 640 (GeometryMapper::create())); |
| 641 return *dummyMapper; |
| 642 } |
| 643 |
637 PaintInvalidatorContextAdapter::PaintInvalidatorContextAdapter( | 644 PaintInvalidatorContextAdapter::PaintInvalidatorContextAdapter( |
638 const PaintInvalidationState& paintInvalidationState) | 645 const PaintInvalidationState& paintInvalidationState) |
639 : PaintInvalidatorContext(dummyTreeBuilderContext()), | 646 // The dummy parameters will be never used because the overriding |
| 647 // mapLocalRectToVisualRectInBacking() uses PaintInvalidationState. |
| 648 : PaintInvalidatorContext(dummyTreeBuilderContext(), dummyGeometryMapper()), |
640 m_paintInvalidationState(paintInvalidationState) { | 649 m_paintInvalidationState(paintInvalidationState) { |
641 forcedSubtreeInvalidationFlags = | 650 forcedSubtreeInvalidationFlags = |
642 paintInvalidationState.m_forcedSubtreeInvalidationFlags; | 651 paintInvalidationState.m_forcedSubtreeInvalidationFlags; |
643 paintInvalidationContainer = | 652 paintInvalidationContainer = |
644 &paintInvalidationState.paintInvalidationContainer(); | 653 &paintInvalidationState.paintInvalidationContainer(); |
645 paintingLayer = &paintInvalidationState.paintingLayer(); | 654 paintingLayer = &paintInvalidationState.paintingLayer(); |
646 } | 655 } |
647 | 656 |
648 void PaintInvalidatorContextAdapter::mapLocalRectToVisualRectInBacking( | 657 void PaintInvalidatorContextAdapter::mapLocalRectToVisualRectInBacking( |
649 const LayoutObject& object, | 658 const LayoutObject& object, |
650 LayoutRect& rect) const { | 659 LayoutRect& rect) const { |
651 DCHECK(&object == &m_paintInvalidationState.currentObject()); | 660 DCHECK(&object == &m_paintInvalidationState.currentObject()); |
652 m_paintInvalidationState.mapLocalRectToVisualRectInBacking(rect); | 661 m_paintInvalidationState.mapLocalRectToVisualRectInBacking(rect); |
653 } | 662 } |
654 | 663 |
655 } // namespace blink | 664 } // namespace blink |
OLD | NEW |