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

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

Issue 2560123003: 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 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 1422
1423 void LayoutBlockFlow::layoutBlockChildren(bool relayoutChildren, 1423 void LayoutBlockFlow::layoutBlockChildren(bool relayoutChildren,
1424 SubtreeLayoutScope& layoutScope, 1424 SubtreeLayoutScope& layoutScope,
1425 LayoutUnit beforeEdge, 1425 LayoutUnit beforeEdge,
1426 LayoutUnit afterEdge) { 1426 LayoutUnit afterEdge) {
1427 dirtyForLayoutFromPercentageHeightDescendants(layoutScope); 1427 dirtyForLayoutFromPercentageHeightDescendants(layoutScope);
1428 1428
1429 BlockChildrenLayoutInfo layoutInfo(this, beforeEdge, afterEdge); 1429 BlockChildrenLayoutInfo layoutInfo(this, beforeEdge, afterEdge);
1430 MarginInfo& marginInfo = layoutInfo.marginInfo(); 1430 MarginInfo& marginInfo = layoutInfo.marginInfo();
1431 1431
1432 // Fieldsets need to find their legend and position it inside the border of
1433 // the object.
1434 // The legend then gets skipped during normal layout. The same is true for
1435 // ruby text.
1436 // It doesn't get included in the normal layout process but is instead skipped
1432 LayoutObject* childToExclude = 1437 LayoutObject* childToExclude =
1433 layoutSpecialExcludedChild(relayoutChildren, layoutScope); 1438 layoutSpecialExcludedChild(relayoutChildren, layoutScope);
1434 1439
1435 // TODO(foolip): Speculative CHECKs to crash if any non-LayoutBox 1440 // TODO(foolip): Speculative CHECKs to crash if any non-LayoutBox
1436 // children ever appear, the childrenInline() check at the call site 1441 // children ever appear, the childrenInline() check at the call site
1437 // should make this impossible. crbug.com/632848 1442 // should make this impossible. crbug.com/632848
1438 LayoutObject* firstChild = this->firstChild(); 1443 LayoutObject* firstChild = this->firstChild();
1439 CHECK(!firstChild || firstChild->isBox()); 1444 CHECK(!firstChild || firstChild->isBox());
1440 LayoutBox* next = toLayoutBox(firstChild); 1445 LayoutBox* next = toLayoutBox(firstChild);
1441 LayoutBox* lastNormalFlowChild = nullptr; 1446 LayoutBox* lastNormalFlowChild = nullptr;
1442 1447
1443 while (next) { 1448 while (next) {
1444 LayoutBox* child = next; 1449 LayoutBox* child = next;
1445 LayoutObject* nextSibling = child->nextSibling(); 1450 LayoutObject* nextSibling = child->nextSibling();
1446 CHECK(!nextSibling || nextSibling->isBox()); 1451 CHECK(!nextSibling || nextSibling->isBox());
1447 next = toLayoutBox(nextSibling); 1452 next = toLayoutBox(nextSibling);
1448 1453
1449 child->setMayNeedPaintInvalidation(); 1454 child->setMayNeedPaintInvalidation();
1450 1455
1451 if (childToExclude == child) 1456 if (childToExclude == child)
1452 continue; // Skip this child, since it will be positioned by the 1457 continue; // Skip this child, since it will be positioned by the
1453 // specialized subclass (ruby runs). 1458 // specialized subclass (fieldsets and ruby runs).
1454 1459
1455 updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, *child); 1460 updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, *child);
1456 1461
1457 if (child->isOutOfFlowPositioned()) { 1462 if (child->isOutOfFlowPositioned()) {
1458 child->containingBlock()->insertPositionedObject(child); 1463 child->containingBlock()->insertPositionedObject(child);
1459 adjustPositionedBlock(*child, layoutInfo); 1464 adjustPositionedBlock(*child, layoutInfo);
1460 continue; 1465 continue;
1461 } 1466 }
1462 if (child->isFloating()) { 1467 if (child->isFloating()) {
1463 insertFloatingObject(*child); 1468 insertFloatingObject(*child);
(...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after
2934 return; 2939 return;
2935 } 2940 }
2936 } 2941 }
2937 2942
2938 // Skip the LayoutBlock override, since that one deals with anonymous child 2943 // Skip the LayoutBlock override, since that one deals with anonymous child
2939 // insertion in a way that isn't sufficient for us, and can only cause trouble 2944 // insertion in a way that isn't sufficient for us, and can only cause trouble
2940 // at this point. 2945 // at this point.
2941 LayoutBox::addChild(newChild, beforeChild); 2946 LayoutBox::addChild(newChild, beforeChild);
2942 2947
2943 if (madeBoxesNonInline && parent() && isAnonymousBlock() && 2948 if (madeBoxesNonInline && parent() && isAnonymousBlock() &&
2944 parent()->isLayoutBlock() && !parent()->createsAnonymousWrapper()) { 2949 parent()->isLayoutBlock()) {
2945 toLayoutBlock(parent())->removeLeftoverAnonymousBlock(this); 2950 toLayoutBlock(parent())->removeLeftoverAnonymousBlock(this);
2946 // |this| may be dead now. 2951 // |this| may be dead now.
2947 } 2952 }
2948 } 2953 }
2949 2954
2950 static bool isMergeableAnonymousBlock(const LayoutBlockFlow* block) { 2955 static bool isMergeableAnonymousBlock(const LayoutBlockFlow* block) {
2951 return block->isAnonymousBlock() && !block->continuation() && 2956 return block->isAnonymousBlock() && !block->continuation() &&
2952 !block->beingDestroyed() && !block->isRubyRun() && 2957 !block->beingDestroyed() && !block->isRubyRun() &&
2953 !block->isRubyBase(); 2958 !block->isRubyBase();
2954 } 2959 }
(...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after
4220 4225
4221 if (type == NoFlowThread || multiColumnFlowThread()) 4226 if (type == NoFlowThread || multiColumnFlowThread())
4222 return; 4227 return;
4223 4228
4224 // Ruby elements manage child insertion in a special way, and would mess up 4229 // Ruby elements manage child insertion in a special way, and would mess up
4225 // insertion of the flow thread. The flow thread needs to be a direct child of 4230 // insertion of the flow thread. The flow thread needs to be a direct child of
4226 // the multicol block (|this|). 4231 // the multicol block (|this|).
4227 if (isRuby()) 4232 if (isRuby())
4228 return; 4233 return;
4229 4234
4235 // Fieldsets look for a legend special child (layoutSpecialExcludedChild()).
4236 // We currently only support one special child per layout object, and the
4237 // flow thread would make for a second one.
4238 if (isFieldset())
4239 return;
4240
4230 // Form controls are replaced content, and are therefore not supposed to 4241 // Form controls are replaced content, and are therefore not supposed to
4231 // support multicol. 4242 // support multicol.
4232 if (isFileUploadControl() || isTextControl() || isListBox()) 4243 if (isFileUploadControl() || isTextControl() || isListBox())
4233 return; 4244 return;
4234 4245
4235 LayoutMultiColumnFlowThread* flowThread = createMultiColumnFlowThread(type); 4246 LayoutMultiColumnFlowThread* flowThread = createMultiColumnFlowThread(type);
4236 addChild(flowThread); 4247 addChild(flowThread);
4237 m_paginationStateChanged = true; 4248 m_paginationStateChanged = true;
4238 4249
4239 // Check that addChild() put the flow thread as a direct child, and didn't do 4250 // Check that addChild() put the flow thread as a direct child, and didn't do
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
4547 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState); 4558 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState);
4548 } 4559 }
4549 4560
4550 void LayoutBlockFlow::invalidateDisplayItemClients( 4561 void LayoutBlockFlow::invalidateDisplayItemClients(
4551 PaintInvalidationReason invalidationReason) const { 4562 PaintInvalidationReason invalidationReason) const {
4552 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients( 4563 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients(
4553 invalidationReason); 4564 invalidationReason);
4554 } 4565 }
4555 4566
4556 } // namespace blink 4567 } // 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