| 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 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1414 | 1414 |
| 1415 void LayoutBlockFlow::layoutBlockChildren(bool relayoutChildren, | 1415 void LayoutBlockFlow::layoutBlockChildren(bool relayoutChildren, |
| 1416 SubtreeLayoutScope& layoutScope, | 1416 SubtreeLayoutScope& layoutScope, |
| 1417 LayoutUnit beforeEdge, | 1417 LayoutUnit beforeEdge, |
| 1418 LayoutUnit afterEdge) { | 1418 LayoutUnit afterEdge) { |
| 1419 dirtyForLayoutFromPercentageHeightDescendants(layoutScope); | 1419 dirtyForLayoutFromPercentageHeightDescendants(layoutScope); |
| 1420 | 1420 |
| 1421 BlockChildrenLayoutInfo layoutInfo(this, beforeEdge, afterEdge); | 1421 BlockChildrenLayoutInfo layoutInfo(this, beforeEdge, afterEdge); |
| 1422 MarginInfo& marginInfo = layoutInfo.marginInfo(); | 1422 MarginInfo& marginInfo = layoutInfo.marginInfo(); |
| 1423 | 1423 |
| 1424 // Fieldsets need to find their legend and position it inside the border of |
| 1425 // the object. |
| 1426 // The legend then gets skipped during normal layout. The same is true for |
| 1427 // ruby text. |
| 1428 // It doesn't get included in the normal layout process but is instead skipped |
| 1424 LayoutObject* childToExclude = | 1429 LayoutObject* childToExclude = |
| 1425 layoutSpecialExcludedChild(relayoutChildren, layoutScope); | 1430 layoutSpecialExcludedChild(relayoutChildren, layoutScope); |
| 1426 | 1431 |
| 1427 // TODO(foolip): Speculative CHECKs to crash if any non-LayoutBox | 1432 // TODO(foolip): Speculative CHECKs to crash if any non-LayoutBox |
| 1428 // children ever appear, the childrenInline() check at the call site | 1433 // children ever appear, the childrenInline() check at the call site |
| 1429 // should make this impossible. crbug.com/632848 | 1434 // should make this impossible. crbug.com/632848 |
| 1430 LayoutObject* firstChild = this->firstChild(); | 1435 LayoutObject* firstChild = this->firstChild(); |
| 1431 CHECK(!firstChild || firstChild->isBox()); | 1436 CHECK(!firstChild || firstChild->isBox()); |
| 1432 LayoutBox* next = toLayoutBox(firstChild); | 1437 LayoutBox* next = toLayoutBox(firstChild); |
| 1433 LayoutBox* lastNormalFlowChild = nullptr; | 1438 LayoutBox* lastNormalFlowChild = nullptr; |
| 1434 | 1439 |
| 1435 while (next) { | 1440 while (next) { |
| 1436 LayoutBox* child = next; | 1441 LayoutBox* child = next; |
| 1437 LayoutObject* nextSibling = child->nextSibling(); | 1442 LayoutObject* nextSibling = child->nextSibling(); |
| 1438 CHECK(!nextSibling || nextSibling->isBox()); | 1443 CHECK(!nextSibling || nextSibling->isBox()); |
| 1439 next = toLayoutBox(nextSibling); | 1444 next = toLayoutBox(nextSibling); |
| 1440 | 1445 |
| 1441 child->setMayNeedPaintInvalidation(); | 1446 child->setMayNeedPaintInvalidation(); |
| 1442 | 1447 |
| 1443 if (childToExclude == child) | 1448 if (childToExclude == child) |
| 1444 continue; // Skip this child, since it will be positioned by the | 1449 continue; // Skip this child, since it will be positioned by the |
| 1445 // specialized subclass (ruby runs). | 1450 // specialized subclass (fieldsets and ruby runs). |
| 1446 | 1451 |
| 1447 updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, *child); | 1452 updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, *child); |
| 1448 | 1453 |
| 1449 if (child->isOutOfFlowPositioned()) { | 1454 if (child->isOutOfFlowPositioned()) { |
| 1450 child->containingBlock()->insertPositionedObject(child); | 1455 child->containingBlock()->insertPositionedObject(child); |
| 1451 adjustPositionedBlock(*child, layoutInfo); | 1456 adjustPositionedBlock(*child, layoutInfo); |
| 1452 continue; | 1457 continue; |
| 1453 } | 1458 } |
| 1454 if (child->isFloating()) { | 1459 if (child->isFloating()) { |
| 1455 insertFloatingObject(*child); | 1460 insertFloatingObject(*child); |
| (...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2957 return; | 2962 return; |
| 2958 } | 2963 } |
| 2959 } | 2964 } |
| 2960 | 2965 |
| 2961 // Skip the LayoutBlock override, since that one deals with anonymous child | 2966 // Skip the LayoutBlock override, since that one deals with anonymous child |
| 2962 // insertion in a way that isn't sufficient for us, and can only cause trouble | 2967 // insertion in a way that isn't sufficient for us, and can only cause trouble |
| 2963 // at this point. | 2968 // at this point. |
| 2964 LayoutBox::addChild(newChild, beforeChild); | 2969 LayoutBox::addChild(newChild, beforeChild); |
| 2965 | 2970 |
| 2966 if (madeBoxesNonInline && parent() && isAnonymousBlock() && | 2971 if (madeBoxesNonInline && parent() && isAnonymousBlock() && |
| 2967 parent()->isLayoutBlock() && !parent()->createsAnonymousWrapper()) { | 2972 parent()->isLayoutBlock()) { |
| 2968 toLayoutBlock(parent())->removeLeftoverAnonymousBlock(this); | 2973 toLayoutBlock(parent())->removeLeftoverAnonymousBlock(this); |
| 2969 // |this| may be dead now. | 2974 // |this| may be dead now. |
| 2970 } | 2975 } |
| 2971 } | 2976 } |
| 2972 | 2977 |
| 2973 static bool isMergeableAnonymousBlock(const LayoutBlockFlow* block) { | 2978 static bool isMergeableAnonymousBlock(const LayoutBlockFlow* block) { |
| 2974 return block->isAnonymousBlock() && !block->continuation() && | 2979 return block->isAnonymousBlock() && !block->continuation() && |
| 2975 !block->beingDestroyed() && !block->isRubyRun() && | 2980 !block->beingDestroyed() && !block->isRubyRun() && |
| 2976 !block->isRubyBase(); | 2981 !block->isRubyBase(); |
| 2977 } | 2982 } |
| (...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4241 | 4246 |
| 4242 if (type == NoFlowThread || multiColumnFlowThread()) | 4247 if (type == NoFlowThread || multiColumnFlowThread()) |
| 4243 return; | 4248 return; |
| 4244 | 4249 |
| 4245 // Ruby elements manage child insertion in a special way, and would mess up | 4250 // Ruby elements manage child insertion in a special way, and would mess up |
| 4246 // insertion of the flow thread. The flow thread needs to be a direct child of | 4251 // insertion of the flow thread. The flow thread needs to be a direct child of |
| 4247 // the multicol block (|this|). | 4252 // the multicol block (|this|). |
| 4248 if (isRuby()) | 4253 if (isRuby()) |
| 4249 return; | 4254 return; |
| 4250 | 4255 |
| 4256 // Fieldsets look for a legend special child (layoutSpecialExcludedChild()). |
| 4257 // We currently only support one special child per layout object, and the |
| 4258 // flow thread would make for a second one. |
| 4259 if (isFieldset()) |
| 4260 return; |
| 4261 |
| 4251 // Form controls are replaced content, and are therefore not supposed to | 4262 // Form controls are replaced content, and are therefore not supposed to |
| 4252 // support multicol. | 4263 // support multicol. |
| 4253 if (isFileUploadControl() || isTextControl() || isListBox()) | 4264 if (isFileUploadControl() || isTextControl() || isListBox()) |
| 4254 return; | 4265 return; |
| 4255 | 4266 |
| 4256 LayoutMultiColumnFlowThread* flowThread = createMultiColumnFlowThread(type); | 4267 LayoutMultiColumnFlowThread* flowThread = createMultiColumnFlowThread(type); |
| 4257 addChild(flowThread); | 4268 addChild(flowThread); |
| 4258 m_paginationStateChanged = true; | 4269 m_paginationStateChanged = true; |
| 4259 | 4270 |
| 4260 // Check that addChild() put the flow thread as a direct child, and didn't do | 4271 // 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 Loading... |
| 4568 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState); | 4579 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState); |
| 4569 } | 4580 } |
| 4570 | 4581 |
| 4571 void LayoutBlockFlow::invalidateDisplayItemClients( | 4582 void LayoutBlockFlow::invalidateDisplayItemClients( |
| 4572 PaintInvalidationReason invalidationReason) const { | 4583 PaintInvalidationReason invalidationReason) const { |
| 4573 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients( | 4584 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients( |
| 4574 invalidationReason); | 4585 invalidationReason); |
| 4575 } | 4586 } |
| 4576 | 4587 |
| 4577 } // namespace blink | 4588 } // namespace blink |
| OLD | NEW |