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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 return; | 294 return; |
295 | 295 |
296 SubtreeLayoutScope layoutScope(this); | 296 SubtreeLayoutScope layoutScope(this); |
297 | 297 |
298 // Multiple passes might be required for column and pagination based layout | 298 // Multiple passes might be required for column and pagination based layout |
299 // In the case of the old column code the number of passes will only be two | 299 // In the case of the old column code the number of passes will only be two |
300 // however, in the newer column code the number of passes could equal the | 300 // however, in the newer column code the number of passes could equal the |
301 // number of columns. | 301 // number of columns. |
302 bool done = false; | 302 bool done = false; |
303 LayoutUnit pageLogicalHeight = 0; | 303 LayoutUnit pageLogicalHeight = 0; |
| 304 LayoutRepainter repainter(*this, checkForRepaintDuringLayout()); |
304 while (!done) | 305 while (!done) |
305 done = layoutBlockFlow(relayoutChildren, pageLogicalHeight, layoutScope)
; | 306 done = layoutBlockFlow(relayoutChildren, pageLogicalHeight, layoutScope)
; |
| 307 |
| 308 fitBorderToLinesIfNeeded(); |
| 309 |
| 310 RenderView* renderView = view(); |
| 311 if (renderView->layoutState()->m_pageLogicalHeight) |
| 312 setPageLogicalOffset(renderView->layoutState()->pageLogicalOffset(*this,
logicalTop())); |
| 313 |
| 314 updateLayerTransform(); |
| 315 |
| 316 // Update our scroll information if we're overflow:auto/scroll/hidden now th
at we know if |
| 317 // we overflow or not. |
| 318 updateScrollInfoAfterLayout(); |
| 319 |
| 320 // Repaint with our new bounds if they are different from our old bounds. |
| 321 bool didFullRepaint = repainter.repaintAfterLayout(); |
| 322 if (!didFullRepaint && m_repaintLogicalTop != m_repaintLogicalBottom && (sty
le()->visibility() == VISIBLE || enclosingLayer()->hasVisibleContent())) { |
| 323 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) |
| 324 setShouldRepaintOverflow(true); |
| 325 else |
| 326 repaintOverflow(); |
| 327 } |
| 328 clearNeedsLayout(); |
306 } | 329 } |
307 | 330 |
308 inline bool RenderBlockFlow::layoutBlockFlow(bool relayoutChildren, LayoutUnit &
pageLogicalHeight, SubtreeLayoutScope& layoutScope) | 331 inline bool RenderBlockFlow::layoutBlockFlow(bool relayoutChildren, LayoutUnit &
pageLogicalHeight, SubtreeLayoutScope& layoutScope) |
309 { | 332 { |
310 LayoutRepainter repainter(*this, checkForRepaintDuringLayout()); | |
311 | |
312 LayoutUnit oldLeft = logicalLeft(); | 333 LayoutUnit oldLeft = logicalLeft(); |
313 if (updateLogicalWidthAndColumnWidth()) | 334 if (updateLogicalWidthAndColumnWidth()) |
314 relayoutChildren = true; | 335 relayoutChildren = true; |
315 | 336 |
316 rebuildFloatsFromIntruding(); | 337 rebuildFloatsFromIntruding(); |
317 | 338 |
318 bool pageLogicalHeightChanged = false; | 339 bool pageLogicalHeightChanged = false; |
319 bool hasSpecifiedPageLogicalHeight = false; | 340 bool hasSpecifiedPageLogicalHeight = false; |
320 checkForPaginationLogicalHeightChange(pageLogicalHeight, pageLogicalHeightCh
anged, hasSpecifiedPageLogicalHeight); | 341 checkForPaginationLogicalHeightChange(pageLogicalHeight, pageLogicalHeightCh
anged, hasSpecifiedPageLogicalHeight); |
321 | 342 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 else | 382 else |
362 layoutBlockChildren(relayoutChildren, maxFloatLogicalBottom, layoutScope
, beforeEdge, afterEdge); | 383 layoutBlockChildren(relayoutChildren, maxFloatLogicalBottom, layoutScope
, beforeEdge, afterEdge); |
363 | 384 |
364 // Expand our intrinsic height to encompass floats. | 385 // Expand our intrinsic height to encompass floats. |
365 if (lowestFloatLogicalBottom() > (logicalHeight() - afterEdge) && createsBlo
ckFormattingContext()) | 386 if (lowestFloatLogicalBottom() > (logicalHeight() - afterEdge) && createsBlo
ckFormattingContext()) |
366 setLogicalHeight(lowestFloatLogicalBottom() + afterEdge); | 387 setLogicalHeight(lowestFloatLogicalBottom() + afterEdge); |
367 | 388 |
368 if (RenderMultiColumnFlowThread* flowThread = multiColumnFlowThread()) { | 389 if (RenderMultiColumnFlowThread* flowThread = multiColumnFlowThread()) { |
369 if (flowThread->recalculateColumnHeights()) { | 390 if (flowThread->recalculateColumnHeights()) { |
370 setChildNeedsLayout(MarkOnlyThis); | 391 setChildNeedsLayout(MarkOnlyThis); |
371 statePusher.pop(); | |
372 return false; | 392 return false; |
373 } | 393 } |
374 } else if (hasColumns()) { | 394 } else if (hasColumns()) { |
375 OwnPtr<RenderOverflow> savedOverflow = m_overflow.release(); | 395 OwnPtr<RenderOverflow> savedOverflow = m_overflow.release(); |
376 if (childrenInline()) | 396 if (childrenInline()) |
377 addOverflowFromInlineChildren(); | 397 addOverflowFromInlineChildren(); |
378 else | 398 else |
379 addOverflowFromBlockChildren(); | 399 addOverflowFromBlockChildren(); |
380 LayoutUnit layoutOverflowLogicalBottom = (isHorizontalWritingMode() ? la
youtOverflowRect().maxY() : layoutOverflowRect().maxX()) - borderBefore() - padd
ingBefore(); | 400 LayoutUnit layoutOverflowLogicalBottom = (isHorizontalWritingMode() ? la
youtOverflowRect().maxY() : layoutOverflowRect().maxX()) - borderBefore() - padd
ingBefore(); |
381 m_overflow = savedOverflow.release(); | 401 m_overflow = savedOverflow.release(); |
382 | 402 |
383 if (!hasSpecifiedPageLogicalHeight && shouldRelayoutForPagination(pageLo
gicalHeight, layoutOverflowLogicalBottom)) { | 403 if (!hasSpecifiedPageLogicalHeight && shouldRelayoutForPagination(pageLo
gicalHeight, layoutOverflowLogicalBottom)) { |
384 statePusher.pop(); | |
385 setEverHadLayout(true); | 404 setEverHadLayout(true); |
386 return false; | 405 return false; |
387 } | 406 } |
388 | 407 |
389 setColumnCountAndHeight(ceilf(layoutOverflowLogicalBottom.toFloat() / pa
geLogicalHeight.toFloat()), pageLogicalHeight.toFloat()); | 408 setColumnCountAndHeight(ceilf(layoutOverflowLogicalBottom.toFloat() / pa
geLogicalHeight.toFloat()), pageLogicalHeight.toFloat()); |
390 } | 409 } |
391 | 410 |
392 if (shouldBreakAtLineToAvoidWidow()) { | 411 if (shouldBreakAtLineToAvoidWidow()) { |
393 statePusher.pop(); | |
394 setEverHadLayout(true); | 412 setEverHadLayout(true); |
395 return false; | 413 return false; |
396 } | 414 } |
397 | 415 |
398 // Calculate our new height. | 416 // Calculate our new height. |
399 LayoutUnit oldHeight = logicalHeight(); | 417 LayoutUnit oldHeight = logicalHeight(); |
400 LayoutUnit oldClientAfterEdge = clientLogicalBottom(); | 418 LayoutUnit oldClientAfterEdge = clientLogicalBottom(); |
401 | 419 |
402 if (isRenderFlowThread()) | 420 if (isRenderFlowThread()) |
403 toRenderFlowThread(this)->applyBreakAfterContent(oldClientAfterEdge); | 421 toRenderFlowThread(this)->applyBreakAfterContent(oldClientAfterEdge); |
(...skipping 17 matching lines...) Expand all Loading... |
421 if (heightChanged) | 439 if (heightChanged) |
422 relayoutChildren = true; | 440 relayoutChildren = true; |
423 | 441 |
424 layoutPositionedObjects(relayoutChildren || isRoot(), oldLeft != logicalLeft
() ? ForcedLayoutAfterContainingBlockMoved : DefaultLayout); | 442 layoutPositionedObjects(relayoutChildren || isRoot(), oldLeft != logicalLeft
() ? ForcedLayoutAfterContainingBlockMoved : DefaultLayout); |
425 | 443 |
426 updateRegionsAndShapesAfterChildLayout(flowThread, heightChanged); | 444 updateRegionsAndShapesAfterChildLayout(flowThread, heightChanged); |
427 | 445 |
428 // Add overflow from children (unless we're multi-column, since in that case
all our child overflow is clipped anyway). | 446 // Add overflow from children (unless we're multi-column, since in that case
all our child overflow is clipped anyway). |
429 computeOverflow(oldClientAfterEdge); | 447 computeOverflow(oldClientAfterEdge); |
430 | 448 |
431 statePusher.pop(); | |
432 | |
433 fitBorderToLinesIfNeeded(); | |
434 | |
435 RenderView* renderView = view(); | |
436 if (renderView->layoutState()->m_pageLogicalHeight) | |
437 setPageLogicalOffset(renderView->layoutState()->pageLogicalOffset(*this,
logicalTop())); | |
438 | |
439 updateLayerTransform(); | |
440 | |
441 // Update our scroll information if we're overflow:auto/scroll/hidden now th
at we know if | |
442 // we overflow or not. | |
443 updateScrollInfoAfterLayout(); | |
444 | |
445 // Repaint with our new bounds if they are different from our old bounds. | |
446 bool didFullRepaint = repainter.repaintAfterLayout(); | |
447 if (!didFullRepaint && m_repaintLogicalTop != m_repaintLogicalBottom && (sty
le()->visibility() == VISIBLE || enclosingLayer()->hasVisibleContent())) { | |
448 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) | |
449 setShouldRepaintOverflow(true); | |
450 else | |
451 repaintOverflow(); | |
452 } | |
453 | |
454 clearNeedsLayout(); | |
455 return true; | 449 return true; |
456 } | 450 } |
457 | 451 |
458 void RenderBlockFlow::determineLogicalLeftPositionForChild(RenderBox* child, App
lyLayoutDeltaMode applyDelta) | 452 void RenderBlockFlow::determineLogicalLeftPositionForChild(RenderBox* child, App
lyLayoutDeltaMode applyDelta) |
459 { | 453 { |
460 LayoutUnit startPosition = borderStart() + paddingStart(); | 454 LayoutUnit startPosition = borderStart() + paddingStart(); |
461 if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) | 455 if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) |
462 startPosition -= verticalScrollbarWidth(); | 456 startPosition -= verticalScrollbarWidth(); |
463 LayoutUnit totalAvailableLogicalWidth = borderAndPaddingLogicalWidth() + ava
ilableLogicalWidth(); | 457 LayoutUnit totalAvailableLogicalWidth = borderAndPaddingLogicalWidth() + ava
ilableLogicalWidth(); |
464 | 458 |
(...skipping 2357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2822 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() | 2816 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() |
2823 { | 2817 { |
2824 if (m_rareData) | 2818 if (m_rareData) |
2825 return *m_rareData; | 2819 return *m_rareData; |
2826 | 2820 |
2827 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); | 2821 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); |
2828 return *m_rareData; | 2822 return *m_rareData; |
2829 } | 2823 } |
2830 | 2824 |
2831 } // namespace WebCore | 2825 } // namespace WebCore |
OLD | NEW |