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

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

Issue 2763833003: Optimize PaintInvalidatorContext::mapLocalRectToVisualRectInBacking() (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/paint/PaintInvalidator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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() {
chrishtr 2017/03/22 17:54:31 Is it somehow guaranteed that this GeometryMapper
Xianzhu 2017/03/22 18:50:02 Yes because the adapter's mapLocalRectToVisualRect
Xianzhu 2017/03/22 18:50:48 On 2017/03/22 18:50:02, Xianzhu wrote: > On 2017/0
chrishtr 2017/03/22 18:56:21 Ok, please add a comment saying that it's guarante
Xianzhu 2017/03/22 19:20:43 Done.
639 DEFINE_STATIC_LOCAL(std::unique_ptr<GeometryMapper>, dummyMapper,
640 (GeometryMapper::create()));
wkorman 2017/03/22 18:33:40 We saw pdr@ recently make a perf improvement by ad
Xianzhu 2017/03/22 18:51:38 I think it's not worth it.
641 return *dummyMapper;
642 }
643
637 PaintInvalidatorContextAdapter::PaintInvalidatorContextAdapter( 644 PaintInvalidatorContextAdapter::PaintInvalidatorContextAdapter(
638 const PaintInvalidationState& paintInvalidationState) 645 const PaintInvalidationState& paintInvalidationState)
639 : PaintInvalidatorContext(dummyTreeBuilderContext()), 646 : PaintInvalidatorContext(dummyTreeBuilderContext(), dummyGeometryMapper()),
640 m_paintInvalidationState(paintInvalidationState) { 647 m_paintInvalidationState(paintInvalidationState) {
641 forcedSubtreeInvalidationFlags = 648 forcedSubtreeInvalidationFlags =
642 paintInvalidationState.m_forcedSubtreeInvalidationFlags; 649 paintInvalidationState.m_forcedSubtreeInvalidationFlags;
643 paintInvalidationContainer = 650 paintInvalidationContainer =
644 &paintInvalidationState.paintInvalidationContainer(); 651 &paintInvalidationState.paintInvalidationContainer();
645 paintingLayer = &paintInvalidationState.paintingLayer(); 652 paintingLayer = &paintInvalidationState.paintingLayer();
646 } 653 }
647 654
648 void PaintInvalidatorContextAdapter::mapLocalRectToVisualRectInBacking( 655 void PaintInvalidatorContextAdapter::mapLocalRectToVisualRectInBacking(
649 const LayoutObject& object, 656 const LayoutObject& object,
650 LayoutRect& rect) const { 657 LayoutRect& rect) const {
651 DCHECK(&object == &m_paintInvalidationState.currentObject()); 658 DCHECK(&object == &m_paintInvalidationState.currentObject());
652 m_paintInvalidationState.mapLocalRectToVisualRectInBacking(rect); 659 m_paintInvalidationState.mapLocalRectToVisualRectInBacking(rect);
653 } 660 }
654 661
655 } // namespace blink 662 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/paint/PaintInvalidator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698