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 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 setLogicalHeight(logicalHeight() + (result - oldTop)); | 776 setLogicalHeight(logicalHeight() + (result - oldTop)); |
777 | 777 |
778 // Return the final adjusted logical top. | 778 // Return the final adjusted logical top. |
779 return result; | 779 return result; |
780 } | 780 } |
781 | 781 |
782 static inline LayoutUnit calculateMinimumPageHeight(RenderStyle* renderStyle, Ro
otInlineBox* lastLine, LayoutUnit lineTop, LayoutUnit lineBottom) | 782 static inline LayoutUnit calculateMinimumPageHeight(RenderStyle* renderStyle, Ro
otInlineBox* lastLine, LayoutUnit lineTop, LayoutUnit lineBottom) |
783 { | 783 { |
784 // We may require a certain minimum number of lines per page in order to sat
isfy | 784 // We may require a certain minimum number of lines per page in order to sat
isfy |
785 // orphans and widows, and that may affect the minimum page height. | 785 // orphans and widows, and that may affect the minimum page height. |
786 unsigned lineCount = std::max<unsigned>(renderStyle->hasAutoOrphans() ? 1 :
renderStyle->orphans(), renderStyle->hasAutoWidows() ? 1 : renderStyle->widows()
); | 786 unsigned lineCount = std::max<unsigned>(renderStyle->hasAutoOrphans() ? 1 :
renderStyle->orphans(), renderStyle->widows()); |
787 if (lineCount > 1) { | 787 if (lineCount > 1) { |
788 RootInlineBox* line = lastLine; | 788 RootInlineBox* line = lastLine; |
789 for (unsigned i = 1; i < lineCount && line->prevRootBox(); i++) | 789 for (unsigned i = 1; i < lineCount && line->prevRootBox(); i++) |
790 line = line->prevRootBox(); | 790 line = line->prevRootBox(); |
791 | 791 |
792 // FIXME: Paginating using line overflow isn't all fine. See FIXME in | 792 // FIXME: Paginating using line overflow isn't all fine. See FIXME in |
793 // adjustLinePositionForPagination() for more details. | 793 // adjustLinePositionForPagination() for more details. |
794 LayoutRect overflow = line->logicalVisualOverflowRect(line->lineTop(), l
ine->lineBottom()); | 794 LayoutRect overflow = line->logicalVisualOverflowRect(line->lineTop(), l
ine->lineBottom()); |
795 lineTop = std::min(line->lineTopWithLeading(), overflow.y()); | 795 lineTop = std::min(line->lineTopWithLeading(), overflow.y()); |
796 } | 796 } |
(...skipping 2324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3121 FrameView* frameView = document().view(); | 3121 FrameView* frameView = document().view(); |
3122 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr
ollOffset().height(); | 3122 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr
ollOffset().height(); |
3123 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height(
); | 3123 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height(
); |
3124 if (size().height() < visibleHeight) | 3124 if (size().height() < visibleHeight) |
3125 top += (visibleHeight - size().height()) / 2; | 3125 top += (visibleHeight - size().height()) / 2; |
3126 setY(top); | 3126 setY(top); |
3127 dialog->setCentered(top); | 3127 dialog->setCentered(top); |
3128 } | 3128 } |
3129 | 3129 |
3130 } // namespace blink | 3130 } // namespace blink |
OLD | NEW |