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

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

Issue 192863004: Use outlineBox if we have an outline (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed Mac test (neutral change => same amount of invalidation but in one instead of 2) 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderBlock.h ('k') | Source/core/rendering/RenderBlockFlow.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) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 1645 matching lines...) Expand 10 before | Expand all | Expand 10 after
1656 if (isRenderFlowThread()) 1656 if (isRenderFlowThread())
1657 toRenderFlowThread(this)->applyBreakAfterContent(clientLogicalBottom()); 1657 toRenderFlowThread(this)->applyBreakAfterContent(clientLogicalBottom());
1658 1658
1659 // Lay out our positioned objects if our positioned child bit is set. 1659 // Lay out our positioned objects if our positioned child bit is set.
1660 // Also, if an absolute position element inside a relative positioned contai ner moves, and the absolute element has a fixed position 1660 // Also, if an absolute position element inside a relative positioned contai ner moves, and the absolute element has a fixed position
1661 // child, neither the fixed element nor its container learn of the movement since posChildNeedsLayout() is only marked as far as the 1661 // child, neither the fixed element nor its container learn of the movement since posChildNeedsLayout() is only marked as far as the
1662 // relative positioned container. So if we can have fixed pos objects in our positioned objects list check if any of them 1662 // relative positioned container. So if we can have fixed pos objects in our positioned objects list check if any of them
1663 // are statically positioned and thus need to move with their absolute ances tors. 1663 // are statically positioned and thus need to move with their absolute ances tors.
1664 bool canContainFixedPosObjects = canContainFixedPositionObjects(); 1664 bool canContainFixedPosObjects = canContainFixedPositionObjects();
1665 if (posChildNeedsLayout() || canContainFixedPosObjects) 1665 if (posChildNeedsLayout() || canContainFixedPosObjects)
1666 layoutPositionedObjects(false, !posChildNeedsLayout() && canContainFixed PosObjects); 1666 layoutPositionedObjects(false, !posChildNeedsLayout() && canContainFixed PosObjects ? LayoutOnlyFixedPositionedObjects : DefaultLayout);
1667 1667
1668 // Recompute our overflow information. 1668 // Recompute our overflow information.
1669 // FIXME: We could do better here by computing a temporary overflow object f rom layoutPositionedObjects and only 1669 // FIXME: We could do better here by computing a temporary overflow object f rom layoutPositionedObjects and only
1670 // updating our overflow if we either used to have overflow or if the new te mporary object has overflow. 1670 // updating our overflow if we either used to have overflow or if the new te mporary object has overflow.
1671 // For now just always recompute overflow. This is no worse performance-wis e than the old code that called rightmostPosition and 1671 // For now just always recompute overflow. This is no worse performance-wis e than the old code that called rightmostPosition and
1672 // lowestPosition on every relayout so it's not a regression. 1672 // lowestPosition on every relayout so it's not a regression.
1673 // computeOverflow expects the bottom edge before we clamp our height. Since this information isn't available during 1673 // computeOverflow expects the bottom edge before we clamp our height. Since this information isn't available during
1674 // simplifiedLayout, we cache the value in m_overflow. 1674 // simplifiedLayout, we cache the value in m_overflow.
1675 LayoutUnit oldClientAfterEdge = hasRenderOverflow() ? m_overflow->layoutClie ntAfterEdge() : clientLogicalBottom(); 1675 LayoutUnit oldClientAfterEdge = hasRenderOverflow() ? m_overflow->layoutClie ntAfterEdge() : clientLogicalBottom();
1676 computeOverflow(oldClientAfterEdge, true); 1676 computeOverflow(oldClientAfterEdge, true);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1724 Length marginLeft = child->style()->marginStartUsing(style()); 1724 Length marginLeft = child->style()->marginStartUsing(style());
1725 Length marginRight = child->style()->marginEndUsing(style()); 1725 Length marginRight = child->style()->marginEndUsing(style());
1726 LayoutUnit margin = 0; 1726 LayoutUnit margin = 0;
1727 if (marginLeft.isFixed()) 1727 if (marginLeft.isFixed())
1728 margin += marginLeft.value(); 1728 margin += marginLeft.value();
1729 if (marginRight.isFixed()) 1729 if (marginRight.isFixed())
1730 margin += marginRight.value(); 1730 margin += marginRight.value();
1731 return margin; 1731 return margin;
1732 } 1732 }
1733 1733
1734 void RenderBlock::layoutPositionedObjects(bool relayoutChildren, bool fixedPosit ionObjectsOnly) 1734 void RenderBlock::layoutPositionedObjects(bool relayoutChildren, PositionedLayou tBehavior info)
1735 { 1735 {
1736 TrackedRendererListHashSet* positionedDescendants = positionedObjects(); 1736 TrackedRendererListHashSet* positionedDescendants = positionedObjects();
1737 if (!positionedDescendants) 1737 if (!positionedDescendants)
1738 return; 1738 return;
1739 1739
1740 if (hasColumns()) 1740 if (hasColumns())
1741 view()->layoutState()->clearPaginationInformation(); // Positioned objec ts are not part of the column flow, so they don't paginate with the columns. 1741 view()->layoutState()->clearPaginationInformation(); // Positioned objec ts are not part of the column flow, so they don't paginate with the columns.
1742 1742
1743 RenderBox* r; 1743 RenderBox* r;
1744 TrackedRendererListHashSet::iterator end = positionedDescendants->end(); 1744 TrackedRendererListHashSet::iterator end = positionedDescendants->end();
1745 for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin( ); it != end; ++it) { 1745 for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin( ); it != end; ++it) {
1746 r = *it; 1746 r = *it;
1747 1747
1748 SubtreeLayoutScope layoutScope(r); 1748 SubtreeLayoutScope layoutScope(r);
1749 // A fixed position element with an absolute positioned ancestor has no way of knowing if the latter has changed position. So 1749 // A fixed position element with an absolute positioned ancestor has no way of knowing if the latter has changed position. So
1750 // if this is a fixed position element, mark it for layout if it has an abspos ancestor and needs to move with that ancestor, i.e. 1750 // if this is a fixed position element, mark it for layout if it has an abspos ancestor and needs to move with that ancestor, i.e.
1751 // it has static position. 1751 // it has static position.
1752 markFixedPositionObjectForLayoutIfNeeded(r, layoutScope); 1752 markFixedPositionObjectForLayoutIfNeeded(r, layoutScope);
1753 if (fixedPositionObjectsOnly) { 1753 if (info == LayoutOnlyFixedPositionedObjects) {
1754 r->layoutIfNeeded(); 1754 r->layoutIfNeeded();
1755 continue; 1755 continue;
1756 } 1756 }
1757 1757
1758 // When a non-positioned block element moves, it may have positioned chi ldren that are implicitly positioned relative to the 1758 // When a non-positioned block element moves, it may have positioned chi ldren that are implicitly positioned relative to the
1759 // non-positioned block. Rather than trying to detect all of these move ment cases, we just always lay out positioned 1759 // non-positioned block. Rather than trying to detect all of these move ment cases, we just always lay out positioned
1760 // objects that are positioned implicitly like this. Such objects are r are, and so in typical DHTML menu usage (where everything is 1760 // objects that are positioned implicitly like this. Such objects are r are, and so in typical DHTML menu usage (where everything is
1761 // positioned explicitly) this should not incur a performance penalty. 1761 // positioned explicitly) this should not incur a performance penalty.
1762 if (relayoutChildren || (r->style()->hasStaticBlockPosition(isHorizontal WritingMode()) && r->parent() != this)) 1762 if (relayoutChildren || (r->style()->hasStaticBlockPosition(isHorizontal WritingMode()) && r->parent() != this))
1763 layoutScope.setChildNeedsLayout(r); 1763 layoutScope.setChildNeedsLayout(r);
(...skipping 15 matching lines...) Expand all
1779 LayoutUnit oldLogicalTop = 0; 1779 LayoutUnit oldLogicalTop = 0;
1780 bool needsBlockDirectionLocationSetBeforeLayout = r->needsLayout() && vi ew()->layoutState()->needsBlockDirectionLocationSetBeforeLayout(); 1780 bool needsBlockDirectionLocationSetBeforeLayout = r->needsLayout() && vi ew()->layoutState()->needsBlockDirectionLocationSetBeforeLayout();
1781 if (needsBlockDirectionLocationSetBeforeLayout) { 1781 if (needsBlockDirectionLocationSetBeforeLayout) {
1782 if (isHorizontalWritingMode() == r->isHorizontalWritingMode()) 1782 if (isHorizontalWritingMode() == r->isHorizontalWritingMode())
1783 r->updateLogicalHeight(); 1783 r->updateLogicalHeight();
1784 else 1784 else
1785 r->updateLogicalWidth(); 1785 r->updateLogicalWidth();
1786 oldLogicalTop = logicalTopForChild(r); 1786 oldLogicalTop = logicalTopForChild(r);
1787 } 1787 }
1788 1788
1789 // FIXME: We should be able to do a r->setNeedsPositionedMovementLayout( ) here instead of a full layout. Need
1790 // to investigate why it does not trigger the correct invalidations in t hat case. crbug.com/350756
1791 if (info == ForcedLayoutAfterContainingBlockMoved)
1792 r->setNeedsLayout();
1793
1789 r->layoutIfNeeded(); 1794 r->layoutIfNeeded();
1790 1795
1791 // Lay out again if our estimate was wrong. 1796 // Lay out again if our estimate was wrong.
1792 if (needsBlockDirectionLocationSetBeforeLayout && logicalTopForChild(r) != oldLogicalTop) 1797 if (needsBlockDirectionLocationSetBeforeLayout && logicalTopForChild(r) != oldLogicalTop)
1793 r->forceChildLayout(); 1798 r->forceChildLayout();
1794 } 1799 }
1795 1800
1796 if (hasColumns()) 1801 if (hasColumns())
1797 view()->layoutState()->m_columnInfo = columnInfo(); // FIXME: Kind of gr oss. We just put this back into the layout state so that pop() will work. 1802 view()->layoutState()->m_columnInfo = columnInfo(); // FIXME: Kind of gr oss. We just put this back into the layout state so that pop() will work.
1798 } 1803 }
(...skipping 3220 matching lines...) Expand 10 before | Expand all | Expand 10 after
5019 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 5024 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
5020 { 5025 {
5021 showRenderObject(); 5026 showRenderObject();
5022 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 5027 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
5023 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 5028 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
5024 } 5029 }
5025 5030
5026 #endif 5031 #endif
5027 5032
5028 } // namespace WebCore 5033 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBlock.h ('k') | Source/core/rendering/RenderBlockFlow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698