Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(431)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp

Issue 1472053002: Jump to the next outer column when an inner column is too short. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: code review Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 LayoutUnit LayoutBlockFlow::adjustBlockChildForPagination(LayoutUnit logicalTop, LayoutBox& child, bool atBeforeSideOfBlock) 675 LayoutUnit LayoutBlockFlow::adjustBlockChildForPagination(LayoutUnit logicalTop, LayoutBox& child, bool atBeforeSideOfBlock)
676 { 676 {
677 LayoutBlockFlow* childBlockFlow = child.isLayoutBlockFlow() ? toLayoutBlockF low(&child) : 0; 677 LayoutBlockFlow* childBlockFlow = child.isLayoutBlockFlow() ? toLayoutBlockF low(&child) : 0;
678 678
679 // Calculate the pagination strut for this child. A strut may come from thre e sources: 679 // Calculate the pagination strut for this child. A strut may come from thre e sources:
680 // 1. The first piece of content inside the child doesn't fit in the current page or column 680 // 1. The first piece of content inside the child doesn't fit in the current page or column
681 // 2. A forced break before the child 681 // 2. A forced break before the child
682 // 3. The child itself is unsplittable and doesn't fit in the current page o r column. 682 // 3. The child itself is unsplittable and doesn't fit in the current page o r column.
683 // 683 //
684 // No matter which source, if we need to insert a strut, it should always ta ke us to the exact 684 // No matter which source, if we need to insert a strut, it should always ta ke us to the exact
685 // top of the next page or column, or be zero. 685 // top of a page or column further ahead, or be zero.
686 686
687 // We're now going to calculate the child's final pagination strut. We may e nd up propagating 687 // We're now going to calculate the child's final pagination strut. We may e nd up propagating
688 // it to its containing block (|this|), so reset it first. 688 // it to its containing block (|this|), so reset it first.
689 child.resetPaginationStrut(); 689 child.resetPaginationStrut();
690 690
691 // The first piece of content inside the child may have set a strut during l ayout. Currently, 691 // The first piece of content inside the child may have set a strut during l ayout. Currently,
692 // only block flows support strut propagation, but this may (and should) cha nge in the future. 692 // only block flows support strut propagation, but this may (and should) cha nge in the future.
693 // See crbug.com/539873 693 // See crbug.com/539873
694 LayoutUnit strutFromContent = childBlockFlow ? childBlockFlow->paginationStr utPropagatedFromChild() : LayoutUnit(); 694 LayoutUnit strutFromContent = childBlockFlow ? childBlockFlow->paginationStr utPropagatedFromChild() : LayoutUnit();
695 LayoutUnit logicalTopWithContentStrut = logicalTop + strutFromContent; 695 LayoutUnit logicalTopWithContentStrut = logicalTop + strutFromContent;
696 696
697 // If the object has a page or column break value of "before", then we shoul d shift to the top of the next page. 697 // If the object has a page or column break value of "before", then we shoul d shift to the top of the next page.
698 LayoutUnit logicalTopAfterForcedBreak = applyBeforeBreak(child, logicalTop); 698 LayoutUnit logicalTopAfterForcedBreak = applyBeforeBreak(child, logicalTop);
699 699
700 // For replaced elements and scrolled elements, we want to shift them to the next page if they don't fit on the current one. 700 // For replaced elements and scrolled elements, we want to shift them to the next page if they don't fit on the current one.
701 LayoutUnit logicalTopAfterUnsplittable = adjustForUnsplittableChild(child, l ogicalTop); 701 LayoutUnit logicalTopAfterUnsplittable = adjustForUnsplittableChild(child, l ogicalTop);
702 702
703 // Some sanity checks: No matter what the reason is for pushing the child to the next page or 703 // Pick the largest offset. Tall unsplittable content may take us to a page or column further
704 // column, the amount should be the same. 704 // ahead than the next one.
705 ASSERT(!strutFromContent || logicalTopAfterForcedBreak == logicalTop || logi calTopAfterForcedBreak == logicalTopWithContentStrut);
706 ASSERT(!strutFromContent || logicalTopAfterUnsplittable == logicalTop || log icalTopAfterUnsplittable == logicalTopWithContentStrut);
707 ASSERT(logicalTopAfterUnsplittable == logicalTop || logicalTopAfterForcedBre ak == logicalTop || logicalTopAfterUnsplittable == logicalTopAfterForcedBreak);
708
709 LayoutUnit logicalTopAfterPagination = std::max(logicalTopWithContentStrut, std::max(logicalTopAfterForcedBreak, logicalTopAfterUnsplittable)); 705 LayoutUnit logicalTopAfterPagination = std::max(logicalTopWithContentStrut, std::max(logicalTopAfterForcedBreak, logicalTopAfterUnsplittable));
710 LayoutUnit newLogicalTop = logicalTop; 706 LayoutUnit newLogicalTop = logicalTop;
711 if (LayoutUnit paginationStrut = logicalTopAfterPagination - logicalTop) { 707 if (LayoutUnit paginationStrut = logicalTopAfterPagination - logicalTop) {
712 ASSERT(paginationStrut > 0); 708 ASSERT(paginationStrut > 0);
713 // We are willing to propagate out to our parent block as long as we wer e at the top of the block prior 709 // We are willing to propagate out to our parent block as long as we wer e at the top of the block prior
714 // to collapsing our margins, and as long as we didn't clear or move as a result of other pagination. 710 // to collapsing our margins, and as long as we didn't clear or move as a result of other pagination.
715 if (atBeforeSideOfBlock && logicalTopAfterForcedBreak == logicalTop && a llowsPaginationStrut()) { 711 if (atBeforeSideOfBlock && logicalTopAfterForcedBreak == logicalTop && a llowsPaginationStrut()) {
716 // FIXME: Should really check if we're exceeding the page height bef ore propagating the strut, but we don't 712 // FIXME: Should really check if we're exceeding the page height bef ore propagating the strut, but we don't
717 // have all the information to do so (the strut only has the remaini ng amount to push). Gecko gets this wrong too 713 // have all the information to do so (the strut only has the remaini ng amount to push). Gecko gets this wrong too
718 // and pushes to the next page anyway, so not too concerned about it . 714 // and pushes to the next page anyway, so not too concerned about it .
719 paginationStrut += logicalTop + marginBeforeIfFloating(); 715 paginationStrut += logicalTop + marginBeforeIfFloating();
720 setPaginationStrutPropagatedFromChild(paginationStrut); 716 setPaginationStrutPropagatedFromChild(paginationStrut);
721 if (childBlockFlow) 717 if (childBlockFlow)
722 childBlockFlow->setPaginationStrutPropagatedFromChild(LayoutUnit ()); 718 childBlockFlow->setPaginationStrutPropagatedFromChild(LayoutUnit ());
723 } else { 719 } else {
724 child.setPaginationStrut(paginationStrut); 720 child.setPaginationStrut(paginationStrut);
725 newLogicalTop += paginationStrut; 721 newLogicalTop += paginationStrut;
726 } 722 }
727 } 723 }
728 724
729 paginatedContentWasLaidOut(newLogicalTop); 725 paginatedContentWasLaidOut(newLogicalTop);
730 726
731 // Similar to how we apply clearance. Go ahead and boost height() to be the place where we're going to position the child. 727 // Similar to how we apply clearance. Go ahead and boost height() to be the place where we're going to position the child.
732 setLogicalHeight(logicalHeight() + (newLogicalTop - logicalTop)); 728 setLogicalHeight(logicalHeight() + (newLogicalTop - logicalTop));
733 729
734 // Return the final adjusted logical top. 730 // Return the final adjusted logical top.
735 return newLogicalTop; 731 return newLogicalTop;
736 } 732 }
737 733
738 static bool shouldSetStrutOnBlock(const LayoutBlockFlow& block, const RootInline Box& lineBox, LayoutUnit lineLogicalOffset, int lineIndex, LayoutUnit remainingL ogicalHeight) 734 static bool shouldSetStrutOnBlock(const LayoutBlockFlow& block, const RootInline Box& lineBox, LayoutUnit lineLogicalOffset, int lineIndex, LayoutUnit pageLogica lHeight)
739 { 735 {
740 bool wantsStrutOnBlock = false; 736 bool wantsStrutOnBlock = false;
741 if (!block.style()->hasAutoOrphans() && block.style()->orphans() >= lineInde x) { 737 if (!block.style()->hasAutoOrphans() && block.style()->orphans() >= lineInde x) {
742 // Not enough orphans here. Push the entire block to the next column / p age as an 738 // Not enough orphans here. Push the entire block to the next column / p age as an
743 // attempt to better satisfy the orphans requirement. 739 // attempt to better satisfy the orphans requirement.
744 wantsStrutOnBlock = true; 740 wantsStrutOnBlock = true;
745 } else if (lineBox == block.firstRootBox() && lineLogicalOffset == block.bor derAndPaddingBefore()) { 741 } else if (lineBox == block.firstRootBox() && lineLogicalOffset == block.bor derAndPaddingBefore()) {
746 // This is the first line in the block. We can take the whole block with us to the next page 742 // This is the first line in the block. We can take the whole block with us to the next page
747 // or column, rather than keeping a content-less portion of it in the pr evious one. Only do 743 // or column, rather than keeping a content-less portion of it in the pr evious one. Only do
748 // this if the line is flush with the content edge of the block, though. If it isn't, it 744 // this if the line is flush with the content edge of the block, though. If it isn't, it
749 // means that the line was pushed downwards by preceding floats that did n't fit beside the 745 // means that the line was pushed downwards by preceding floats that did n't fit beside the
750 // line, and we don't want to move all that, since it has already been e stablished that it 746 // line, and we don't want to move all that, since it has already been e stablished that it
751 // fits nicely where it is. 747 // fits nicely where it is.
752 LayoutUnit lineHeight = lineBox.lineBottomWithLeading() - lineBox.lineTo pWithLeading(); 748 LayoutUnit lineHeight = lineBox.lineBottomWithLeading() - lineBox.lineTo pWithLeading();
753 LayoutUnit totalLogicalHeight = lineHeight + std::max<LayoutUnit>(0, lin eLogicalOffset); 749 LayoutUnit totalLogicalHeight = lineHeight + std::max<LayoutUnit>(0, lin eLogicalOffset);
754 LayoutUnit pageLogicalHeightAtNewOffset = block.pageLogicalHeightForOffs et(lineLogicalOffset + remainingLogicalHeight);
755 // It's rather pointless to break before the block if the current line i sn't going to 750 // It's rather pointless to break before the block if the current line i sn't going to
756 // fit in the same column or page, so check that as well. 751 // fit in the same column or page, so check that as well.
757 if (totalLogicalHeight <= pageLogicalHeightAtNewOffset) 752 if (totalLogicalHeight <= pageLogicalHeight)
758 wantsStrutOnBlock = true; 753 wantsStrutOnBlock = true;
759 } 754 }
760 return wantsStrutOnBlock && block.allowsPaginationStrut(); 755 return wantsStrutOnBlock && block.allowsPaginationStrut();
761 } 756 }
762 757
763 void LayoutBlockFlow::adjustLinePositionForPagination(RootInlineBox& lineBox, La youtUnit& delta) 758 void LayoutBlockFlow::adjustLinePositionForPagination(RootInlineBox& lineBox, La youtUnit& delta)
764 { 759 {
765 // TODO(mstensho): Pay attention to line overflow. It should be painted in t he same column as 760 // TODO(mstensho): Pay attention to line overflow. It should be painted in t he same column as
766 // the rest of the line, possibly overflowing the column. We currently only allow overflow above 761 // the rest of the line, possibly overflowing the column. We currently only allow overflow above
767 // the first column. We clip at all other column boundaries, and that's how it has to be for 762 // the first column. We clip at all other column boundaries, and that's how it has to be for
768 // now. The paint we have to do when a column has overflow has to be special . We need to exclude 763 // now. The paint we have to do when a column has overflow has to be special . We need to exclude
769 // content that paints in a previous column (and content that paints in the following column). 764 // content that paints in a previous column (and content that paints in the following column).
770 // 765 //
771 // FIXME: Another problem with simply moving lines is that the available lin e width may change (because of floats). 766 // FIXME: Another problem with simply moving lines is that the available lin e width may change (because of floats).
772 // Technically if the location we move the line to has a different line widt h than our old position, then we need to dirty the 767 // Technically if the location we move the line to has a different line widt h than our old position, then we need to dirty the
773 // line and all following lines. 768 // line and all following lines.
774 LayoutUnit logicalOffset = lineBox.lineTopWithLeading(); 769 LayoutUnit logicalOffset = lineBox.lineTopWithLeading();
775 LayoutUnit lineHeight = lineBox.lineBottomWithLeading() - logicalOffset; 770 LayoutUnit lineHeight = lineBox.lineBottomWithLeading() - logicalOffset;
776 logicalOffset += delta; 771 logicalOffset += delta;
777 lineBox.setPaginationStrut(LayoutUnit()); 772 lineBox.setPaginationStrut(LayoutUnit());
778 lineBox.setIsFirstAfterPageBreak(false); 773 lineBox.setIsFirstAfterPageBreak(false);
779 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); 774 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset);
780 if (!pageLogicalHeight) 775 if (!pageLogicalHeight)
781 return; 776 return;
782 if (lineHeight > pageLogicalHeight) {
783 // Too tall to fit in one page / column. Give up. Don't push to the next page / column.
784 // TODO(mstensho): Get rid of this. This is just utter weirdness, but th e other browsers
785 // also do something slightly similar, although in much more specific ca ses than we do here,
786 // and printing Google Docs depends on it.
787 return;
788 }
789 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset, AssociateWithLatterPage); 777 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset, AssociateWithLatterPage);
790
791 int lineIndex = lineCount(&lineBox); 778 int lineIndex = lineCount(&lineBox);
792 if (remainingLogicalHeight < lineHeight || (shouldBreakAtLineToAvoidWidow() && lineBreakToAvoidWidow() == lineIndex)) { 779 if (remainingLogicalHeight < lineHeight || (shouldBreakAtLineToAvoidWidow() && lineBreakToAvoidWidow() == lineIndex)) {
780 LayoutUnit paginationStrut = calculatePaginationStrutToFitContent(logica lOffset, remainingLogicalHeight, lineHeight);
781 LayoutUnit newLogicalOffset = logicalOffset + paginationStrut;
782 // The new offset may require us to insert a new row for columns (fragme ntainer group).
783 // Give the multicol machinery an opportunity to do so (before checking the height of a
784 // column that wouldn't have existed yet otherwise).
785 paginatedContentWasLaidOut(newLogicalOffset);
786 // Moving to a different page or column may mean that its height is diff erent.
787 pageLogicalHeight = pageLogicalHeightForOffset(newLogicalOffset);
788 if (lineHeight > pageLogicalHeight) {
789 // Too tall to fit in one page / column. Give up. Don't push to the next page / column.
790 // TODO(mstensho): Get rid of this. This is just utter weirdness, bu t the other browsers
791 // also do something slightly similar, although in much more specifi c cases than we do here,
792 // and printing Google Docs depends on it.
793 return;
794 }
795
793 // We need to insert a break now, either because there's no room for the line in the 796 // We need to insert a break now, either because there's no room for the line in the
794 // current column / page, or because we have determined that we need a b reak to satisfy 797 // current column / page, or because we have determined that we need a b reak to satisfy
795 // widow requirements. 798 // widow requirements.
796 if (shouldBreakAtLineToAvoidWidow() && lineBreakToAvoidWidow() == lineIn dex) { 799 if (shouldBreakAtLineToAvoidWidow() && lineBreakToAvoidWidow() == lineIn dex) {
797 clearShouldBreakAtLineToAvoidWidow(); 800 clearShouldBreakAtLineToAvoidWidow();
798 setDidBreakAtLineToAvoidWidow(); 801 setDidBreakAtLineToAvoidWidow();
799 } 802 }
800 if (shouldSetStrutOnBlock(*this, lineBox, logicalOffset, lineIndex, rema iningLogicalHeight)) { 803 if (shouldSetStrutOnBlock(*this, lineBox, logicalOffset, lineIndex, page LogicalHeight)) {
801 // Note that when setting the strut on a block, it may be propagated to parent blocks 804 // Note that when setting the strut on a block, it may be propagated to parent blocks
802 // later on, if a block's logical top is flush with that of its pare nt. We don't want 805 // later on, if a block's logical top is flush with that of its pare nt. We don't want
803 // content-less portions (struts) at the beginning of a block before a break, if it can 806 // content-less portions (struts) at the beginning of a block before a break, if it can
804 // be avoided. After all, that's the reason for setting struts on bl ocks and not lines 807 // be avoided. After all, that's the reason for setting struts on bl ocks and not lines
805 // in the first place. 808 // in the first place.
806 LayoutUnit strut = remainingLogicalHeight + logicalOffset + marginBe foreIfFloating(); 809 LayoutUnit strut = paginationStrut + logicalOffset + marginBeforeIfF loating();
807 setPaginationStrutPropagatedFromChild(strut); 810 setPaginationStrutPropagatedFromChild(strut);
808 } else { 811 } else {
809 logicalOffset += remainingLogicalHeight; 812 delta += paginationStrut;
810 delta += remainingLogicalHeight; 813 lineBox.setPaginationStrut(paginationStrut);
811 lineBox.setPaginationStrut(remainingLogicalHeight);
812 lineBox.setIsFirstAfterPageBreak(true); 814 lineBox.setIsFirstAfterPageBreak(true);
813 } 815 }
814 } else if (remainingLogicalHeight == pageLogicalHeight) { 816 return;
817 }
818
819 if (remainingLogicalHeight == pageLogicalHeight) {
815 // We're at the very top of a page or column. 820 // We're at the very top of a page or column.
816 if (lineBox != firstRootBox()) 821 if (lineBox != firstRootBox())
817 lineBox.setIsFirstAfterPageBreak(true); 822 lineBox.setIsFirstAfterPageBreak(true);
818 // If this is the first line in the block, and the block has a top borde r, padding, or (in 823 // If this is the first line in the block, and the block has a top borde r, padding, or (in
819 // case it's a float) margin, we may want to set a strut on the block, s o that everything 824 // case it's a float) margin, we may want to set a strut on the block, s o that everything
820 // ends up in the next column or page. Setting a strut on the block is a lso important when 825 // ends up in the next column or page. Setting a strut on the block is a lso important when
821 // it comes to satisfying orphan requirements. 826 // it comes to satisfying orphan requirements.
822 if (shouldSetStrutOnBlock(*this, lineBox, logicalOffset, lineIndex, rema iningLogicalHeight)) { 827 if (shouldSetStrutOnBlock(*this, lineBox, logicalOffset, lineIndex, page LogicalHeight)) {
823 LayoutUnit strut = logicalOffset + marginBeforeIfFloating(); 828 LayoutUnit strut = logicalOffset + marginBeforeIfFloating();
824 setPaginationStrutPropagatedFromChild(strut); 829 setPaginationStrutPropagatedFromChild(strut);
825 } 830 }
826 } else if (lineBox == firstRootBox() && allowsPaginationStrut()) { 831 } else if (lineBox == firstRootBox() && allowsPaginationStrut()) {
827 // This is the first line in the block. The block may still start in the previous column or 832 // This is the first line in the block. The block may still start in the previous column or
828 // page, and if that's the case, attempt to pull it over to where this l ine is, so that we 833 // page, and if that's the case, attempt to pull it over to where this l ine is, so that we
829 // don't split the top border, padding, or (in case it's a float) margin . 834 // don't split the top border, padding, or (in case it's a float) margin .
830 LayoutUnit totalLogicalOffset = logicalOffset + marginBeforeIfFloating() ; 835 LayoutUnit totalLogicalOffset = logicalOffset + marginBeforeIfFloating() ;
831 LayoutUnit strut = remainingLogicalHeight + totalLogicalOffset - pageLog icalHeight; 836 LayoutUnit strut = remainingLogicalHeight + totalLogicalOffset - pageLog icalHeight;
832 if (strut > 0) { 837 if (strut > 0) {
(...skipping 13 matching lines...) Expand all
846 if (child.paginationBreakability() == AllowAnyBreaks) 851 if (child.paginationBreakability() == AllowAnyBreaks)
847 return logicalOffset; 852 return logicalOffset;
848 LayoutUnit childLogicalHeight = logicalHeightForChild(child); 853 LayoutUnit childLogicalHeight = logicalHeightForChild(child);
849 // Floats' margins do not collapse with page or column boundaries. 854 // Floats' margins do not collapse with page or column boundaries.
850 if (child.isFloating()) 855 if (child.isFloating())
851 childLogicalHeight += marginBeforeForChild(child) + marginAfterForChild( child); 856 childLogicalHeight += marginBeforeForChild(child) + marginAfterForChild( child);
852 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); 857 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset);
853 if (!pageLogicalHeight) 858 if (!pageLogicalHeight)
854 return logicalOffset; 859 return logicalOffset;
855 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset, AssociateWithLatterPage); 860 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset, AssociateWithLatterPage);
856 // Break if there's not enough space left for us, but only as long as we're not already at the 861 if (remainingLogicalHeight >= childLogicalHeight)
857 // top of a page. No point in leaving a page completely blank. 862 return logicalOffset; // It fits fine where it is. No need to break.
858 if (remainingLogicalHeight < childLogicalHeight && remainingLogicalHeight < pageLogicalHeight) 863 LayoutUnit paginationStrut = calculatePaginationStrutToFitContent(logicalOff set, remainingLogicalHeight, childLogicalHeight);
859 return logicalOffset + remainingLogicalHeight; 864 if (paginationStrut == remainingLogicalHeight && remainingLogicalHeight == p ageLogicalHeight) {
860 return logicalOffset; 865 // Don't break if we were at the top of a page, and we failed to fit the content
866 // completely. No point in leaving a page completely blank.
867 return logicalOffset;
868 }
869 return logicalOffset + paginationStrut;
861 } 870 }
862 871
863 void LayoutBlockFlow::rebuildFloatsFromIntruding() 872 void LayoutBlockFlow::rebuildFloatsFromIntruding()
864 { 873 {
865 if (m_floatingObjects) 874 if (m_floatingObjects)
866 m_floatingObjects->setHorizontalWritingMode(isHorizontalWritingMode()); 875 m_floatingObjects->setHorizontalWritingMode(isHorizontalWritingMode());
867 876
868 HashSet<LayoutBox*> oldIntrudingFloatSet; 877 HashSet<LayoutBox*> oldIntrudingFloatSet;
869 if (!childrenInline() && m_floatingObjects) { 878 if (!childrenInline() && m_floatingObjects) {
870 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); 879 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
(...skipping 2226 matching lines...) Expand 10 before | Expand all | Expand 10 after
3097 FrameView* frameView = document().view(); 3106 FrameView* frameView = document().view();
3098 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height(); 3107 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height();
3099 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( ); 3108 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( );
3100 if (size().height() < visibleHeight) 3109 if (size().height() < visibleHeight)
3101 top += (visibleHeight - size().height()) / 2; 3110 top += (visibleHeight - size().height()) / 2;
3102 setY(top); 3111 setY(top);
3103 dialog->setCentered(top); 3112 dialog->setCentered(top);
3104 } 3113 }
3105 3114
3106 } // namespace blink 3115 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutFlowThread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698