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

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: Created 6 years, 3 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
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 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1479 width += portionOfMarginNotConsumedByFloat(childMarginStart, startOffsetForC ontent, startOffsetForLine); 1485 width += portionOfMarginNotConsumedByFloat(childMarginStart, startOffsetForC ontent, startOffsetForLine);
1480 width += portionOfMarginNotConsumedByFloat(childMarginEnd, endOffsetForConte nt, endOffsetForLine); 1486 width += portionOfMarginNotConsumedByFloat(childMarginEnd, endOffsetForConte nt, endOffsetForLine);
1481 return width; 1487 return width;
1482 } 1488 }
1483 1489
1484 LayoutUnit RenderBox::containingBlockLogicalWidthForContent() const 1490 LayoutUnit RenderBox::containingBlockLogicalWidthForContent() const
1485 { 1491 {
1486 if (hasOverrideContainingBlockLogicalWidth()) 1492 if (hasOverrideContainingBlockLogicalWidth())
1487 return overrideContainingBlockContentLogicalWidth(); 1493 return overrideContainingBlockContentLogicalWidth();
1488 1494
1489 RenderBlock* cb = containingBlock(); 1495 RenderBlock* cb;
1496 if (isColumnSpanAll())
1497 cb = flowThreadContainingBlock()->containingBlock();
Julien - ping for review 2014/09/30 00:39:32 It seems like we should be updating containgBlock(
mstensho (USE GERRIT) 2014/09/30 20:20:28 Yeah, I've been thinking about this, and it's cert
1498 else
1499 cb = containingBlock();
1490 return cb->availableLogicalWidth(); 1500 return cb->availableLogicalWidth();
1491 } 1501 }
1492 1502
1493 LayoutUnit RenderBox::containingBlockLogicalHeightForContent(AvailableLogicalHei ghtType heightType) const 1503 LayoutUnit RenderBox::containingBlockLogicalHeightForContent(AvailableLogicalHei ghtType heightType) const
1494 { 1504 {
1495 if (hasOverrideContainingBlockLogicalHeight()) 1505 if (hasOverrideContainingBlockLogicalHeight())
1496 return overrideContainingBlockContentLogicalHeight(); 1506 return overrideContainingBlockContentLogicalHeight();
1497 1507
1498 RenderBlock* cb = containingBlock(); 1508 RenderBlock* cb;
1509 if (isColumnSpanAll())
1510 cb = flowThreadContainingBlock()->containingBlock();
1511 else
1512 cb = containingBlock();
1499 return cb->availableLogicalHeight(heightType); 1513 return cb->availableLogicalHeight(heightType);
1500 } 1514 }
1501 1515
1502 LayoutUnit RenderBox::containingBlockAvailableLineWidth() const 1516 LayoutUnit RenderBox::containingBlockAvailableLineWidth() const
1503 { 1517 {
1504 RenderBlock* cb = containingBlock(); 1518 RenderBlock* cb = containingBlock();
1505 if (cb->isRenderBlockFlow()) 1519 if (cb->isRenderBlockFlow())
1506 return toRenderBlockFlow(cb)->availableLogicalWidthForLine(logicalTop(), false, availableLogicalHeight(IncludeMarginBorderPadding)); 1520 return toRenderBlockFlow(cb)->availableLogicalWidthForLine(logicalTop(), false, availableLogicalHeight(IncludeMarginBorderPadding));
1507 return 0; 1521 return 0;
1508 } 1522 }
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
2110 2124
2111 bool RenderBox::autoWidthShouldFitContent() const 2125 bool RenderBox::autoWidthShouldFitContent() const
2112 { 2126 {
2113 return node() && (isHTMLInputElement(*node()) || isHTMLSelectElement(*node() ) || isHTMLButtonElement(*node()) 2127 return node() && (isHTMLInputElement(*node()) || isHTMLSelectElement(*node() ) || isHTMLButtonElement(*node())
2114 || isHTMLTextAreaElement(*node()) || (isHTMLLegendElement(*node()) && !s tyle()->hasOutOfFlowPosition())); 2128 || isHTMLTextAreaElement(*node()) || (isHTMLLegendElement(*node()) && !s tyle()->hasOutOfFlowPosition()));
2115 } 2129 }
2116 2130
2117 void RenderBox::computeMarginsForDirection(MarginDirection flowDirection, const RenderBlock* containingBlock, LayoutUnit containerWidth, LayoutUnit childWidth, LayoutUnit& marginStart, LayoutUnit& marginEnd, Length marginStartLength, Length marginEndLength) const 2131 void RenderBox::computeMarginsForDirection(MarginDirection flowDirection, const RenderBlock* containingBlock, LayoutUnit containerWidth, LayoutUnit childWidth, LayoutUnit& marginStart, LayoutUnit& marginEnd, Length marginStartLength, Length marginEndLength) const
2118 { 2132 {
2119 if (flowDirection == BlockDirection || isFloating() || isInline()) { 2133 if (flowDirection == BlockDirection || isFloating() || isInline()) {
2120 if (isTableCell() && flowDirection == BlockDirection) { 2134 if ((isColumnSpanAll() || isTableCell()) && flowDirection == BlockDirect ion) {
2121 // FIXME: Not right if we allow cells to have different directionali ty than the table. If we do allow this, though, 2135 // FIXME: Not right if we allow cells to have different directionali ty than the table. If we do allow this, though,
2122 // we may just do it with an extra anonymous block inside the cell. 2136 // we may just do it with an extra anonymous block inside the cell.
2123 marginStart = 0; 2137 marginStart = 0;
2124 marginEnd = 0; 2138 marginEnd = 0;
2125 return; 2139 return;
2126 } 2140 }
2127 2141
2128 // Margins are calculated with respect to the logical width of 2142 // Margins are calculated with respect to the logical width of
2129 // the containing block (8.3) 2143 // the containing block (8.3)
2130 // Inline blocks/tables and floats don't have their margins increased. 2144 // Inline blocks/tables and floats don't have their margins increased.
(...skipping 2047 matching lines...) Expand 10 before | Expand all | Expand 10 after
4178 // Note this is just a heuristic, and it's still possible to have overflow u nder these 4192 // Note this is just a heuristic, and it's still possible to have overflow u nder these
4179 // conditions, but it should work out to be good enough for common cases. Pa ginating overflow 4193 // conditions, but it should work out to be good enough for common cases. Pa ginating overflow
4180 // with scrollbars present is not the end of the world and is what we used t o do in the old model anyway. 4194 // with scrollbars present is not the end of the world and is what we used t o do in the old model anyway.
4181 return !style()->logicalHeight().isIntrinsicOrAuto() 4195 return !style()->logicalHeight().isIntrinsicOrAuto()
4182 || (!style()->logicalMaxHeight().isIntrinsicOrAuto() && !style()->logica lMaxHeight().isMaxSizeNone() && (!style()->logicalMaxHeight().isPercent() || per centageLogicalHeightIsResolvable(this))) 4196 || (!style()->logicalMaxHeight().isIntrinsicOrAuto() && !style()->logica lMaxHeight().isMaxSizeNone() && (!style()->logicalMaxHeight().isPercent() || per centageLogicalHeightIsResolvable(this)))
4183 || (!style()->logicalMinHeight().isIntrinsicOrAuto() && style()->logical MinHeight().isPositive() && (!style()->logicalMinHeight().isPercent() || percent ageLogicalHeightIsResolvable(this))); 4197 || (!style()->logicalMinHeight().isIntrinsicOrAuto() && style()->logical MinHeight().isPositive() && (!style()->logicalMinHeight().isPercent() || percent ageLogicalHeightIsResolvable(this)));
4184 } 4198 }
4185 4199
4186 bool RenderBox::isUnsplittableForPagination() const 4200 bool RenderBox::isUnsplittableForPagination() const
4187 { 4201 {
4188 return isReplaced() || hasUnsplittableScrollingOverflow() || (parent() && is WritingModeRoot()); 4202 // FIXME: column spanners are only unsplittable (or rather: they do not part icipate in
4203 // fragmentation) in their nearest ancestor multicol container. If there are additional
4204 // fragmentation contexts further up in the tree, spanners still need to tak e those into
4205 // account.
4206 return isReplaced() || hasUnsplittableScrollingOverflow() || (parent() && is WritingModeRoot()) || isColumnSpanAll();
4189 } 4207 }
4190 4208
4191 LayoutUnit RenderBox::lineHeight(bool /*firstLine*/, LineDirectionMode direction , LinePositionMode /*linePositionMode*/) const 4209 LayoutUnit RenderBox::lineHeight(bool /*firstLine*/, LineDirectionMode direction , LinePositionMode /*linePositionMode*/) const
4192 { 4210 {
4193 if (isReplaced()) 4211 if (isReplaced())
4194 return direction == HorizontalLine ? m_marginBox.top() + height() + m_ma rginBox.bottom() : m_marginBox.right() + width() + m_marginBox.left(); 4212 return direction == HorizontalLine ? m_marginBox.top() + height() + m_ma rginBox.bottom() : m_marginBox.right() + width() + m_marginBox.left();
4195 return 0; 4213 return 0;
4196 } 4214 }
4197 4215
4198 int RenderBox::baselinePosition(FontBaseline baselineType, bool /*firstLine*/, L ineDirectionMode direction, LinePositionMode linePositionMode) const 4216 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
4529 ASSERT(style()->hasBackground() || style()->hasBoxDecorations()); 4547 ASSERT(style()->hasBackground() || style()->hasBoxDecorations());
4530 4548
4531 if (m_rareData && m_rareData->m_previousBorderBoxSize.width() != -1) 4549 if (m_rareData && m_rareData->m_previousBorderBoxSize.width() != -1)
4532 return m_rareData->m_previousBorderBoxSize; 4550 return m_rareData->m_previousBorderBoxSize;
4533 4551
4534 // We didn't save the old border box size because it was the same as the siz e of oldBounds. 4552 // We didn't save the old border box size because it was the same as the siz e of oldBounds.
4535 return previousBoundsSize; 4553 return previousBoundsSize;
4536 } 4554 }
4537 4555
4538 } // namespace blink 4556 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698