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

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

Issue 335963002: Change LayoutState to be stack-allocated (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix push function to match old behavior... 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
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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 void RenderBox::layout() 314 void RenderBox::layout()
315 { 315 {
316 ASSERT(needsLayout()); 316 ASSERT(needsLayout());
317 317
318 RenderObject* child = slowFirstChild(); 318 RenderObject* child = slowFirstChild();
319 if (!child) { 319 if (!child) {
320 clearNeedsLayout(); 320 clearNeedsLayout();
321 return; 321 return;
322 } 322 }
323 323
324 LayoutStateMaintainer statePusher(*this, locationOffset()); 324 LayoutState state(*this, locationOffset());
325 while (child) { 325 while (child) {
326 child->layoutIfNeeded(); 326 child->layoutIfNeeded();
327 ASSERT(!child->needsLayout()); 327 ASSERT(!child->needsLayout());
328 child = child->nextSibling(); 328 child = child->nextSibling();
329 } 329 }
330 invalidateBackgroundObscurationStatus(); 330 invalidateBackgroundObscurationStatus();
331 clearNeedsLayout(); 331 clearNeedsLayout();
332 } 332 }
333 333
334 // More IE extensions. clientWidth and clientHeight represent the interior of a n object 334 // More IE extensions. clientWidth and clientHeight represent the interior of a n object
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(boundsRectForPaintInvalidation(&newPaintInv alidationContainer)); 1584 setPreviousPaintInvalidationRect(boundsRectForPaintInvalidation(&newPaintInv alidationContainer));
1585 setPreviousPositionFromPaintInvalidationContainer(positionFromPaintInvalidat ionContainer(&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 LayoutState state(*this, isTableRow() ? LayoutSize() : locationOffset()) ;
1592 RenderObject::invalidateTreeAfterLayout(newPaintInvalidationContainer); 1592 RenderObject::invalidateTreeAfterLayout(newPaintInvalidationContainer);
1593 return; 1593 return;
1594 } 1594 }
1595 1595
1596 if ((onlyNeededPositionedMovementLayout() && compositingState() != PaintsInt oOwnBacking) 1596 if ((onlyNeededPositionedMovementLayout() && compositingState() != PaintsInt oOwnBacking)
1597 || (shouldDoFullPaintInvalidationIfSelfPaintingLayer() 1597 || (shouldDoFullPaintInvalidationIfSelfPaintingLayer()
1598 && hasLayer() 1598 && hasLayer()
1599 && layer()->isSelfPaintingLayer())) { 1599 && layer()->isSelfPaintingLayer())) {
1600 setShouldDoFullPaintInvalidationAfterLayout(true); 1600 setShouldDoFullPaintInvalidationAfterLayout(true);
1601 } 1601 }
(...skipping 19 matching lines...) Expand all
1621 } 1621 }
1622 1622
1623 // FIXME: LayoutState should be enabled for other paint invalidation contain ers than the RenderView. crbug.com/363834 1623 // FIXME: LayoutState should be enabled for other paint invalidation contain ers than the RenderView. crbug.com/363834
1624 if (establishesNewPaintInvalidationContainer && !isRenderView()) { 1624 if (establishesNewPaintInvalidationContainer && !isRenderView()) {
1625 ForceHorriblySlowRectMapping slowRectMapping(*this); 1625 ForceHorriblySlowRectMapping slowRectMapping(*this);
1626 RenderObject::invalidateTreeAfterLayout(newPaintInvalidationContainer); 1626 RenderObject::invalidateTreeAfterLayout(newPaintInvalidationContainer);
1627 } else { 1627 } else {
1628 // FIXME: This concept of a tree walking state for fast lookups should b e generalized away from 1628 // FIXME: This concept of a tree walking state for fast lookups should b e generalized away from
1629 // just layout. 1629 // just layout.
1630 // FIXME: Table rows shouldn't be special-cased. 1630 // FIXME: Table rows shouldn't be special-cased.
1631 LayoutStateMaintainer statePusher(*this, isTableRow() ? LayoutSize() : l ocationOffset()); 1631 LayoutState state(*this, isTableRow() ? LayoutSize() : locationOffset()) ;
1632 RenderObject::invalidateTreeAfterLayout(newPaintInvalidationContainer); 1632 RenderObject::invalidateTreeAfterLayout(newPaintInvalidationContainer);
1633 } 1633 }
1634 } 1634 }
1635 1635
1636 bool RenderBox::pushContentsClip(PaintInfo& paintInfo, const LayoutPoint& accumu latedOffset, ContentsClipBehavior contentsClipBehavior) 1636 bool RenderBox::pushContentsClip(PaintInfo& paintInfo, const LayoutPoint& accumu latedOffset, ContentsClipBehavior contentsClipBehavior)
1637 { 1637 {
1638 if (paintInfo.phase == PaintPhaseBlockBackground || paintInfo.phase == Paint PhaseSelfOutline || paintInfo.phase == PaintPhaseMask) 1638 if (paintInfo.phase == PaintPhaseBlockBackground || paintInfo.phase == Paint PhaseSelfOutline || paintInfo.phase == PaintPhaseMask)
1639 return false; 1639 return false;
1640 1640
1641 bool isControlClip = hasControlClip(); 1641 bool isControlClip = hasControlClip();
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1810 // Use the content box logical height as specified by the style. 1810 // Use the content box logical height as specified by the style.
1811 return cb->adjustContentBoxLogicalHeightForBoxSizing(logicalHeightLength.val ue()); 1811 return cb->adjustContentBoxLogicalHeightForBoxSizing(logicalHeightLength.val ue());
1812 } 1812 }
1813 1813
1814 void RenderBox::mapLocalToContainer(const RenderLayerModelObject* repaintContain er, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed) co nst 1814 void RenderBox::mapLocalToContainer(const RenderLayerModelObject* repaintContain er, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed) co nst
1815 { 1815 {
1816 if (repaintContainer == this) 1816 if (repaintContainer == this)
1817 return; 1817 return;
1818 1818
1819 if (RenderView* v = view()) { 1819 if (RenderView* v = view()) {
1820 if (v->canUseLayoutStateForContainer(repaintContainer)) { 1820 if (v->canMapUsingLayoutStateForContainer(repaintContainer)) {
1821 LayoutState* layoutState = v->layoutState(); 1821 LayoutState* layoutState = v->layoutState();
1822 LayoutSize offset = layoutState->paintOffset() + locationOffset(); 1822 LayoutSize offset = layoutState->paintOffset() + locationOffset();
1823 if (style()->hasInFlowPosition() && layer()) 1823 if (style()->hasInFlowPosition() && layer())
1824 offset += layer()->offsetForInFlowPosition(); 1824 offset += layer()->offsetForInFlowPosition();
1825 transformState.move(offset); 1825 transformState.move(offset);
1826 return; 1826 return;
1827 } 1827 }
1828 } 1828 }
1829 1829
1830 bool containerSkipped; 1830 bool containerSkipped;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1863 } 1863 }
1864 1864
1865 mode &= ~ApplyContainerFlip; 1865 mode &= ~ApplyContainerFlip;
1866 1866
1867 o->mapLocalToContainer(repaintContainer, transformState, mode, wasFixed); 1867 o->mapLocalToContainer(repaintContainer, transformState, mode, wasFixed);
1868 } 1868 }
1869 1869
1870 void RenderBox::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, TransformState & transformState) const 1870 void RenderBox::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, TransformState & transformState) const
1871 { 1871 {
1872 // We don't expect to be called during layout. 1872 // We don't expect to be called during layout.
1873 ASSERT(!view() || !view()->layoutStateEnabled()); 1873 ASSERT(!view() || !view()->layoutStateCachedOffsetsEnabled());
1874 1874
1875 bool isFixedPos = style()->position() == FixedPosition; 1875 bool isFixedPos = style()->position() == FixedPosition;
1876 bool hasTransform = hasLayer() && layer()->transform(); 1876 bool hasTransform = hasLayer() && layer()->transform();
1877 if (hasTransform && !isFixedPos) { 1877 if (hasTransform && !isFixedPos) {
1878 // If this box has a transform, it acts as a fixed position container fo r fixed descendants, 1878 // If this box has a transform, it acts as a fixed position container fo r fixed descendants,
1879 // and may itself also be fixed position. So propagate 'fixed' up only i f this box is fixed position. 1879 // and may itself also be fixed position. So propagate 'fixed' up only i f this box is fixed position.
1880 mode &= ~IsFixed; 1880 mode &= ~IsFixed;
1881 } else if (isFixedPos) 1881 } else if (isFixedPos)
1882 mode |= IsFixed; 1882 mode |= IsFixed;
1883 1883
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 paintInvalidationContainer boundary. Therefore the final rect 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 paintInvalidationContainer. 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(paintInvalidationContainer) && styl eToUse->position() != FixedPosition) { 2023 if (v->canMapUsingLayoutStateForContainer(paintInvalidationContainer) && styleToUse->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());
(...skipping 2603 matching lines...) Expand 10 before | Expand all | Expand 10 after
4637 return 0; 4637 return 0;
4638 4638
4639 if (!layoutState && !flowThreadContainingBlock()) 4639 if (!layoutState && !flowThreadContainingBlock())
4640 return 0; 4640 return 0;
4641 4641
4642 RenderBlock* containerBlock = containingBlock(); 4642 RenderBlock* containerBlock = containingBlock();
4643 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); 4643 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop();
4644 } 4644 }
4645 4645
4646 } // namespace WebCore 4646 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698