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

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

Issue 2555413002: Revert commit# 415577 "Add grid/flex layout support for <fieldset>" (Closed)
Patch Set: Created 4 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 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after
1395 1395
1396 void LayoutBlockFlow::layoutBlockChildren(bool relayoutChildren, 1396 void LayoutBlockFlow::layoutBlockChildren(bool relayoutChildren,
1397 SubtreeLayoutScope& layoutScope, 1397 SubtreeLayoutScope& layoutScope,
1398 LayoutUnit beforeEdge, 1398 LayoutUnit beforeEdge,
1399 LayoutUnit afterEdge) { 1399 LayoutUnit afterEdge) {
1400 dirtyForLayoutFromPercentageHeightDescendants(layoutScope); 1400 dirtyForLayoutFromPercentageHeightDescendants(layoutScope);
1401 1401
1402 BlockChildrenLayoutInfo layoutInfo(this, beforeEdge, afterEdge); 1402 BlockChildrenLayoutInfo layoutInfo(this, beforeEdge, afterEdge);
1403 MarginInfo& marginInfo = layoutInfo.marginInfo(); 1403 MarginInfo& marginInfo = layoutInfo.marginInfo();
1404 1404
1405 // Fieldsets need to find their legend and position it inside the border of
1406 // the object.
1407 // The legend then gets skipped during normal layout. The same is true for
1408 // ruby text.
1409 // It doesn't get included in the normal layout process but is instead skipped
1405 LayoutObject* childToExclude = 1410 LayoutObject* childToExclude =
1406 layoutSpecialExcludedChild(relayoutChildren, layoutScope); 1411 layoutSpecialExcludedChild(relayoutChildren, layoutScope);
1407 1412
1408 // TODO(foolip): Speculative CHECKs to crash if any non-LayoutBox 1413 // TODO(foolip): Speculative CHECKs to crash if any non-LayoutBox
1409 // children ever appear, the childrenInline() check at the call site 1414 // children ever appear, the childrenInline() check at the call site
1410 // should make this impossible. crbug.com/632848 1415 // should make this impossible. crbug.com/632848
1411 LayoutObject* firstChild = this->firstChild(); 1416 LayoutObject* firstChild = this->firstChild();
1412 CHECK(!firstChild || firstChild->isBox()); 1417 CHECK(!firstChild || firstChild->isBox());
1413 LayoutBox* next = toLayoutBox(firstChild); 1418 LayoutBox* next = toLayoutBox(firstChild);
1414 LayoutBox* lastNormalFlowChild = nullptr; 1419 LayoutBox* lastNormalFlowChild = nullptr;
1415 1420
1416 while (next) { 1421 while (next) {
1417 LayoutBox* child = next; 1422 LayoutBox* child = next;
1418 LayoutObject* nextSibling = child->nextSibling(); 1423 LayoutObject* nextSibling = child->nextSibling();
1419 CHECK(!nextSibling || nextSibling->isBox()); 1424 CHECK(!nextSibling || nextSibling->isBox());
1420 next = toLayoutBox(nextSibling); 1425 next = toLayoutBox(nextSibling);
1421 1426
1422 child->setMayNeedPaintInvalidation(); 1427 child->setMayNeedPaintInvalidation();
1423 1428
1424 if (childToExclude == child) 1429 if (childToExclude == child)
1425 continue; // Skip this child, since it will be positioned by the 1430 continue; // Skip this child, since it will be positioned by the
1426 // specialized subclass (ruby runs). 1431 // specialized subclass (fieldsets and ruby runs).
1427 1432
1428 updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, *child); 1433 updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, *child);
1429 1434
1430 if (child->isOutOfFlowPositioned()) { 1435 if (child->isOutOfFlowPositioned()) {
1431 child->containingBlock()->insertPositionedObject(child); 1436 child->containingBlock()->insertPositionedObject(child);
1432 adjustPositionedBlock(*child, layoutInfo); 1437 adjustPositionedBlock(*child, layoutInfo);
1433 continue; 1438 continue;
1434 } 1439 }
1435 if (child->isFloating()) { 1440 if (child->isFloating()) {
1436 insertFloatingObject(*child); 1441 insertFloatingObject(*child);
(...skipping 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after
2897 return; 2902 return;
2898 } 2903 }
2899 } 2904 }
2900 2905
2901 // Skip the LayoutBlock override, since that one deals with anonymous child 2906 // Skip the LayoutBlock override, since that one deals with anonymous child
2902 // insertion in a way that isn't sufficient for us, and can only cause trouble 2907 // insertion in a way that isn't sufficient for us, and can only cause trouble
2903 // at this point. 2908 // at this point.
2904 LayoutBox::addChild(newChild, beforeChild); 2909 LayoutBox::addChild(newChild, beforeChild);
2905 2910
2906 if (madeBoxesNonInline && parent() && isAnonymousBlock() && 2911 if (madeBoxesNonInline && parent() && isAnonymousBlock() &&
2907 parent()->isLayoutBlock() && !parent()->createsAnonymousWrapper()) { 2912 parent()->isLayoutBlock()) {
2908 toLayoutBlock(parent())->removeLeftoverAnonymousBlock(this); 2913 toLayoutBlock(parent())->removeLeftoverAnonymousBlock(this);
2909 // |this| may be dead now. 2914 // |this| may be dead now.
2910 } 2915 }
2911 } 2916 }
2912 2917
2913 static bool isMergeableAnonymousBlock(const LayoutBlockFlow* block) { 2918 static bool isMergeableAnonymousBlock(const LayoutBlockFlow* block) {
2914 return block->isAnonymousBlock() && !block->continuation() && 2919 return block->isAnonymousBlock() && !block->continuation() &&
2915 !block->beingDestroyed() && !block->isRubyRun() && 2920 !block->beingDestroyed() && !block->isRubyRun() &&
2916 !block->isRubyBase(); 2921 !block->isRubyBase();
2917 } 2922 }
(...skipping 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after
4142 4147
4143 if (type == NoFlowThread || multiColumnFlowThread()) 4148 if (type == NoFlowThread || multiColumnFlowThread())
4144 return; 4149 return;
4145 4150
4146 // Ruby elements manage child insertion in a special way, and would mess up 4151 // Ruby elements manage child insertion in a special way, and would mess up
4147 // insertion of the flow thread. The flow thread needs to be a direct child of 4152 // insertion of the flow thread. The flow thread needs to be a direct child of
4148 // the multicol block (|this|). 4153 // the multicol block (|this|).
4149 if (isRuby()) 4154 if (isRuby())
4150 return; 4155 return;
4151 4156
4157 // Fieldsets look for a legend special child (layoutSpecialExcludedChild()).
4158 // We currently only support one special child per layout object, and the
4159 // flow thread would make for a second one.
4160 if (isFieldset())
4161 return;
4162
4152 // Form controls are replaced content, and are therefore not supposed to 4163 // Form controls are replaced content, and are therefore not supposed to
4153 // support multicol. 4164 // support multicol.
4154 if (isFileUploadControl() || isTextControl() || isListBox()) 4165 if (isFileUploadControl() || isTextControl() || isListBox())
4155 return; 4166 return;
4156 4167
4157 LayoutMultiColumnFlowThread* flowThread = createMultiColumnFlowThread(type); 4168 LayoutMultiColumnFlowThread* flowThread = createMultiColumnFlowThread(type);
4158 addChild(flowThread); 4169 addChild(flowThread);
4159 4170
4160 // Check that addChild() put the flow thread as a direct child, and didn't do 4171 // Check that addChild() put the flow thread as a direct child, and didn't do
4161 // fancy things. 4172 // fancy things.
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
4468 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState); 4479 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState);
4469 } 4480 }
4470 4481
4471 void LayoutBlockFlow::invalidateDisplayItemClients( 4482 void LayoutBlockFlow::invalidateDisplayItemClients(
4472 PaintInvalidationReason invalidationReason) const { 4483 PaintInvalidationReason invalidationReason) const {
4473 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients( 4484 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients(
4474 invalidationReason); 4485 invalidationReason);
4475 } 4486 }
4476 4487
4477 } // namespace blink 4488 } // 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