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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintInvalidator.cpp

Issue 2653433002: Share GeometryMapper cache between pre-paint and compositing. (Closed)
Patch Set: none Created 3 years, 11 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/paint/PaintInvalidator.h" 5 #include "core/paint/PaintInvalidator.h"
6 6
7 #include "core/editing/FrameSelection.h" 7 #include "core/editing/FrameSelection.h"
8 #include "core/frame/FrameView.h" 8 #include "core/frame/FrameView.h"
9 #include "core/frame/LocalFrame.h" 9 #include "core/frame/LocalFrame.h"
10 #include "core/frame/Settings.h" 10 #include "core/frame/Settings.h"
(...skipping 30 matching lines...) Expand all
41 return result; 41 return result;
42 } 42 }
43 43
44 // TODO(wangxianzhu): Combine this into 44 // TODO(wangxianzhu): Combine this into
45 // PaintInvalidator::mapLocalRectToBacking() when removing 45 // PaintInvalidator::mapLocalRectToBacking() when removing
46 // PaintInvalidationState. 46 // PaintInvalidationState.
47 // This function is templatized to avoid FloatRect<->LayoutRect conversions 47 // This function is templatized to avoid FloatRect<->LayoutRect conversions
48 // which affect performance. 48 // which affect performance.
49 template <typename Rect, typename Point> 49 template <typename Rect, typename Point>
50 static LayoutRect mapLocalRectToPaintInvalidationBacking( 50 static LayoutRect mapLocalRectToPaintInvalidationBacking(
51 GeometryMapper& geometryMapper,
52 const LayoutObject& object, 51 const LayoutObject& object,
53 const Rect& localRect, 52 const Rect& localRect,
54 const PaintInvalidatorContext& context) { 53 const PaintInvalidatorContext& context,
54 GeometryMapper& geometryMapper) {
55 bool isSVGChild = object.isSVGChild(); 55 bool isSVGChild = object.isSVGChild();
56 56
57 // TODO(wkorman): The flip below is required because visual rects are 57 // TODO(wkorman): The flip below is required because visual rects are
58 // currently in "physical coordinates with flipped block-flow direction" 58 // currently in "physical coordinates with flipped block-flow direction"
59 // (see LayoutBoxModelObject.h) but we need them to be in physical 59 // (see LayoutBoxModelObject.h) but we need them to be in physical
60 // coordinates. 60 // coordinates.
61 Rect rect = localRect; 61 Rect rect = localRect;
62 // Writing-mode flipping doesn't apply to non-root SVG. 62 // Writing-mode flipping doesn't apply to non-root SVG.
63 if (!isSVGChild) { 63 if (!isSVGChild) {
64 if (object.isBox()) { 64 if (object.isBox()) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 *context.paintInvalidationContainer, result); 131 *context.paintInvalidationContainer, result);
132 132
133 return result; 133 return result;
134 } 134 }
135 135
136 void PaintInvalidatorContext::mapLocalRectToPaintInvalidationBacking( 136 void PaintInvalidatorContext::mapLocalRectToPaintInvalidationBacking(
137 const LayoutObject& object, 137 const LayoutObject& object,
138 LayoutRect& rect) const { 138 LayoutRect& rect) const {
139 GeometryMapper geometryMapper; 139 GeometryMapper geometryMapper;
140 rect = blink::mapLocalRectToPaintInvalidationBacking<LayoutRect, LayoutPoint>( 140 rect = blink::mapLocalRectToPaintInvalidationBacking<LayoutRect, LayoutPoint>(
141 geometryMapper, object, rect, *this); 141 object, rect, *this, geometryMapper);
142 } 142 }
143 143
144 LayoutRect PaintInvalidator::computeVisualRectInBacking( 144 LayoutRect PaintInvalidator::computeVisualRectInBacking(
145 const LayoutObject& object, 145 const LayoutObject& object,
146 const PaintInvalidatorContext& context) { 146 const PaintInvalidatorContext& context) {
147 if (object.isSVGChild()) { 147 if (object.isSVGChild()) {
148 FloatRect localRect = SVGLayoutSupport::localVisualRect(object); 148 FloatRect localRect = SVGLayoutSupport::localVisualRect(object);
149 return mapLocalRectToPaintInvalidationBacking<FloatRect, FloatPoint>( 149 return mapLocalRectToPaintInvalidationBacking<FloatRect, FloatPoint>(
150 m_geometryMapper, object, localRect, context); 150 object, localRect, context, m_geometryMapper);
151 } 151 }
152 return mapLocalRectToPaintInvalidationBacking<LayoutRect, LayoutPoint>( 152 return mapLocalRectToPaintInvalidationBacking<LayoutRect, LayoutPoint>(
153 m_geometryMapper, object, object.localVisualRect(), context); 153 object, object.localVisualRect(), context, m_geometryMapper);
154 } 154 }
155 155
156 LayoutPoint PaintInvalidator::computeLocationInBacking( 156 LayoutPoint PaintInvalidator::computeLocationInBacking(
157 const LayoutObject& object, 157 const LayoutObject& object,
158 const PaintInvalidatorContext& context) { 158 const PaintInvalidatorContext& context) {
159 // Use visual rect location for LayoutTexts because it suffices to check 159 // Use visual rect location for LayoutTexts because it suffices to check
160 // visual rect change for layout caused invalidation. 160 // visual rect change for layout caused invalidation.
161 if (object.isText()) 161 if (object.isText())
162 return context.newVisualRect.location(); 162 return context.newVisualRect.location();
163 163
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 PaintInvalidatorContext::ForcedSubtreeInvalidationRectUpdate; 443 PaintInvalidatorContext::ForcedSubtreeInvalidationRectUpdate;
444 } 444 }
445 445
446 void PaintInvalidator::processPendingDelayedPaintInvalidations() { 446 void PaintInvalidator::processPendingDelayedPaintInvalidations() {
447 for (auto target : m_pendingDelayedPaintInvalidations) 447 for (auto target : m_pendingDelayedPaintInvalidations)
448 target->getMutableForPainting().setShouldDoFullPaintInvalidation( 448 target->getMutableForPainting().setShouldDoFullPaintInvalidation(
449 PaintInvalidationDelayedFull); 449 PaintInvalidationDelayedFull);
450 } 450 }
451 451
452 } // namespace blink 452 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintInvalidator.h ('k') | third_party/WebKit/Source/core/paint/PrePaintTreeWalk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698