OLD | NEW |
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 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1200 // Table cells call layoutBlock directly, so don't add any logic here. Put
code into | 1200 // Table cells call layoutBlock directly, so don't add any logic here. Put
code into |
1201 // layoutBlock(). | 1201 // layoutBlock(). |
1202 layoutBlock(false); | 1202 layoutBlock(false); |
1203 | 1203 |
1204 // It's safe to check for control clip here, since controls can never be tab
le cells. | 1204 // It's safe to check for control clip here, since controls can never be tab
le cells. |
1205 // If we have a lightweight clip, there can never be any overflow from child
ren. | 1205 // If we have a lightweight clip, there can never be any overflow from child
ren. |
1206 if (hasControlClip() && m_overflow) | 1206 if (hasControlClip() && m_overflow) |
1207 clearLayoutOverflow(); | 1207 clearLayoutOverflow(); |
1208 } | 1208 } |
1209 | 1209 |
| 1210 void RenderBlock::computeInitialRegionRangeForBlock() |
| 1211 { |
| 1212 if (inRenderFlowThread()) { |
| 1213 // Set our start and end regions. No regions above or below us will be c
onsidered by our children. They are |
| 1214 // effectively clamped to our region range. |
| 1215 LayoutUnit oldHeight = logicalHeight(); |
| 1216 LayoutUnit oldLogicalTop = logicalTop(); |
| 1217 setLogicalHeight(numeric_limits<LayoutUnit>::max() / 2); |
| 1218 computeLogicalHeight(); |
| 1219 enclosingRenderFlowThread()->setRegionRangeForBox(this, offsetFromLogica
lTopOfFirstPage()); |
| 1220 setLogicalHeight(oldHeight); |
| 1221 setLogicalTop(oldLogicalTop); |
| 1222 } |
| 1223 } |
| 1224 |
| 1225 void RenderBlock::computeRegionRangeForBlock() |
| 1226 { |
| 1227 if (inRenderFlowThread()) |
| 1228 enclosingRenderFlowThread()->setRegionRangeForBox(this, offsetFromLogica
lTopOfFirstPage()); |
| 1229 } |
| 1230 |
1210 void RenderBlock::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeigh
t, BlockLayoutPass layoutPass) | 1231 void RenderBlock::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeigh
t, BlockLayoutPass layoutPass) |
1211 { | 1232 { |
1212 ASSERT(needsLayout()); | 1233 ASSERT(needsLayout()); |
1213 | 1234 |
1214 if (isInline() && !isInlineBlockOrInlineTable()) // Inline <form>s inside va
rious table elements can | 1235 if (isInline() && !isInlineBlockOrInlineTable()) // Inline <form>s inside va
rious table elements can |
1215 return; // cause us to come in here
. Just bail. | 1236 return; // cause us to come in here
. Just bail. |
1216 | 1237 |
1217 if (!relayoutChildren && simplifiedLayout()) | 1238 if (!relayoutChildren && simplifiedLayout()) |
1218 return; | 1239 return; |
1219 | 1240 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1259 pageLogicalHeightChanged = true; | 1280 pageLogicalHeightChanged = true; |
1260 } | 1281 } |
1261 | 1282 |
1262 if (!hasSpecifiedPageLogicalHeight && !pageLogicalHeight) | 1283 if (!hasSpecifiedPageLogicalHeight && !pageLogicalHeight) |
1263 colInfo->clearForcedBreaks(); | 1284 colInfo->clearForcedBreaks(); |
1264 } | 1285 } |
1265 | 1286 |
1266 RenderView* renderView = view(); | 1287 RenderView* renderView = view(); |
1267 RenderStyle* styleToUse = style(); | 1288 RenderStyle* styleToUse = style(); |
1268 LayoutStateMaintainer statePusher(renderView, this, locationOffset(), hasCol
umns() || hasTransform() || hasReflection() || styleToUse->isFlippedBlocksWritin
gMode(), pageLogicalHeight, pageLogicalHeightChanged, colInfo); | 1289 LayoutStateMaintainer statePusher(renderView, this, locationOffset(), hasCol
umns() || hasTransform() || hasReflection() || styleToUse->isFlippedBlocksWritin
gMode(), pageLogicalHeight, pageLogicalHeightChanged, colInfo); |
1269 | 1290 |
1270 if (inRenderFlowThread()) { | 1291 if (inRenderFlowThread()) { |
1271 // Regions changing widths can force us to relayout our children. | 1292 // Regions changing widths can force us to relayout our children. |
1272 if (logicalWidthChangedInRegions()) | 1293 if (logicalWidthChangedInRegions()) |
1273 relayoutChildren = true; | 1294 relayoutChildren = true; |
1274 | |
1275 // Set our start and end regions. No regions above or below us will be c
onsidered by our children. They are | |
1276 // effectively clamped to our region range. | |
1277 LayoutUnit oldHeight = logicalHeight(); | |
1278 LayoutUnit oldLogicalTop = logicalTop(); | |
1279 setLogicalHeight(numeric_limits<LayoutUnit>::max() / 2); | |
1280 computeLogicalHeight(); | |
1281 enclosingRenderFlowThread()->setRegionRangeForBox(this, offsetFromLogica
lTopOfFirstPage()); | |
1282 setLogicalHeight(oldHeight); | |
1283 setLogicalTop(oldLogicalTop); | |
1284 } | 1295 } |
| 1296 computeInitialRegionRangeForBlock(); |
1285 | 1297 |
1286 // We use four values, maxTopPos, maxTopNeg, maxBottomPos, and maxBottomNeg,
to track | 1298 // We use four values, maxTopPos, maxTopNeg, maxBottomPos, and maxBottomNeg,
to track |
1287 // our current maximal positive and negative margins. These values are used
when we | 1299 // our current maximal positive and negative margins. These values are used
when we |
1288 // are collapsed with adjacent blocks, so for example, if you have block A a
nd B | 1300 // are collapsed with adjacent blocks, so for example, if you have block A a
nd B |
1289 // collapsing together, then you'd take the maximal positive margin from bot
h A and B | 1301 // collapsing together, then you'd take the maximal positive margin from bot
h A and B |
1290 // and subtract it from the maximal negative margin from both A and B to get
the | 1302 // and subtract it from the maximal negative margin from both A and B to get
the |
1291 // true collapsed margin. This algorithm is recursive, so when we finish la
yout() | 1303 // true collapsed margin. This algorithm is recursive, so when we finish la
yout() |
1292 // our block knows its current maximal positive/negative values. | 1304 // our block knows its current maximal positive/negative values. |
1293 // | 1305 // |
1294 // Start out by setting our margin values to our current margins. Table cel
ls have | 1306 // Start out by setting our margin values to our current margins. Table cel
ls have |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1352 } | 1364 } |
1353 } | 1365 } |
1354 } | 1366 } |
1355 } | 1367 } |
1356 | 1368 |
1357 if (previousHeight != newHeight) | 1369 if (previousHeight != newHeight) |
1358 relayoutChildren = true; | 1370 relayoutChildren = true; |
1359 | 1371 |
1360 bool needAnotherLayoutPass = layoutPositionedObjects(relayoutChildren || isR
oot()); | 1372 bool needAnotherLayoutPass = layoutPositionedObjects(relayoutChildren || isR
oot()); |
1361 | 1373 |
1362 if (inRenderFlowThread()) | 1374 computeRegionRangeForBlock(); |
1363 enclosingRenderFlowThread()->setRegionRangeForBox(this, offsetFromLogica
lTopOfFirstPage()); | |
1364 | 1375 |
1365 // Add overflow from children (unless we're multi-column, since in that case
all our child overflow is clipped anyway). | 1376 // Add overflow from children (unless we're multi-column, since in that case
all our child overflow is clipped anyway). |
1366 computeOverflow(oldClientAfterEdge); | 1377 computeOverflow(oldClientAfterEdge); |
1367 | 1378 |
1368 statePusher.pop(); | 1379 statePusher.pop(); |
1369 | 1380 |
1370 if (renderView->layoutState()->m_pageLogicalHeight) | 1381 if (renderView->layoutState()->m_pageLogicalHeight) |
1371 setPageLogicalOffset(renderView->layoutState()->pageLogicalOffset(logica
lTop())); | 1382 setPageLogicalOffset(renderView->layoutState()->pageLogicalOffset(logica
lTop())); |
1372 | 1383 |
1373 updateLayerTransform(); | 1384 updateLayerTransform(); |
(...skipping 5708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7082 } | 7093 } |
7083 | 7094 |
7084 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) | 7095 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) |
7085 { | 7096 { |
7086 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->x(
), floatingObject->y(), floatingObject->maxX(), floatingObject->maxY()); | 7097 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->x(
), floatingObject->y(), floatingObject->maxX(), floatingObject->maxY()); |
7087 } | 7098 } |
7088 | 7099 |
7089 #endif | 7100 #endif |
7090 | 7101 |
7091 } // namespace WebCore | 7102 } // namespace WebCore |
OLD | NEW |