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

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

Issue 2521613003: Add flag for tracking descendant paint property updates (Closed)
Patch Set: Address Xianzhu's comments 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 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2009 Google Inc. All rights reserved. 8 * Copyright (C) 2009 Google Inc. All rights reserved.
9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
10 * (http://www.torchmobile.com/) 10 * (http://www.torchmobile.com/)
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 diff.zIndexChanged() || diff.filterChanged() || 1465 diff.zIndexChanged() || diff.filterChanged() ||
1466 diff.backdropFilterChanged())) { 1466 diff.backdropFilterChanged())) {
1467 // We don't need to invalidate paint of objects on SPv2 when only paint 1467 // We don't need to invalidate paint of objects on SPv2 when only paint
1468 // property or paint order change. Mark the painting layer needing repaint 1468 // property or paint order change. Mark the painting layer needing repaint
1469 // for changed paint property or paint order. Raster invalidation will be 1469 // for changed paint property or paint order. Raster invalidation will be
1470 // issued if needed during paint. 1470 // issued if needed during paint.
1471 ObjectPaintInvalidator(*this).slowSetPaintingLayerNeedsRepaint(); 1471 ObjectPaintInvalidator(*this).slowSetPaintingLayerNeedsRepaint();
1472 1472
1473 // When transform, opacity, etc. change, paint properties will also change 1473 // When transform, opacity, etc. change, paint properties will also change
1474 // so we need to mark this object as needing an update. 1474 // so we need to mark this object as needing an update.
1475 // TODO(pdr): Also update in the non-spv2 codepath?
1476 getMutableForPainting().setNeedsPaintPropertyUpdate(); 1475 getMutableForPainting().setNeedsPaintPropertyUpdate();
1477 } 1476 }
1478 } else { 1477 } else {
1479 // If transform changed, and the layer does not paint into its own separate 1478 // If transform changed, and the layer does not paint into its own separate
1480 // backing, then we need to invalidate paints. 1479 // backing, then we need to invalidate paints.
1481 if (diff.transformChanged()) { 1480 if (diff.transformChanged()) {
1482 // Text nodes share style with their parents but transforms don't apply to 1481 // Text nodes share style with their parents but transforms don't apply to
1483 // them, hence the !isText() check. 1482 // them, hence the !isText() check.
1484 if (!isText() && (!hasLayer() || 1483 if (!isText() && (!hasLayer() ||
1485 !toLayoutBoxModelObject(this) 1484 !toLayoutBoxModelObject(this)
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after
2501 if (filterSkipped && walker->hasFilterInducingProperty()) 2500 if (filterSkipped && walker->hasFilterInducingProperty())
2502 *filterSkipped = true; 2501 *filterSkipped = true;
2503 } 2502 }
2504 } 2503 }
2505 return multicolContainer; 2504 return multicolContainer;
2506 } 2505 }
2507 2506
2508 return o; 2507 return o;
2509 } 2508 }
2510 2509
2511 LayoutObject* LayoutObject::paintInvalidationParent() const { 2510 inline LayoutObject* LayoutObject::paintInvalidationParent() const {
2512 if (isLayoutView()) 2511 if (isLayoutView())
2513 return LayoutAPIShim::layoutObjectFrom(frame()->ownerLayoutItem()); 2512 return LayoutAPIShim::layoutObjectFrom(frame()->ownerLayoutItem());
2514 if (isColumnSpanAll()) 2513 if (isColumnSpanAll())
2515 return spannerPlaceholder(); 2514 return spannerPlaceholder();
2516 return parent(); 2515 return parent();
2517 } 2516 }
2518 2517
2518 LayoutObject* LayoutObject::slowPaintInvalidationParentForTesting() const {
2519 return paintInvalidationParent();
2520 }
2521
2519 bool LayoutObject::isSelectionBorder() const { 2522 bool LayoutObject::isSelectionBorder() const {
2520 SelectionState st = getSelectionState(); 2523 SelectionState st = getSelectionState();
2521 return st == SelectionStart || st == SelectionEnd || st == SelectionBoth; 2524 return st == SelectionStart || st == SelectionEnd || st == SelectionBoth;
2522 } 2525 }
2523 2526
2524 inline void LayoutObject::clearLayoutRootIfNeeded() const { 2527 inline void LayoutObject::clearLayoutRootIfNeeded() const {
2525 if (FrameView* view = frameView()) { 2528 if (FrameView* view = frameView()) {
2526 if (!documentBeingDestroyed()) 2529 if (!documentBeingDestroyed())
2527 view->clearLayoutSubtreeRoot(*this); 2530 view->clearLayoutSubtreeRoot(*this);
2528 } 2531 }
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
2717 2720
2718 if (RuntimeEnabledFeatures::scrollAnchoringEnabled() && 2721 if (RuntimeEnabledFeatures::scrollAnchoringEnabled() &&
2719 m_bitfields.isScrollAnchorObject()) { 2722 m_bitfields.isScrollAnchorObject()) {
2720 // Clear the bit first so that anchor.clear() doesn't recurse into 2723 // Clear the bit first so that anchor.clear() doesn't recurse into
2721 // findReferencingScrollAnchors. 2724 // findReferencingScrollAnchors.
2722 m_bitfields.setIsScrollAnchorObject(false); 2725 m_bitfields.setIsScrollAnchorObject(false);
2723 findReferencingScrollAnchors(this, Clear); 2726 findReferencingScrollAnchors(this, Clear);
2724 } 2727 }
2725 } 2728 }
2726 2729
2730 void LayoutObject::setNeedsPaintPropertyUpdate() {
2731 m_bitfields.setNeedsPaintPropertyUpdate(true);
2732
2733 // Mark all ancestors as having a descendant needing paint property updates.
2734 // |paintInvalidationParent()| is used to ensure we continue marking across
2735 // frame boundaries.
2736 LayoutObject* ancestor = paintInvalidationParent();
2737 while (ancestor && !ancestor->descendantNeedsPaintPropertyUpdate()) {
2738 ancestor->m_bitfields.setDescendantNeedsPaintPropertyUpdate(true);
2739 ancestor = ancestor->paintInvalidationParent();
2740 }
2741 }
2742
2743 void LayoutObject::setAncestorsNeedPaintPropertyUpdateForMainThreadScrolling() {
2744 LayoutObject* ancestor = paintInvalidationParent();
2745 while (ancestor) {
2746 ancestor->setNeedsPaintPropertyUpdate();
2747 ancestor = ancestor->paintInvalidationParent();
2748 }
2749 }
2750
2727 void LayoutObject::maybeClearIsScrollAnchorObject() { 2751 void LayoutObject::maybeClearIsScrollAnchorObject() {
2728 if (!m_bitfields.isScrollAnchorObject()) 2752 if (!m_bitfields.isScrollAnchorObject())
2729 return; 2753 return;
2730 m_bitfields.setIsScrollAnchorObject( 2754 m_bitfields.setIsScrollAnchorObject(
2731 findReferencingScrollAnchors(this, DontClear)); 2755 findReferencingScrollAnchors(this, DontClear));
2732 } 2756 }
2733 2757
2734 void LayoutObject::removeFromLayoutFlowThread() { 2758 void LayoutObject::removeFromLayoutFlowThread() {
2735 if (!isInsideFlowThread()) 2759 if (!isInsideFlowThread())
2736 return; 2760 return;
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
3473 const blink::LayoutObject* root = object1; 3497 const blink::LayoutObject* root = object1;
3474 while (root->parent()) 3498 while (root->parent())
3475 root = root->parent(); 3499 root = root->parent();
3476 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3500 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3477 } else { 3501 } else {
3478 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); 3502 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)");
3479 } 3503 }
3480 } 3504 }
3481 3505
3482 #endif 3506 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698