Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/PrePaintTreeWalk.h" | 5 #include "core/paint/PrePaintTreeWalk.h" |
| 6 | 6 |
| 7 #include "core/dom/DocumentLifecycle.h" | 7 #include "core/dom/DocumentLifecycle.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/layout/LayoutMultiColumnSpannerPlaceholder.h" | 10 #include "core/layout/LayoutMultiColumnSpannerPlaceholder.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 | 98 |
| 99 // Returns whether |a| is an ancestor of or equal to |b|. | 99 // Returns whether |a| is an ancestor of or equal to |b|. |
| 100 static bool isAncestorOfOrEqualTo(const ClipPaintPropertyNode* a, | 100 static bool isAncestorOfOrEqualTo(const ClipPaintPropertyNode* a, |
| 101 const ClipPaintPropertyNode* b) { | 101 const ClipPaintPropertyNode* b) { |
| 102 while (b && b != a) { | 102 while (b && b != a) { |
| 103 b = b->parent(); | 103 b = b->parent(); |
| 104 } | 104 } |
| 105 return b == a; | 105 return b == a; |
| 106 } | 106 } |
| 107 | 107 |
| 108 ClipRect PrePaintTreeWalk::clipRectForContext( | 108 FloatClipRect PrePaintTreeWalk::clipRectForContext( |
| 109 const PaintPropertyTreeBuilderContext::ContainingBlockContext& context, | 109 const PaintPropertyTreeBuilderContext::ContainingBlockContext& context, |
| 110 const EffectPaintPropertyNode* effect, | 110 const EffectPaintPropertyNode* effect, |
| 111 const PropertyTreeState& ancestorState, | 111 const PropertyTreeState& ancestorState, |
| 112 const LayoutPoint& ancestorPaintOffset, | 112 const LayoutPoint& ancestorPaintOffset, |
| 113 bool& hasClip) { | 113 bool& hasClip) { |
| 114 // Only return a non-infinite clip if clips differ, or the "ancestor" state is | 114 // Only return a non-infinite clip if clips differ, or the "ancestor" state is |
| 115 // actually an ancestor clip. This ensures no accuracy issues due to | 115 // actually an ancestor clip. This ensures no accuracy issues due to |
| 116 // transforms applied to infinite rects. | 116 // transforms applied to infinite rects. |
| 117 if (isAncestorOfOrEqualTo(context.clip, ancestorState.clip())) | 117 if (isAncestorOfOrEqualTo(context.clip, ancestorState.clip())) |
|
wkorman
2017/02/16 21:45:32
Do we have existing tests that cover this logic? P
chrishtr
2017/02/16 23:48:32
Yes, but they are layout tests. The situation happ
| |
| 118 return ClipRect(LayoutRect(LayoutRect::infiniteIntRect())); | 118 return FloatClipRect(); |
| 119 | 119 |
| 120 hasClip = true; | 120 hasClip = true; |
| 121 | 121 |
| 122 PropertyTreeState localState(context.transform, context.clip, effect); | 122 PropertyTreeState localState(context.transform, context.clip, effect); |
| 123 | 123 |
| 124 // TODO(chrishtr): remove need for this. | 124 FloatClipRect rect( |
| 125 LayoutRect localRect(LayoutRect::infiniteIntRect()); | 125 m_geometryMapper.sourceToDestinationClipRect(localState, ancestorState)); |
| 126 | 126 |
| 127 LayoutRect rect(m_geometryMapper | 127 rect.moveBy(-FloatPoint(ancestorPaintOffset)); |
| 128 .sourceToDestinationVisualRect(FloatRect(localRect), | |
| 129 localState, ancestorState) | |
| 130 .rect()); | |
| 131 rect.moveBy(-ancestorPaintOffset); | |
| 132 return rect; | 128 return rect; |
| 133 } | 129 } |
| 134 | 130 |
| 135 void PrePaintTreeWalk::invalidatePaintLayerOptimizationsIfNeeded( | 131 void PrePaintTreeWalk::invalidatePaintLayerOptimizationsIfNeeded( |
| 136 const LayoutObject& object, | 132 const LayoutObject& object, |
| 137 const PaintLayer& ancestorTransformedOrRootPaintLayer, | 133 const PaintLayer& ancestorTransformedOrRootPaintLayer, |
| 138 PaintPropertyTreeBuilderContext& context) { | 134 PaintPropertyTreeBuilderContext& context) { |
| 139 if (!object.hasLayer()) | 135 if (!object.hasLayer()) |
| 140 return; | 136 return; |
| 141 | 137 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 274 roundedIntPoint(context.treeBuilderContext.current.paintOffset); | 270 roundedIntPoint(context.treeBuilderContext.current.paintOffset); |
| 275 walk(*toFrameView(widget), context); | 271 walk(*toFrameView(widget), context); |
| 276 } | 272 } |
| 277 // TODO(pdr): Investigate RemoteFrameView (crbug.com/579281). | 273 // TODO(pdr): Investigate RemoteFrameView (crbug.com/579281). |
| 278 } | 274 } |
| 279 | 275 |
| 280 object.getMutableForPainting().clearPaintFlags(); | 276 object.getMutableForPainting().clearPaintFlags(); |
| 281 } | 277 } |
| 282 | 278 |
| 283 } // namespace blink | 279 } // namespace blink |
| OLD | NEW |