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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 if (LayoutMultiColumnFlowThread* flowThread = multiColumnFlowThread()) { | 202 if (LayoutMultiColumnFlowThread* flowThread = multiColumnFlowThread()) { |
203 if (flowThread->needsNewWidth()) | 203 if (flowThread->needsNewWidth()) |
204 return true; | 204 return true; |
205 } | 205 } |
206 return relayoutChildren; | 206 return relayoutChildren; |
207 } | 207 } |
208 | 208 |
209 void LayoutBlockFlow::checkForPaginationLogicalHeightChange(LayoutUnit& pageLogi
calHeight, bool& pageLogicalHeightChanged, bool& hasSpecifiedPageLogicalHeight) | 209 void LayoutBlockFlow::checkForPaginationLogicalHeightChange(LayoutUnit& pageLogi
calHeight, bool& pageLogicalHeightChanged, bool& hasSpecifiedPageLogicalHeight) |
210 { | 210 { |
211 if (LayoutMultiColumnFlowThread* flowThread = multiColumnFlowThread()) { | 211 if (LayoutMultiColumnFlowThread* flowThread = multiColumnFlowThread()) { |
212 LogicalExtentComputedValues computedValues; | 212 // Calculate the non-auto content box height, or set it to 0 if it's aut
o. We need to know |
213 computeLogicalHeight(LayoutUnit(), logicalTop(), computedValues); | 213 // this before layout, so that we can figure out where to insert column
breaks. We also |
214 LayoutUnit columnHeight = computedValues.m_extent - borderAndPaddingLogi
calHeight() - scrollbarLogicalHeight(); | 214 // treat LayoutView (which may be paginated, which uses the multicol imp
lmentation) as |
| 215 // having non-auto height, since its height is deduced from the viewport
height. We use |
| 216 // computeLogicalHeight() to calculate the content box height. That meth
od will clamp |
| 217 // against max-height and min-height. Since we're now at the beginning o
f layout, and we |
| 218 // don't know the actual height of the content yet, only call that metho
d when height is |
| 219 // definite, or we might fool ourselves into believing that columns have
a definite height |
| 220 // when they in fact don't. |
| 221 LayoutUnit columnHeight; |
| 222 if (hasDefiniteLogicalHeight() || isLayoutView()) { |
| 223 LogicalExtentComputedValues computedValues; |
| 224 computeLogicalHeight(LayoutUnit(), logicalTop(), computedValues); |
| 225 columnHeight = computedValues.m_extent - borderAndPaddingLogicalHeig
ht() - scrollbarLogicalHeight(); |
| 226 } |
215 pageLogicalHeightChanged = columnHeight != flowThread->columnHeightAvail
able(); | 227 pageLogicalHeightChanged = columnHeight != flowThread->columnHeightAvail
able(); |
216 flowThread->setColumnHeightAvailable(std::max<LayoutUnit>(columnHeight,
0)); | 228 flowThread->setColumnHeightAvailable(std::max(columnHeight, LayoutUnit()
)); |
217 } else if (isLayoutFlowThread()) { | 229 } else if (isLayoutFlowThread()) { |
218 LayoutFlowThread* flowThread = toLayoutFlowThread(this); | 230 LayoutFlowThread* flowThread = toLayoutFlowThread(this); |
219 | 231 |
220 // FIXME: This is a hack to always make sure we have a page logical heig
ht, if said height | 232 // FIXME: This is a hack to always make sure we have a page logical heig
ht, if said height |
221 // is known. The page logical height thing in LayoutState is meaningless
for flow | 233 // is known. The page logical height thing in LayoutState is meaningless
for flow |
222 // thread-based pagination (page height isn't necessarily uniform throug
hout the flow | 234 // thread-based pagination (page height isn't necessarily uniform throug
hout the flow |
223 // thread), but as long as it is used universally as a means to determin
e whether page | 235 // thread), but as long as it is used universally as a means to determin
e whether page |
224 // height is known or not, we need this. Page height is unknown when col
umn balancing is | 236 // height is known or not, we need this. Page height is unknown when col
umn balancing is |
225 // enabled and flow thread height is still unknown (i.e. during the firs
t layout pass). When | 237 // enabled and flow thread height is still unknown (i.e. during the firs
t layout pass). When |
226 // it's unknown, we need to prevent the pagination code from assuming pa
ge breaks everywhere | 238 // it's unknown, we need to prevent the pagination code from assuming pa
ge breaks everywhere |
(...skipping 2833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3060 FrameView* frameView = document().view(); | 3072 FrameView* frameView = document().view(); |
3061 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr
ollOffset().height(); | 3073 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr
ollOffset().height(); |
3062 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height(
); | 3074 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height(
); |
3063 if (size().height() < visibleHeight) | 3075 if (size().height() < visibleHeight) |
3064 top += (visibleHeight - size().height()) / 2; | 3076 top += (visibleHeight - size().height()) / 2; |
3065 setY(top); | 3077 setY(top); |
3066 dialog->setCentered(top); | 3078 dialog->setCentered(top); |
3067 } | 3079 } |
3068 | 3080 |
3069 } // namespace blink | 3081 } // namespace blink |
OLD | NEW |