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

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

Issue 2215133005: Add grid/flex layout support for <fieldset> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed more ClusterFuzz tests Created 4 years, 3 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 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 } 1156 }
1157 } 1157 }
1158 1158
1159 void LayoutBlockFlow::layoutBlockChildren(bool relayoutChildren, SubtreeLayoutSc ope& layoutScope, LayoutUnit beforeEdge, LayoutUnit afterEdge) 1159 void LayoutBlockFlow::layoutBlockChildren(bool relayoutChildren, SubtreeLayoutSc ope& layoutScope, LayoutUnit beforeEdge, LayoutUnit afterEdge)
1160 { 1160 {
1161 dirtyForLayoutFromPercentageHeightDescendants(layoutScope); 1161 dirtyForLayoutFromPercentageHeightDescendants(layoutScope);
1162 1162
1163 BlockChildrenLayoutInfo layoutInfo(this, beforeEdge, afterEdge); 1163 BlockChildrenLayoutInfo layoutInfo(this, beforeEdge, afterEdge);
1164 MarginInfo& marginInfo = layoutInfo.marginInfo(); 1164 MarginInfo& marginInfo = layoutInfo.marginInfo();
1165 1165
1166 // Fieldsets need to find their legend and position it inside the border of the object.
1167 // The legend then gets skipped during normal layout. The same is true for r uby text.
1168 // It doesn't get included in the normal layout process but is instead skipp ed.
1169 LayoutObject* childToExclude = layoutSpecialExcludedChild(relayoutChildren, layoutScope); 1166 LayoutObject* childToExclude = layoutSpecialExcludedChild(relayoutChildren, layoutScope);
1170 1167
1171 LayoutBox* next = firstChildBox(); 1168 LayoutBox* next = firstChildBox();
1172 LayoutBox* lastNormalFlowChild = nullptr; 1169 LayoutBox* lastNormalFlowChild = nullptr;
1173 1170
1174 while (next) { 1171 while (next) {
1175 LayoutBox* child = next; 1172 LayoutBox* child = next;
1176 next = child->nextSiblingBox(); 1173 next = child->nextSiblingBox();
1177 1174
1178 child->setMayNeedPaintInvalidation(); 1175 child->setMayNeedPaintInvalidation();
1179 1176
1180 if (childToExclude == child) 1177 if (childToExclude == child)
1181 continue; // Skip this child, since it will be positioned by the spe cialized subclass (fieldsets and ruby runs). 1178 continue; // Skip this child, since it will be positioned by the spe cialized subclass (ruby runs).
1182 1179
1183 updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, *child); 1180 updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, *child);
1184 1181
1185 if (child->isOutOfFlowPositioned()) { 1182 if (child->isOutOfFlowPositioned()) {
1186 child->containingBlock()->insertPositionedObject(child); 1183 child->containingBlock()->insertPositionedObject(child);
1187 adjustPositionedBlock(*child, layoutInfo); 1184 adjustPositionedBlock(*child, layoutInfo);
1188 continue; 1185 continue;
1189 } 1186 }
1190 if (child->isFloating()) { 1187 if (child->isFloating()) {
1191 insertFloatingObject(*child); 1188 insertFloatingObject(*child);
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after
2403 newBlock->addChild(newChild); 2400 newBlock->addChild(newChild);
2404 newBlock->reparentSubsequentFloatingOrOutOfFlowSiblings(); 2401 newBlock->reparentSubsequentFloatingOrOutOfFlowSiblings();
2405 return; 2402 return;
2406 } 2403 }
2407 } 2404 }
2408 2405
2409 // Skip the LayoutBlock override, since that one deals with anonymous child insertion in a way 2406 // Skip the LayoutBlock override, since that one deals with anonymous child insertion in a way
2410 // that isn't sufficient for us, and can only cause trouble at this point. 2407 // that isn't sufficient for us, and can only cause trouble at this point.
2411 LayoutBox::addChild(newChild, beforeChild); 2408 LayoutBox::addChild(newChild, beforeChild);
2412 2409
2413 if (madeBoxesNonInline && parent() && isAnonymousBlock() && parent()->isLayo utBlock()) { 2410 if (madeBoxesNonInline && parent() && isAnonymousBlock() && parent()->isLayo utBlock() && !parent()->createsAnonymousWrapper()) {
2414 toLayoutBlock(parent())->removeLeftoverAnonymousBlock(this); 2411 toLayoutBlock(parent())->removeLeftoverAnonymousBlock(this);
2415 // |this| may be dead now. 2412 // |this| may be dead now.
2416 } 2413 }
2417 } 2414 }
2418 2415
2419 static bool isMergeableAnonymousBlock(const LayoutBlockFlow* block) 2416 static bool isMergeableAnonymousBlock(const LayoutBlockFlow* block)
2420 { 2417 {
2421 return block->isAnonymousBlock() && !block->continuation() && !block->beingD estroyed() && !block->isRubyRun() && !block->isRubyBase(); 2418 return block->isAnonymousBlock() && !block->continuation() && !block->beingD estroyed() && !block->isRubyRun() && !block->isRubyBase();
2422 } 2419 }
2423 2420
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
3481 } 3478 }
3482 3479
3483 if (type == NoFlowThread || multiColumnFlowThread()) 3480 if (type == NoFlowThread || multiColumnFlowThread())
3484 return; 3481 return;
3485 3482
3486 // Ruby elements manage child insertion in a special way, and would mess up insertion of the 3483 // Ruby elements manage child insertion in a special way, and would mess up insertion of the
3487 // flow thread. The flow thread needs to be a direct child of the multicol b lock (|this|). 3484 // flow thread. The flow thread needs to be a direct child of the multicol b lock (|this|).
3488 if (isRuby()) 3485 if (isRuby())
3489 return; 3486 return;
3490 3487
3491 // Fieldsets look for a legend special child (layoutSpecialExcludedChild()). We currently only
3492 // support one special child per layout object, and the flow thread would ma ke for a second one.
3493 if (isFieldset())
3494 return;
3495
3496 // Form controls are replaced content, and are therefore not supposed to sup port multicol. 3488 // Form controls are replaced content, and are therefore not supposed to sup port multicol.
3497 if (isFileUploadControl() || isTextControl() || isListBox()) 3489 if (isFileUploadControl() || isTextControl() || isListBox())
3498 return; 3490 return;
3499 3491
3500 LayoutMultiColumnFlowThread* flowThread = createMultiColumnFlowThread(type); 3492 LayoutMultiColumnFlowThread* flowThread = createMultiColumnFlowThread(type);
3501 addChild(flowThread); 3493 addChild(flowThread);
3502 3494
3503 // Check that addChild() put the flow thread as a direct child, and didn't d o fancy things. 3495 // Check that addChild() put the flow thread as a direct child, and didn't d o fancy things.
3504 ASSERT(flowThread->parent() == this); 3496 ASSERT(flowThread->parent() == this);
3505 3497
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
3753 3745
3754 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState); 3746 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState);
3755 } 3747 }
3756 3748
3757 void LayoutBlockFlow::invalidateDisplayItemClients(PaintInvalidationReason inval idationReason) const 3749 void LayoutBlockFlow::invalidateDisplayItemClients(PaintInvalidationReason inval idationReason) const
3758 { 3750 {
3759 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients(invalidationRe ason); 3751 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients(invalidationRe ason);
3760 } 3752 }
3761 3753
3762 } // namespace blink 3754 } // 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