| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 SubtreeLayoutScope layoutScope(*this); | 219 SubtreeLayoutScope layoutScope(*this); |
| 220 | 220 |
| 221 // Multiple passes might be required for column and pagination based layout | 221 // Multiple passes might be required for column and pagination based layout |
| 222 // In the case of the old column code the number of passes will only be two | 222 // In the case of the old column code the number of passes will only be two |
| 223 // however, in the newer column code the number of passes could equal the | 223 // however, in the newer column code the number of passes could equal the |
| 224 // number of columns. | 224 // number of columns. |
| 225 bool done = false; | 225 bool done = false; |
| 226 while (!done) | 226 while (!done) |
| 227 done = layoutBlockFlow(relayoutChildren, layoutScope); | 227 done = layoutBlockFlow(relayoutChildren, layoutScope); |
| 228 | 228 |
| 229 fitBorderToLinesIfNeeded(); | |
| 230 | |
| 231 updateLayerTransformAfterLayout(); | 229 updateLayerTransformAfterLayout(); |
| 232 | 230 |
| 233 // Update our scroll information if we're overflow:auto/scroll/hidden now th
at we know if | 231 // Update our scroll information if we're overflow:auto/scroll/hidden now th
at we know if |
| 234 // we overflow or not. | 232 // we overflow or not. |
| 235 updateScrollInfoAfterLayout(); | 233 updateScrollInfoAfterLayout(); |
| 236 | 234 |
| 237 if (m_paintInvalidationLogicalTop != m_paintInvalidationLogicalBottom) | 235 if (m_paintInvalidationLogicalTop != m_paintInvalidationLogicalBottom) |
| 238 setShouldInvalidateOverflowForPaint(true); | 236 setShouldInvalidateOverflowForPaint(true); |
| 239 | 237 |
| 240 clearNeedsLayout(); | 238 clearNeedsLayout(); |
| (...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1267 { | 1265 { |
| 1268 // FIXME(sky): Remove this. | 1266 // FIXME(sky): Remove this. |
| 1269 } | 1267 } |
| 1270 | 1268 |
| 1271 bool RenderBlockFlow::hitTestFloats(const HitTestRequest& request, HitTestResult
& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumul
atedOffset) | 1269 bool RenderBlockFlow::hitTestFloats(const HitTestRequest& request, HitTestResult
& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumul
atedOffset) |
| 1272 { | 1270 { |
| 1273 // FIXME(sky): Remove this. | 1271 // FIXME(sky): Remove this. |
| 1274 return false; | 1272 return false; |
| 1275 } | 1273 } |
| 1276 | 1274 |
| 1277 void RenderBlockFlow::adjustForBorderFit(LayoutUnit x, LayoutUnit& left, LayoutU
nit& right) const | |
| 1278 { | |
| 1279 // We don't deal with relative positioning. Our assumption is that you shrin
k to fit the lines without accounting | |
| 1280 // for either overflow or translations via relative positioning. | |
| 1281 if (childrenInline()) { | |
| 1282 for (RootInlineBox* box = firstRootBox(); box; box = box->nextRootBox())
{ | |
| 1283 if (box->firstChild()) | |
| 1284 left = std::min(left, x + static_cast<LayoutUnit>(box->firstChil
d()->x())); | |
| 1285 if (box->lastChild()) | |
| 1286 right = std::max(right, x + static_cast<LayoutUnit>(ceilf(box->l
astChild()->logicalRight()))); | |
| 1287 } | |
| 1288 } else { | |
| 1289 for (RenderBox* obj = firstChildBox(); obj; obj = obj->nextSiblingBox())
{ | |
| 1290 if (!obj->isFloatingOrOutOfFlowPositioned()) { | |
| 1291 if (obj->isRenderBlockFlow() && !obj->hasOverflowClip()) { | |
| 1292 toRenderBlockFlow(obj)->adjustForBorderFit(x + obj->x(), lef
t, right); | |
| 1293 } else { | |
| 1294 // We are a replaced element or some kind of non-block-flow
object. | |
| 1295 left = std::min(left, x + obj->x()); | |
| 1296 right = std::max(right, x + obj->x() + obj->width()); | |
| 1297 } | |
| 1298 } | |
| 1299 } | |
| 1300 } | |
| 1301 } | |
| 1302 | |
| 1303 void RenderBlockFlow::fitBorderToLinesIfNeeded() | |
| 1304 { | |
| 1305 if (style()->borderFit() == BorderFitBorder || hasOverrideWidth()) | |
| 1306 return; | |
| 1307 | |
| 1308 // Walk any normal flow lines to snugly fit. | |
| 1309 LayoutUnit left = LayoutUnit::max(); | |
| 1310 LayoutUnit right = LayoutUnit::min(); | |
| 1311 LayoutUnit oldWidth = contentWidth(); | |
| 1312 adjustForBorderFit(0, left, right); | |
| 1313 | |
| 1314 // Clamp to our existing edges. We can never grow. We only shrink. | |
| 1315 LayoutUnit leftEdge = borderLeft() + paddingLeft(); | |
| 1316 LayoutUnit rightEdge = leftEdge + oldWidth; | |
| 1317 left = std::min(rightEdge, std::max(leftEdge, left)); | |
| 1318 right = std::max(left, std::min(rightEdge, right)); | |
| 1319 | |
| 1320 LayoutUnit newContentWidth = right - left; | |
| 1321 if (newContentWidth == oldWidth) | |
| 1322 return; | |
| 1323 | |
| 1324 setOverrideLogicalContentWidth(newContentWidth); | |
| 1325 layoutBlock(false); | |
| 1326 clearOverrideLogicalContentWidth(); | |
| 1327 } | |
| 1328 | |
| 1329 LayoutUnit RenderBlockFlow::logicalLeftFloatOffsetForLine(LayoutUnit logicalTop,
LayoutUnit fixedOffset, LayoutUnit logicalHeight) const | 1275 LayoutUnit RenderBlockFlow::logicalLeftFloatOffsetForLine(LayoutUnit logicalTop,
LayoutUnit fixedOffset, LayoutUnit logicalHeight) const |
| 1330 { | 1276 { |
| 1331 // FIXME(sky): remove this. | 1277 // FIXME(sky): remove this. |
| 1332 return fixedOffset; | 1278 return fixedOffset; |
| 1333 } | 1279 } |
| 1334 | 1280 |
| 1335 LayoutUnit RenderBlockFlow::logicalRightFloatOffsetForLine(LayoutUnit logicalTop
, LayoutUnit fixedOffset, LayoutUnit logicalHeight) const | 1281 LayoutUnit RenderBlockFlow::logicalRightFloatOffsetForLine(LayoutUnit logicalTop
, LayoutUnit fixedOffset, LayoutUnit logicalHeight) const |
| 1336 { | 1282 { |
| 1337 // FIXME(sky): remove this. | 1283 // FIXME(sky): remove this. |
| 1338 return fixedOffset; | 1284 return fixedOffset; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1434 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() | 1380 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() |
| 1435 { | 1381 { |
| 1436 if (m_rareData) | 1382 if (m_rareData) |
| 1437 return *m_rareData; | 1383 return *m_rareData; |
| 1438 | 1384 |
| 1439 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); | 1385 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); |
| 1440 return *m_rareData; | 1386 return *m_rareData; |
| 1441 } | 1387 } |
| 1442 | 1388 |
| 1443 } // namespace blink | 1389 } // namespace blink |
| OLD | NEW |