Chromium Code Reviews| 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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 372 setPaginationStrut(0); | 372 setPaginationStrut(0); |
| 373 } | 373 } |
| 374 | 374 |
| 375 LayoutUnit beforeEdge = borderBefore() + paddingBefore(); | 375 LayoutUnit beforeEdge = borderBefore() + paddingBefore(); |
| 376 LayoutUnit afterEdge = borderAfter() + paddingAfter() + scrollbarLogicalHeig ht(); | 376 LayoutUnit afterEdge = borderAfter() + paddingAfter() + scrollbarLogicalHeig ht(); |
| 377 LayoutUnit previousHeight = logicalHeight(); | 377 LayoutUnit previousHeight = logicalHeight(); |
| 378 setLogicalHeight(beforeEdge); | 378 setLogicalHeight(beforeEdge); |
| 379 | 379 |
| 380 m_repaintLogicalTop = 0; | 380 m_repaintLogicalTop = 0; |
| 381 m_repaintLogicalBottom = 0; | 381 m_repaintLogicalBottom = 0; |
| 382 LayoutUnit maxFloatLogicalBottom = 0; | |
| 383 if (!firstChild() && !isAnonymousBlock()) | 382 if (!firstChild() && !isAnonymousBlock()) |
| 384 setChildrenInline(true); | 383 setChildrenInline(true); |
| 385 | 384 |
| 386 FastTextAutosizer::LayoutScope fastTextAutosizerLayoutScope(this); | 385 FastTextAutosizer::LayoutScope fastTextAutosizerLayoutScope(this); |
| 387 | 386 |
| 388 if (childrenInline()) | 387 if (childrenInline()) |
| 389 layoutInlineChildren(relayoutChildren, m_repaintLogicalTop, m_repaintLog icalBottom, afterEdge); | 388 layoutInlineChildren(relayoutChildren, m_repaintLogicalTop, m_repaintLog icalBottom, afterEdge); |
| 390 else | 389 else |
| 391 layoutBlockChildren(relayoutChildren, maxFloatLogicalBottom, layoutScope , beforeEdge, afterEdge); | 390 layoutBlockChildren(relayoutChildren, layoutScope, beforeEdge, afterEdge ); |
| 392 | 391 |
| 393 // Expand our intrinsic height to encompass floats. | 392 // Expand our intrinsic height to encompass floats. |
| 394 if (lowestFloatLogicalBottom() > (logicalHeight() - afterEdge) && createsBlo ckFormattingContext()) | 393 if (lowestFloatLogicalBottom() > (logicalHeight() - afterEdge) && createsBlo ckFormattingContext()) |
| 395 setLogicalHeight(lowestFloatLogicalBottom() + afterEdge); | 394 setLogicalHeight(lowestFloatLogicalBottom() + afterEdge); |
| 396 | 395 |
| 397 if (RenderMultiColumnFlowThread* flowThread = multiColumnFlowThread()) { | 396 if (RenderMultiColumnFlowThread* flowThread = multiColumnFlowThread()) { |
| 398 if (flowThread->recalculateColumnHeights()) { | 397 if (flowThread->recalculateColumnHeights()) { |
| 399 setChildNeedsLayout(MarkOnlyThis); | 398 setChildNeedsLayout(MarkOnlyThis); |
| 400 return false; | 399 return false; |
| 401 } | 400 } |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 423 | 422 |
| 424 // Calculate our new height. | 423 // Calculate our new height. |
| 425 LayoutUnit oldHeight = logicalHeight(); | 424 LayoutUnit oldHeight = logicalHeight(); |
| 426 LayoutUnit oldClientAfterEdge = clientLogicalBottom(); | 425 LayoutUnit oldClientAfterEdge = clientLogicalBottom(); |
| 427 | 426 |
| 428 if (isRenderFlowThread()) | 427 if (isRenderFlowThread()) |
| 429 toRenderFlowThread(this)->applyBreakAfterContent(oldClientAfterEdge); | 428 toRenderFlowThread(this)->applyBreakAfterContent(oldClientAfterEdge); |
| 430 | 429 |
| 431 updateLogicalHeight(); | 430 updateLogicalHeight(); |
| 432 LayoutUnit newHeight = logicalHeight(); | 431 LayoutUnit newHeight = logicalHeight(); |
| 433 if (oldHeight != newHeight) { | 432 if (oldHeight > newHeight && !childrenInline()) { |
| 434 if (oldHeight > newHeight && maxFloatLogicalBottom > newHeight && !child renInline()) { | 433 // One of our children's floats may have become an overhanging float for us. |
| 435 // One of our children's floats may have become an overhanging float for us. We need to look for it. | 434 for (RenderObject* child = lastChild(); child; child = child->previousSi bling()) { |
| 436 for (RenderObject* child = firstChild(); child; child = child->nextS ibling()) { | 435 if (child->isRenderBlockFlow() && !child->isFloatingOrOutOfFlowPosit ioned()) { |
| 437 if (child->isRenderBlockFlow() && !child->isFloatingOrOutOfFlowP ositioned()) { | 436 RenderBlockFlow* block = toRenderBlockFlow(child); |
| 438 RenderBlockFlow* block = toRenderBlockFlow(child); | 437 if (block->lowestFloatLogicalBottom() + block->logicalTop() <= n ewHeight) |
| 439 if (block->lowestFloatLogicalBottom() + block->logicalTop() > newHeight) | 438 break; |
| 440 addOverhangingFloats(block, false); | 439 addOverhangingFloats(block, false); |
| 441 } | |
| 442 } | 440 } |
| 443 } | 441 } |
| 444 } | 442 } |
| 445 | 443 |
| 446 bool heightChanged = (previousHeight != newHeight); | 444 bool heightChanged = (previousHeight != newHeight); |
| 447 if (heightChanged) | 445 if (heightChanged) |
| 448 relayoutChildren = true; | 446 relayoutChildren = true; |
| 449 | 447 |
| 450 layoutPositionedObjects(relayoutChildren || isDocumentElement(), oldLeft != logicalLeft() ? ForcedLayoutAfterContainingBlockMoved : DefaultLayout); | 448 layoutPositionedObjects(relayoutChildren || isDocumentElement(), oldLeft != logicalLeft() ? ForcedLayoutAfterContainingBlockMoved : DefaultLayout); |
| 451 | 449 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 495 if (applyDelta == ApplyLayoutDelta && !RuntimeEnabledFeatures::repaintAf terLayoutEnabled()) | 493 if (applyDelta == ApplyLayoutDelta && !RuntimeEnabledFeatures::repaintAf terLayoutEnabled()) |
| 496 view()->addLayoutDelta(LayoutSize(0, child->y() - logicalTop)); | 494 view()->addLayoutDelta(LayoutSize(0, child->y() - logicalTop)); |
| 497 child->setY(logicalTop); | 495 child->setY(logicalTop); |
| 498 } else { | 496 } else { |
| 499 if (applyDelta == ApplyLayoutDelta && !RuntimeEnabledFeatures::repaintAf terLayoutEnabled()) | 497 if (applyDelta == ApplyLayoutDelta && !RuntimeEnabledFeatures::repaintAf terLayoutEnabled()) |
| 500 view()->addLayoutDelta(LayoutSize(child->x() - logicalTop, 0)); | 498 view()->addLayoutDelta(LayoutSize(child->x() - logicalTop, 0)); |
| 501 child->setX(logicalTop); | 499 child->setX(logicalTop); |
| 502 } | 500 } |
| 503 } | 501 } |
| 504 | 502 |
| 505 void RenderBlockFlow::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, LayoutUnit& previousFloatLogicalBottom, LayoutUnit& maxFloatLogicalBottom) | 503 void RenderBlockFlow::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, LayoutUnit& previousFloatLogicalBottom) |
| 506 { | 504 { |
| 507 LayoutUnit oldPosMarginBefore = maxPositiveMarginBefore(); | 505 LayoutUnit oldPosMarginBefore = maxPositiveMarginBefore(); |
| 508 LayoutUnit oldNegMarginBefore = maxNegativeMarginBefore(); | 506 LayoutUnit oldNegMarginBefore = maxNegativeMarginBefore(); |
| 509 | 507 |
| 510 // The child is a normal flow object. Compute the margins we will use for co llapsing now. | 508 // The child is a normal flow object. Compute the margins we will use for co llapsing now. |
| 511 child->computeAndSetBlockDirectionMargins(this); | 509 child->computeAndSetBlockDirectionMargins(this); |
| 512 | 510 |
| 513 // Try to guess our correct logical top position. In most cases this guess w ill | 511 // Try to guess our correct logical top position. In most cases this guess w ill |
| 514 // be correct. Only if we're wrong (when we compute the real logical top pos ition) | 512 // be correct. Only if we're wrong (when we compute the real logical top pos ition) |
| 515 // will we have to potentially relayout. | 513 // will we have to potentially relayout. |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 622 LayoutSize childOffset = child->location() - oldRect.location(); | 620 LayoutSize childOffset = child->location() - oldRect.location(); |
| 623 | 621 |
| 624 // Update our height now that the child has been placed in the correct posit ion. | 622 // Update our height now that the child has been placed in the correct posit ion. |
| 625 setLogicalHeight(logicalHeight() + logicalHeightForChild(child)); | 623 setLogicalHeight(logicalHeight() + logicalHeightForChild(child)); |
| 626 if (mustSeparateMarginAfterForChild(child)) { | 624 if (mustSeparateMarginAfterForChild(child)) { |
| 627 setLogicalHeight(logicalHeight() + marginAfterForChild(child)); | 625 setLogicalHeight(logicalHeight() + marginAfterForChild(child)); |
| 628 marginInfo.clearMargin(); | 626 marginInfo.clearMargin(); |
| 629 } | 627 } |
| 630 // If the child has overhanging floats that intrude into following siblings (or possibly out | 628 // If the child has overhanging floats that intrude into following siblings (or possibly out |
| 631 // of this block), then the parent gets notified of the floats now. | 629 // of this block), then the parent gets notified of the floats now. |
| 632 if (childRenderBlockFlow && childRenderBlockFlow->containsFloats()) | 630 if (childRenderBlockFlow) |
|
leviw_travelin_and_unemployed
2014/04/15 20:27:30
You're taking out the check because we already che
| |
| 633 maxFloatLogicalBottom = max(maxFloatLogicalBottom, addOverhangingFloats( childRenderBlockFlow, !childNeededLayout)); | 631 addOverhangingFloats(childRenderBlockFlow, !childNeededLayout); |
| 634 | 632 |
| 635 if (childOffset.width() || childOffset.height()) { | 633 if (childOffset.width() || childOffset.height()) { |
| 636 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) | 634 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) |
| 637 view()->addLayoutDelta(childOffset); | 635 view()->addLayoutDelta(childOffset); |
| 638 | 636 |
| 639 // If the child moved, we have to repaint it as well as any floating/pos itioned | 637 // If the child moved, we have to repaint it as well as any floating/pos itioned |
| 640 // descendants. An exception is if we need a layout. In this case, we kn ow we're going to | 638 // descendants. An exception is if we need a layout. In this case, we kn ow we're going to |
| 641 // repaint ourselves (and the child) anyway. | 639 // repaint ourselves (and the child) anyway. |
| 642 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && childHadLayou t && !selfNeedsLayout()) | 640 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && childHadLayou t && !selfNeedsLayout()) |
| 643 child->repaintOverhangingFloats(true); | 641 child->repaintOverhangingFloats(true); |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 880 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set( ); | 878 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set( ); |
| 881 FloatingObjectSetIterator end = floatingObjectSet.end(); | 879 FloatingObjectSetIterator end = floatingObjectSet.end(); |
| 882 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end && !oldIntrudingFloatSet.isEmpty(); ++it) | 880 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end && !oldIntrudingFloatSet.isEmpty(); ++it) |
| 883 oldIntrudingFloatSet.remove((*it)->renderer()); | 881 oldIntrudingFloatSet.remove((*it)->renderer()); |
| 884 if (!oldIntrudingFloatSet.isEmpty()) | 882 if (!oldIntrudingFloatSet.isEmpty()) |
| 885 markAllDescendantsWithFloatsForLayout(); | 883 markAllDescendantsWithFloatsForLayout(); |
| 886 } | 884 } |
| 887 } | 885 } |
| 888 } | 886 } |
| 889 | 887 |
| 890 void RenderBlockFlow::layoutBlockChildren(bool relayoutChildren, LayoutUnit& max FloatLogicalBottom, SubtreeLayoutScope& layoutScope, LayoutUnit beforeEdge, Layo utUnit afterEdge) | 888 void RenderBlockFlow::layoutBlockChildren(bool relayoutChildren, SubtreeLayoutSc ope& layoutScope, LayoutUnit beforeEdge, LayoutUnit afterEdge) |
| 891 { | 889 { |
| 892 dirtyForLayoutFromPercentageHeightDescendants(layoutScope); | 890 dirtyForLayoutFromPercentageHeightDescendants(layoutScope); |
| 893 | 891 |
| 894 // The margin struct caches all our current margin collapsing state. The com pact struct caches state when we encounter compacts, | 892 // The margin struct caches all our current margin collapsing state. The com pact struct caches state when we encounter compacts, |
| 895 MarginInfo marginInfo(this, beforeEdge, afterEdge); | 893 MarginInfo marginInfo(this, beforeEdge, afterEdge); |
| 896 | 894 |
| 897 // Fieldsets need to find their legend and position it inside the border of the object. | 895 // Fieldsets need to find their legend and position it inside the border of the object. |
| 898 // The legend then gets skipped during normal layout. The same is true for r uby text. | 896 // The legend then gets skipped during normal layout. The same is true for r uby text. |
| 899 // It doesn't get included in the normal layout process but is instead skipp ed. | 897 // It doesn't get included in the normal layout process but is instead skipp ed. |
| 900 RenderObject* childToExclude = layoutSpecialExcludedChild(relayoutChildren, layoutScope); | 898 RenderObject* childToExclude = layoutSpecialExcludedChild(relayoutChildren, layoutScope); |
| 901 | 899 |
| 902 LayoutUnit previousFloatLogicalBottom = 0; | 900 LayoutUnit previousFloatLogicalBottom = 0; |
| 903 maxFloatLogicalBottom = 0; | |
| 904 | 901 |
| 905 RenderBox* next = firstChildBox(); | 902 RenderBox* next = firstChildBox(); |
| 906 RenderBox* lastNormalFlowChild = 0; | 903 RenderBox* lastNormalFlowChild = 0; |
| 907 | 904 |
| 908 while (next) { | 905 while (next) { |
| 909 RenderBox* child = next; | 906 RenderBox* child = next; |
| 910 next = child->nextSiblingBox(); | 907 next = child->nextSiblingBox(); |
| 911 | 908 |
| 912 // FIXME: this should only be set from clearNeedsLayout crbug.com/361250 | 909 // FIXME: this should only be set from clearNeedsLayout crbug.com/361250 |
| 913 child->setLayoutDidGetCalled(true); | 910 child->setLayoutDidGetCalled(true); |
| 914 | 911 |
| 915 if (childToExclude == child) | 912 if (childToExclude == child) |
| 916 continue; // Skip this child, since it will be positioned by the spe cialized subclass (fieldsets and ruby runs). | 913 continue; // Skip this child, since it will be positioned by the spe cialized subclass (fieldsets and ruby runs). |
| 917 | 914 |
| 918 updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, child); | 915 updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, child); |
| 919 | 916 |
| 920 if (child->isOutOfFlowPositioned()) { | 917 if (child->isOutOfFlowPositioned()) { |
| 921 child->containingBlock()->insertPositionedObject(child); | 918 child->containingBlock()->insertPositionedObject(child); |
| 922 adjustPositionedBlock(child, marginInfo); | 919 adjustPositionedBlock(child, marginInfo); |
| 923 continue; | 920 continue; |
| 924 } | 921 } |
| 925 if (child->isFloating()) { | 922 if (child->isFloating()) { |
| 926 insertFloatingObject(child); | 923 insertFloatingObject(child); |
| 927 adjustFloatingBlock(marginInfo); | 924 adjustFloatingBlock(marginInfo); |
| 928 continue; | 925 continue; |
| 929 } | 926 } |
| 930 | 927 |
| 931 // Lay out the child. | 928 // Lay out the child. |
| 932 layoutBlockChild(child, marginInfo, previousFloatLogicalBottom, maxFloat LogicalBottom); | 929 layoutBlockChild(child, marginInfo, previousFloatLogicalBottom); |
| 933 lastNormalFlowChild = child; | 930 lastNormalFlowChild = child; |
| 934 } | 931 } |
| 935 | 932 |
| 936 // Now do the handling of the bottom of the block, adding in our bottom bord er/padding and | 933 // Now do the handling of the bottom of the block, adding in our bottom bord er/padding and |
| 937 // determining the correct collapsed bottom margin information. | 934 // determining the correct collapsed bottom margin information. |
| 938 handleAfterSideOfBlock(lastNormalFlowChild, beforeEdge, afterEdge, marginInf o); | 935 handleAfterSideOfBlock(lastNormalFlowChild, beforeEdge, afterEdge, marginInf o); |
| 939 } | 936 } |
| 940 | 937 |
| 941 // Our MarginInfo state used when laying out block children. | 938 // Our MarginInfo state used when laying out block children. |
| 942 MarginInfo::MarginInfo(RenderBlockFlow* blockFlow, LayoutUnit beforeBorderPaddin g, LayoutUnit afterBorderPadding) | 939 MarginInfo::MarginInfo(RenderBlockFlow* blockFlow, LayoutUnit beforeBorderPaddin g, LayoutUnit afterBorderPadding) |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1171 LayoutUnit oldLogicalTop = logicalTop; | 1168 LayoutUnit oldLogicalTop = logicalTop; |
| 1172 logicalTop = min(logicalTop, nextPageLogicalTop(beforeCollapseLogicalTop )); | 1169 logicalTop = min(logicalTop, nextPageLogicalTop(beforeCollapseLogicalTop )); |
| 1173 setLogicalHeight(logicalHeight() + (logicalTop - oldLogicalTop)); | 1170 setLogicalHeight(logicalHeight() + (logicalTop - oldLogicalTop)); |
| 1174 } | 1171 } |
| 1175 | 1172 |
| 1176 if (previousBlockFlow) { | 1173 if (previousBlockFlow) { |
| 1177 // If |child| is a self-collapsing block it may have collapsed into a pr evious sibling and although it hasn't reduced the height of the parent yet | 1174 // If |child| is a self-collapsing block it may have collapsed into a pr evious sibling and although it hasn't reduced the height of the parent yet |
| 1178 // any floats from the parent will now overhang. | 1175 // any floats from the parent will now overhang. |
| 1179 LayoutUnit oldLogicalHeight = logicalHeight(); | 1176 LayoutUnit oldLogicalHeight = logicalHeight(); |
| 1180 setLogicalHeight(logicalTop); | 1177 setLogicalHeight(logicalTop); |
| 1181 if (previousBlockFlow->containsFloats() && !previousBlockFlow->avoidsFlo ats() && (previousBlockFlow->logicalTop() + previousBlockFlow->lowestFloatLogica lBottom()) > logicalTop) | 1178 if (!previousBlockFlow->avoidsFloats() && (previousBlockFlow->logicalTop () + previousBlockFlow->lowestFloatLogicalBottom()) > logicalTop) |
| 1182 addOverhangingFloats(previousBlockFlow, false); | 1179 addOverhangingFloats(previousBlockFlow, false); |
| 1183 setLogicalHeight(oldLogicalHeight); | 1180 setLogicalHeight(oldLogicalHeight); |
| 1184 | 1181 |
| 1185 // If |child|'s previous sibling is a self-collapsing block that cleared a float and margin collapsing resulted in |child| moving up | 1182 // If |child|'s previous sibling is a self-collapsing block that cleared a float and margin collapsing resulted in |child| moving up |
| 1186 // into the margin area of the self-collapsing block then the float it c lears is now intruding into |child|. Layout again so that we can look for | 1183 // into the margin area of the self-collapsing block then the float it c lears is now intruding into |child|. Layout again so that we can look for |
| 1187 // floats in the parent that overhang |child|'s new logical top. | 1184 // floats in the parent that overhang |child|'s new logical top. |
| 1188 bool logicalTopIntrudesIntoFloat = clearanceForSelfCollapsingBlock > 0 & & logicalTop < beforeCollapseLogicalTop; | 1185 bool logicalTopIntrudesIntoFloat = clearanceForSelfCollapsingBlock > 0 & & logicalTop < beforeCollapseLogicalTop; |
| 1189 if (logicalTopIntrudesIntoFloat && containsFloats() && !child->avoidsFlo ats() && lowestFloatLogicalBottom() > logicalTop) | 1186 if (logicalTopIntrudesIntoFloat && containsFloats() && !child->avoidsFlo ats() && lowestFloatLogicalBottom() > logicalTop) |
| 1190 child->setNeedsLayout(); | 1187 child->setNeedsLayout(); |
| 1191 } | 1188 } |
| (...skipping 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2437 LayoutSize offset = isHorizontalWritingMode() | 2434 LayoutSize offset = isHorizontalWritingMode() |
| 2438 ? LayoutSize(logicalLeftOffset - (prev != parent() ? prev->m arginLeft() : LayoutUnit()), logicalTopOffset) | 2435 ? LayoutSize(logicalLeftOffset - (prev != parent() ? prev->m arginLeft() : LayoutUnit()), logicalTopOffset) |
| 2439 : LayoutSize(logicalTopOffset, logicalLeftOffset - (prev != parent() ? prev->marginTop() : LayoutUnit())); | 2436 : LayoutSize(logicalTopOffset, logicalLeftOffset - (prev != parent() ? prev->marginTop() : LayoutUnit())); |
| 2440 | 2437 |
| 2441 m_floatingObjects->add(floatingObject->copyToNewContainer(offset )); | 2438 m_floatingObjects->add(floatingObject->copyToNewContainer(offset )); |
| 2442 } | 2439 } |
| 2443 } | 2440 } |
| 2444 } | 2441 } |
| 2445 } | 2442 } |
| 2446 | 2443 |
| 2447 LayoutUnit RenderBlockFlow::addOverhangingFloats(RenderBlockFlow* child, bool ma keChildPaintOtherFloats) | 2444 void RenderBlockFlow::addOverhangingFloats(RenderBlockFlow* child, bool makeChil dPaintOtherFloats) |
| 2448 { | 2445 { |
| 2449 // Prevent floats from being added to the canvas by the root element, e.g., <html>. | 2446 // Prevent floats from being added to the canvas by the root element, e.g., <html>. |
| 2450 if (child->hasOverflowClip() || !child->containsFloats() || child->isDocumen tElement() || child->hasColumns() || child->isWritingModeRoot()) | 2447 if (child->hasOverflowClip() || !child->containsFloats() || child->isDocumen tElement() || child->hasColumns() || child->isWritingModeRoot()) |
| 2451 return 0; | 2448 return; |
| 2452 | 2449 |
| 2453 LayoutUnit childLogicalTop = child->logicalTop(); | 2450 LayoutUnit childLogicalTop = child->logicalTop(); |
| 2454 LayoutUnit childLogicalLeft = child->logicalLeft(); | 2451 LayoutUnit childLogicalLeft = child->logicalLeft(); |
| 2455 LayoutUnit lowestFloatLogicalBottom = 0; | |
| 2456 | 2452 |
| 2457 // Floats that will remain the child's responsibility to paint should factor into its | 2453 // Floats that will remain the child's responsibility to paint should factor into its |
| 2458 // overflow. | 2454 // overflow. |
| 2459 FloatingObjectSetIterator childEnd = child->m_floatingObjects->set().end(); | 2455 FloatingObjectSetIterator childEnd = child->m_floatingObjects->set().end(); |
| 2460 for (FloatingObjectSetIterator childIt = child->m_floatingObjects->set().beg in(); childIt != childEnd; ++childIt) { | 2456 for (FloatingObjectSetIterator childIt = child->m_floatingObjects->set().beg in(); childIt != childEnd; ++childIt) { |
| 2461 FloatingObject* floatingObject = *childIt; | 2457 FloatingObject* floatingObject = *childIt; |
| 2462 LayoutUnit logicalBottomForFloat = min(this->logicalBottomForFloat(float ingObject), LayoutUnit::max() - childLogicalTop); | 2458 LayoutUnit logicalBottomForFloat = min(this->logicalBottomForFloat(float ingObject), LayoutUnit::max() - childLogicalTop); |
| 2463 LayoutUnit logicalBottom = childLogicalTop + logicalBottomForFloat; | 2459 LayoutUnit logicalBottom = childLogicalTop + logicalBottomForFloat; |
| 2464 lowestFloatLogicalBottom = max(lowestFloatLogicalBottom, logicalBottom); | |
| 2465 | 2460 |
| 2466 if (logicalBottom > logicalHeight()) { | 2461 if (logicalBottom > logicalHeight()) { |
| 2467 // If the object is not in the list, we add it now. | 2462 // If the object is not in the list, we add it now. |
| 2468 if (!containsFloat(floatingObject->renderer())) { | 2463 if (!containsFloat(floatingObject->renderer())) { |
| 2469 LayoutSize offset = isHorizontalWritingMode() ? LayoutSize(-chil dLogicalLeft, -childLogicalTop) : LayoutSize(-childLogicalTop, -childLogicalLeft ); | 2464 LayoutSize offset = isHorizontalWritingMode() ? LayoutSize(-chil dLogicalLeft, -childLogicalTop) : LayoutSize(-childLogicalTop, -childLogicalLeft ); |
| 2470 bool shouldPaint = false; | 2465 bool shouldPaint = false; |
| 2471 | 2466 |
| 2472 // The nearest enclosing layer always paints the float (so that zindex and stacking | 2467 // The nearest enclosing layer always paints the float (so that zindex and stacking |
| 2473 // behaves properly). We always want to propagate the desire to paint the float as | 2468 // behaves properly). We always want to propagate the desire to paint the float as |
| 2474 // far out as we can, to the outermost block that overlaps the f loat, stopping only | 2469 // far out as we can, to the outermost block that overlaps the f loat, stopping only |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 2493 // it should paint. | 2488 // it should paint. |
| 2494 floatingObject->setShouldPaint(true); | 2489 floatingObject->setShouldPaint(true); |
| 2495 } | 2490 } |
| 2496 | 2491 |
| 2497 // Since the float doesn't overhang, it didn't get put into our list . We need to go ahead and add its overflow in to the | 2492 // Since the float doesn't overhang, it didn't get put into our list . We need to go ahead and add its overflow in to the |
| 2498 // child now. | 2493 // child now. |
| 2499 if (floatingObject->isDescendant()) | 2494 if (floatingObject->isDescendant()) |
| 2500 child->addOverflowFromChild(floatingObject->renderer(), LayoutSi ze(xPositionForFloatIncludingMargin(floatingObject), yPositionForFloatIncludingM argin(floatingObject))); | 2495 child->addOverflowFromChild(floatingObject->renderer(), LayoutSi ze(xPositionForFloatIncludingMargin(floatingObject), yPositionForFloatIncludingM argin(floatingObject))); |
| 2501 } | 2496 } |
| 2502 } | 2497 } |
| 2503 return lowestFloatLogicalBottom; | |
| 2504 } | 2498 } |
| 2505 | 2499 |
| 2506 LayoutUnit RenderBlockFlow::lowestFloatLogicalBottom(FloatingObject::Type floatT ype) const | 2500 LayoutUnit RenderBlockFlow::lowestFloatLogicalBottom(FloatingObject::Type floatT ype) const |
| 2507 { | 2501 { |
| 2508 if (!m_floatingObjects) | 2502 if (!m_floatingObjects) |
| 2509 return 0; | 2503 return 0; |
| 2510 | 2504 |
| 2511 return m_floatingObjects->lowestFloatLogicalBottom(floatType); | 2505 return m_floatingObjects->lowestFloatLogicalBottom(floatType); |
| 2512 } | 2506 } |
| 2513 | 2507 |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2803 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() | 2797 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() |
| 2804 { | 2798 { |
| 2805 if (m_rareData) | 2799 if (m_rareData) |
| 2806 return *m_rareData; | 2800 return *m_rareData; |
| 2807 | 2801 |
| 2808 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); | 2802 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); |
| 2809 return *m_rareData; | 2803 return *m_rareData; |
| 2810 } | 2804 } |
| 2811 | 2805 |
| 2812 } // namespace WebCore | 2806 } // namespace WebCore |
| OLD | NEW |