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

Side by Side Diff: Source/core/rendering/RenderObject.cpp

Issue 160903002: Move RenderLayer repainting to repaint-after-layout framework. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Rebase to master Created 6 years, 9 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 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 // A positioned object has no effect on the min/max width of its con taining block ever. 739 // A positioned object has no effect on the min/max width of its con taining block ever.
740 // We can optimize this case and not go up any further. 740 // We can optimize this case and not go up any further.
741 break; 741 break;
742 o = container; 742 o = container;
743 } 743 }
744 } 744 }
745 745
746 void RenderObject::setLayerNeedsFullRepaint() 746 void RenderObject::setLayerNeedsFullRepaint()
747 { 747 {
748 ASSERT(hasLayer()); 748 ASSERT(hasLayer());
749 toRenderLayerModelObject(this)->layer()->repainter().setRepaintStatus(NeedsF ullRepaint); 749 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled())
750 setShouldDoFullRepaintAfterLayout(true);
751 else
752 toRenderLayerModelObject(this)->layer()->repainter().setRepaintStatus(Ne edsFullRepaint);
750 } 753 }
751 754
752 void RenderObject::setLayerNeedsFullRepaintForPositionedMovementLayout() 755 void RenderObject::setLayerNeedsFullRepaintForPositionedMovementLayout()
753 { 756 {
754 ASSERT(hasLayer()); 757 ASSERT(hasLayer());
755 toRenderLayerModelObject(this)->layer()->repainter().setRepaintStatus(NeedsF ullRepaintForPositionedMovementLayout); 758 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled())
759 setShouldDoFullRepaintIfNotComposited(true);
760 else
761 toRenderLayerModelObject(this)->layer()->repainter().setRepaintStatus(Ne edsFullRepaintForPositionedMovementLayout);
756 } 762 }
757 763
758 RenderBlock* RenderObject::containerForFixedPosition(const RenderLayerModelObjec t* repaintContainer, bool* repaintContainerSkipped) const 764 RenderBlock* RenderObject::containerForFixedPosition(const RenderLayerModelObjec t* repaintContainer, bool* repaintContainerSkipped) const
759 { 765 {
760 ASSERT(!repaintContainerSkipped || !*repaintContainerSkipped); 766 ASSERT(!repaintContainerSkipped || !*repaintContainerSkipped);
761 ASSERT(!isText()); 767 ASSERT(!isText());
762 ASSERT(style()->position() == FixedPosition); 768 ASSERT(style()->position() == FixedPosition);
763 769
764 RenderObject* ancestor = parent(); 770 RenderObject* ancestor = parent();
765 for (; ancestor && !ancestor->canContainFixedPositionObjects(); ancestor = a ncestor->parent()) { 771 for (; ancestor && !ancestor->canContainFixedPositionObjects(); ancestor = a ncestor->parent()) {
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
1607 } 1613 }
1608 return false; 1614 return false;
1609 } 1615 }
1610 1616
1611 void RenderObject::repaintOverflow() 1617 void RenderObject::repaintOverflow()
1612 { 1618 {
1613 } 1619 }
1614 1620
1615 bool RenderObject::checkForRepaint() const 1621 bool RenderObject::checkForRepaint() const
1616 { 1622 {
1623 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled())
1624 return !document().view()->needsFullRepaint() && everHadLayout();
1625
1617 return !document().view()->needsFullRepaint() && !hasLayer() && everHadLayou t(); 1626 return !document().view()->needsFullRepaint() && !hasLayer() && everHadLayou t();
1618 } 1627 }
1619 1628
1620 bool RenderObject::checkForRepaintDuringLayout() const 1629 bool RenderObject::checkForRepaintDuringLayout() const
1621 { 1630 {
1622 return !RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && checkForRepai nt(); 1631 return !RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && checkForRepai nt();
1623 } 1632 }
1624 1633
1625 LayoutRect RenderObject::rectWithOutlineForRepaint(const RenderLayerModelObject* repaintContainer, LayoutUnit outlineWidth) const 1634 LayoutRect RenderObject::rectWithOutlineForRepaint(const RenderLayerModelObject* repaintContainer, LayoutUnit outlineWidth) const
1626 { 1635 {
(...skipping 1694 matching lines...) Expand 10 before | Expand all | Expand 10 after
3321 { 3330 {
3322 ASSERT_NOT_REACHED(); 3331 ASSERT_NOT_REACHED();
3323 return false; 3332 return false;
3324 } 3333 }
3325 3334
3326 bool RenderObject::isRelayoutBoundaryForInspector() const 3335 bool RenderObject::isRelayoutBoundaryForInspector() const
3327 { 3336 {
3328 return objectIsRelayoutBoundary(this); 3337 return objectIsRelayoutBoundary(this);
3329 } 3338 }
3330 3339
3340 LayoutRect RenderObject::newOutlineRect()
3341 {
3342 ASSERT(hasOutline());
3343
3344 OutlineRects& outlineRects = view()->outlineRects();
3345 OutlineRects::iterator it = outlineRects.find(this);
3346 if (it == outlineRects.end())
3347 return outlineBoundsForRepaint(containerForRepaint());
3348 return it->value->newOutlineRect;
3349 }
3350
3351 void RenderObject::setNewOutlineRect(const LayoutRect& rect)
3352 {
3353 ASSERT(hasOutline());
3354
3355 OutlineRects& outlineRects = view()->outlineRects();
3356 OutlineRects::iterator it = outlineRects.find(this);
3357 if (it == outlineRects.end())
3358 outlineRects.set(this, adoptPtr(new OutlineRectInfo()));
3359
3360 outlineRects.get(this)->newOutlineRect = rect;
3361 }
3362
3363 LayoutRect RenderObject::oldOutlineRect()
3364 {
3365 ASSERT(hasOutline());
3366
3367 OutlineRects& outlineRects = view()->outlineRects();
3368 OutlineRects::iterator it = outlineRects.find(this);
3369 if (it == outlineRects.end())
3370 return LayoutRect();
3371 return it->value->oldOutlineRect;
3372 }
3373
3374 void RenderObject::setOldOutlineRect(const LayoutRect& rect)
3375 {
3376 ASSERT(hasOutline());
3377
3378 OutlineRects& outlineRects = view()->outlineRects();
3379 OutlineRects::iterator it = outlineRects.find(this);
3380 if (it == outlineRects.end())
3381 outlineRects.set(this, adoptPtr(new OutlineRectInfo()));
3382 outlineRects.get(this)->oldOutlineRect = rect;
3383 }
3384
3385 void RenderObject::clearRepaintState()
3386 {
3387 setShouldDoFullRepaintAfterLayout(false);
3388 setShouldDoFullRepaintIfSelfPaintingLayer(false);
3389 setShouldRepaintOverflowIfNeeded(false);
3390 setLayoutDidGetCalled(false);
3391
3392 OutlineRects& outlineRects = view()->outlineRects();
3393 OutlineRects::iterator it = outlineRects.find(this);
3394 if (it != outlineRects.end())
3395 outlineRects.remove(it);
3396 }
3397
3331 } // namespace WebCore 3398 } // namespace WebCore
3332 3399
3333 #ifndef NDEBUG 3400 #ifndef NDEBUG
3334 3401
3335 void showTree(const WebCore::RenderObject* object) 3402 void showTree(const WebCore::RenderObject* object)
3336 { 3403 {
3337 if (object) 3404 if (object)
3338 object->showTreeForThis(); 3405 object->showTreeForThis();
3339 } 3406 }
3340 3407
(...skipping 12 matching lines...) Expand all
3353 { 3420 {
3354 if (object1) { 3421 if (object1) {
3355 const WebCore::RenderObject* root = object1; 3422 const WebCore::RenderObject* root = object1;
3356 while (root->parent()) 3423 while (root->parent())
3357 root = root->parent(); 3424 root = root->parent();
3358 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3425 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3359 } 3426 }
3360 } 3427 }
3361 3428
3362 #endif 3429 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698