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

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

Issue 2271883002: Fix paint invalidation and painting for composited-scrolling input elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: none Created 4 years, 3 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/ObjectPaintInvalidator.h" 5 #include "core/paint/ObjectPaintInvalidator.h"
6 6
7 #include "core/frame/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "core/frame/LocalFrame.h" 8 #include "core/frame/LocalFrame.h"
9 #include "core/layout/LayoutBlockFlow.h" 9 #include "core/layout/LayoutBlockFlow.h"
10 #include "core/layout/compositing/CompositedLayerMapping.h" 10 #include "core/layout/compositing/CompositedLayerMapping.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 DCHECK(paintInvalidationContainer.compositingState() != NotComposited); 217 DCHECK(paintInvalidationContainer.compositingState() != NotComposited);
218 218
219 PaintLayer& layer = *paintInvalidationContainer.layer(); 219 PaintLayer& layer = *paintInvalidationContainer.layer();
220 if (layer.groupedMapping()) { 220 if (layer.groupedMapping()) {
221 if (GraphicsLayer* squashingLayer = layer.groupedMapping()->squashingLay er()) { 221 if (GraphicsLayer* squashingLayer = layer.groupedMapping()->squashingLay er()) {
222 // Note: the subpixel accumulation of layer() does not need to be ad ded here. It is already taken into account. 222 // Note: the subpixel accumulation of layer() does not need to be ad ded here. It is already taken into account.
223 squashingLayer->setNeedsDisplayInRect(enclosingIntRect(rect), reason , m_object); 223 squashingLayer->setNeedsDisplayInRect(enclosingIntRect(rect), reason , m_object);
224 } 224 }
225 } else if (m_object.compositedScrollsWithRespectTo(paintInvalidationContaine r)) { 225 } else if (m_object.compositedScrollsWithRespectTo(paintInvalidationContaine r)) {
226 layer.compositedLayerMapping()->setScrollingContentsNeedDisplayInRect(re ct, reason, m_object); 226 layer.compositedLayerMapping()->setScrollingContentsNeedDisplayInRect(re ct, reason, m_object);
227 } else if (paintInvalidationContainer.usesCompositedScrolling()) { 227 } else if (paintInvalidationContainer.usesCompositedScrolling() && reason != PaintInvalidationRectangle) {
228 if (layer.compositedLayerMapping()->shouldPaintBackgroundOntoScrollingCo ntentsLayer()) { 228 if (layer.compositedLayerMapping()->shouldPaintBackgroundOntoScrollingCo ntentsLayer()) {
229 // TODO(flackr): Get a correct rect in the context of the scrolling contents layer to update 229 // TODO(flackr): Get a correct rect in the context of the scrolling contents layer to update
230 // rather than updating the entire rect. 230 // rather than updating the entire rect.
231 const LayoutRect& scrollingContentsRect = toLayoutBox(m_object).layo utOverflowRect(); 231 const LayoutRect& scrollingContentsRect = toLayoutBox(m_object).layo utOverflowRect();
232 layer.compositedLayerMapping()->setScrollingContentsNeedDisplayInRec t(scrollingContentsRect, reason, m_object); 232 layer.compositedLayerMapping()->setScrollingContentsNeedDisplayInRec t(scrollingContentsRect, reason, m_object);
233 layer.setNeedsRepaint(); 233 layer.setNeedsRepaint();
234 invalidateDisplayItemClient(*layer.compositedLayerMapping()->scrolli ngContentsLayer(), reason); 234 invalidateDisplayItemClient(*layer.compositedLayerMapping()->scrolli ngContentsLayer(), reason);
235 } 235 }
236 layer.compositedLayerMapping()->setNonScrollingContentsNeedDisplayInRect (rect, reason, m_object); 236 layer.compositedLayerMapping()->setNonScrollingContentsNeedDisplayInRect (rect, reason, m_object);
237 } else { 237 } else {
(...skipping 29 matching lines...) Expand all
267 267
268 // This conditional handles situations where non-rooted (and hence non-compo sited) frames are 268 // This conditional handles situations where non-rooted (and hence non-compo sited) frames are
269 // painted, such as SVG images. 269 // painted, such as SVG images.
270 if (!paintInvalidationContainer.isPaintInvalidationContainer()) 270 if (!paintInvalidationContainer.isPaintInvalidationContainer())
271 invalidatePaintRectangleOnWindow(paintInvalidationContainer, enclosingIn tRect(dirtyRect)); 271 invalidatePaintRectangleOnWindow(paintInvalidationContainer, enclosingIn tRect(dirtyRect));
272 272
273 if (paintInvalidationContainer.view()->usesCompositing() && paintInvalidatio nContainer.isPaintInvalidationContainer()) 273 if (paintInvalidationContainer.view()->usesCompositing() && paintInvalidatio nContainer.isPaintInvalidationContainer())
274 setBackingNeedsPaintInvalidationInRect(paintInvalidationContainer, dirty Rect, invalidationReason); 274 setBackingNeedsPaintInvalidationInRect(paintInvalidationContainer, dirty Rect, invalidationReason);
275 } 275 }
276 276
277 void ObjectPaintInvalidator::invalidatePaintRectangle(const LayoutRect& dirtyRec t) 277 void ObjectPaintInvalidator::invalidatePaintRectangle(const LayoutRect& dirtyRec t, DisplayItemClient* displayItemClient)
278 { 278 {
279 CHECK(m_object.isRooted()); 279 CHECK(m_object.isRooted());
280 280
281 if (dirtyRect.isEmpty()) 281 if (dirtyRect.isEmpty())
282 return; 282 return;
283 283
284 if (m_object.view()->document().printing()) 284 if (m_object.view()->document().printing())
285 return; // Don't invalidate paints if we're printing. 285 return; // Don't invalidate paints if we're printing.
286 286
287 const LayoutBoxModelObject& paintInvalidationContainer = m_object.containerF orPaintInvalidation(); 287 const LayoutBoxModelObject& paintInvalidationContainer = m_object.containerF orPaintInvalidation();
288 LayoutRect dirtyRectOnBacking = dirtyRect; 288 LayoutRect dirtyRectOnBacking = dirtyRect;
289 PaintLayer::mapRectToPaintInvalidationBacking(m_object, paintInvalidationCon tainer, dirtyRectOnBacking); 289 PaintLayer::mapRectToPaintInvalidationBacking(m_object, paintInvalidationCon tainer, dirtyRectOnBacking);
290 dirtyRectOnBacking.move(m_object.scrollAdjustmentForPaintInvalidation(paintI nvalidationContainer)); 290 dirtyRectOnBacking.move(m_object.scrollAdjustmentForPaintInvalidation(paintI nvalidationContainer));
291 291
292 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRectOnBacking , PaintInvalidationRectangle); 292 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRectOnBacking , PaintInvalidationRectangle);
293 293
294 slowSetPaintingLayerNeedsRepaint(); 294 slowSetPaintingLayerNeedsRepaint();
295 m_object.invalidateDisplayItemClients(PaintInvalidationRectangle); 295 if (displayItemClient)
296 invalidateDisplayItemClient(*displayItemClient, PaintInvalidationRectang le);
297 else
298 m_object.invalidateDisplayItemClients(PaintInvalidationRectangle);
296 } 299 }
297 300
298 void ObjectPaintInvalidator::slowSetPaintingLayerNeedsRepaint() 301 void ObjectPaintInvalidator::slowSetPaintingLayerNeedsRepaint()
299 { 302 {
300 if (PaintLayer* paintingLayer = m_object.paintingLayer()) 303 if (PaintLayer* paintingLayer = m_object.paintingLayer())
301 paintingLayer->setNeedsRepaint(); 304 paintingLayer->setNeedsRepaint();
302 } 305 }
303 306
304 bool ObjectPaintInvalidatorWithContext::incrementallyInvalidatePaint() 307 bool ObjectPaintInvalidatorWithContext::incrementallyInvalidatePaint()
305 { 308 {
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 m_object.invalidateDisplayItemClients(reason); 470 m_object.invalidateDisplayItemClients(reason);
468 return reason; 471 return reason;
469 } 472 }
470 473
471 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() 474 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts()
472 : m_disabler(&gDisablePaintInvalidationStateAsserts, true) 475 : m_disabler(&gDisablePaintInvalidationStateAsserts, true)
473 { 476 {
474 } 477 }
475 478
476 } // namespace blink 479 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698