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 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 } | 777 } |
778 } | 778 } |
779 | 779 |
780 // Similar to how we apply clearance. Go ahead and boost height() to be the
place where we're going to position the child. | 780 // Similar to how we apply clearance. Go ahead and boost height() to be the
place where we're going to position the child. |
781 setLogicalHeight(logicalHeight() + (result - oldTop)); | 781 setLogicalHeight(logicalHeight() + (result - oldTop)); |
782 | 782 |
783 // Return the final adjusted logical top. | 783 // Return the final adjusted logical top. |
784 return result; | 784 return result; |
785 } | 785 } |
786 | 786 |
787 static inline LayoutUnit calculateMinimumPageHeight(RenderStyle* renderStyle, Ro
otInlineBox* lastLine, LayoutUnit lineTop, LayoutUnit lineBottom) | 787 static inline LayoutUnit calculateMinimumPageHeight(const RenderStyle* renderSty
le, RootInlineBox* lastLine, LayoutUnit lineTop, LayoutUnit lineBottom) |
788 { | 788 { |
789 // We may require a certain minimum number of lines per page in order to sat
isfy | 789 // We may require a certain minimum number of lines per page in order to sat
isfy |
790 // orphans and widows, and that may affect the minimum page height. | 790 // orphans and widows, and that may affect the minimum page height. |
791 unsigned lineCount = std::max<unsigned>(renderStyle->hasAutoOrphans() ? 1 :
renderStyle->orphans(), renderStyle->widows()); | 791 unsigned lineCount = std::max<unsigned>(renderStyle->hasAutoOrphans() ? 1 :
renderStyle->orphans(), renderStyle->widows()); |
792 if (lineCount > 1) { | 792 if (lineCount > 1) { |
793 RootInlineBox* line = lastLine; | 793 RootInlineBox* line = lastLine; |
794 for (unsigned i = 1; i < lineCount && line->prevRootBox(); i++) | 794 for (unsigned i = 1; i < lineCount && line->prevRootBox(); i++) |
795 line = line->prevRootBox(); | 795 line = line->prevRootBox(); |
796 | 796 |
797 // FIXME: Paginating using line overflow isn't all fine. See FIXME in | 797 // FIXME: Paginating using line overflow isn't all fine. See FIXME in |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 // Our MarginInfo state used when laying out block children. | 1091 // Our MarginInfo state used when laying out block children. |
1092 MarginInfo::MarginInfo(RenderBlockFlow* blockFlow, LayoutUnit beforeBorderPaddin
g, LayoutUnit afterBorderPadding) | 1092 MarginInfo::MarginInfo(RenderBlockFlow* blockFlow, LayoutUnit beforeBorderPaddin
g, LayoutUnit afterBorderPadding) |
1093 : m_canCollapseMarginAfterWithLastChild(true) | 1093 : m_canCollapseMarginAfterWithLastChild(true) |
1094 , m_atBeforeSideOfBlock(true) | 1094 , m_atBeforeSideOfBlock(true) |
1095 , m_atAfterSideOfBlock(false) | 1095 , m_atAfterSideOfBlock(false) |
1096 , m_hasMarginBeforeQuirk(false) | 1096 , m_hasMarginBeforeQuirk(false) |
1097 , m_hasMarginAfterQuirk(false) | 1097 , m_hasMarginAfterQuirk(false) |
1098 , m_determinedMarginBeforeQuirk(false) | 1098 , m_determinedMarginBeforeQuirk(false) |
1099 , m_discardMargin(false) | 1099 , m_discardMargin(false) |
1100 { | 1100 { |
1101 RenderStyle* blockStyle = blockFlow->style(); | 1101 const RenderStyle* blockStyle = blockFlow->style(); |
1102 ASSERT(blockFlow->isRenderView() || blockFlow->parent()); | 1102 ASSERT(blockFlow->isRenderView() || blockFlow->parent()); |
1103 m_canCollapseWithChildren = !blockFlow->createsNewFormattingContext() && !bl
ockFlow->isRenderFlowThread() && !blockFlow->isRenderView(); | 1103 m_canCollapseWithChildren = !blockFlow->createsNewFormattingContext() && !bl
ockFlow->isRenderFlowThread() && !blockFlow->isRenderView(); |
1104 | 1104 |
1105 m_canCollapseMarginBeforeWithChildren = m_canCollapseWithChildren && !before
BorderPadding && blockStyle->marginBeforeCollapse() != MSEPARATE; | 1105 m_canCollapseMarginBeforeWithChildren = m_canCollapseWithChildren && !before
BorderPadding && blockStyle->marginBeforeCollapse() != MSEPARATE; |
1106 | 1106 |
1107 // If any height other than auto is specified in CSS, then we don't collapse
our bottom | 1107 // If any height other than auto is specified in CSS, then we don't collapse
our bottom |
1108 // margins with our children's margins. To do otherwise would be to risk odd
visual | 1108 // margins with our children's margins. To do otherwise would be to risk odd
visual |
1109 // effects when the children overflow out of the parent block and yet still
collapse | 1109 // effects when the children overflow out of the parent block and yet still
collapse |
1110 // with it. We also don't collapse if we have any bottom border/padding. | 1110 // with it. We also don't collapse if we have any bottom border/padding. |
1111 m_canCollapseMarginAfterWithChildren = m_canCollapseWithChildren && !afterBo
rderPadding | 1111 m_canCollapseMarginAfterWithChildren = m_canCollapseWithChildren && !afterBo
rderPadding |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1935 return result; | 1935 return result; |
1936 } | 1936 } |
1937 | 1937 |
1938 void RenderBlockFlow::createFloatingObjects() | 1938 void RenderBlockFlow::createFloatingObjects() |
1939 { | 1939 { |
1940 m_floatingObjects = adoptPtr(new FloatingObjects(this, isHorizontalWritingMo
de())); | 1940 m_floatingObjects = adoptPtr(new FloatingObjects(this, isHorizontalWritingMo
de())); |
1941 } | 1941 } |
1942 | 1942 |
1943 void RenderBlockFlow::styleWillChange(StyleDifference diff, const RenderStyle& n
ewStyle) | 1943 void RenderBlockFlow::styleWillChange(StyleDifference diff, const RenderStyle& n
ewStyle) |
1944 { | 1944 { |
1945 RenderStyle* oldStyle = style(); | 1945 const RenderStyle* oldStyle = style(); |
1946 s_canPropagateFloatIntoSibling = oldStyle ? !isFloatingOrOutOfFlowPositioned
() && !avoidsFloats() : false; | 1946 s_canPropagateFloatIntoSibling = oldStyle ? !isFloatingOrOutOfFlowPositioned
() && !avoidsFloats() : false; |
1947 if (oldStyle && parent() && diff.needsFullLayout() && oldStyle->position() !
= newStyle.position() | 1947 if (oldStyle && parent() && diff.needsFullLayout() && oldStyle->position() !
= newStyle.position() |
1948 && containsFloats() && !isFloating() && !isOutOfFlowPositioned() && newS
tyle.hasOutOfFlowPosition()) | 1948 && containsFloats() && !isFloating() && !isOutOfFlowPositioned() && newS
tyle.hasOutOfFlowPosition()) |
1949 markAllDescendantsWithFloatsForLayout(); | 1949 markAllDescendantsWithFloatsForLayout(); |
1950 | 1950 |
1951 RenderBlock::styleWillChange(diff, newStyle); | 1951 RenderBlock::styleWillChange(diff, newStyle); |
1952 } | 1952 } |
1953 | 1953 |
1954 void RenderBlockFlow::styleDidChange(StyleDifference diff, const RenderStyle* ol
dStyle) | 1954 void RenderBlockFlow::styleDidChange(StyleDifference diff, const RenderStyle* ol
dStyle) |
1955 { | 1955 { |
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3150 FrameView* frameView = document().view(); | 3150 FrameView* frameView = document().view(); |
3151 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr
ollOffset().height(); | 3151 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr
ollOffset().height(); |
3152 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height(
); | 3152 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height(
); |
3153 if (size().height() < visibleHeight) | 3153 if (size().height() < visibleHeight) |
3154 top += (visibleHeight - size().height()) / 2; | 3154 top += (visibleHeight - size().height()) / 2; |
3155 setY(top); | 3155 setY(top); |
3156 dialog->setCentered(top); | 3156 dialog->setCentered(top); |
3157 } | 3157 } |
3158 | 3158 |
3159 } // namespace blink | 3159 } // namespace blink |
OLD | NEW |