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 584033002: [New Multicolumn] Add support for column-span:all (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase master Created 6 years, 2 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/RenderBlockFlow.cpp ('k') | Source/core/rendering/RenderFlowThread.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 28 matching lines...) Expand all
39 #include "core/html/HTMLFrameOwnerElement.h" 39 #include "core/html/HTMLFrameOwnerElement.h"
40 #include "core/page/AutoscrollController.h" 40 #include "core/page/AutoscrollController.h"
41 #include "core/page/EventHandler.h" 41 #include "core/page/EventHandler.h"
42 #include "core/page/Page.h" 42 #include "core/page/Page.h"
43 #include "core/paint/BackgroundImageGeometry.h" 43 #include "core/paint/BackgroundImageGeometry.h"
44 #include "core/paint/BoxPainter.h" 44 #include "core/paint/BoxPainter.h"
45 #include "core/rendering/HitTestResult.h" 45 #include "core/rendering/HitTestResult.h"
46 #include "core/rendering/PaintInfo.h" 46 #include "core/rendering/PaintInfo.h"
47 #include "core/rendering/RenderDeprecatedFlexibleBox.h" 47 #include "core/rendering/RenderDeprecatedFlexibleBox.h"
48 #include "core/rendering/RenderFlexibleBox.h" 48 #include "core/rendering/RenderFlexibleBox.h"
49 #include "core/rendering/RenderFlowThread.h"
49 #include "core/rendering/RenderGeometryMap.h" 50 #include "core/rendering/RenderGeometryMap.h"
50 #include "core/rendering/RenderGrid.h" 51 #include "core/rendering/RenderGrid.h"
51 #include "core/rendering/RenderInline.h" 52 #include "core/rendering/RenderInline.h"
52 #include "core/rendering/RenderLayer.h" 53 #include "core/rendering/RenderLayer.h"
53 #include "core/rendering/RenderListBox.h" 54 #include "core/rendering/RenderListBox.h"
54 #include "core/rendering/RenderListMarker.h" 55 #include "core/rendering/RenderListMarker.h"
55 #include "core/rendering/RenderTableCell.h" 56 #include "core/rendering/RenderTableCell.h"
56 #include "core/rendering/RenderView.h" 57 #include "core/rendering/RenderView.h"
57 #include "core/rendering/compositing/RenderLayerCompositor.h" 58 #include "core/rendering/compositing/RenderLayerCompositor.h"
58 #include "platform/LengthFunctions.h" 59 #include "platform/LengthFunctions.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 parentToInvalidate->invalidateBackgroundObscurationStatus(); 210 parentToInvalidate->invalidateBackgroundObscurationStatus();
210 parentToInvalidate = parentToInvalidate->parent(); 211 parentToInvalidate = parentToInvalidate->parent();
211 } 212 }
212 } 213 }
213 214
214 if (isDocumentElement() || isBody()) 215 if (isDocumentElement() || isBody())
215 document().view()->recalculateScrollbarOverlayStyle(); 216 document().view()->recalculateScrollbarOverlayStyle();
216 217
217 updateShapeOutsideInfoAfterStyleChange(*style(), oldStyle); 218 updateShapeOutsideInfoAfterStyleChange(*style(), oldStyle);
218 updateGridPositionAfterStyleChange(oldStyle); 219 updateGridPositionAfterStyleChange(oldStyle);
220
221 if (RenderFlowThread* flowThread = flowThreadContainingBlock()) {
222 if (flowThread != this)
223 flowThread->flowThreadDescendantStyleDidChange(this);
224 }
219 } 225 }
220 226
221 void RenderBox::updateShapeOutsideInfoAfterStyleChange(const RenderStyle& style, const RenderStyle* oldStyle) 227 void RenderBox::updateShapeOutsideInfoAfterStyleChange(const RenderStyle& style, const RenderStyle* oldStyle)
222 { 228 {
223 const ShapeValue* shapeOutside = style.shapeOutside(); 229 const ShapeValue* shapeOutside = style.shapeOutside();
224 const ShapeValue* oldShapeOutside = oldStyle ? oldStyle->shapeOutside() : Re nderStyle::initialShapeOutside(); 230 const ShapeValue* oldShapeOutside = oldStyle ? oldStyle->shapeOutside() : Re nderStyle::initialShapeOutside();
225 231
226 Length shapeMargin = style.shapeMargin(); 232 Length shapeMargin = style.shapeMargin();
227 Length oldShapeMargin = oldStyle ? oldStyle->shapeMargin() : RenderStyle::in itialShapeMargin(); 233 Length oldShapeMargin = oldStyle ? oldStyle->shapeMargin() : RenderStyle::in itialShapeMargin();
228 234
(...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after
1473 width += portionOfMarginNotConsumedByFloat(childMarginStart, startOffsetForC ontent, startOffsetForLine); 1479 width += portionOfMarginNotConsumedByFloat(childMarginStart, startOffsetForC ontent, startOffsetForLine);
1474 width += portionOfMarginNotConsumedByFloat(childMarginEnd, endOffsetForConte nt, endOffsetForLine); 1480 width += portionOfMarginNotConsumedByFloat(childMarginEnd, endOffsetForConte nt, endOffsetForLine);
1475 return width; 1481 return width;
1476 } 1482 }
1477 1483
1478 LayoutUnit RenderBox::containingBlockLogicalWidthForContent() const 1484 LayoutUnit RenderBox::containingBlockLogicalWidthForContent() const
1479 { 1485 {
1480 if (hasOverrideContainingBlockLogicalWidth()) 1486 if (hasOverrideContainingBlockLogicalWidth())
1481 return overrideContainingBlockContentLogicalWidth(); 1487 return overrideContainingBlockContentLogicalWidth();
1482 1488
1483 RenderBlock* cb = containingBlock(); 1489 RenderBlock* cb;
1490 if (isColumnSpanAll())
1491 cb = flowThreadContainingBlock()->containingBlock();
1492 else
1493 cb = containingBlock();
1484 return cb->availableLogicalWidth(); 1494 return cb->availableLogicalWidth();
1485 } 1495 }
1486 1496
1487 LayoutUnit RenderBox::containingBlockLogicalHeightForContent(AvailableLogicalHei ghtType heightType) const 1497 LayoutUnit RenderBox::containingBlockLogicalHeightForContent(AvailableLogicalHei ghtType heightType) const
1488 { 1498 {
1489 if (hasOverrideContainingBlockLogicalHeight()) 1499 if (hasOverrideContainingBlockLogicalHeight())
1490 return overrideContainingBlockContentLogicalHeight(); 1500 return overrideContainingBlockContentLogicalHeight();
1491 1501
1492 RenderBlock* cb = containingBlock(); 1502 RenderBlock* cb;
1503 if (isColumnSpanAll())
1504 cb = flowThreadContainingBlock()->containingBlock();
1505 else
1506 cb = containingBlock();
1493 return cb->availableLogicalHeight(heightType); 1507 return cb->availableLogicalHeight(heightType);
1494 } 1508 }
1495 1509
1496 LayoutUnit RenderBox::containingBlockAvailableLineWidth() const 1510 LayoutUnit RenderBox::containingBlockAvailableLineWidth() const
1497 { 1511 {
1498 RenderBlock* cb = containingBlock(); 1512 RenderBlock* cb = containingBlock();
1499 if (cb->isRenderBlockFlow()) 1513 if (cb->isRenderBlockFlow())
1500 return toRenderBlockFlow(cb)->availableLogicalWidthForLine(logicalTop(), false, availableLogicalHeight(IncludeMarginBorderPadding)); 1514 return toRenderBlockFlow(cb)->availableLogicalWidthForLine(logicalTop(), false, availableLogicalHeight(IncludeMarginBorderPadding));
1501 return 0; 1515 return 0;
1502 } 1516 }
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
2104 2118
2105 bool RenderBox::autoWidthShouldFitContent() const 2119 bool RenderBox::autoWidthShouldFitContent() const
2106 { 2120 {
2107 return node() && (isHTMLInputElement(*node()) || isHTMLSelectElement(*node() ) || isHTMLButtonElement(*node()) 2121 return node() && (isHTMLInputElement(*node()) || isHTMLSelectElement(*node() ) || isHTMLButtonElement(*node())
2108 || isHTMLTextAreaElement(*node()) || (isHTMLLegendElement(*node()) && !s tyle()->hasOutOfFlowPosition())); 2122 || isHTMLTextAreaElement(*node()) || (isHTMLLegendElement(*node()) && !s tyle()->hasOutOfFlowPosition()));
2109 } 2123 }
2110 2124
2111 void RenderBox::computeMarginsForDirection(MarginDirection flowDirection, const RenderBlock* containingBlock, LayoutUnit containerWidth, LayoutUnit childWidth, LayoutUnit& marginStart, LayoutUnit& marginEnd, Length marginStartLength, Length marginEndLength) const 2125 void RenderBox::computeMarginsForDirection(MarginDirection flowDirection, const RenderBlock* containingBlock, LayoutUnit containerWidth, LayoutUnit childWidth, LayoutUnit& marginStart, LayoutUnit& marginEnd, Length marginStartLength, Length marginEndLength) const
2112 { 2126 {
2113 if (flowDirection == BlockDirection || isFloating() || isInline()) { 2127 if (flowDirection == BlockDirection || isFloating() || isInline()) {
2114 if (isTableCell() && flowDirection == BlockDirection) { 2128 if ((isColumnSpanAll() || isTableCell()) && flowDirection == BlockDirect ion) {
2115 // FIXME: Not right if we allow cells to have different directionali ty than the table. If we do allow this, though, 2129 // FIXME: Not right if we allow cells to have different directionali ty than the table. If we do allow this, though,
2116 // we may just do it with an extra anonymous block inside the cell. 2130 // we may just do it with an extra anonymous block inside the cell.
2117 marginStart = 0; 2131 marginStart = 0;
2118 marginEnd = 0; 2132 marginEnd = 0;
2119 return; 2133 return;
2120 } 2134 }
2121 2135
2122 // Margins are calculated with respect to the logical width of 2136 // Margins are calculated with respect to the logical width of
2123 // the containing block (8.3) 2137 // the containing block (8.3)
2124 // Inline blocks/tables and floats don't have their margins increased. 2138 // Inline blocks/tables and floats don't have their margins increased.
(...skipping 2047 matching lines...) Expand 10 before | Expand all | Expand 10 after
4172 // Note this is just a heuristic, and it's still possible to have overflow u nder these 4186 // Note this is just a heuristic, and it's still possible to have overflow u nder these
4173 // conditions, but it should work out to be good enough for common cases. Pa ginating overflow 4187 // conditions, but it should work out to be good enough for common cases. Pa ginating overflow
4174 // with scrollbars present is not the end of the world and is what we used t o do in the old model anyway. 4188 // with scrollbars present is not the end of the world and is what we used t o do in the old model anyway.
4175 return !style()->logicalHeight().isIntrinsicOrAuto() 4189 return !style()->logicalHeight().isIntrinsicOrAuto()
4176 || (!style()->logicalMaxHeight().isIntrinsicOrAuto() && !style()->logica lMaxHeight().isMaxSizeNone() && (!style()->logicalMaxHeight().isPercent() || per centageLogicalHeightIsResolvable(this))) 4190 || (!style()->logicalMaxHeight().isIntrinsicOrAuto() && !style()->logica lMaxHeight().isMaxSizeNone() && (!style()->logicalMaxHeight().isPercent() || per centageLogicalHeightIsResolvable(this)))
4177 || (!style()->logicalMinHeight().isIntrinsicOrAuto() && style()->logical MinHeight().isPositive() && (!style()->logicalMinHeight().isPercent() || percent ageLogicalHeightIsResolvable(this))); 4191 || (!style()->logicalMinHeight().isIntrinsicOrAuto() && style()->logical MinHeight().isPositive() && (!style()->logicalMinHeight().isPercent() || percent ageLogicalHeightIsResolvable(this)));
4178 } 4192 }
4179 4193
4180 bool RenderBox::isUnsplittableForPagination() const 4194 bool RenderBox::isUnsplittableForPagination() const
4181 { 4195 {
4182 return isReplaced() || hasUnsplittableScrollingOverflow() || (parent() && is WritingModeRoot()); 4196 // FIXME: column spanners are only unsplittable (or rather: they do not part icipate in
4197 // fragmentation) in their nearest ancestor multicol container. If there are additional
4198 // fragmentation contexts further up in the tree, spanners still need to tak e those into
4199 // account.
4200 return isReplaced() || hasUnsplittableScrollingOverflow() || (parent() && is WritingModeRoot()) || isColumnSpanAll();
4183 } 4201 }
4184 4202
4185 LayoutUnit RenderBox::lineHeight(bool /*firstLine*/, LineDirectionMode direction , LinePositionMode /*linePositionMode*/) const 4203 LayoutUnit RenderBox::lineHeight(bool /*firstLine*/, LineDirectionMode direction , LinePositionMode /*linePositionMode*/) const
4186 { 4204 {
4187 if (isReplaced()) 4205 if (isReplaced())
4188 return direction == HorizontalLine ? m_marginBox.top() + height() + m_ma rginBox.bottom() : m_marginBox.right() + width() + m_marginBox.left(); 4206 return direction == HorizontalLine ? m_marginBox.top() + height() + m_ma rginBox.bottom() : m_marginBox.right() + width() + m_marginBox.left();
4189 return 0; 4207 return 0;
4190 } 4208 }
4191 4209
4192 int RenderBox::baselinePosition(FontBaseline baselineType, bool /*firstLine*/, L ineDirectionMode direction, LinePositionMode linePositionMode) const 4210 int RenderBox::baselinePosition(FontBaseline baselineType, bool /*firstLine*/, L ineDirectionMode direction, LinePositionMode linePositionMode) const
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
4523 ASSERT(style()->hasBackground() || style()->hasBoxDecorations()); 4541 ASSERT(style()->hasBackground() || style()->hasBoxDecorations());
4524 4542
4525 if (m_rareData && m_rareData->m_previousBorderBoxSize.width() != -1) 4543 if (m_rareData && m_rareData->m_previousBorderBoxSize.width() != -1)
4526 return m_rareData->m_previousBorderBoxSize; 4544 return m_rareData->m_previousBorderBoxSize;
4527 4545
4528 // We didn't save the old border box size because it was the same as the siz e of oldBounds. 4546 // We didn't save the old border box size because it was the same as the siz e of oldBounds.
4529 return previousBoundsSize; 4547 return previousBoundsSize;
4530 } 4548 }
4531 4549
4532 } // namespace blink 4550 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBlockFlow.cpp ('k') | Source/core/rendering/RenderFlowThread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698