Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 175 } | 175 } |
| 176 } | 176 } |
| 177 | 177 |
| 178 DCHECK(context.paintInvalidationContainer == object.containerForPaintInvalid ation()); | 178 DCHECK(context.paintInvalidationContainer == object.containerForPaintInvalid ation()); |
| 179 DCHECK(context.paintingLayer == object.paintingLayer()); | 179 DCHECK(context.paintingLayer == object.paintingLayer()); |
| 180 | 180 |
| 181 if (object.mayNeedPaintInvalidationSubtree()) | 181 if (object.mayNeedPaintInvalidationSubtree()) |
| 182 context.forcedSubtreeInvalidationFlags |= PaintInvalidatorContext::Force dSubtreeInvalidationChecking; | 182 context.forcedSubtreeInvalidationFlags |= PaintInvalidatorContext::Force dSubtreeInvalidationChecking; |
| 183 | 183 |
| 184 // TODO(crbug.com/637313): This is temporary before we support filters in pa int property tree. | 184 // TODO(crbug.com/637313): This is temporary before we support filters in pa int property tree. |
| 185 if (object.hasFilterInducingProperty()) | 185 // TODO(crbug.com/648274): This is a workaround for multi-column contents. |
| 186 // TODO(crbug.com/648409): This is a workaround for inline contents in verti cal-rl container. | |
| 187 if (object.hasFilterInducingProperty() || object.isLayoutFlowThread() || obj ect.hasFlippedBlocksWritingMode()) | |
|
pdr.
2016/09/19 22:19:15
Can the hasFlippedBlocksWritingMode check be made
Xianzhu
2016/09/19 23:37:40
This would be complex: we need to check for the fl
Xianzhu
2016/09/19 23:39:45
P.S. I'm using the workarounds to see how many tes
| |
| 186 context.forcedSubtreeInvalidationFlags |= PaintInvalidatorContext::Force dSubtreeSlowPathRect; | 188 context.forcedSubtreeInvalidationFlags |= PaintInvalidatorContext::Force dSubtreeSlowPathRect; |
| 187 | 189 |
| 188 context.oldBounds = object.previousPaintInvalidationRect(); | 190 context.oldBounds = object.previousPaintInvalidationRect(); |
| 189 context.oldLocation = object.previousPositionFromPaintInvalidationBacking(); | 191 context.oldLocation = object.previousPositionFromPaintInvalidationBacking(); |
| 190 context.newBounds = computePaintInvalidationRectInBacking(object, context); | 192 context.newBounds = computePaintInvalidationRectInBacking(object, context); |
| 191 context.newLocation = computeLocationFromPaintInvalidationBacking(object, co ntext); | 193 context.newLocation = computeLocationFromPaintInvalidationBacking(object, co ntext); |
| 192 | 194 |
| 193 IntSize adjustment = object.scrollAdjustmentForPaintInvalidation(*context.pa intInvalidationContainer); | 195 IntSize adjustment = object.scrollAdjustmentForPaintInvalidation(*context.pa intInvalidationContainer); |
| 194 context.newLocation.move(adjustment); | 196 context.newLocation.move(adjustment); |
| 195 context.newBounds.move(adjustment); | 197 context.newBounds.move(adjustment); |
| 196 | 198 |
| 197 object.getMutableForPainting().setPreviousPaintInvalidationRect(context.newB ounds); | 199 object.getMutableForPainting().setPreviousPaintInvalidationRect(context.newB ounds); |
| 198 object.getMutableForPainting().setPreviousPositionFromPaintInvalidationBacki ng(context.newLocation); | 200 object.getMutableForPainting().setPreviousPositionFromPaintInvalidationBacki ng(context.newLocation); |
| 199 } | 201 } |
| 200 | 202 |
| 201 void PaintInvalidator::invalidatePaintIfNeeded(FrameView& frameView, PaintInvali datorContext& context) | 203 void PaintInvalidator::invalidatePaintIfNeeded(FrameView& frameView, PaintInvali datorContext& context) |
| 202 { | 204 { |
| 203 LayoutView* layoutView = frameView.layoutView(); | 205 LayoutView* layoutView = frameView.layoutView(); |
| 204 CHECK(layoutView); | 206 CHECK(layoutView); |
| 205 | 207 |
| 206 context.paintInvalidationContainer = context.paintInvalidationContainerForSt ackedContents = &layoutView->containerForPaintInvalidation(); | 208 context.paintInvalidationContainer = context.paintInvalidationContainerForSt ackedContents = &layoutView->containerForPaintInvalidation(); |
| 207 context.paintingLayer = layoutView->layer(); | 209 context.paintingLayer = layoutView->layer(); |
| 208 | 210 |
| 209 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | 211 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
| 212 // Undo content clip and scroll before invalidating FrameView scrollbars . | |
|
pdr.
2016/09/19 22:19:15
If there is a scroll translation (because the fram
Xianzhu
2016/09/19 23:37:40
Thought of this but chose the current method becau
| |
| 213 PaintPropertyTreeBuilderContext& treeBuilderContext = const_cast<PaintPr opertyTreeBuilderContext&>(context.treeBuilderContext); | |
| 214 const ClipPaintPropertyNode* clip = treeBuilderContext.current.clip; | |
| 215 const ScrollPaintPropertyNode* scroll = treeBuilderContext.current.scrol l; | |
| 216 treeBuilderContext.current.clip = clip->parent(); | |
| 217 treeBuilderContext.current.scroll = scroll->parent(); | |
|
pdr.
2016/09/19 22:19:15
This will be incorrect if the frameview does not s
Xianzhu
2016/09/19 23:37:40
Fixed.
No test hit the bug because if the frameVi
| |
| 210 frameView.invalidatePaintOfScrollControlsIfNeeded(context); | 218 frameView.invalidatePaintOfScrollControlsIfNeeded(context); |
| 219 treeBuilderContext.current.clip = clip; | |
| 220 treeBuilderContext.current.scroll = scroll; | |
| 221 } | |
| 211 | 222 |
| 212 if (frameView.frame().selection().isCaretBoundsDirty()) | 223 if (frameView.frame().selection().isCaretBoundsDirty()) |
| 213 frameView.frame().selection().invalidateCaretRect(); | 224 frameView.frame().selection().invalidateCaretRect(); |
| 214 | 225 |
| 215 // Temporary callback for crbug.com/487345,402044 | 226 // Temporary callback for crbug.com/487345,402044 |
| 216 // TODO(ojan): Make this more general to be used by PositionObserver | 227 // TODO(ojan): Make this more general to be used by PositionObserver |
| 217 // and rAF throttling. | 228 // and rAF throttling. |
| 218 IntRect visibleRect = frameView.rootFrameToContents(frameView.computeVisible Area()); | 229 IntRect visibleRect = frameView.rootFrameToContents(frameView.computeVisible Area()); |
| 219 layoutView->sendMediaPositionChangeNotifications(visibleRect); | 230 layoutView->sendMediaPositionChangeNotifications(visibleRect); |
| 220 } | 231 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 285 object.getMutableForPainting().clearPaintInvalidationFlags(); | 296 object.getMutableForPainting().clearPaintInvalidationFlags(); |
| 286 } | 297 } |
| 287 | 298 |
| 288 void PaintInvalidator::processPendingDelayedPaintInvalidations() | 299 void PaintInvalidator::processPendingDelayedPaintInvalidations() |
| 289 { | 300 { |
| 290 for (auto target : m_pendingDelayedPaintInvalidations) | 301 for (auto target : m_pendingDelayedPaintInvalidations) |
| 291 target->getMutableForPainting().setShouldDoFullPaintInvalidation(PaintIn validationDelayedFull); | 302 target->getMutableForPainting().setShouldDoFullPaintInvalidation(PaintIn validationDelayedFull); |
| 292 } | 303 } |
| 293 | 304 |
| 294 } // namespace blink | 305 } // namespace blink |
| OLD | NEW |