OLD | NEW |
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 Loading... |
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. |
1146 LayoutObject* childToExclude = layoutSpecialExcludedChild(relayoutChildren,
layoutScope); | 1149 LayoutObject* childToExclude = layoutSpecialExcludedChild(relayoutChildren,
layoutScope); |
1147 | 1150 |
1148 LayoutBox* next = firstChildBox(); | 1151 LayoutBox* next = firstChildBox(); |
1149 LayoutBox* lastNormalFlowChild = nullptr; | 1152 LayoutBox* lastNormalFlowChild = nullptr; |
1150 | 1153 |
1151 while (next) { | 1154 while (next) { |
1152 LayoutBox* child = next; | 1155 LayoutBox* child = next; |
1153 next = child->nextSiblingBox(); | 1156 next = child->nextSiblingBox(); |
1154 | 1157 |
1155 child->setMayNeedPaintInvalidation(); | 1158 child->setMayNeedPaintInvalidation(); |
1156 | 1159 |
1157 if (childToExclude == child) | 1160 if (childToExclude == child) |
1158 continue; // Skip this child, since it will be positioned by the spe
cialized subclass (ruby runs). | 1161 continue; // Skip this child, since it will be positioned by the spe
cialized subclass (fieldsets and ruby runs). |
1159 | 1162 |
1160 updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, *child); | 1163 updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, *child); |
1161 | 1164 |
1162 if (child->isOutOfFlowPositioned()) { | 1165 if (child->isOutOfFlowPositioned()) { |
1163 child->containingBlock()->insertPositionedObject(child); | 1166 child->containingBlock()->insertPositionedObject(child); |
1164 adjustPositionedBlock(*child, layoutInfo); | 1167 adjustPositionedBlock(*child, layoutInfo); |
1165 continue; | 1168 continue; |
1166 } | 1169 } |
1167 if (child->isFloating()) { | 1170 if (child->isFloating()) { |
1168 insertFloatingObject(*child); | 1171 insertFloatingObject(*child); |
(...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2387 newBlock->addChild(newChild); | 2390 newBlock->addChild(newChild); |
2388 newBlock->reparentSubsequentFloatingOrOutOfFlowSiblings(); | 2391 newBlock->reparentSubsequentFloatingOrOutOfFlowSiblings(); |
2389 return; | 2392 return; |
2390 } | 2393 } |
2391 } | 2394 } |
2392 | 2395 |
2393 // Skip the LayoutBlock override, since that one deals with anonymous child
insertion in a way | 2396 // Skip the LayoutBlock override, since that one deals with anonymous child
insertion in a way |
2394 // that isn't sufficient for us, and can only cause trouble at this point. | 2397 // that isn't sufficient for us, and can only cause trouble at this point. |
2395 LayoutBox::addChild(newChild, beforeChild); | 2398 LayoutBox::addChild(newChild, beforeChild); |
2396 | 2399 |
2397 if (madeBoxesNonInline && parent() && isAnonymousBlock() && parent()->isLayo
utBlock() && !parent()->createsAnonymousWrapper()) { | 2400 if (madeBoxesNonInline && parent() && isAnonymousBlock() && parent()->isLayo
utBlock()) { |
2398 toLayoutBlock(parent())->removeLeftoverAnonymousBlock(this); | 2401 toLayoutBlock(parent())->removeLeftoverAnonymousBlock(this); |
2399 // |this| may be dead now. | 2402 // |this| may be dead now. |
2400 } | 2403 } |
2401 } | 2404 } |
2402 | 2405 |
2403 void LayoutBlockFlow::removeChild(LayoutObject* oldChild) | 2406 void LayoutBlockFlow::removeChild(LayoutObject* oldChild) |
2404 { | 2407 { |
2405 // No need to waste time in merging or removing empty anonymous blocks. | 2408 // No need to waste time in merging or removing empty anonymous blocks. |
2406 // We can just bail out if our document is getting destroyed. | 2409 // We can just bail out if our document is getting destroyed. |
2407 if (documentBeingDestroyed()) { | 2410 if (documentBeingDestroyed()) { |
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3513 } | 3516 } |
3514 | 3517 |
3515 if (type == NoFlowThread || multiColumnFlowThread()) | 3518 if (type == NoFlowThread || multiColumnFlowThread()) |
3516 return; | 3519 return; |
3517 | 3520 |
3518 // Ruby elements manage child insertion in a special way, and would mess up
insertion of the | 3521 // Ruby elements manage child insertion in a special way, and would mess up
insertion of the |
3519 // flow thread. The flow thread needs to be a direct child of the multicol b
lock (|this|). | 3522 // flow thread. The flow thread needs to be a direct child of the multicol b
lock (|this|). |
3520 if (isRuby()) | 3523 if (isRuby()) |
3521 return; | 3524 return; |
3522 | 3525 |
| 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 |
3523 // Form controls are replaced content, and are therefore not supposed to sup
port multicol. | 3531 // Form controls are replaced content, and are therefore not supposed to sup
port multicol. |
3524 if (isFileUploadControl() || isTextControl() || isListBox()) | 3532 if (isFileUploadControl() || isTextControl() || isListBox()) |
3525 return; | 3533 return; |
3526 | 3534 |
3527 LayoutMultiColumnFlowThread* flowThread = createMultiColumnFlowThread(type); | 3535 LayoutMultiColumnFlowThread* flowThread = createMultiColumnFlowThread(type); |
3528 addChild(flowThread); | 3536 addChild(flowThread); |
3529 | 3537 |
3530 // Check that addChild() put the flow thread as a direct child, and didn't d
o fancy things. | 3538 // Check that addChild() put the flow thread as a direct child, and didn't d
o fancy things. |
3531 ASSERT(flowThread->parent() == this); | 3539 ASSERT(flowThread->parent() == this); |
3532 | 3540 |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3767 if (!rect.isEmpty()) | 3775 if (!rect.isEmpty()) |
3768 rects.append(rect); | 3776 rects.append(rect); |
3769 } | 3777 } |
3770 } | 3778 } |
3771 | 3779 |
3772 if (inlineElementContinuation) | 3780 if (inlineElementContinuation) |
3773 inlineElementContinuation->addOutlineRects(rects, additionalOffset + (in
lineElementContinuation->containingBlock()->location() - location()), includeBlo
ckOverflows); | 3781 inlineElementContinuation->addOutlineRects(rects, additionalOffset + (in
lineElementContinuation->containingBlock()->location() - location()), includeBlo
ckOverflows); |
3774 } | 3782 } |
3775 | 3783 |
3776 } // namespace blink | 3784 } // namespace blink |
OLD | NEW |