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

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

Issue 2413783002: Revert of Use enclosingLayoutRect instead of enclosingIntRect in SVGLayoutSupport::transformPaintInvalidation… (Closed)
Patch Set: Remove bad rebaseline on Win7 Created 4 years, 2 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 | « third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "core/layout/LayoutBlockFlow.h" 11 #include "core/layout/LayoutBlockFlow.h"
12 #include "core/layout/LayoutObject.h" 12 #include "core/layout/LayoutObject.h"
13 #include "core/layout/LayoutTable.h" 13 #include "core/layout/LayoutTable.h"
14 #include "core/layout/LayoutView.h" 14 #include "core/layout/LayoutView.h"
15 #include "core/layout/svg/SVGLayoutSupport.h" 15 #include "core/layout/svg/SVGLayoutSupport.h"
16 #include "core/paint/ObjectPaintProperties.h" 16 #include "core/paint/ObjectPaintProperties.h"
17 #include "core/paint/PaintLayer.h" 17 #include "core/paint/PaintLayer.h"
18 #include "core/paint/PaintLayerScrollableArea.h" 18 #include "core/paint/PaintLayerScrollableArea.h"
19 #include "core/paint/PaintPropertyTreeBuilder.h" 19 #include "core/paint/PaintPropertyTreeBuilder.h"
20 20
21 namespace blink { 21 namespace blink {
22 22
23 // TODO(wangxianzhu): Avoid using function when possible. For example, we can
24 // avoid it by avoiding unnecessary conversions between LayoutRects and
25 // FloatRects.
26 static LayoutRect enclosingLayoutRectIfNotEmpty(const FloatRect& floatRect) {
27 return floatRect.isEmpty() ? LayoutRect(floatRect)
28 : enclosingLayoutRect(floatRect);
29 }
30
31 static LayoutRect slowMapToVisualRectInAncestorSpace( 23 static LayoutRect slowMapToVisualRectInAncestorSpace(
32 const LayoutObject& object, 24 const LayoutObject& object,
33 const LayoutBoxModelObject& ancestor, 25 const LayoutBoxModelObject& ancestor,
34 const FloatRect& rect) { 26 const FloatRect& rect) {
35 if (object.isSVG() && !object.isSVGRoot()) { 27 if (object.isSVG() && !object.isSVGRoot()) {
36 LayoutRect result; 28 LayoutRect result;
37 SVGLayoutSupport::mapToVisualRectInAncestorSpace(object, &ancestor, rect, 29 SVGLayoutSupport::mapToVisualRectInAncestorSpace(object, &ancestor, rect,
38 result); 30 result);
39 return result; 31 return result;
40 } 32 }
41 33
42 LayoutRect result = enclosingLayoutRectIfNotEmpty(rect); 34 LayoutRect result(rect);
43 if (object.isLayoutView()) 35 if (object.isLayoutView())
44 toLayoutView(object).mapToVisualRectInAncestorSpace( 36 toLayoutView(object).mapToVisualRectInAncestorSpace(
45 &ancestor, result, InputIsInFrameCoordinates, DefaultVisualRectFlags); 37 &ancestor, result, InputIsInFrameCoordinates, DefaultVisualRectFlags);
46 else 38 else
47 object.mapToVisualRectInAncestorSpace(&ancestor, result); 39 object.mapToVisualRectInAncestorSpace(&ancestor, result);
48 return result; 40 return result;
49 } 41 }
50 42
51 // TODO(wangxianzhu): Combine this into 43 // TODO(wangxianzhu): Combine this into
52 // PaintInvalidator::mapLocalRectToPaintInvalidationBacking() when removing 44 // PaintInvalidator::mapLocalRectToPaintInvalidationBacking() when removing
(...skipping 20 matching lines...) Expand all
73 // physical coordinates for boxes, but "physical coordinates with flipped 65 // physical coordinates for boxes, but "physical coordinates with flipped
74 // block-flow direction" for non-boxes for which we don't need to flip.) 66 // block-flow direction" for non-boxes for which we don't need to flip.)
75 // TODO(wangxianzhu): Avoid containingBlock(). 67 // TODO(wangxianzhu): Avoid containingBlock().
76 object.containingBlock()->flipForWritingMode(rect); 68 object.containingBlock()->flipForWritingMode(rect);
77 } 69 }
78 } 70 }
79 71
80 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 72 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
81 // In SPv2, visual rects are in the space of their local transform node. 73 // In SPv2, visual rects are in the space of their local transform node.
82 rect.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset)); 74 rect.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset));
83 return enclosingLayoutRectIfNotEmpty(rect); 75 return LayoutRect(rect);
84 } 76 }
85 77
86 LayoutRect result; 78 LayoutRect result;
87 if (context.forcedSubtreeInvalidationFlags & 79 if (context.forcedSubtreeInvalidationFlags &
88 PaintInvalidatorContext::ForcedSubtreeSlowPathRect) { 80 PaintInvalidatorContext::ForcedSubtreeSlowPathRect) {
89 result = slowMapToVisualRectInAncestorSpace( 81 result = slowMapToVisualRectInAncestorSpace(
90 object, *context.paintInvalidationContainer, rect); 82 object, *context.paintInvalidationContainer, rect);
91 } else if (object == context.paintInvalidationContainer) { 83 } else if (object == context.paintInvalidationContainer) {
92 result = enclosingLayoutRectIfNotEmpty(rect); 84 result = LayoutRect(rect);
93 } else { 85 } else {
94 rect.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset)); 86 rect.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset));
95 87
96 PropertyTreeState currentTreeState( 88 PropertyTreeState currentTreeState(
97 context.treeBuilderContext.current.transform, 89 context.treeBuilderContext.current.transform,
98 context.treeBuilderContext.current.clip, 90 context.treeBuilderContext.current.clip,
99 context.treeBuilderContext.currentEffect, 91 context.treeBuilderContext.currentEffect,
100 context.treeBuilderContext.current.scroll); 92 context.treeBuilderContext.current.scroll);
101 const ObjectPaintProperties* containerPaintProperties = 93 const ObjectPaintProperties* containerPaintProperties =
102 context.paintInvalidationContainer->objectPaintProperties(); 94 context.paintInvalidationContainer->objectPaintProperties();
103 auto containerContentsProperties = 95 auto containerContentsProperties =
104 containerPaintProperties->contentsProperties(); 96 containerPaintProperties->contentsProperties();
105 97
106 bool success = false; 98 bool success = false;
107 result = enclosingLayoutRectIfNotEmpty( 99 result = LayoutRect(geometryMapper.mapToVisualRectInDestinationSpace(
108 geometryMapper.mapToVisualRectInDestinationSpace( 100 rect, currentTreeState, containerContentsProperties.propertyTreeState,
109 rect, currentTreeState, 101 success));
110 containerContentsProperties.propertyTreeState, success));
111 DCHECK(success); 102 DCHECK(success);
112 103
113 // Convert the result to the container's contents space. 104 // Convert the result to the container's contents space.
114 result.moveBy(-containerContentsProperties.paintOffset); 105 result.moveBy(-containerContentsProperties.paintOffset);
115 } 106 }
116 107
117 if (context.paintInvalidationContainer->layer()->groupedMapping()) 108 if (context.paintInvalidationContainer->layer()->groupedMapping())
118 PaintLayer::mapRectInPaintInvalidationContainerToBacking( 109 PaintLayer::mapRectInPaintInvalidationContainerToBacking(
119 *context.paintInvalidationContainer, result); 110 *context.paintInvalidationContainer, result);
120 return result; 111 return result;
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 object.getMutableForPainting().clearPaintInvalidationFlags(); 440 object.getMutableForPainting().clearPaintInvalidationFlags();
450 } 441 }
451 442
452 void PaintInvalidator::processPendingDelayedPaintInvalidations() { 443 void PaintInvalidator::processPendingDelayedPaintInvalidations() {
453 for (auto target : m_pendingDelayedPaintInvalidations) 444 for (auto target : m_pendingDelayedPaintInvalidations)
454 target->getMutableForPainting().setShouldDoFullPaintInvalidation( 445 target->getMutableForPainting().setShouldDoFullPaintInvalidation(
455 PaintInvalidationDelayedFull); 446 PaintInvalidationDelayedFull);
456 } 447 }
457 448
458 } // namespace blink 449 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698