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 1754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1765 marginInfo.clearMargin(); | 1765 marginInfo.clearMargin(); |
1766 } | 1766 } |
1767 | 1767 |
1768 if (marginInfo.margin()) | 1768 if (marginInfo.margin()) |
1769 marginInfo.setHasMarginAfterQuirk(hasMarginAfterQuirk(&child)); | 1769 marginInfo.setHasMarginAfterQuirk(hasMarginAfterQuirk(&child)); |
1770 } | 1770 } |
1771 | 1771 |
1772 // If margins would pull us past the top of the next page, then we need to | 1772 // If margins would pull us past the top of the next page, then we need to |
1773 // pull back and pretend like the margins collapsed into the page edge. | 1773 // pull back and pretend like the margins collapsed into the page edge. |
1774 LayoutState* layoutState = view()->layoutState(); | 1774 LayoutState* layoutState = view()->layoutState(); |
1775 if (layoutState->isPaginated() && | 1775 if (layoutState->isPaginated() && isPageLogicalHeightKnown() && |
1776 isPageLogicalHeightKnown(beforeCollapseLogicalTop) && | |
1777 logicalTop > beforeCollapseLogicalTop) { | 1776 logicalTop > beforeCollapseLogicalTop) { |
1778 LayoutUnit oldLogicalTop = logicalTop; | 1777 LayoutUnit oldLogicalTop = logicalTop; |
1779 logicalTop = | 1778 logicalTop = |
1780 std::min(logicalTop, nextPageLogicalTop(beforeCollapseLogicalTop)); | 1779 std::min(logicalTop, nextPageLogicalTop(beforeCollapseLogicalTop)); |
1781 setLogicalHeight(logicalHeight() + (logicalTop - oldLogicalTop)); | 1780 setLogicalHeight(logicalHeight() + (logicalTop - oldLogicalTop)); |
1782 } | 1781 } |
1783 | 1782 |
1784 if (previousBlockFlow) { | 1783 if (previousBlockFlow) { |
1785 // If |child| is a self-collapsing block it may have collapsed into a | 1784 // If |child| is a self-collapsing block it may have collapsed into a |
1786 // previous sibling and although it hasn't reduced the height of the parent | 1785 // previous sibling and although it hasn't reduced the height of the parent |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2058 // Collapse the result with our current margins. | 2057 // Collapse the result with our current margins. |
2059 if (!discardMarginBefore) | 2058 if (!discardMarginBefore) |
2060 logicalTopEstimate += | 2059 logicalTopEstimate += |
2061 std::max(marginInfo.positiveMargin(), positiveMarginBefore) - | 2060 std::max(marginInfo.positiveMargin(), positiveMarginBefore) - |
2062 std::max(marginInfo.negativeMargin(), negativeMarginBefore); | 2061 std::max(marginInfo.negativeMargin(), negativeMarginBefore); |
2063 } | 2062 } |
2064 | 2063 |
2065 // Adjust logicalTopEstimate down to the next page if the margins are so large | 2064 // Adjust logicalTopEstimate down to the next page if the margins are so large |
2066 // that we don't fit on the current page. | 2065 // that we don't fit on the current page. |
2067 LayoutState* layoutState = view()->layoutState(); | 2066 LayoutState* layoutState = view()->layoutState(); |
2068 if (layoutState->isPaginated() && isPageLogicalHeightKnown(logicalHeight()) && | 2067 if (layoutState->isPaginated() && isPageLogicalHeightKnown() && |
2069 logicalTopEstimate > logicalHeight()) | 2068 logicalTopEstimate > logicalHeight()) |
2070 logicalTopEstimate = | 2069 logicalTopEstimate = |
2071 std::min(logicalTopEstimate, nextPageLogicalTop(logicalHeight())); | 2070 std::min(logicalTopEstimate, nextPageLogicalTop(logicalHeight())); |
2072 | 2071 |
2073 logicalTopEstimate += getClearDelta(&child, logicalTopEstimate); | 2072 logicalTopEstimate += getClearDelta(&child, logicalTopEstimate); |
2074 | 2073 |
2075 estimateWithoutPagination = logicalTopEstimate; | 2074 estimateWithoutPagination = logicalTopEstimate; |
2076 | 2075 |
2077 if (layoutState->isPaginated()) { | 2076 if (layoutState->isPaginated()) { |
2078 if (!layoutInfo.isAtFirstInFlowChild()) { | 2077 if (!layoutInfo.isAtFirstInFlowChild()) { |
(...skipping 2468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4547 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState); | 4546 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState); |
4548 } | 4547 } |
4549 | 4548 |
4550 void LayoutBlockFlow::invalidateDisplayItemClients( | 4549 void LayoutBlockFlow::invalidateDisplayItemClients( |
4551 PaintInvalidationReason invalidationReason) const { | 4550 PaintInvalidationReason invalidationReason) const { |
4552 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients( | 4551 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients( |
4553 invalidationReason); | 4552 invalidationReason); |
4554 } | 4553 } |
4555 | 4554 |
4556 } // namespace blink | 4555 } // namespace blink |
OLD | NEW |