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

Side by Side Diff: Source/core/rendering/RenderBlockFlow.cpp

Issue 792803002: [New Multicolumn] Layout support for column-span:all. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@347325-placeholder
Patch Set: Created 6 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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 // invalidate our paint (and the child) anyway. 676 // invalidate our paint (and the child) anyway.
677 if (!selfNeedsLayout() && (childOffset.width() || childOffset.height())) 677 if (!selfNeedsLayout() && (childOffset.width() || childOffset.height()))
678 child.invalidatePaintForOverhangingFloats(true); 678 child.invalidatePaintForOverhangingFloats(true);
679 679
680 if (paginated) { 680 if (paginated) {
681 // Check for an after page/column break. 681 // Check for an after page/column break.
682 LayoutUnit newHeight = applyAfterBreak(child, logicalHeight(), marginInf o); 682 LayoutUnit newHeight = applyAfterBreak(child, logicalHeight(), marginInf o);
683 if (newHeight != height()) 683 if (newHeight != height())
684 setLogicalHeight(newHeight); 684 setLogicalHeight(newHeight);
685 } 685 }
686
687 if (child.isRenderMultiColumnSpannerPlaceholder()) {
688 // The actual column-span:all element is positioned by this placeholder child.
689 positionSpannerDescendant(toRenderMultiColumnSpannerPlaceholder(child));
690 }
686 } 691 }
687 692
688 LayoutUnit RenderBlockFlow::adjustBlockChildForPagination(LayoutUnit logicalTopA fterClear, LayoutUnit estimateWithoutPagination, RenderBox& child, bool atBefore SideOfBlock) 693 LayoutUnit RenderBlockFlow::adjustBlockChildForPagination(LayoutUnit logicalTopA fterClear, LayoutUnit estimateWithoutPagination, RenderBox& child, bool atBefore SideOfBlock)
689 { 694 {
690 RenderBlockFlow* childBlockFlow = child.isRenderBlockFlow() ? toRenderBlockF low(&child) : 0; 695 RenderBlockFlow* childBlockFlow = child.isRenderBlockFlow() ? toRenderBlockF low(&child) : 0;
691 696
692 if (estimateWithoutPagination != logicalTopAfterClear) { 697 if (estimateWithoutPagination != logicalTopAfterClear) {
693 // Our guess prior to pagination movement was wrong. Before we attempt t o paginate, let's try again at the new 698 // Our guess prior to pagination movement was wrong. Before we attempt t o paginate, let's try again at the new
694 // position. 699 // position.
695 setLogicalHeight(logicalTopAfterClear); 700 setLogicalHeight(logicalTopAfterClear);
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 adjustPositionedBlock(*child, marginInfo); 1058 adjustPositionedBlock(*child, marginInfo);
1054 continue; 1059 continue;
1055 } 1060 }
1056 if (child->isFloating()) { 1061 if (child->isFloating()) {
1057 insertFloatingObject(*child); 1062 insertFloatingObject(*child);
1058 adjustFloatingBlock(marginInfo); 1063 adjustFloatingBlock(marginInfo);
1059 continue; 1064 continue;
1060 } 1065 }
1061 if (child->isColumnSpanAll()) { 1066 if (child->isColumnSpanAll()) {
1062 // This is not the containing block of the spanner. The spanner's pl aceholder will lay 1067 // This is not the containing block of the spanner. The spanner's pl aceholder will lay
1063 // it out in due course. 1068 // it out in due course. For now we just need to consult our flow th read, so that the
1069 // columns (if any) preceding and following the spanner are laid out correctly.
1070 LayoutUnit adjustment = flowThreadContainingBlock()->skipColumnSpann er(child, offsetFromLogicalTopOfFirstPage() + logicalHeight());
1071 setLogicalHeight(logicalHeight() + adjustment);
1064 continue; 1072 continue;
1065 } 1073 }
1066 1074
1067 // Lay out the child. 1075 // Lay out the child.
1068 layoutBlockChild(*child, marginInfo, previousFloatLogicalBottom); 1076 layoutBlockChild(*child, marginInfo, previousFloatLogicalBottom);
1069 lastNormalFlowChild = child; 1077 lastNormalFlowChild = child;
1070 } 1078 }
1071 1079
1072 // Now do the handling of the bottom of the block, adding in our bottom bord er/padding and 1080 // Now do the handling of the bottom of the block, adding in our bottom bord er/padding and
1073 // determining the correct collapsed bottom margin information. 1081 // determining the correct collapsed bottom margin information.
(...skipping 1886 matching lines...) Expand 10 before | Expand all | Expand 10 after
2960 void RenderBlockFlow::setPaginationStrut(LayoutUnit strut) 2968 void RenderBlockFlow::setPaginationStrut(LayoutUnit strut)
2961 { 2969 {
2962 if (!m_rareData) { 2970 if (!m_rareData) {
2963 if (!strut) 2971 if (!strut)
2964 return; 2972 return;
2965 m_rareData = adoptPtrWillBeNoop(new RenderBlockFlowRareData(this)); 2973 m_rareData = adoptPtrWillBeNoop(new RenderBlockFlowRareData(this));
2966 } 2974 }
2967 m_rareData->m_paginationStrut = strut; 2975 m_rareData->m_paginationStrut = strut;
2968 } 2976 }
2969 2977
2978 void RenderBlockFlow::positionSpannerDescendant(RenderMultiColumnSpannerPlacehol der& child)
2979 {
2980 RenderBox& spanner = *child.rendererInFlowThread();
2981 // FIXME: |spanner| is a descendant, but never a direct child, so the names here are bad, if
2982 // nothing else.
2983 setLogicalTopForChild(spanner, child.logicalTop());
2984 determineLogicalLeftPositionForChild(spanner);
2985 }
2986
2970 bool RenderBlockFlow::avoidsFloats() const 2987 bool RenderBlockFlow::avoidsFloats() const
2971 { 2988 {
2972 // Floats can't intrude into our box if we have a non-auto column count or w idth. 2989 // Floats can't intrude into our box if we have a non-auto column count or w idth.
2973 // Note: we need to use RenderBox::avoidsFloats here since RenderBlock::avoi dsFloats is always true. 2990 // Note: we need to use RenderBox::avoidsFloats here since RenderBlock::avoi dsFloats is always true.
2974 return RenderBox::avoidsFloats() || !style()->hasAutoColumnCount() || !style ()->hasAutoColumnWidth(); 2991 return RenderBox::avoidsFloats() || !style()->hasAutoColumnCount() || !style ()->hasAutoColumnWidth();
2975 } 2992 }
2976 2993
2977 void RenderBlockFlow::moveChildrenTo(RenderBoxModelObject* toBoxModelObject, Ren derObject* startChild, RenderObject* endChild, RenderObject* beforeChild, bool f ullRemoveInsert) 2994 void RenderBlockFlow::moveChildrenTo(RenderBoxModelObject* toBoxModelObject, Ren derObject* startChild, RenderObject* endChild, RenderObject* beforeChild, bool f ullRemoveInsert)
2978 { 2995 {
2979 if (childrenInline()) 2996 if (childrenInline())
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
3108 FrameView* frameView = document().view(); 3125 FrameView* frameView = document().view();
3109 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height(); 3126 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height();
3110 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( ); 3127 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( );
3111 if (height() < visibleHeight) 3128 if (height() < visibleHeight)
3112 top += (visibleHeight - height()) / 2; 3129 top += (visibleHeight - height()) / 2;
3113 setY(top); 3130 setY(top);
3114 dialog->setCentered(top); 3131 dialog->setCentered(top);
3115 } 3132 }
3116 3133
3117 } // namespace blink 3134 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698