| 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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 setChildrenInline(true); | 431 setChildrenInline(true); |
| 432 | 432 |
| 433 TextAutosizer::LayoutScope textAutosizerLayoutScope(this); | 433 TextAutosizer::LayoutScope textAutosizerLayoutScope(this); |
| 434 | 434 |
| 435 if (childrenInline()) | 435 if (childrenInline()) |
| 436 layoutInlineChildren(relayoutChildren, m_paintInvalidationLogicalTop, m_
paintInvalidationLogicalBottom, afterEdge); | 436 layoutInlineChildren(relayoutChildren, m_paintInvalidationLogicalTop, m_
paintInvalidationLogicalBottom, afterEdge); |
| 437 else | 437 else |
| 438 layoutBlockChildren(relayoutChildren, layoutScope, beforeEdge, afterEdge
); | 438 layoutBlockChildren(relayoutChildren, layoutScope, beforeEdge, afterEdge
); |
| 439 | 439 |
| 440 // Expand our intrinsic height to encompass floats. | 440 // Expand our intrinsic height to encompass floats. |
| 441 if (lowestFloatLogicalBottom() > (logicalHeight() - afterEdge) && createsBlo
ckFormattingContext()) | 441 if (lowestFloatLogicalBottom() > (logicalHeight() - afterEdge) && createsNew
FormattingContext()) |
| 442 setLogicalHeight(lowestFloatLogicalBottom() + afterEdge); | 442 setLogicalHeight(lowestFloatLogicalBottom() + afterEdge); |
| 443 | 443 |
| 444 if (RenderMultiColumnFlowThread* flowThread = multiColumnFlowThread()) { | 444 if (RenderMultiColumnFlowThread* flowThread = multiColumnFlowThread()) { |
| 445 if (flowThread->recalculateColumnHeights()) { | 445 if (flowThread->recalculateColumnHeights()) { |
| 446 setChildNeedsLayout(MarkOnlyThis); | 446 setChildNeedsLayout(MarkOnlyThis); |
| 447 return false; | 447 return false; |
| 448 } | 448 } |
| 449 } else if (hasColumns()) { | 449 } else if (hasColumns()) { |
| 450 OwnPtr<RenderOverflow> savedOverflow = m_overflow.release(); | 450 OwnPtr<RenderOverflow> savedOverflow = m_overflow.release(); |
| 451 if (childrenInline()) | 451 if (childrenInline()) |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 // See <rdar://problem/8049753>, where float property is applied on a text n
ode in a SVG. | 922 // See <rdar://problem/8049753>, where float property is applied on a text n
ode in a SVG. |
| 923 if (!parent() || !parent()->isRenderBlockFlow()) | 923 if (!parent() || !parent()->isRenderBlockFlow()) |
| 924 return; | 924 return; |
| 925 | 925 |
| 926 // Attempt to locate a previous sibling with overhanging floats. We skip any
elements that | 926 // Attempt to locate a previous sibling with overhanging floats. We skip any
elements that |
| 927 // may have shifted to avoid floats, and any objects whose floats cannot int
eract with objects | 927 // may have shifted to avoid floats, and any objects whose floats cannot int
eract with objects |
| 928 // outside it (i.e. objects that create a new block formatting context). | 928 // outside it (i.e. objects that create a new block formatting context). |
| 929 RenderBlockFlow* parentBlockFlow = toRenderBlockFlow(parent()); | 929 RenderBlockFlow* parentBlockFlow = toRenderBlockFlow(parent()); |
| 930 bool parentHasFloats = false; | 930 bool parentHasFloats = false; |
| 931 RenderObject* prev = previousSibling(); | 931 RenderObject* prev = previousSibling(); |
| 932 while (prev && (!prev->isBox() || !prev->isRenderBlock() || toRenderBlock(pr
ev)->avoidsFloats() || toRenderBlock(prev)->createsBlockFormattingContext())) { | 932 while (prev && (!prev->isBox() || !prev->isRenderBlock() || toRenderBlock(pr
ev)->avoidsFloats() || toRenderBlock(prev)->createsNewFormattingContext())) { |
| 933 if (prev->isFloating()) | 933 if (prev->isFloating()) |
| 934 parentHasFloats = true; | 934 parentHasFloats = true; |
| 935 prev = prev->previousSibling(); | 935 prev = prev->previousSibling(); |
| 936 } | 936 } |
| 937 | 937 |
| 938 // First add in floats from the parent. Self-collapsing blocks let their par
ent track any floats that intrude into | 938 // First add in floats from the parent. Self-collapsing blocks let their par
ent track any floats that intrude into |
| 939 // them (as opposed to floats they contain themselves) so check for those he
re too. | 939 // them (as opposed to floats they contain themselves) so check for those he
re too. |
| 940 LayoutUnit logicalTopOffset = logicalTop(); | 940 LayoutUnit logicalTopOffset = logicalTop(); |
| 941 bool parentHasIntrudingFloats = !parentHasFloats && (!prev || toRenderBlockF
low(prev)->isSelfCollapsingBlock()) && parentBlockFlow->lowestFloatLogicalBottom
() > logicalTopOffset; | 941 bool parentHasIntrudingFloats = !parentHasFloats && (!prev || toRenderBlockF
low(prev)->isSelfCollapsingBlock()) && parentBlockFlow->lowestFloatLogicalBottom
() > logicalTopOffset; |
| 942 if (parentHasFloats || parentHasIntrudingFloats) | 942 if (parentHasFloats || parentHasIntrudingFloats) |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1071 : m_canCollapseMarginAfterWithLastChild(true) | 1071 : m_canCollapseMarginAfterWithLastChild(true) |
| 1072 , m_atBeforeSideOfBlock(true) | 1072 , m_atBeforeSideOfBlock(true) |
| 1073 , m_atAfterSideOfBlock(false) | 1073 , m_atAfterSideOfBlock(false) |
| 1074 , m_hasMarginBeforeQuirk(false) | 1074 , m_hasMarginBeforeQuirk(false) |
| 1075 , m_hasMarginAfterQuirk(false) | 1075 , m_hasMarginAfterQuirk(false) |
| 1076 , m_determinedMarginBeforeQuirk(false) | 1076 , m_determinedMarginBeforeQuirk(false) |
| 1077 , m_discardMargin(false) | 1077 , m_discardMargin(false) |
| 1078 { | 1078 { |
| 1079 RenderStyle* blockStyle = blockFlow->style(); | 1079 RenderStyle* blockStyle = blockFlow->style(); |
| 1080 ASSERT(blockFlow->isRenderView() || blockFlow->parent()); | 1080 ASSERT(blockFlow->isRenderView() || blockFlow->parent()); |
| 1081 m_canCollapseWithChildren = !blockFlow->createsBlockFormattingContext() && !
blockFlow->isRenderFlowThread() && !blockFlow->isRenderView(); | 1081 m_canCollapseWithChildren = !blockFlow->createsNewFormattingContext() && !bl
ockFlow->isRenderFlowThread() && !blockFlow->isRenderView(); |
| 1082 | 1082 |
| 1083 m_canCollapseMarginBeforeWithChildren = m_canCollapseWithChildren && !before
BorderPadding && blockStyle->marginBeforeCollapse() != MSEPARATE; | 1083 m_canCollapseMarginBeforeWithChildren = m_canCollapseWithChildren && !before
BorderPadding && blockStyle->marginBeforeCollapse() != MSEPARATE; |
| 1084 | 1084 |
| 1085 // If any height other than auto is specified in CSS, then we don't collapse
our bottom | 1085 // If any height other than auto is specified in CSS, then we don't collapse
our bottom |
| 1086 // margins with our children's margins. To do otherwise would be to risk odd
visual | 1086 // margins with our children's margins. To do otherwise would be to risk odd
visual |
| 1087 // effects when the children overflow out of the parent block and yet still
collapse | 1087 // effects when the children overflow out of the parent block and yet still
collapse |
| 1088 // with it. We also don't collapse if we have any bottom border/padding. | 1088 // with it. We also don't collapse if we have any bottom border/padding. |
| 1089 m_canCollapseMarginAfterWithChildren = m_canCollapseWithChildren && !afterBo
rderPadding | 1089 m_canCollapseMarginAfterWithChildren = m_canCollapseWithChildren && !afterBo
rderPadding |
| 1090 && (blockStyle->logicalHeight().isAuto() && !blockStyle->logicalHeight()
.value()) && blockStyle->marginAfterCollapse() != MSEPARATE; | 1090 && (blockStyle->logicalHeight().isAuto() && !blockStyle->logicalHeight()
.value()) && blockStyle->marginAfterCollapse() != MSEPARATE; |
| 1091 | 1091 |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1769 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++
it) { | 1769 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++
it) { |
| 1770 FloatingObject* floatingObject = it->get(); | 1770 FloatingObject* floatingObject = it->get(); |
| 1771 if (floatingObject->isDescendant()) | 1771 if (floatingObject->isDescendant()) |
| 1772 addOverflowFromChild(floatingObject->renderer(), IntSize(xPositionFo
rFloatIncludingMargin(floatingObject), yPositionForFloatIncludingMargin(floating
Object))); | 1772 addOverflowFromChild(floatingObject->renderer(), IntSize(xPositionFo
rFloatIncludingMargin(floatingObject), yPositionForFloatIncludingMargin(floating
Object))); |
| 1773 } | 1773 } |
| 1774 } | 1774 } |
| 1775 | 1775 |
| 1776 void RenderBlockFlow::computeOverflow(LayoutUnit oldClientAfterEdge, bool recomp
uteFloats) | 1776 void RenderBlockFlow::computeOverflow(LayoutUnit oldClientAfterEdge, bool recomp
uteFloats) |
| 1777 { | 1777 { |
| 1778 RenderBlock::computeOverflow(oldClientAfterEdge, recomputeFloats); | 1778 RenderBlock::computeOverflow(oldClientAfterEdge, recomputeFloats); |
| 1779 if (!hasColumns() && (recomputeFloats || createsBlockFormattingContext() ||
hasSelfPaintingLayer())) | 1779 if (!hasColumns() && (recomputeFloats || createsNewFormattingContext() || ha
sSelfPaintingLayer())) |
| 1780 addOverflowFromFloats(); | 1780 addOverflowFromFloats(); |
| 1781 } | 1781 } |
| 1782 | 1782 |
| 1783 RootInlineBox* RenderBlockFlow::createAndAppendRootInlineBox() | 1783 RootInlineBox* RenderBlockFlow::createAndAppendRootInlineBox() |
| 1784 { | 1784 { |
| 1785 RootInlineBox* rootBox = createRootInlineBox(); | 1785 RootInlineBox* rootBox = createRootInlineBox(); |
| 1786 m_lineBoxes.appendLineBox(rootBox); | 1786 m_lineBoxes.appendLineBox(rootBox); |
| 1787 | 1787 |
| 1788 return rootBox; | 1788 return rootBox; |
| 1789 } | 1789 } |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2469 return false; | 2469 return false; |
| 2470 | 2470 |
| 2471 return logicalBottomForFloat(it->get()) > logicalHeight(); | 2471 return logicalBottomForFloat(it->get()) > logicalHeight(); |
| 2472 } | 2472 } |
| 2473 | 2473 |
| 2474 void RenderBlockFlow::addIntrudingFloats(RenderBlockFlow* prev, LayoutUnit logic
alLeftOffset, LayoutUnit logicalTopOffset) | 2474 void RenderBlockFlow::addIntrudingFloats(RenderBlockFlow* prev, LayoutUnit logic
alLeftOffset, LayoutUnit logicalTopOffset) |
| 2475 { | 2475 { |
| 2476 ASSERT(!avoidsFloats()); | 2476 ASSERT(!avoidsFloats()); |
| 2477 | 2477 |
| 2478 // If we create our own block formatting context then our contents don't int
eract with floats outside it, even those from our parent. | 2478 // If we create our own block formatting context then our contents don't int
eract with floats outside it, even those from our parent. |
| 2479 if (createsBlockFormattingContext()) | 2479 if (createsNewFormattingContext()) |
| 2480 return; | 2480 return; |
| 2481 | 2481 |
| 2482 // If the parent or previous sibling doesn't have any floats to add, don't b
other. | 2482 // If the parent or previous sibling doesn't have any floats to add, don't b
other. |
| 2483 if (!prev->m_floatingObjects) | 2483 if (!prev->m_floatingObjects) |
| 2484 return; | 2484 return; |
| 2485 | 2485 |
| 2486 logicalLeftOffset += marginLogicalLeft(); | 2486 logicalLeftOffset += marginLogicalLeft(); |
| 2487 | 2487 |
| 2488 const FloatingObjectSet& prevSet = prev->m_floatingObjects->set(); | 2488 const FloatingObjectSet& prevSet = prev->m_floatingObjects->set(); |
| 2489 FloatingObjectSetIterator prevEnd = prevSet.end(); | 2489 FloatingObjectSetIterator prevEnd = prevSet.end(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2506 | 2506 |
| 2507 m_floatingObjects->add(floatingObject->copyToNewContainer(offset
)); | 2507 m_floatingObjects->add(floatingObject->copyToNewContainer(offset
)); |
| 2508 } | 2508 } |
| 2509 } | 2509 } |
| 2510 } | 2510 } |
| 2511 } | 2511 } |
| 2512 | 2512 |
| 2513 void RenderBlockFlow::addOverhangingFloats(RenderBlockFlow* child, bool makeChil
dPaintOtherFloats) | 2513 void RenderBlockFlow::addOverhangingFloats(RenderBlockFlow* child, bool makeChil
dPaintOtherFloats) |
| 2514 { | 2514 { |
| 2515 // Prevent floats from being added to the canvas by the root element, e.g.,
<html>. | 2515 // Prevent floats from being added to the canvas by the root element, e.g.,
<html>. |
| 2516 if (!child->containsFloats() || child->isRenderRegion() || child->createsBlo
ckFormattingContext()) | 2516 if (!child->containsFloats() || child->isRenderRegion() || child->createsNew
FormattingContext()) |
| 2517 return; | 2517 return; |
| 2518 | 2518 |
| 2519 LayoutUnit childLogicalTop = child->logicalTop(); | 2519 LayoutUnit childLogicalTop = child->logicalTop(); |
| 2520 LayoutUnit childLogicalLeft = child->logicalLeft(); | 2520 LayoutUnit childLogicalLeft = child->logicalLeft(); |
| 2521 | 2521 |
| 2522 // Floats that will remain the child's responsibility to paint should factor
into its | 2522 // Floats that will remain the child's responsibility to paint should factor
into its |
| 2523 // overflow. | 2523 // overflow. |
| 2524 FloatingObjectSetIterator childEnd = child->m_floatingObjects->set().end(); | 2524 FloatingObjectSetIterator childEnd = child->m_floatingObjects->set().end(); |
| 2525 for (FloatingObjectSetIterator childIt = child->m_floatingObjects->set().beg
in(); childIt != childEnd; ++childIt) { | 2525 for (FloatingObjectSetIterator childIt = child->m_floatingObjects->set().beg
in(); childIt != childEnd; ++childIt) { |
| 2526 FloatingObject* floatingObject = childIt->get(); | 2526 FloatingObject* floatingObject = childIt->get(); |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2844 FrameView* frameView = document().view(); | 2844 FrameView* frameView = document().view(); |
| 2845 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr
ollOffset().height(); | 2845 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr
ollOffset().height(); |
| 2846 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height(
); | 2846 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height(
); |
| 2847 if (height() < visibleHeight) | 2847 if (height() < visibleHeight) |
| 2848 top += (visibleHeight - height()) / 2; | 2848 top += (visibleHeight - height()) / 2; |
| 2849 setY(top); | 2849 setY(top); |
| 2850 dialog->setCentered(top); | 2850 dialog->setCentered(top); |
| 2851 } | 2851 } |
| 2852 | 2852 |
| 2853 } // namespace blink | 2853 } // namespace blink |
| OLD | NEW |