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