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

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
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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 m_paintOffset -= toLayoutBox(m_currentObject).locationOffset(); 314 m_paintOffset -= toLayoutBox(m_currentObject).locationOffset();
315 } 315 }
316 316
317 if (!m_currentObject.hasOverflowClip()) 317 if (!m_currentObject.hasOverflowClip())
318 return; 318 return;
319 319
320 const LayoutBox& box = toLayoutBox(m_currentObject); 320 const LayoutBox& box = toLayoutBox(m_currentObject);
321 321
322 // Do not clip scroll layer contents because the compositor expects the whol e layer 322 // Do not clip scroll layer contents because the compositor expects the whol e layer
323 // to be always invalidated in-time. 323 // to be always invalidated in-time.
324 if (box.usesCompositedScrolling()) 324 if (box == m_paintInvalidationContainer && box.scrollsOverflow())
325 ASSERT(!m_clipped); // The box should establish paint invalidation conta iner, so no m_clipped inherited. 325 ASSERT(!m_clipped); // The box establishes paint invalidation container, so no m_clipped inherited.
326 else 326 else
327 addClipRectRelativeToPaintOffset(box.overflowClipRect(LayoutPoint())); 327 addClipRectRelativeToPaintOffset(box.overflowClipRect(LayoutPoint()));
328 328
329 m_paintOffset -= box.scrolledContentOffset(); 329 m_paintOffset -= box.scrolledContentOffset();
330 330
331 // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip if present. 331 // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip if present.
332 } 332 }
333 333
334 static FloatPoint slowLocalToAncestorPoint(const LayoutObject& object, const Lay outBoxModelObject& ancestor, const FloatPoint& point) 334 static FloatPoint slowLocalToAncestorPoint(const LayoutObject& object, const Lay outBoxModelObject& ancestor, const FloatPoint& point)
335 { 335 {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 LayoutRect PaintInvalidationState::computePaintInvalidationRectInBackingForSVG() const 378 LayoutRect PaintInvalidationState::computePaintInvalidationRectInBackingForSVG() const
379 { 379 {
380 LayoutRect rect; 380 LayoutRect rect;
381 if (m_cachedOffsetsEnabled) { 381 if (m_cachedOffsetsEnabled) {
382 FloatRect svgRect = SVGLayoutSupport::localOverflowRectForPaintInvalidat ion(m_currentObject); 382 FloatRect svgRect = SVGLayoutSupport::localOverflowRectForPaintInvalidat ion(m_currentObject);
383 rect = SVGLayoutSupport::transformPaintInvalidationRect(m_currentObject, m_svgTransform, svgRect); 383 rect = SVGLayoutSupport::transformPaintInvalidationRect(m_currentObject, m_svgTransform, svgRect);
384 rect.move(m_paintOffset); 384 rect.move(m_paintOffset);
385 if (m_clipped) 385 if (m_clipped)
386 rect.intersect(m_clipRect); 386 rect.intersect(m_clipRect);
387 #if ASSERT_SAME_RESULT_SLOW_AND_FAST_PATH 387 #if ASSERT_SAME_RESULT_SLOW_AND_FAST_PATH
388 // TODO(crbug.com/597902): Slow path misses clipping of paintInvalidatio nContainer.
389 LayoutRect slowPathRect = SVGLayoutSupport::clippedOverflowRectForPaintI nvalidation(m_currentObject, *m_paintInvalidationContainer); 388 LayoutRect slowPathRect = SVGLayoutSupport::clippedOverflowRectForPaintI nvalidation(m_currentObject, *m_paintInvalidationContainer);
390 if (m_clipped)
391 slowPathRect.intersect(m_clipRect);
392 assertRectsEqual(m_currentObject, m_paintInvalidationContainer, rect, sl owPathRect); 389 assertRectsEqual(m_currentObject, m_paintInvalidationContainer, rect, sl owPathRect);
393 #endif 390 #endif
394 } else { 391 } else {
395 // TODO(wangxianzhu): Sometimes m_cachedOffsetsEnabled==false doesn't me an we can't use cached 392 // TODO(wangxianzhu): Sometimes m_cachedOffsetsEnabled==false doesn't me an we can't use cached
396 // m_svgTransform. We can use hybrid fast path (for SVG) and slow path ( for things above the SVGRoot). 393 // m_svgTransform. We can use hybrid fast path (for SVG) and slow path ( for things above the SVGRoot).
397 rect = SVGLayoutSupport::clippedOverflowRectForPaintInvalidation(m_curre ntObject, *m_paintInvalidationContainer); 394 rect = SVGLayoutSupport::clippedOverflowRectForPaintInvalidation(m_curre ntObject, *m_paintInvalidationContainer);
398 } 395 }
399 396
400 if (m_paintInvalidationContainer->layer()->groupedMapping()) 397 if (m_paintInvalidationContainer->layer()->groupedMapping())
401 PaintLayer::mapRectInPaintInvalidationContainerToBacking(*m_paintInvalid ationContainer, rect); 398 PaintLayer::mapRectInPaintInvalidationContainerToBacking(*m_paintInvalid ationContainer, rect);
402 return rect; 399 return rect;
403 } 400 }
404 401
405 static void slowMapToVisualRectInAncestorSpace(const LayoutObject& object, const LayoutBoxModelObject& ancestor, LayoutRect& rect) 402 static void slowMapToVisualRectInAncestorSpace(const LayoutObject& object, const LayoutBoxModelObject& ancestor, LayoutRect& rect)
406 { 403 {
407 if (object.isLayoutView()) { 404 if (object.isLayoutView())
408 toLayoutView(object).mapToVisualRectInAncestorSpace(&ancestor, rect, Inp utIsInFrameCoordinates, DefaultVisualRectFlags); 405 toLayoutView(object).mapToVisualRectInAncestorSpace(&ancestor, rect, Inp utIsInFrameCoordinates, DefaultVisualRectFlags);
409 } else { 406 else
410 object.mapToVisualRectInAncestorSpace(&ancestor, rect); 407 object.mapToVisualRectInAncestorSpace(&ancestor, rect);
411 }
412 } 408 }
413 409
414 void PaintInvalidationState::mapLocalRectToPaintInvalidationContainer(LayoutRect & rect) const 410 void PaintInvalidationState::mapLocalRectToPaintInvalidationContainer(LayoutRect & rect) const
415 { 411 {
416 ASSERT(!m_didUpdateForChildren); 412 ASSERT(!m_didUpdateForChildren);
417 413
418 if (m_cachedOffsetsEnabled) { 414 if (m_cachedOffsetsEnabled) {
419 #if ASSERT_SAME_RESULT_SLOW_AND_FAST_PATH 415 #if ASSERT_SAME_RESULT_SLOW_AND_FAST_PATH
420 LayoutRect slowPathRect(rect); 416 LayoutRect slowPathRect(rect);
421 slowMapToVisualRectInAncestorSpace(m_currentObject, *m_paintInvalidation Container, slowPathRect); 417 slowMapToVisualRectInAncestorSpace(m_currentObject, *m_paintInvalidation Container, slowPathRect);
422 #endif 418 #endif
423 rect.move(m_paintOffset); 419 rect.move(m_paintOffset);
424 if (m_clipped) 420 if (m_clipped)
425 rect.intersect(m_clipRect); 421 rect.intersect(m_clipRect);
426 #if ASSERT_SAME_RESULT_SLOW_AND_FAST_PATH 422 #if ASSERT_SAME_RESULT_SLOW_AND_FAST_PATH
427 // TODO(crbug.com/597902): Slow path misses clipping of paintInvalidatio nContainer.
428 if (m_clipped)
429 slowPathRect.intersect(m_clipRect);
430 assertRectsEqual(m_currentObject, *m_paintInvalidationContainer, rect, s lowPathRect); 423 assertRectsEqual(m_currentObject, *m_paintInvalidationContainer, rect, s lowPathRect);
431 #endif 424 #endif
432 } else { 425 } else {
433 slowMapToVisualRectInAncestorSpace(m_currentObject, *m_paintInvalidation Container, rect); 426 slowMapToVisualRectInAncestorSpace(m_currentObject, *m_paintInvalidation Container, rect);
434 } 427 }
435 } 428 }
436 429
437 void PaintInvalidationState::mapLocalRectToPaintInvalidationBacking(LayoutRect& rect) const 430 void PaintInvalidationState::mapLocalRectToPaintInvalidationBacking(LayoutRect& rect) const
438 { 431 {
439 mapLocalRectToPaintInvalidationContainer(rect); 432 mapLocalRectToPaintInvalidationContainer(rect);
(...skipping 16 matching lines...) Expand all
456 449
457 PaintLayer& PaintInvalidationState::enclosingSelfPaintingLayer(const LayoutObjec t& layoutObject) const 450 PaintLayer& PaintInvalidationState::enclosingSelfPaintingLayer(const LayoutObjec t& layoutObject) const
458 { 451 {
459 if (layoutObject.hasLayer() && toLayoutBoxModelObject(layoutObject).hasSelfP aintingLayer()) 452 if (layoutObject.hasLayer() && toLayoutBoxModelObject(layoutObject).hasSelfP aintingLayer())
460 return *toLayoutBoxModelObject(layoutObject).layer(); 453 return *toLayoutBoxModelObject(layoutObject).layer();
461 454
462 return m_enclosingSelfPaintingLayer; 455 return m_enclosingSelfPaintingLayer;
463 } 456 }
464 457
465 } // namespace blink 458 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698