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

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

Issue 2150003005: Add grid/flex layout support for <fieldset> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add grid/flex layout support for <fieldset> Created 4 years, 4 months 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 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 } 1136 }
1137 } 1137 }
1138 1138
1139 void LayoutBlockFlow::layoutBlockChildren(bool relayoutChildren, SubtreeLayoutSc ope& layoutScope, LayoutUnit beforeEdge, LayoutUnit afterEdge) 1139 void LayoutBlockFlow::layoutBlockChildren(bool relayoutChildren, SubtreeLayoutSc ope& layoutScope, LayoutUnit beforeEdge, LayoutUnit afterEdge)
1140 { 1140 {
1141 dirtyForLayoutFromPercentageHeightDescendants(layoutScope); 1141 dirtyForLayoutFromPercentageHeightDescendants(layoutScope);
1142 1142
1143 BlockChildrenLayoutInfo layoutInfo(this, beforeEdge, afterEdge); 1143 BlockChildrenLayoutInfo layoutInfo(this, beforeEdge, afterEdge);
1144 MarginInfo& marginInfo = layoutInfo.marginInfo(); 1144 MarginInfo& marginInfo = layoutInfo.marginInfo();
1145 1145
1146 // Fieldsets need to find their legend and position it inside the border of the object.
1147 // The legend then gets skipped during normal layout. The same is true for r uby text.
1148 // It doesn't get included in the normal layout process but is instead skipp ed.
1149 LayoutObject* childToExclude = layoutSpecialExcludedChild(relayoutChildren, layoutScope); 1146 LayoutObject* childToExclude = layoutSpecialExcludedChild(relayoutChildren, layoutScope);
1150 1147
1151 LayoutBox* next = firstChildBox(); 1148 LayoutBox* next = firstChildBox();
1152 LayoutBox* lastNormalFlowChild = nullptr; 1149 LayoutBox* lastNormalFlowChild = nullptr;
1153 1150
1154 while (next) { 1151 while (next) {
1155 LayoutBox* child = next; 1152 LayoutBox* child = next;
1156 next = child->nextSiblingBox(); 1153 next = child->nextSiblingBox();
1157 1154
1158 child->setMayNeedPaintInvalidation(); 1155 child->setMayNeedPaintInvalidation();
1159 1156
1160 if (childToExclude == child) 1157 if (childToExclude == child)
1161 continue; // Skip this child, since it will be positioned by the spe cialized subclass (fieldsets and ruby runs). 1158 continue; // Skip this child, since it will be positioned by the spe cialized subclass (ruby runs).
1162 1159
1163 updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, *child); 1160 updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, *child);
1164 1161
1165 if (child->isOutOfFlowPositioned()) { 1162 if (child->isOutOfFlowPositioned()) {
1166 child->containingBlock()->insertPositionedObject(child); 1163 child->containingBlock()->insertPositionedObject(child);
1167 adjustPositionedBlock(*child, layoutInfo); 1164 adjustPositionedBlock(*child, layoutInfo);
1168 continue; 1165 continue;
1169 } 1166 }
1170 if (child->isFloating()) { 1167 if (child->isFloating()) {
1171 insertFloatingObject(*child); 1168 insertFloatingObject(*child);
(...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after
2390 newBlock->addChild(newChild); 2387 newBlock->addChild(newChild);
2391 newBlock->reparentSubsequentFloatingOrOutOfFlowSiblings(); 2388 newBlock->reparentSubsequentFloatingOrOutOfFlowSiblings();
2392 return; 2389 return;
2393 } 2390 }
2394 } 2391 }
2395 2392
2396 // Skip the LayoutBlock override, since that one deals with anonymous child insertion in a way 2393 // Skip the LayoutBlock override, since that one deals with anonymous child insertion in a way
2397 // that isn't sufficient for us, and can only cause trouble at this point. 2394 // that isn't sufficient for us, and can only cause trouble at this point.
2398 LayoutBox::addChild(newChild, beforeChild); 2395 LayoutBox::addChild(newChild, beforeChild);
2399 2396
2400 if (madeBoxesNonInline && parent() && isAnonymousBlock() && parent()->isLayo utBlock()) { 2397 if (madeBoxesNonInline && parent() && isAnonymousBlock() && parent()->isLayo utBlock() && !parent()->createsAnonymousWrapper()) {
2401 toLayoutBlock(parent())->removeLeftoverAnonymousBlock(this); 2398 toLayoutBlock(parent())->removeLeftoverAnonymousBlock(this);
2402 // |this| may be dead now. 2399 // |this| may be dead now.
2403 } 2400 }
2404 } 2401 }
2405 2402
2406 static bool isMergeableAnonymousBlock(const LayoutBlockFlow* block) 2403 static bool isMergeableAnonymousBlock(const LayoutBlockFlow* block)
2407 { 2404 {
2408 return block->isAnonymousBlock() && !block->continuation() && !block->beingD estroyed() && !block->isRubyRun() && !block->isRubyBase(); 2405 return block->isAnonymousBlock() && !block->continuation() && !block->beingD estroyed() && !block->isRubyRun() && !block->isRubyBase();
2409 } 2406 }
2410 2407
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after
3516 } 3513 }
3517 3514
3518 if (type == NoFlowThread || multiColumnFlowThread()) 3515 if (type == NoFlowThread || multiColumnFlowThread())
3519 return; 3516 return;
3520 3517
3521 // Ruby elements manage child insertion in a special way, and would mess up insertion of the 3518 // Ruby elements manage child insertion in a special way, and would mess up insertion of the
3522 // flow thread. The flow thread needs to be a direct child of the multicol b lock (|this|). 3519 // flow thread. The flow thread needs to be a direct child of the multicol b lock (|this|).
3523 if (isRuby()) 3520 if (isRuby())
3524 return; 3521 return;
3525 3522
3526 // Fieldsets look for a legend special child (layoutSpecialExcludedChild()). We currently only
3527 // support one special child per layout object, and the flow thread would ma ke for a second one.
3528 if (isFieldset())
3529 return;
3530
3531 // Form controls are replaced content, and are therefore not supposed to sup port multicol. 3523 // Form controls are replaced content, and are therefore not supposed to sup port multicol.
3532 if (isFileUploadControl() || isTextControl() || isListBox()) 3524 if (isFileUploadControl() || isTextControl() || isListBox())
3533 return; 3525 return;
3534 3526
3535 LayoutMultiColumnFlowThread* flowThread = createMultiColumnFlowThread(type); 3527 LayoutMultiColumnFlowThread* flowThread = createMultiColumnFlowThread(type);
3536 addChild(flowThread); 3528 addChild(flowThread);
3537 3529
3538 // Check that addChild() put the flow thread as a direct child, and didn't d o fancy things. 3530 // Check that addChild() put the flow thread as a direct child, and didn't d o fancy things.
3539 ASSERT(flowThread->parent() == this); 3531 ASSERT(flowThread->parent() == this);
3540 3532
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
3775 if (!rect.isEmpty()) 3767 if (!rect.isEmpty())
3776 rects.append(rect); 3768 rects.append(rect);
3777 } 3769 }
3778 } 3770 }
3779 3771
3780 if (inlineElementContinuation) 3772 if (inlineElementContinuation)
3781 inlineElementContinuation->addOutlineRects(rects, additionalOffset + (in lineElementContinuation->containingBlock()->location() - location()), includeBlo ckOverflows); 3773 inlineElementContinuation->addOutlineRects(rects, additionalOffset + (in lineElementContinuation->containingBlock()->location() - location()), includeBlo ckOverflows);
3782 } 3774 }
3783 3775
3784 } // namespace blink 3776 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutFieldset.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698