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

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

Issue 2063543002: LayoutObject::paintInvalidationParent() to fix multicol spanner invalidation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: LayoutObject::paintInvalidationParent() to fix multicol spanner invalidation Created 4 years, 6 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 /* 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. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 597
598 return nullptr; 598 return nullptr;
599 } 599 }
600 600
601 PaintLayer* LayoutObject::enclosingLayer() const 601 PaintLayer* LayoutObject::enclosingLayer() const
602 { 602 {
603 for (const LayoutObject* current = this; current; current = current->parent( )) { 603 for (const LayoutObject* current = this; current; current = current->parent( )) {
604 if (current->hasLayer()) 604 if (current->hasLayer())
605 return toLayoutBoxModelObject(current)->layer(); 605 return toLayoutBoxModelObject(current)->layer();
606 } 606 }
607 // FIXME: we should get rid of detached layout subtrees, at which point this code should 607 // TODO(crbug.com/365897): we should get rid of detached layout subtrees, at which point this code should
608 // not be reached. crbug.com/411429 608 // not be reached.
609 return nullptr; 609 return nullptr;
610 } 610 }
611 611
612 PaintLayer* LayoutObject::paintingLayer() const 612 PaintLayer* LayoutObject::paintingLayer() const
613 { 613 {
614 for (const LayoutObject* current = this; current; current = current->isColum nSpanAll() ? current->containingBlock() : current->parent()) { 614 for (const LayoutObject* current = this; current; current = current->paintIn validationParent()) {
615 if (current->hasLayer() && toLayoutBoxModelObject(current)->layer()->isS elfPaintingLayer()) 615 if (current->hasLayer() && toLayoutBoxModelObject(current)->layer()->isS elfPaintingLayer())
616 return toLayoutBoxModelObject(current)->layer(); 616 return toLayoutBoxModelObject(current)->layer();
617 } 617 }
618 // TODO(crbug.com/365897): we should get rid of detached layout subtrees, at which point this code should
619 // not be reached.
618 return nullptr; 620 return nullptr;
619 } 621 }
620 622
621 bool LayoutObject::scrollRectToVisible(const LayoutRect& rect, const ScrollAlign ment& alignX, const ScrollAlignment& alignY, ScrollType scrollType, bool makeVis ibleInVisualViewport) 623 bool LayoutObject::scrollRectToVisible(const LayoutRect& rect, const ScrollAlign ment& alignX, const ScrollAlignment& alignY, ScrollType scrollType, bool makeVis ibleInVisualViewport)
622 { 624 {
623 LayoutBox* enclosingBox = this->enclosingBox(); 625 LayoutBox* enclosingBox = this->enclosingBox();
624 if (!enclosingBox) 626 if (!enclosingBox)
625 return false; 627 return false;
626 628
627 enclosingBox->scrollRectToVisible(rect, alignX, alignY, scrollType, makeVisi bleInVisualViewport); 629 enclosingBox->scrollRectToVisible(rect, alignX, alignY, scrollType, makeVisi bleInVisualViewport);
(...skipping 1980 matching lines...) Expand 10 before | Expand all | Expand 10 after
2608 if (filterOrReflectionSkipped && walker->hasFilterOrReflection() ) 2610 if (filterOrReflectionSkipped && walker->hasFilterOrReflection() )
2609 *filterOrReflectionSkipped = true; 2611 *filterOrReflectionSkipped = true;
2610 } 2612 }
2611 } 2613 }
2612 return multicolContainer; 2614 return multicolContainer;
2613 } 2615 }
2614 2616
2615 return o; 2617 return o;
2616 } 2618 }
2617 2619
2618 LayoutObject* LayoutObject::parentCrossingFrameBoundaries() const 2620 LayoutObject* LayoutObject::paintInvalidationParent() const
2619 { 2621 {
2620 return isLayoutView() ? frame()->ownerLayoutObject() : parent(); 2622 if (isLayoutView())
chrishtr 2016/06/13 19:49:39 Is it important for this method to not be virtual,
Xianzhu 2016/06/13 19:58:01 Not important, but just want to make the fact that
chrishtr 2016/06/13 20:09:33 It feels a little cleaner to go with virtual like
2623 return frame()->ownerLayoutObject();
2624 if (isColumnSpanAll())
2625 return spannerPlaceholder();
2626 return parent();
2621 } 2627 }
2622 2628
2623 bool LayoutObject::isSelectionBorder() const 2629 bool LayoutObject::isSelectionBorder() const
2624 { 2630 {
2625 SelectionState st = getSelectionState(); 2631 SelectionState st = getSelectionState();
2626 return st == SelectionStart || st == SelectionEnd || st == SelectionBoth; 2632 return st == SelectionStart || st == SelectionEnd || st == SelectionBoth;
2627 } 2633 }
2628 2634
2629 inline void LayoutObject::clearLayoutRootIfNeeded() const 2635 inline void LayoutObject::clearLayoutRootIfNeeded() const
2630 { 2636 {
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
3417 return PaintInvalidationForcedByLayout; 3423 return PaintInvalidationForcedByLayout;
3418 case DocumentLifecycle::InCompositingUpdate: 3424 case DocumentLifecycle::InCompositingUpdate:
3419 return PaintInvalidationCompositingUpdate; 3425 return PaintInvalidationCompositingUpdate;
3420 default: 3426 default:
3421 return PaintInvalidationFull; 3427 return PaintInvalidationFull;
3422 } 3428 }
3423 } 3429 }
3424 3430
3425 inline void LayoutObject::markAncestorsForPaintInvalidation() 3431 inline void LayoutObject::markAncestorsForPaintInvalidation()
3426 { 3432 {
3427 for (LayoutObject* parent = this->parentCrossingFrameBoundaries(); parent && !parent->shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState(); p arent = parent->parentCrossingFrameBoundaries()) 3433 for (LayoutObject* parent = this->paintInvalidationParent(); parent && !pare nt->shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState(); parent = parent->paintInvalidationParent())
3428 parent->m_bitfields.setChildShouldCheckForPaintInvalidation(true); 3434 parent->m_bitfields.setChildShouldCheckForPaintInvalidation(true);
3429 } 3435 }
3430 3436
3431 void LayoutObject::setShouldInvalidateSelection() 3437 void LayoutObject::setShouldInvalidateSelection()
3432 { 3438 {
3433 if (!canUpdateSelectionOnRootLineBoxes()) 3439 if (!canUpdateSelectionOnRootLineBoxes())
3434 return; 3440 return;
3435 m_bitfields.setShouldInvalidateSelection(true); 3441 m_bitfields.setShouldInvalidateSelection(true);
3436 markAncestorsForPaintInvalidation(); 3442 markAncestorsForPaintInvalidation();
3437 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded(); 3443 frameView()->scheduleVisualUpdateForPaintInvalidationIfNeeded();
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
3708 const blink::LayoutObject* root = object1; 3714 const blink::LayoutObject* root = object1;
3709 while (root->parent()) 3715 while (root->parent())
3710 root = root->parent(); 3716 root = root->parent();
3711 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3717 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3712 } else { 3718 } else {
3713 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3719 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3714 } 3720 }
3715 } 3721 }
3716 3722
3717 #endif 3723 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | third_party/WebKit/Source/core/layout/VisualRectMappingTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698