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/paint/ObjectPaintInvalidator.cpp

Issue 2489893002: [SPv2] Track paint offset change (Closed)
Patch Set: Fix test failures Created 4 years, 1 month 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/LayoutView.h" 9 #include "core/layout/LayoutView.h"
10 #include "core/layout/api/LayoutPartItem.h" 10 #include "core/layout/api/LayoutPartItem.h"
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 PaintInvalidationReason 522 PaintInvalidationReason
523 ObjectPaintInvalidatorWithContext::invalidatePaintIfNeededWithComputedReason( 523 ObjectPaintInvalidatorWithContext::invalidatePaintIfNeededWithComputedReason(
524 PaintInvalidationReason reason) { 524 PaintInvalidationReason reason) {
525 // We need to invalidate the selection before checking for whether we are 525 // We need to invalidate the selection before checking for whether we are
526 // doing a full invalidation. This is because we need to update the previous 526 // doing a full invalidation. This is because we need to update the previous
527 // selection rect regardless. 527 // selection rect regardless.
528 invalidateSelectionIfNeeded(reason); 528 invalidateSelectionIfNeeded(reason);
529 529
530 switch (reason) { 530 switch (reason) {
531 case PaintInvalidationNone: 531 case PaintInvalidationNone:
532 // TODO(trchen): Currently we don't keep track of paint offset of layout 532 // There are corner cases that the display items need to be invalidated
533 // objects. There are corner cases that the display items need to be 533 // for paint offset mutation, but incurs no pixel difference (i.e. bounds
534 // invalidated for paint offset mutation, but incurs no pixel difference 534 // stay the same) so no rect-based invalidation is issued. See
535 // (i.e. bounds stay the same) so no rect-based invalidation is issued. 535 // crbug.com/508383 and crbug.com/515977.
536 // See crbug.com/508383 and crbug.com/515977. This is a workaround to 536 if (m_context.forcedSubtreeInvalidationFlags &
537 // force display items to update paint offset. Exclude non-root SVG whose 537 PaintInvalidatorContext::ForcedSubtreeInvalidationChecking) {
538 // paint offset is always zero. 538 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
539 if ((!m_object.isSVG() || m_object.isSVGRoot()) && 539 if (m_context.oldPaintOffset != m_context.newPaintOffset) {
540 (m_context.forcedSubtreeInvalidationFlags & 540 reason = PaintInvalidationLocationChange;
541 PaintInvalidatorContext::ForcedSubtreeInvalidationChecking)) { 541 break;
542 reason = PaintInvalidationLocationChange; 542 }
543 break; 543 } else {
544 // For SPv1, we conservatively assume the object changed paint offset
545 // except for non-root SVG whose paint offset is always zero.
chrishtr 2016/11/10 18:42:00 SPv2 fixes the issue of paint offset always being
Xianzhu 2016/11/10 22:51:50 The paint offsets are always 0 intentionally. For
546 if (!m_object.isSVG() || m_object.isSVGRoot()) {
547 reason = PaintInvalidationLocationChange;
548 break;
549 }
550 }
544 } 551 }
552
545 if (m_object.isSVG() && 553 if (m_object.isSVG() &&
546 (m_context.forcedSubtreeInvalidationFlags & 554 (m_context.forcedSubtreeInvalidationFlags &
547 PaintInvalidatorContext::ForcedSubtreeSVGResourceChange)) { 555 PaintInvalidatorContext::ForcedSubtreeSVGResourceChange)) {
548 reason = PaintInvalidationSVGResourceChange; 556 reason = PaintInvalidationSVGResourceChange;
549 break; 557 break;
550 } 558 }
551 return PaintInvalidationNone; 559 return PaintInvalidationNone;
552 case PaintInvalidationDelayedFull: 560 case PaintInvalidationDelayedFull:
553 return PaintInvalidationDelayedFull; 561 return PaintInvalidationDelayedFull;
554 default: 562 default:
555 DCHECK(isImmediateFullPaintInvalidationReason(reason)); 563 DCHECK(isImmediateFullPaintInvalidationReason(reason));
556 fullyInvalidatePaint(reason, m_context.oldVisualRect, 564 fullyInvalidatePaint(reason, m_context.oldVisualRect,
557 m_context.newVisualRect); 565 m_context.newVisualRect);
558 } 566 }
559 567
560 m_context.paintingLayer->setNeedsRepaint(); 568 m_context.paintingLayer->setNeedsRepaint();
561 m_object.invalidateDisplayItemClients(reason); 569 m_object.invalidateDisplayItemClients(reason);
562 return reason; 570 return reason;
563 } 571 }
564 572
565 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() 573 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts()
566 : m_disabler(&gDisablePaintInvalidationStateAsserts, true) {} 574 : m_disabler(&gDisablePaintInvalidationStateAsserts, true) {}
567 575
568 } // namespace blink 576 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698