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

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

Issue 148823002: *** DO NOT LAND *** Measure the size and complexity of the old multicol implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 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
« no previous file with comments | « Source/core/rendering/RenderBox.h ('k') | Source/core/rendering/RenderBoxModelObject.h » ('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 1975 matching lines...) Expand 10 before | Expand all | Expand 10 after
1986 // A region "has" boxes inside it without being their container. 1986 // A region "has" boxes inside it without being their container.
1987 // FIXME: change container() / containingBlock() to count for boxes being po sitioned relative to the region, not the 1987 // FIXME: change container() / containingBlock() to count for boxes being po sitioned relative to the region, not the
1988 // FlowThread. This requires a separate patch as a simple test with such a c hange in container() causes 129 out of 1988 // FlowThread. This requires a separate patch as a simple test with such a c hange in container() causes 129 out of
1989 // 337 regions tests to fail. 1989 // 337 regions tests to fail.
1990 ASSERT(o == container() || o->isRenderRegion()); 1990 ASSERT(o == container() || o->isRenderRegion());
1991 1991
1992 LayoutSize offset; 1992 LayoutSize offset;
1993 if (isInFlowPositioned()) 1993 if (isInFlowPositioned())
1994 offset += offsetForInFlowPosition(); 1994 offset += offsetForInFlowPosition();
1995 1995
1996 if (!isInline() || isReplaced()) { 1996 if (!isInline() || isReplaced())
1997 if (!style()->hasOutOfFlowPosition() && o->hasColumns()) { 1997 offset += topLeftLocationOffset();
1998 RenderBlock* block = toRenderBlock(o);
1999 LayoutRect columnRect(frameRect());
2000 block->adjustStartEdgeForWritingModeIncludingColumns(columnRect);
2001 offset += toSize(columnRect.location());
2002 LayoutPoint columnPoint = block->flipForWritingModeIncludingColumns( point + offset);
2003 offset = toLayoutSize(block->flipForWritingModeIncludingColumns(toLa youtPoint(offset)));
2004 o->adjustForColumns(offset, columnPoint);
2005 offset = block->flipForWritingMode(offset);
2006
2007 if (offsetDependsOnPoint)
2008 *offsetDependsOnPoint = true;
2009 } else
2010 offset += topLeftLocationOffset();
2011 }
2012 1998
2013 if (o->hasOverflowClip()) 1999 if (o->hasOverflowClip())
2014 offset -= toRenderBox(o)->scrolledContentOffset(); 2000 offset -= toRenderBox(o)->scrolledContentOffset();
2015 2001
2016 if (style()->position() == AbsolutePosition && o->isInFlowPositioned() && o- >isRenderInline()) 2002 if (style()->position() == AbsolutePosition && o->isInFlowPositioned() && o- >isRenderInline())
2017 offset += toRenderInline(o)->offsetForInFlowPositionedInline(this); 2003 offset += toRenderInline(o)->offsetForInFlowPositionedInline(this);
2018 2004
2019 if (offsetDependsOnPoint) 2005 if (offsetDependsOnPoint)
2020 *offsetDependsOnPoint |= o->isRenderFlowThread(); 2006 *offsetDependsOnPoint |= o->isRenderFlowThread();
2021 2007
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
2173 if (position == AbsolutePosition && o->isInFlowPositioned() && o->isRenderIn line()) { 2159 if (position == AbsolutePosition && o->isInFlowPositioned() && o->isRenderIn line()) {
2174 topLeft += toRenderInline(o)->offsetForInFlowPositionedInline(this); 2160 topLeft += toRenderInline(o)->offsetForInFlowPositionedInline(this);
2175 } else if (styleToUse->hasInFlowPosition() && layer()) { 2161 } else if (styleToUse->hasInFlowPosition() && layer()) {
2176 // Apply the relative position offset when invalidating a rectangle. Th e layer 2162 // Apply the relative position offset when invalidating a rectangle. Th e layer
2177 // is translated, but the render box isn't, so we need to do this to get the 2163 // is translated, but the render box isn't, so we need to do this to get the
2178 // right dirty rect. Since this is called from RenderObject::setStyle, the relative position 2164 // right dirty rect. Since this is called from RenderObject::setStyle, the relative position
2179 // flag on the RenderObject has been cleared, so use the one on the styl e(). 2165 // flag on the RenderObject has been cleared, so use the one on the styl e().
2180 topLeft += layer()->offsetForInFlowPosition(); 2166 topLeft += layer()->offsetForInFlowPosition();
2181 } 2167 }
2182 2168
2183 if (position != AbsolutePosition && position != FixedPosition && o->hasColum ns() && o->isRenderBlockFlow()) { 2169 if (position != AbsolutePosition && position != FixedPosition && o->isRender BlockFlow()) {
2184 LayoutRect repaintRect(topLeft, rect.size()); 2170 LayoutRect repaintRect(topLeft, rect.size());
2185 toRenderBlock(o)->adjustRectForColumns(repaintRect);
2186 topLeft = repaintRect.location(); 2171 topLeft = repaintRect.location();
2187 rect = repaintRect; 2172 rect = repaintRect;
2188 } 2173 }
2189 2174
2190 // FIXME: We ignore the lightweight clipping rect that controls use, since i f |o| is in mid-layout, 2175 // FIXME: We ignore the lightweight clipping rect that controls use, since i f |o| is in mid-layout,
2191 // its controlClipRect will be wrong. For overflow clip we use the values ca ched by the layer. 2176 // its controlClipRect will be wrong. For overflow clip we use the values ca ched by the layer.
2192 rect.setLocation(topLeft); 2177 rect.setLocation(topLeft);
2193 if (o->hasOverflowClip()) { 2178 if (o->hasOverflowClip()) {
2194 RenderBox* containerBox = toRenderBox(o); 2179 RenderBox* containerBox = toRenderBox(o);
2195 containerBox->applyCachedClipAndScrollOffsetForRepaint(rect); 2180 containerBox->applyCachedClipAndScrollOffsetForRepaint(rect);
(...skipping 2264 matching lines...) Expand 10 before | Expand all | Expand 10 after
4460 bool hasTopOverflow = !style()->isLeftToRightDirection() && !isHorizonta lWritingMode(); 4445 bool hasTopOverflow = !style()->isLeftToRightDirection() && !isHorizonta lWritingMode();
4461 bool hasLeftOverflow = !style()->isLeftToRightDirection() && isHorizonta lWritingMode(); 4446 bool hasLeftOverflow = !style()->isLeftToRightDirection() && isHorizonta lWritingMode();
4462 if (isFlexibleBox() && style()->isReverseFlexDirection()) { 4447 if (isFlexibleBox() && style()->isReverseFlexDirection()) {
4463 RenderFlexibleBox* flexibleBox = toRenderFlexibleBox(this); 4448 RenderFlexibleBox* flexibleBox = toRenderFlexibleBox(this);
4464 if (flexibleBox->isHorizontalFlow()) 4449 if (flexibleBox->isHorizontalFlow())
4465 hasLeftOverflow = true; 4450 hasLeftOverflow = true;
4466 else 4451 else
4467 hasTopOverflow = true; 4452 hasTopOverflow = true;
4468 } 4453 }
4469 4454
4470 if (hasColumns() && style()->columnProgression() == ReverseColumnProgres sion) {
4471 if (isHorizontalWritingMode() ^ !style()->hasInlineColumnAxis())
4472 hasLeftOverflow = !hasLeftOverflow;
4473 else
4474 hasTopOverflow = !hasTopOverflow;
4475 }
4476
4477 if (!hasTopOverflow) 4455 if (!hasTopOverflow)
4478 overflowRect.shiftYEdgeTo(max(overflowRect.y(), clientBox.y())); 4456 overflowRect.shiftYEdgeTo(max(overflowRect.y(), clientBox.y()));
4479 else 4457 else
4480 overflowRect.shiftMaxYEdgeTo(min(overflowRect.maxY(), clientBox.maxY ())); 4458 overflowRect.shiftMaxYEdgeTo(min(overflowRect.maxY(), clientBox.maxY ()));
4481 if (!hasLeftOverflow) 4459 if (!hasLeftOverflow)
4482 overflowRect.shiftXEdgeTo(max(overflowRect.x(), clientBox.x())); 4460 overflowRect.shiftXEdgeTo(max(overflowRect.x(), clientBox.x()));
4483 else 4461 else
4484 overflowRect.shiftMaxXEdgeTo(min(overflowRect.maxX(), clientBox.maxX ())); 4462 overflowRect.shiftMaxXEdgeTo(min(overflowRect.maxX(), clientBox.maxX ()));
4485 4463
4486 // Now re-test with the adjusted rectangle and see if it has become unre achable or fully 4464 // Now re-test with the adjusted rectangle and see if it has become unre achable or fully
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
4795 return logicalHeight() - position; 4773 return logicalHeight() - position;
4796 } 4774 }
4797 4775
4798 LayoutPoint RenderBox::flipForWritingMode(const LayoutPoint& position) const 4776 LayoutPoint RenderBox::flipForWritingMode(const LayoutPoint& position) const
4799 { 4777 {
4800 if (!style()->isFlippedBlocksWritingMode()) 4778 if (!style()->isFlippedBlocksWritingMode())
4801 return position; 4779 return position;
4802 return isHorizontalWritingMode() ? LayoutPoint(position.x(), height() - posi tion.y()) : LayoutPoint(width() - position.x(), position.y()); 4780 return isHorizontalWritingMode() ? LayoutPoint(position.x(), height() - posi tion.y()) : LayoutPoint(width() - position.x(), position.y());
4803 } 4781 }
4804 4782
4805 LayoutPoint RenderBox::flipForWritingModeIncludingColumns(const LayoutPoint& poi nt) const
4806 {
4807 if (!hasColumns() || !style()->isFlippedBlocksWritingMode())
4808 return flipForWritingMode(point);
4809 return toRenderBlock(this)->flipForWritingModeIncludingColumns(point);
4810 }
4811
4812 LayoutSize RenderBox::flipForWritingMode(const LayoutSize& offset) const 4783 LayoutSize RenderBox::flipForWritingMode(const LayoutSize& offset) const
4813 { 4784 {
4814 if (!style()->isFlippedBlocksWritingMode()) 4785 if (!style()->isFlippedBlocksWritingMode())
4815 return offset; 4786 return offset;
4816 return isHorizontalWritingMode() ? LayoutSize(offset.width(), height() - off set.height()) : LayoutSize(width() - offset.width(), offset.height()); 4787 return isHorizontalWritingMode() ? LayoutSize(offset.width(), height() - off set.height()) : LayoutSize(width() - offset.width(), offset.height());
4817 } 4788 }
4818 4789
4819 FloatPoint RenderBox::flipForWritingMode(const FloatPoint& position) const 4790 FloatPoint RenderBox::flipForWritingMode(const FloatPoint& position) const
4820 { 4791 {
4821 if (!style()->isFlippedBlocksWritingMode()) 4792 if (!style()->isFlippedBlocksWritingMode())
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
4917 return 0; 4888 return 0;
4918 4889
4919 if (!layoutState && !flowThreadContainingBlock()) 4890 if (!layoutState && !flowThreadContainingBlock())
4920 return 0; 4891 return 0;
4921 4892
4922 RenderBlock* containerBlock = containingBlock(); 4893 RenderBlock* containerBlock = containingBlock();
4923 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); 4894 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop();
4924 } 4895 }
4925 4896
4926 } // namespace WebCore 4897 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBox.h ('k') | Source/core/rendering/RenderBoxModelObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698