| 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()) |
| 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
. |
| 213 PaintPropertyTreeBuilderContext& treeBuilderContext = const_cast<PaintPr
opertyTreeBuilderContext&>(context.treeBuilderContext); |
| 214 PaintPropertyTreeBuilderContext::ContainingBlockContext savedCurrent = t
reeBuilderContext.current; |
| 215 if (frameView.contentClip() == savedCurrent.clip) |
| 216 treeBuilderContext.current.clip = savedCurrent.clip->parent(); |
| 217 if (frameView.scroll() == savedCurrent.scroll) |
| 218 treeBuilderContext.current.scroll = savedCurrent.scroll->parent(); |
| 219 if (frameView.scrollTranslation() == savedCurrent.transform) |
| 220 treeBuilderContext.current.transform = savedCurrent.transform->paren
t(); |
| 210 frameView.invalidatePaintOfScrollControlsIfNeeded(context); | 221 frameView.invalidatePaintOfScrollControlsIfNeeded(context); |
| 222 treeBuilderContext.current = savedCurrent; |
| 223 } |
| 211 | 224 |
| 212 if (frameView.frame().selection().isCaretBoundsDirty()) | 225 if (frameView.frame().selection().isCaretBoundsDirty()) |
| 213 frameView.frame().selection().invalidateCaretRect(); | 226 frameView.frame().selection().invalidateCaretRect(); |
| 214 | 227 |
| 215 // Temporary callback for crbug.com/487345,402044 | 228 // Temporary callback for crbug.com/487345,402044 |
| 216 // TODO(ojan): Make this more general to be used by PositionObserver | 229 // TODO(ojan): Make this more general to be used by PositionObserver |
| 217 // and rAF throttling. | 230 // and rAF throttling. |
| 218 IntRect visibleRect = frameView.rootFrameToContents(frameView.computeVisible
Area()); | 231 IntRect visibleRect = frameView.rootFrameToContents(frameView.computeVisible
Area()); |
| 219 layoutView->sendMediaPositionChangeNotifications(visibleRect); | 232 layoutView->sendMediaPositionChangeNotifications(visibleRect); |
| 220 } | 233 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 object.getMutableForPainting().clearPaintInvalidationFlags(); | 298 object.getMutableForPainting().clearPaintInvalidationFlags(); |
| 286 } | 299 } |
| 287 | 300 |
| 288 void PaintInvalidator::processPendingDelayedPaintInvalidations() | 301 void PaintInvalidator::processPendingDelayedPaintInvalidations() |
| 289 { | 302 { |
| 290 for (auto target : m_pendingDelayedPaintInvalidations) | 303 for (auto target : m_pendingDelayedPaintInvalidations) |
| 291 target->getMutableForPainting().setShouldDoFullPaintInvalidation(PaintIn
validationDelayedFull); | 304 target->getMutableForPainting().setShouldDoFullPaintInvalidation(PaintIn
validationDelayedFull); |
| 292 } | 305 } |
| 293 | 306 |
| 294 } // namespace blink | 307 } // namespace blink |
| OLD | NEW |