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

Side by Side Diff: third_party/WebKit/Source/core/layout/PaintInvalidationState.cpp

Issue 1856993004: Let mapToVisualRectInAncestorSpace apply ancestor clip if not scrollsOverflow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Saturated
Patch Set: Created 4 years, 8 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 | « no previous file | 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/layout/PaintInvalidationState.h" 5 #include "core/layout/PaintInvalidationState.h"
6 6
7 #include "core/frame/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "core/frame/Settings.h" 8 #include "core/frame/Settings.h"
9 #include "core/layout/LayoutInline.h" 9 #include "core/layout/LayoutInline.h"
10 #include "core/layout/LayoutPart.h" 10 #include "core/layout/LayoutPart.h"
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 LayoutRect PaintInvalidationState::computePaintInvalidationRectInBackingForSVG() const 366 LayoutRect PaintInvalidationState::computePaintInvalidationRectInBackingForSVG() const
367 { 367 {
368 LayoutRect rect; 368 LayoutRect rect;
369 if (m_cachedOffsetsEnabled) { 369 if (m_cachedOffsetsEnabled) {
370 FloatRect svgRect = SVGLayoutSupport::localOverflowRectForPaintInvalidat ion(m_currentObject); 370 FloatRect svgRect = SVGLayoutSupport::localOverflowRectForPaintInvalidat ion(m_currentObject);
371 rect = SVGLayoutSupport::transformPaintInvalidationRect(m_currentObject, m_svgTransform, svgRect); 371 rect = SVGLayoutSupport::transformPaintInvalidationRect(m_currentObject, m_svgTransform, svgRect);
372 rect.move(m_paintOffset); 372 rect.move(m_paintOffset);
373 if (m_clipped) 373 if (m_clipped)
374 rect.intersect(m_clipRect); 374 rect.intersect(m_clipRect);
375 #if ASSERT_SAME_RESULT_SLOW_AND_FAST_PATH 375 #if ASSERT_SAME_RESULT_SLOW_AND_FAST_PATH
376 // TODO(crbug.com/597902): Slow path misses clipping of paintInvalidatio nContainer.
377 LayoutRect slowPathRect = SVGLayoutSupport::clippedOverflowRectForPaintI nvalidation(m_currentObject, *m_paintInvalidationContainer); 376 LayoutRect slowPathRect = SVGLayoutSupport::clippedOverflowRectForPaintI nvalidation(m_currentObject, *m_paintInvalidationContainer);
378 if (m_clipped)
379 slowPathRect.intersect(m_clipRect);
380 assertRectsEqual(m_currentObject, m_paintInvalidationContainer, rect, sl owPathRect); 377 assertRectsEqual(m_currentObject, m_paintInvalidationContainer, rect, sl owPathRect);
381 #endif 378 #endif
382 } else { 379 } else {
383 // TODO(wangxianzhu): Sometimes m_cachedOffsetsEnabled==false doesn't me an we can't use cached 380 // TODO(wangxianzhu): Sometimes m_cachedOffsetsEnabled==false doesn't me an we can't use cached
384 // m_svgTransform. We can use hybrid fast path (for SVG) and slow path ( for things above the SVGRoot). 381 // m_svgTransform. We can use hybrid fast path (for SVG) and slow path ( for things above the SVGRoot).
385 rect = SVGLayoutSupport::clippedOverflowRectForPaintInvalidation(m_curre ntObject, *m_paintInvalidationContainer); 382 rect = SVGLayoutSupport::clippedOverflowRectForPaintInvalidation(m_curre ntObject, *m_paintInvalidationContainer);
386 } 383 }
387 384
388 if (m_paintInvalidationContainer->layer()->groupedMapping()) 385 if (m_paintInvalidationContainer->layer()->groupedMapping())
389 PaintLayer::mapRectInPaintInvalidationContainerToBacking(*m_paintInvalid ationContainer, rect); 386 PaintLayer::mapRectInPaintInvalidationContainerToBacking(*m_paintInvalid ationContainer, rect);
390 return rect; 387 return rect;
391 } 388 }
392 389
393 static void slowMapToVisualRectInAncestorSpace(const LayoutObject& object, const LayoutBoxModelObject& ancestor, LayoutRect& rect) 390 static void slowMapToVisualRectInAncestorSpace(const LayoutObject& object, const LayoutBoxModelObject& ancestor, LayoutRect& rect)
394 { 391 {
395 if (object.isLayoutView()) { 392 if (object.isLayoutView()) {
396 toLayoutView(object).mapToVisualRectInAncestorSpace(&ancestor, rect, Inp utIsInFrameCoordinates, DefaultVisualRectFlags); 393 toLayoutView(object).mapToVisualRectInAncestorSpace(&ancestor, rect, Inp utIsInFrameCoordinates, DefaultVisualRectFlags);
397 } else { 394 } else {
398 object.mapToVisualRectInAncestorSpace(&ancestor, rect); 395 object.mapToVisualRectInAncestorSpace(&ancestor, rect);
399 } 396 }
397
398 // LayoutObject::mapToVisualRectInAncestorSpace() doesn't apply overflow cli p of ancestor.
chrishtr 2016/04/06 23:18:19 Do any other call sites of mapToVisualRectInAncest
Xianzhu 2016/04/06 23:37:33 Didn't think of this. Just looked at several calls
399 if (ancestor.isBox() && !ancestor.isLayoutView() && !toLayoutBox(ancestor).s crollsOverflow())
400 rect.intersect(toLayoutBox(ancestor).overflowClipRect(LayoutPoint()));
400 } 401 }
401 402
402 void PaintInvalidationState::mapLocalRectToPaintInvalidationBacking(LayoutRect& rect) const 403 void PaintInvalidationState::mapLocalRectToPaintInvalidationBacking(LayoutRect& rect) const
403 { 404 {
404 ASSERT(!m_didUpdateForChildren); 405 ASSERT(!m_didUpdateForChildren);
405 406
406 if (m_cachedOffsetsEnabled) { 407 if (m_cachedOffsetsEnabled) {
407 #if ASSERT_SAME_RESULT_SLOW_AND_FAST_PATH 408 #if ASSERT_SAME_RESULT_SLOW_AND_FAST_PATH
408 LayoutRect slowPathRect(rect); 409 LayoutRect slowPathRect(rect);
409 slowMapToVisualRectInAncestorSpace(m_currentObject, *m_paintInvalidation Container, slowPathRect); 410 slowMapToVisualRectInAncestorSpace(m_currentObject, *m_paintInvalidation Container, slowPathRect);
410 #endif 411 #endif
411 rect.move(m_paintOffset); 412 rect.move(m_paintOffset);
412 if (m_clipped) 413 if (m_clipped)
413 rect.intersect(m_clipRect); 414 rect.intersect(m_clipRect);
414 #if ASSERT_SAME_RESULT_SLOW_AND_FAST_PATH 415 #if ASSERT_SAME_RESULT_SLOW_AND_FAST_PATH
415 // TODO(crbug.com/597902): Slow path misses clipping of paintInvalidatio nContainer.
416 if (m_clipped)
417 slowPathRect.intersect(m_clipRect);
418 assertRectsEqual(m_currentObject, *m_paintInvalidationContainer, rect, s lowPathRect); 416 assertRectsEqual(m_currentObject, *m_paintInvalidationContainer, rect, s lowPathRect);
419 #endif 417 #endif
420 } else { 418 } else {
421 slowMapToVisualRectInAncestorSpace(m_currentObject, *m_paintInvalidation Container, rect); 419 slowMapToVisualRectInAncestorSpace(m_currentObject, *m_paintInvalidation Container, rect);
422 } 420 }
423 421
424 if (m_paintInvalidationContainer->layer()->groupedMapping()) 422 if (m_paintInvalidationContainer->layer()->groupedMapping())
425 PaintLayer::mapRectInPaintInvalidationContainerToBacking(*m_paintInvalid ationContainer, rect); 423 PaintLayer::mapRectInPaintInvalidationContainerToBacking(*m_paintInvalid ationContainer, rect);
426 } 424 }
427 425
(...skipping 11 matching lines...) Expand all
439 437
440 PaintLayer& PaintInvalidationState::enclosingSelfPaintingLayer(const LayoutObjec t& layoutObject) const 438 PaintLayer& PaintInvalidationState::enclosingSelfPaintingLayer(const LayoutObjec t& layoutObject) const
441 { 439 {
442 if (layoutObject.hasLayer() && toLayoutBoxModelObject(layoutObject).hasSelfP aintingLayer()) 440 if (layoutObject.hasLayer() && toLayoutBoxModelObject(layoutObject).hasSelfP aintingLayer())
443 return *toLayoutBoxModelObject(layoutObject).layer(); 441 return *toLayoutBoxModelObject(layoutObject).layer();
444 442
445 return m_enclosingSelfPaintingLayer; 443 return m_enclosingSelfPaintingLayer;
446 } 444 }
447 445
448 } // namespace blink 446 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698