| 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 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1304 marginInfo.clearMargin(); | 1304 marginInfo.clearMargin(); |
| 1305 } | 1305 } |
| 1306 | 1306 |
| 1307 if (marginInfo.margin()) | 1307 if (marginInfo.margin()) |
| 1308 marginInfo.setHasMarginAfterQuirk(hasMarginAfterQuirk(&child)); | 1308 marginInfo.setHasMarginAfterQuirk(hasMarginAfterQuirk(&child)); |
| 1309 } | 1309 } |
| 1310 | 1310 |
| 1311 // If margins would pull us past the top of the next page, then we need to p
ull back and pretend like the margins | 1311 // If margins would pull us past the top of the next page, then we need to p
ull back and pretend like the margins |
| 1312 // collapsed into the page edge. | 1312 // collapsed into the page edge. |
| 1313 LayoutState* layoutState = view()->layoutState(); | 1313 LayoutState* layoutState = view()->layoutState(); |
| 1314 if (layoutState->isPaginated() && layoutState->pageLogicalHeight() && logica
lTop > beforeCollapseLogicalTop) { | 1314 if (layoutState->isPaginated() && isPageLogicalHeightKnown(beforeCollapseLog
icalTop) && logicalTop > beforeCollapseLogicalTop) { |
| 1315 LayoutUnit oldLogicalTop = logicalTop; | 1315 LayoutUnit oldLogicalTop = logicalTop; |
| 1316 logicalTop = std::min(logicalTop, nextPageLogicalTop(beforeCollapseLogic
alTop)); | 1316 logicalTop = std::min(logicalTop, nextPageLogicalTop(beforeCollapseLogic
alTop)); |
| 1317 setLogicalHeight(logicalHeight() + (logicalTop - oldLogicalTop)); | 1317 setLogicalHeight(logicalHeight() + (logicalTop - oldLogicalTop)); |
| 1318 } | 1318 } |
| 1319 | 1319 |
| 1320 if (previousBlockFlow) { | 1320 if (previousBlockFlow) { |
| 1321 // 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 | 1321 // 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 |
| 1322 // any floats from the parent will now overhang. | 1322 // any floats from the parent will now overhang. |
| 1323 LayoutUnit oldLogicalHeight = logicalHeight(); | 1323 LayoutUnit oldLogicalHeight = logicalHeight(); |
| 1324 setLogicalHeight(logicalTop); | 1324 setLogicalHeight(logicalTop); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1525 } | 1525 } |
| 1526 | 1526 |
| 1527 // Collapse the result with our current margins. | 1527 // Collapse the result with our current margins. |
| 1528 if (!discardMarginBefore) | 1528 if (!discardMarginBefore) |
| 1529 logicalTopEstimate += std::max(marginInfo.positiveMargin(), positive
MarginBefore) - std::max(marginInfo.negativeMargin(), negativeMarginBefore); | 1529 logicalTopEstimate += std::max(marginInfo.positiveMargin(), positive
MarginBefore) - std::max(marginInfo.negativeMargin(), negativeMarginBefore); |
| 1530 } | 1530 } |
| 1531 | 1531 |
| 1532 // Adjust logicalTopEstimate down to the next page if the margins are so lar
ge that we don't fit on the current | 1532 // Adjust logicalTopEstimate down to the next page if the margins are so lar
ge that we don't fit on the current |
| 1533 // page. | 1533 // page. |
| 1534 LayoutState* layoutState = view()->layoutState(); | 1534 LayoutState* layoutState = view()->layoutState(); |
| 1535 if (layoutState->isPaginated() && layoutState->pageLogicalHeight() && logica
lTopEstimate > logicalHeight()) | 1535 if (layoutState->isPaginated() && isPageLogicalHeightKnown(logicalHeight())
&& logicalTopEstimate > logicalHeight()) |
| 1536 logicalTopEstimate = std::min(logicalTopEstimate, nextPageLogicalTop(log
icalHeight())); | 1536 logicalTopEstimate = std::min(logicalTopEstimate, nextPageLogicalTop(log
icalHeight())); |
| 1537 | 1537 |
| 1538 logicalTopEstimate += getClearDelta(&child, logicalTopEstimate); | 1538 logicalTopEstimate += getClearDelta(&child, logicalTopEstimate); |
| 1539 | 1539 |
| 1540 estimateWithoutPagination = logicalTopEstimate; | 1540 estimateWithoutPagination = logicalTopEstimate; |
| 1541 | 1541 |
| 1542 if (layoutState->isPaginated()) { | 1542 if (layoutState->isPaginated()) { |
| 1543 // If the object has a page or column break value of "before", then we s
hould shift to the top of the next page. | 1543 // If the object has a page or column break value of "before", then we s
hould shift to the top of the next page. |
| 1544 logicalTopEstimate = applyBeforeBreak(child, logicalTopEstimate); | 1544 logicalTopEstimate = applyBeforeBreak(child, logicalTopEstimate); |
| 1545 | 1545 |
| (...skipping 1604 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 |