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

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

Issue 332543002: Rename Repaint to Paint Invalidation Part 4 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderBox.h ('k') | Source/core/rendering/RenderCounter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after
1567 // FIXME: We should still be recursing through inline's children, as they ca n have boxes, but we don't 1567 // FIXME: We should still be recursing through inline's children, as they ca n have boxes, but we don't
1568 // appear to have tests for this? 1568 // appear to have tests for this?
1569 // FIXME: SVG should probably also go through this unified paint invalidatio n system. 1569 // FIXME: SVG should probably also go through this unified paint invalidatio n system.
1570 1570
1571 ASSERT(RuntimeEnabledFeatures::repaintAfterLayoutEnabled()); 1571 ASSERT(RuntimeEnabledFeatures::repaintAfterLayoutEnabled());
1572 ASSERT(!needsLayout()); 1572 ASSERT(!needsLayout());
1573 1573
1574 if (!shouldCheckForPaintInvalidationAfterLayout()) 1574 if (!shouldCheckForPaintInvalidationAfterLayout())
1575 return; 1575 return;
1576 1576
1577 bool establishesNewPaintInvalidationContainer = isRepaintContainer(); 1577 bool establishesNewPaintInvalidationContainer = isPaintInvalidationContainer ();
1578 const RenderLayerModelObject& newPaintInvalidationContainer = *adjustComposi tedContainerForSpecialAncestors(establishesNewPaintInvalidationContainer ? this : &paintInvalidationContainer); 1578 const RenderLayerModelObject& newPaintInvalidationContainer = *adjustComposi tedContainerForSpecialAncestors(establishesNewPaintInvalidationContainer ? this : &paintInvalidationContainer);
1579 // FIXME: This assert should be re-enabled when we move paint invalidation t o after compositing update. crbug.com/360286 1579 // FIXME: This assert should be re-enabled when we move paint invalidation t o after compositing update. crbug.com/360286
1580 // ASSERT(&newPaintInvalidationContainer == containerForRepaint()); 1580 // ASSERT(&newPaintInvalidationContainer == containerForPaintInvalidation()) ;
1581 1581
1582 const LayoutRect oldPaintInvalidationRect = previousPaintInvalidationRect(); 1582 const LayoutRect oldPaintInvalidationRect = previousPaintInvalidationRect();
1583 const LayoutPoint oldPositionFromPaintInvalidationContainer = previousPositi onFromPaintInvalidationContainer(); 1583 const LayoutPoint oldPositionFromPaintInvalidationContainer = previousPositi onFromPaintInvalidationContainer();
1584 setPreviousPaintInvalidationRect(boundsRectForRepaint(&newPaintInvalidationC ontainer)); 1584 setPreviousPaintInvalidationRect(boundsRectForPaintInvalidation(&newPaintInv alidationContainer));
1585 setPreviousPositionFromPaintInvalidationContainer(positionFromRepaintContain er(&newPaintInvalidationContainer)); 1585 setPreviousPositionFromPaintInvalidationContainer(positionFromPaintInvalidat ionContainer(&newPaintInvalidationContainer));
1586 1586
1587 // If we are set to do a full paint invalidation that means the RenderView w ill be 1587 // If we are set to do a full paint invalidation that means the RenderView w ill be
1588 // issue paint invalidations. We can then skip issuing of paint invalidation s for the child 1588 // issue paint invalidations. We can then skip issuing of paint invalidation s for the child
1589 // renderers as they'll be covered by the RenderView. 1589 // renderers as they'll be covered by the RenderView.
1590 if (view()->doingFullRepaint()) { 1590 if (view()->doingFullRepaint()) {
1591 LayoutStateMaintainer statePusher(*this, isTableRow() ? LayoutSize() : l ocationOffset()); 1591 LayoutStateMaintainer statePusher(*this, isTableRow() ? LayoutSize() : l ocationOffset());
1592 RenderObject::invalidateTreeAfterLayout(newPaintInvalidationContainer); 1592 RenderObject::invalidateTreeAfterLayout(newPaintInvalidationContainer);
1593 return; 1593 return;
1594 } 1594 }
1595 1595
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
1982 { 1982 {
1983 if (inlineBoxWrapper()) { 1983 if (inlineBoxWrapper()) {
1984 if (!documentBeingDestroyed()) 1984 if (!documentBeingDestroyed())
1985 inlineBoxWrapper()->remove(); 1985 inlineBoxWrapper()->remove();
1986 inlineBoxWrapper()->destroy(); 1986 inlineBoxWrapper()->destroy();
1987 ASSERT(m_rareData); 1987 ASSERT(m_rareData);
1988 m_rareData->m_inlineBoxWrapper = 0; 1988 m_rareData->m_inlineBoxWrapper = 0;
1989 } 1989 }
1990 } 1990 }
1991 1991
1992 LayoutRect RenderBox::clippedOverflowRectForRepaint(const RenderLayerModelObject * repaintContainer) const 1992 LayoutRect RenderBox::clippedOverflowRectForPaintInvalidation(const RenderLayerM odelObject* paintInvalidationContainer) const
1993 { 1993 {
1994 if (style()->visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent ()) 1994 if (style()->visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent ())
1995 return LayoutRect(); 1995 return LayoutRect();
1996 1996
1997 LayoutRect r = visualOverflowRect(); 1997 LayoutRect r = visualOverflowRect();
1998 1998
1999 RenderView* v = view(); 1999 RenderView* v = view();
2000 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && v) { 2000 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && v) {
2001 // FIXME: layoutDelta needs to be applied in parts before/after transfor ms and 2001 // FIXME: layoutDelta needs to be applied in parts before/after transfor ms and
2002 // repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308 2002 // repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308
2003 r.move(v->layoutDelta()); 2003 r.move(v->layoutDelta());
2004 } 2004 }
2005 2005
2006 mapRectToRepaintBacking(repaintContainer, r); 2006 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r);
2007 return r; 2007 return r;
2008 } 2008 }
2009 2009
2010 void RenderBox::mapRectToRepaintBacking(const RenderLayerModelObject* repaintCon tainer, LayoutRect& rect, bool fixed) const 2010 void RenderBox::mapRectToPaintInvalidationBacking(const RenderLayerModelObject* paintInvalidationContainer, LayoutRect& rect, bool fixed) const
2011 { 2011 {
2012 // The rect we compute at each step is shifted by our x/y offset in the pare nt container's coordinate space. 2012 // The rect we compute at each step is shifted by our x/y offset in the pare nt container's coordinate space.
2013 // Only when we cross a writing mode boundary will we have to possibly flipF orWritingMode (to convert into a more appropriate 2013 // Only when we cross a writing mode boundary will we have to possibly flipF orWritingMode (to convert into a more appropriate
2014 // offset corner for the enclosing container). This allows for a fully RL o r BT document to repaint 2014 // offset corner for the enclosing container). This allows for a fully RL o r BT document to repaint
2015 // properly even during layout, since the rect remains flipped all the way u ntil the end. 2015 // properly even during layout, since the rect remains flipped all the way u ntil the end.
2016 // 2016 //
2017 // RenderView::computeRectForRepaint then converts the rect to physical coor dinates. We also convert to 2017 // RenderView::computeRectForRepaint then converts the rect to physical coor dinates. We also convert to
2018 // physical when we hit a repaintContainer boundary. Therefore the final re ct returned is always in the 2018 // physical when we hit a paintInvalidationContainer boundary. Therefore the final rect returned is always in the
2019 // physical coordinate space of the repaintContainer. 2019 // physical coordinate space of the paintInvalidationContainer.
2020 RenderStyle* styleToUse = style(); 2020 RenderStyle* styleToUse = style();
2021 if (RenderView* v = view()) { 2021 if (RenderView* v = view()) {
2022 // LayoutState is only valid for root-relative, non-fixed position repai nting 2022 // LayoutState is only valid for root-relative, non-fixed position repai nting
2023 if (v->canUseLayoutStateForContainer(repaintContainer) && styleToUse->po sition() != FixedPosition) { 2023 if (v->canUseLayoutStateForContainer(paintInvalidationContainer) && styl eToUse->position() != FixedPosition) {
2024 LayoutState* layoutState = v->layoutState(); 2024 LayoutState* layoutState = v->layoutState();
2025 2025
2026 if (layer() && layer()->transform()) 2026 if (layer() && layer()->transform())
2027 rect = layer()->transform()->mapRect(pixelSnappedIntRect(rect)); 2027 rect = layer()->transform()->mapRect(pixelSnappedIntRect(rect));
2028 2028
2029 // We can't trust the bits on RenderObject, because this might be ca lled while re-resolving style. 2029 // We can't trust the bits on RenderObject, because this might be ca lled while re-resolving style.
2030 if (styleToUse->hasInFlowPosition() && layer()) 2030 if (styleToUse->hasInFlowPosition() && layer())
2031 rect.move(layer()->offsetForInFlowPosition()); 2031 rect.move(layer()->offsetForInFlowPosition());
2032 2032
2033 rect.moveBy(location()); 2033 rect.moveBy(location());
2034 rect.move(layoutState->paintOffset()); 2034 rect.move(layoutState->paintOffset());
2035 if (layoutState->isClipped()) 2035 if (layoutState->isClipped())
2036 rect.intersect(layoutState->clipRect()); 2036 rect.intersect(layoutState->clipRect());
2037 return; 2037 return;
2038 } 2038 }
2039 } 2039 }
2040 2040
2041 if (hasReflection()) 2041 if (hasReflection())
2042 rect.unite(reflectedRect(rect)); 2042 rect.unite(reflectedRect(rect));
2043 2043
2044 if (repaintContainer == this) { 2044 if (paintInvalidationContainer == this) {
2045 if (repaintContainer->style()->isFlippedBlocksWritingMode()) 2045 if (paintInvalidationContainer->style()->isFlippedBlocksWritingMode())
2046 flipForWritingMode(rect); 2046 flipForWritingMode(rect);
2047 return; 2047 return;
2048 } 2048 }
2049 2049
2050 bool containerSkipped; 2050 bool containerSkipped;
2051 RenderObject* o = container(repaintContainer, &containerSkipped); 2051 RenderObject* o = container(paintInvalidationContainer, &containerSkipped);
2052 if (!o) 2052 if (!o)
2053 return; 2053 return;
2054 2054
2055 if (isWritingModeRoot() && !isOutOfFlowPositioned()) 2055 if (isWritingModeRoot() && !isOutOfFlowPositioned())
2056 flipForWritingMode(rect); 2056 flipForWritingMode(rect);
2057 2057
2058 LayoutPoint topLeft = rect.location(); 2058 LayoutPoint topLeft = rect.location();
2059 topLeft.move(locationOffset()); 2059 topLeft.move(locationOffset());
2060 2060
2061 EPosition position = styleToUse->position(); 2061 EPosition position = styleToUse->position();
(...skipping 29 matching lines...) Expand all
2091 // its controlClipRect will be wrong. For overflow clip we use the values ca ched by the layer. 2091 // its controlClipRect will be wrong. For overflow clip we use the values ca ched by the layer.
2092 rect.setLocation(topLeft); 2092 rect.setLocation(topLeft);
2093 if (o->hasOverflowClip()) { 2093 if (o->hasOverflowClip()) {
2094 RenderBox* containerBox = toRenderBox(o); 2094 RenderBox* containerBox = toRenderBox(o);
2095 containerBox->applyCachedClipAndScrollOffsetForRepaint(rect); 2095 containerBox->applyCachedClipAndScrollOffsetForRepaint(rect);
2096 if (rect.isEmpty()) 2096 if (rect.isEmpty())
2097 return; 2097 return;
2098 } 2098 }
2099 2099
2100 if (containerSkipped) { 2100 if (containerSkipped) {
2101 // If the repaintContainer is below o, then we need to map the rect into repaintContainer's coordinates. 2101 // If the paintInvalidationContainer is below o, then we need to map the rect into paintInvalidationContainer's coordinates.
2102 LayoutSize containerOffset = repaintContainer->offsetFromAncestorContain er(o); 2102 LayoutSize containerOffset = paintInvalidationContainer->offsetFromAnces torContainer(o);
2103 rect.move(-containerOffset); 2103 rect.move(-containerOffset);
2104 return; 2104 return;
2105 } 2105 }
2106 2106
2107 o->mapRectToRepaintBacking(repaintContainer, rect, fixed); 2107 o->mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, fixed );
2108 } 2108 }
2109 2109
2110 void RenderBox::repaintDuringLayoutIfMoved(const LayoutRect& oldRect) 2110 void RenderBox::repaintDuringLayoutIfMoved(const LayoutRect& oldRect)
2111 { 2111 {
2112 if (oldRect.location() != m_frameRect.location()) { 2112 if (oldRect.location() != m_frameRect.location()) {
2113 LayoutRect newRect = m_frameRect; 2113 LayoutRect newRect = m_frameRect;
2114 // The child moved. Invalidate the object's old and new positions. We have to do this 2114 // The child moved. Invalidate the object's old and new positions. We have to do this
2115 // since the object may not have gotten a layout. 2115 // since the object may not have gotten a layout.
2116 m_frameRect = oldRect; 2116 m_frameRect = oldRect;
2117 paintInvalidationForWholeRenderer(); 2117 paintInvalidationForWholeRenderer();
(...skipping 2514 matching lines...) Expand 10 before | Expand all | Expand 10 after
4632 { 4632 {
4633 // FIXME: The table code should handle that automatically. If not, 4633 // FIXME: The table code should handle that automatically. If not,
4634 // we should fix it and remove the table part checks. 4634 // we should fix it and remove the table part checks.
4635 if (box->isTable()) { 4635 if (box->isTable()) {
4636 // Because we may have added some sections with already computed column structures, we need to 4636 // Because we may have added some sections with already computed column structures, we need to
4637 // sync the table structure with them now. This avoids crashes when addi ng new cells to the table. 4637 // sync the table structure with them now. This avoids crashes when addi ng new cells to the table.
4638 toRenderTable(box)->forceSectionsRecalc(); 4638 toRenderTable(box)->forceSectionsRecalc();
4639 } else if (box->isTableSection()) 4639 } else if (box->isTableSection())
4640 toRenderTableSection(box)->setNeedsCellRecalc(); 4640 toRenderTableSection(box)->setNeedsCellRecalc();
4641 4641
4642 box->setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); 4642 box->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation();
4643 } 4643 }
4644 4644
4645 RenderObject* RenderBox::splitAnonymousBoxesAroundChild(RenderObject* beforeChil d) 4645 RenderObject* RenderBox::splitAnonymousBoxesAroundChild(RenderObject* beforeChil d)
4646 { 4646 {
4647 bool didSplitParentAnonymousBoxes = false; 4647 bool didSplitParentAnonymousBoxes = false;
4648 4648
4649 while (beforeChild->parent() != this) { 4649 while (beforeChild->parent() != this) {
4650 RenderBox* boxToSplit = toRenderBox(beforeChild->parent()); 4650 RenderBox* boxToSplit = toRenderBox(beforeChild->parent());
4651 if (boxToSplit->slowFirstChild() != beforeChild && boxToSplit->isAnonymo us()) { 4651 if (boxToSplit->slowFirstChild() != beforeChild && boxToSplit->isAnonymo us()) {
4652 didSplitParentAnonymousBoxes = true; 4652 didSplitParentAnonymousBoxes = true;
4653 4653
4654 // We have to split the parent box into two boxes and move children 4654 // We have to split the parent box into two boxes and move children
4655 // from |beforeChild| to end into the new post box. 4655 // from |beforeChild| to end into the new post box.
4656 RenderBox* postBox = boxToSplit->createAnonymousBoxWithSameTypeAs(th is); 4656 RenderBox* postBox = boxToSplit->createAnonymousBoxWithSameTypeAs(th is);
4657 postBox->setChildrenInline(boxToSplit->childrenInline()); 4657 postBox->setChildrenInline(boxToSplit->childrenInline());
4658 RenderBox* parentBox = toRenderBox(boxToSplit->parent()); 4658 RenderBox* parentBox = toRenderBox(boxToSplit->parent());
4659 // We need to invalidate the |parentBox| before inserting the new no de 4659 // We need to invalidate the |parentBox| before inserting the new no de
4660 // so that the table repainting logic knows the structure is dirty. 4660 // so that the table repainting logic knows the structure is dirty.
4661 // See for example RenderTableCell:clippedOverflowRectForRepaint. 4661 // See for example RenderTableCell:clippedOverflowRectForPaintInvali dation.
4662 markBoxForRelayoutAfterSplit(parentBox); 4662 markBoxForRelayoutAfterSplit(parentBox);
4663 parentBox->virtualChildren()->insertChildNode(parentBox, postBox, bo xToSplit->nextSibling()); 4663 parentBox->virtualChildren()->insertChildNode(parentBox, postBox, bo xToSplit->nextSibling());
4664 boxToSplit->moveChildrenTo(postBox, beforeChild, 0, true); 4664 boxToSplit->moveChildrenTo(postBox, beforeChild, 0, true);
4665 4665
4666 markBoxForRelayoutAfterSplit(boxToSplit); 4666 markBoxForRelayoutAfterSplit(boxToSplit);
4667 markBoxForRelayoutAfterSplit(postBox); 4667 markBoxForRelayoutAfterSplit(postBox);
4668 4668
4669 beforeChild = postBox; 4669 beforeChild = postBox;
4670 } else 4670 } else
4671 beforeChild = boxToSplit; 4671 beforeChild = boxToSplit;
(...skipping 13 matching lines...) Expand all
4685 return 0; 4685 return 0;
4686 4686
4687 if (!layoutState && !flowThreadContainingBlock()) 4687 if (!layoutState && !flowThreadContainingBlock())
4688 return 0; 4688 return 0;
4689 4689
4690 RenderBlock* containerBlock = containingBlock(); 4690 RenderBlock* containerBlock = containingBlock();
4691 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); 4691 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop();
4692 } 4692 }
4693 4693
4694 } // namespace WebCore 4694 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBox.h ('k') | Source/core/rendering/RenderCounter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698