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

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: 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 setShouldDoFullRepaintAfterLayout(true);
Julien - ping for review 2014/03/04 18:22:10 This is wrong :-/ It's OK to put a FIXME but this
dsinclair 2014/03/04 19:21:52 Done. Had to store another flag in this case so w
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 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
1593 } 1599 }
1594 return false; 1600 return false;
1595 } 1601 }
1596 1602
1597 void RenderObject::repaintOverflow() 1603 void RenderObject::repaintOverflow()
1598 { 1604 {
1599 } 1605 }
1600 1606
1601 bool RenderObject::checkForRepaint() const 1607 bool RenderObject::checkForRepaint() const
1602 { 1608 {
1609 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled())
1610 return !document().view()->needsFullRepaint() && everHadLayout();
Julien - ping for review 2014/03/04 18:22:10 FYI I think we shouldn't check everHadLayout() her
dsinclair 2014/03/04 19:21:52 Ack.
1611
1603 return !document().view()->needsFullRepaint() && !hasLayer() && everHadLayou t(); 1612 return !document().view()->needsFullRepaint() && !hasLayer() && everHadLayou t();
1604 } 1613 }
1605 1614
1606 bool RenderObject::checkForRepaintDuringLayout() const 1615 bool RenderObject::checkForRepaintDuringLayout() const
1607 { 1616 {
1608 return !RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && checkForRepai nt(); 1617 return !RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && checkForRepai nt();
1609 } 1618 }
1610 1619
1611 LayoutRect RenderObject::rectWithOutlineForRepaint(const RenderLayerModelObject* repaintContainer, LayoutUnit outlineWidth) const 1620 LayoutRect RenderObject::rectWithOutlineForRepaint(const RenderLayerModelObject* repaintContainer, LayoutUnit outlineWidth) const
1612 { 1621 {
(...skipping 1694 matching lines...) Expand 10 before | Expand all | Expand 10 after
3307 { 3316 {
3308 ASSERT_NOT_REACHED(); 3317 ASSERT_NOT_REACHED();
3309 return false; 3318 return false;
3310 } 3319 }
3311 3320
3312 bool RenderObject::isRelayoutBoundaryForInspector() const 3321 bool RenderObject::isRelayoutBoundaryForInspector() const
3313 { 3322 {
3314 return objectIsRelayoutBoundary(this); 3323 return objectIsRelayoutBoundary(this);
3315 } 3324 }
3316 3325
3326 const LayoutRect RenderObject::newOutlineRect()
3327 {
3328 ASSERT(hasOutline());
Julien - ping for review 2014/03/04 18:22:10 The outline rectangle includes the box shadow too
dsinclair 2014/03/04 19:21:52 So, then the shadow isn't included in the repaint
Julien - ping for review 2014/03/07 18:26:38 It is actually included in the repaint rect (see a
3329
3330 OutlineRects* outlineRects = view()->outlineRects();
3331 OutlineRects::iterator it = outlineRects->find(this);
3332 if (it == outlineRects->end())
3333 return outlineBoundsForRepaint(containerForRepaint());
3334 return it->value.newOutlineRect;
3335 }
3336
3337 void RenderObject::setNewOutlineRect(const LayoutRect& rect)
3338 {
3339 ASSERT(hasOutline());
3340
3341 OutlineRects* outlineRects = view()->outlineRects();
3342 OutlineRects::iterator it = outlineRects->find(this);
3343 if (it == outlineRects->end())
3344 outlineRects->set(this, OutlineRectInfo());
3345
3346 outlineRects->get(this).newOutlineRect = rect;
3347 }
3348
3349 const LayoutRect RenderObject::oldOutlineRect()
Julien - ping for review 2014/03/04 18:22:10 I don't see the point in making a copy of LayoutRe
dsinclair 2014/03/04 19:21:52 Done.
3350 {
3351 ASSERT(hasOutline());
3352
3353 OutlineRects* outlineRects = view()->outlineRects();
3354 OutlineRects::iterator it = outlineRects->find(this);
3355 if (it == outlineRects->end())
3356 return LayoutRect();
3357 return it->value.oldOutlineRect;
3358 }
3359
3360 void RenderObject::setOldOutlineRect(const LayoutRect& rect)
3361 {
3362 ASSERT(hasOutline());
3363
3364 OutlineRects* outlineRects = view()->outlineRects();
3365 OutlineRects::iterator it = outlineRects->find(this);
3366 if (it == outlineRects->end())
3367 outlineRects->set(this, OutlineRectInfo());
3368 outlineRects->get(this).oldOutlineRect = rect;
3369 }
3370
3371 void RenderObject::clearRepaintState()
3372 {
3373 setShouldDoFullRepaintAfterLayout(false);
3374 setShouldDoFullRepaintIfSelfPaintingLayer(false);
3375 setShouldRepaintOverflowIfNeeded(false);
3376 setLayoutDidGetCalled(false);
3377
3378 OutlineRects* outlineRects = view()->outlineRects();
3379 OutlineRects::iterator it = outlineRects->find(this);
3380 if (it != outlineRects->end())
3381 outlineRects->remove(it);
3382 }
3383
3317 } // namespace WebCore 3384 } // namespace WebCore
3318 3385
3319 #ifndef NDEBUG 3386 #ifndef NDEBUG
3320 3387
3321 void showTree(const WebCore::RenderObject* object) 3388 void showTree(const WebCore::RenderObject* object)
3322 { 3389 {
3323 if (object) 3390 if (object)
3324 object->showTreeForThis(); 3391 object->showTreeForThis();
3325 } 3392 }
3326 3393
(...skipping 12 matching lines...) Expand all
3339 { 3406 {
3340 if (object1) { 3407 if (object1) {
3341 const WebCore::RenderObject* root = object1; 3408 const WebCore::RenderObject* root = object1;
3342 while (root->parent()) 3409 while (root->parent())
3343 root = root->parent(); 3410 root = root->parent();
3344 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3411 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3345 } 3412 }
3346 } 3413 }
3347 3414
3348 #endif 3415 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698