OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2007 David Smith (catfish.man@gmail.com) | 4 * (C) 2007 David Smith (catfish.man@gmail.com) |
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 | 691 |
692 // We already know the newBlockBox isn't going to contain inline kids, so av
oid wasting | 692 // We already know the newBlockBox isn't going to contain inline kids, so av
oid wasting |
693 // time in makeChildrenNonInline by just setting this explicitly up front. | 693 // time in makeChildrenNonInline by just setting this explicitly up front. |
694 newBlockBox->setChildrenInline(false); | 694 newBlockBox->setChildrenInline(false); |
695 | 695 |
696 newBlockBox->addChild(newChild); | 696 newBlockBox->addChild(newChild); |
697 | 697 |
698 // Always just do a full layout in order to ensure that line boxes (especial
ly wrappers for images) | 698 // Always just do a full layout in order to ensure that line boxes (especial
ly wrappers for images) |
699 // get deleted properly. Because objects moves from the pre block into the
post block, we want to | 699 // get deleted properly. Because objects moves from the pre block into the
post block, we want to |
700 // make new line boxes instead of leaving the old line boxes around. | 700 // make new line boxes instead of leaving the old line boxes around. |
701 pre->setNeedsLayoutAndPrefWidthsRecalc(); | 701 pre->setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); |
702 block->setNeedsLayoutAndPrefWidthsRecalc(); | 702 block->setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); |
703 post->setNeedsLayoutAndPrefWidthsRecalc(); | 703 post->setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); |
704 } | 704 } |
705 | 705 |
706 void RenderBlock::makeChildrenAnonymousColumnBlocks(RenderObject* beforeChild, R
enderBlockFlow* newBlockBox, RenderObject* newChild) | 706 void RenderBlock::makeChildrenAnonymousColumnBlocks(RenderObject* beforeChild, R
enderBlockFlow* newBlockBox, RenderObject* newChild) |
707 { | 707 { |
708 RenderBlockFlow* pre = 0; | 708 RenderBlockFlow* pre = 0; |
709 RenderBlockFlow* post = 0; | 709 RenderBlockFlow* post = 0; |
710 RenderBlock* block = this; // Eventually block will not just be |this|, but
will also be a block nested inside |this|. Assign to a variable | 710 RenderBlock* block = this; // Eventually block will not just be |this|, but
will also be a block nested inside |this|. Assign to a variable |
711 // so that we don't have to patch all of the rest
of the code later on. | 711 // so that we don't have to patch all of the rest
of the code later on. |
712 | 712 |
713 // Delete the block's line boxes before we do the split. | 713 // Delete the block's line boxes before we do the split. |
(...skipping 27 matching lines...) Expand all Loading... |
741 // We already know the newBlockBox isn't going to contain inline kids, so av
oid wasting | 741 // We already know the newBlockBox isn't going to contain inline kids, so av
oid wasting |
742 // time in makeChildrenNonInline by just setting this explicitly up front. | 742 // time in makeChildrenNonInline by just setting this explicitly up front. |
743 newBlockBox->setChildrenInline(false); | 743 newBlockBox->setChildrenInline(false); |
744 | 744 |
745 newBlockBox->addChild(newChild); | 745 newBlockBox->addChild(newChild); |
746 | 746 |
747 // Always just do a full layout in order to ensure that line boxes (especial
ly wrappers for images) | 747 // Always just do a full layout in order to ensure that line boxes (especial
ly wrappers for images) |
748 // get deleted properly. Because objects moved from the pre block into the
post block, we want to | 748 // get deleted properly. Because objects moved from the pre block into the
post block, we want to |
749 // make new line boxes instead of leaving the old line boxes around. | 749 // make new line boxes instead of leaving the old line boxes around. |
750 if (pre) | 750 if (pre) |
751 pre->setNeedsLayoutAndPrefWidthsRecalc(); | 751 pre->setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); |
752 block->setNeedsLayoutAndPrefWidthsRecalc(); | 752 block->setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); |
753 if (post) | 753 if (post) |
754 post->setNeedsLayoutAndPrefWidthsRecalc(); | 754 post->setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); |
755 } | 755 } |
756 | 756 |
757 RenderBlockFlow* RenderBlock::columnsBlockForSpanningElement(RenderObject* newCh
ild) | 757 RenderBlockFlow* RenderBlock::columnsBlockForSpanningElement(RenderObject* newCh
ild) |
758 { | 758 { |
759 // FIXME: This function is the gateway for the addition of column-span suppo
rt. It will | 759 // FIXME: This function is the gateway for the addition of column-span suppo
rt. It will |
760 // be added to in three stages: | 760 // be added to in three stages: |
761 // (1) Immediate children of a multi-column block can span. | 761 // (1) Immediate children of a multi-column block can span. |
762 // (2) Nested block-level children with only block-level ancestors between t
hem and the multi-column block can span. | 762 // (2) Nested block-level children with only block-level ancestors between t
hem and the multi-column block can span. |
763 // (3) Nested children with block or inline ancestors between them and the m
ulti-column block can span (this is when we | 763 // (3) Nested children with block or inline ancestors between them and the m
ulti-column block can span (this is when we |
764 // cross the streams and have to cope with both types of continuations mixed
together). | 764 // cross the streams and have to cope with both types of continuations mixed
together). |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 && prev->isAnonymousColumnSpanBlock() == next->isAnonymousColumnSpanB
lock(); | 1077 && prev->isAnonymousColumnSpanBlock() == next->isAnonymousColumnSpanB
lock(); |
1078 } | 1078 } |
1079 | 1079 |
1080 void RenderBlock::collapseAnonymousBlockChild(RenderBlock* parent, RenderBlock*
child) | 1080 void RenderBlock::collapseAnonymousBlockChild(RenderBlock* parent, RenderBlock*
child) |
1081 { | 1081 { |
1082 // It's possible that this block's destruction may have been triggered by th
e | 1082 // It's possible that this block's destruction may have been triggered by th
e |
1083 // child's removal. Just bail if the anonymous child block is already being | 1083 // child's removal. Just bail if the anonymous child block is already being |
1084 // destroyed. See crbug.com/282088 | 1084 // destroyed. See crbug.com/282088 |
1085 if (child->beingDestroyed()) | 1085 if (child->beingDestroyed()) |
1086 return; | 1086 return; |
1087 parent->setNeedsLayoutAndPrefWidthsRecalc(); | 1087 parent->setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); |
1088 parent->setChildrenInline(child->childrenInline()); | 1088 parent->setChildrenInline(child->childrenInline()); |
1089 RenderObject* nextSibling = child->nextSibling(); | 1089 RenderObject* nextSibling = child->nextSibling(); |
1090 | 1090 |
1091 RenderFlowThread* childFlowThread = child->flowThreadContainingBlock(); | 1091 RenderFlowThread* childFlowThread = child->flowThreadContainingBlock(); |
1092 CurrentRenderFlowThreadMaintainer flowThreadMaintainer(childFlowThread); | 1092 CurrentRenderFlowThreadMaintainer flowThreadMaintainer(childFlowThread); |
1093 | 1093 |
1094 parent->children()->removeChildNode(parent, child, child->hasLayer()); | 1094 parent->children()->removeChildNode(parent, child, child->hasLayer()); |
1095 child->moveAllChildrenTo(parent, nextSibling, child->hasLayer()); | 1095 child->moveAllChildrenTo(parent, nextSibling, child->hasLayer()); |
1096 // Explicitly delete the child's line box tree, or the special anonymous | 1096 // Explicitly delete the child's line box tree, or the special anonymous |
1097 // block handling in willBeDestroyed will cause problems. | 1097 // block handling in willBeDestroyed will cause problems. |
(...skipping 13 matching lines...) Expand all Loading... |
1111 // This protects against column split flows when anonymous blocks are gettin
g merged. | 1111 // This protects against column split flows when anonymous blocks are gettin
g merged. |
1112 TemporaryChange<bool> columnFlowSplitEnabled(gColumnFlowSplitEnabled, false)
; | 1112 TemporaryChange<bool> columnFlowSplitEnabled(gColumnFlowSplitEnabled, false)
; |
1113 | 1113 |
1114 // If this child is a block, and if our previous and next siblings are | 1114 // If this child is a block, and if our previous and next siblings are |
1115 // both anonymous blocks with inline content, then we can go ahead and | 1115 // both anonymous blocks with inline content, then we can go ahead and |
1116 // fold the inline content back together. | 1116 // fold the inline content back together. |
1117 RenderObject* prev = oldChild->previousSibling(); | 1117 RenderObject* prev = oldChild->previousSibling(); |
1118 RenderObject* next = oldChild->nextSibling(); | 1118 RenderObject* next = oldChild->nextSibling(); |
1119 bool canMergeAnonymousBlocks = canMergeContiguousAnonymousBlocks(oldChild, p
rev, next); | 1119 bool canMergeAnonymousBlocks = canMergeContiguousAnonymousBlocks(oldChild, p
rev, next); |
1120 if (canMergeAnonymousBlocks && prev && next) { | 1120 if (canMergeAnonymousBlocks && prev && next) { |
1121 prev->setNeedsLayoutAndPrefWidthsRecalc(); | 1121 prev->setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); |
1122 RenderBlockFlow* nextBlock = toRenderBlockFlow(next); | 1122 RenderBlockFlow* nextBlock = toRenderBlockFlow(next); |
1123 RenderBlockFlow* prevBlock = toRenderBlockFlow(prev); | 1123 RenderBlockFlow* prevBlock = toRenderBlockFlow(prev); |
1124 | 1124 |
1125 if (prev->childrenInline() != next->childrenInline()) { | 1125 if (prev->childrenInline() != next->childrenInline()) { |
1126 RenderBlock* inlineChildrenBlock = prev->childrenInline() ? prevBloc
k : nextBlock; | 1126 RenderBlock* inlineChildrenBlock = prev->childrenInline() ? prevBloc
k : nextBlock; |
1127 RenderBlock* blockChildrenBlock = prev->childrenInline() ? nextBlock
: prevBlock; | 1127 RenderBlock* blockChildrenBlock = prev->childrenInline() ? nextBlock
: prevBlock; |
1128 | 1128 |
1129 // Place the inline children block inside of the block children bloc
k instead of deleting it. | 1129 // Place the inline children block inside of the block children bloc
k instead of deleting it. |
1130 // In order to reuse it, we have to reset it to just be a generic an
onymous block. Make sure | 1130 // In order to reuse it, we have to reset it to just be a generic an
onymous block. Make sure |
1131 // to clear out inherited column properties by just making a new sty
le, and to also clear the | 1131 // to clear out inherited column properties by just making a new sty
le, and to also clear the |
1132 // column span flag if it is set. | 1132 // column span flag if it is set. |
1133 ASSERT(!inlineChildrenBlock->continuation()); | 1133 ASSERT(!inlineChildrenBlock->continuation()); |
1134 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWith
Display(style(), BLOCK); | 1134 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWith
Display(style(), BLOCK); |
1135 // Cache this value as it might get changed in setStyle() call. | 1135 // Cache this value as it might get changed in setStyle() call. |
1136 bool inlineChildrenBlockHasLayer = inlineChildrenBlock->hasLayer(); | 1136 bool inlineChildrenBlockHasLayer = inlineChildrenBlock->hasLayer(); |
1137 inlineChildrenBlock->setStyle(newStyle); | 1137 inlineChildrenBlock->setStyle(newStyle); |
1138 children()->removeChildNode(this, inlineChildrenBlock, inlineChildre
nBlockHasLayer); | 1138 children()->removeChildNode(this, inlineChildrenBlock, inlineChildre
nBlockHasLayer); |
1139 | 1139 |
1140 // Now just put the inlineChildrenBlock inside the blockChildrenBloc
k. | 1140 // Now just put the inlineChildrenBlock inside the blockChildrenBloc
k. |
1141 blockChildrenBlock->children()->insertChildNode(blockChildrenBlock,
inlineChildrenBlock, prev == inlineChildrenBlock ? blockChildrenBlock->firstChil
d() : 0, | 1141 blockChildrenBlock->children()->insertChildNode(blockChildrenBlock,
inlineChildrenBlock, prev == inlineChildrenBlock ? blockChildrenBlock->firstChil
d() : 0, |
1142 inlineChildrenBlockH
asLayer || blockChildrenBlock->hasLayer()); | 1142 inlineChildrenBlockH
asLayer || blockChildrenBlock->hasLayer()); |
1143 next->setNeedsLayoutAndPrefWidthsRecalc(); | 1143 next->setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); |
1144 | 1144 |
1145 // inlineChildrenBlock got reparented to blockChildrenBlock, so it i
s no longer a child | 1145 // inlineChildrenBlock got reparented to blockChildrenBlock, so it i
s no longer a child |
1146 // of "this". we null out prev or next so that is not used later in
the function. | 1146 // of "this". we null out prev or next so that is not used later in
the function. |
1147 if (inlineChildrenBlock == prevBlock) | 1147 if (inlineChildrenBlock == prevBlock) |
1148 prev = 0; | 1148 prev = 0; |
1149 else | 1149 else |
1150 next = 0; | 1150 next = 0; |
1151 } else { | 1151 } else { |
1152 // Take all the children out of the |next| block and put them in | 1152 // Take all the children out of the |next| block and put them in |
1153 // the |prev| block. | 1153 // the |prev| block. |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1672 if (isHorizontalWritingMode() == r->isHorizontalWritingMode()) | 1672 if (isHorizontalWritingMode() == r->isHorizontalWritingMode()) |
1673 r->updateLogicalHeight(); | 1673 r->updateLogicalHeight(); |
1674 else | 1674 else |
1675 r->updateLogicalWidth(); | 1675 r->updateLogicalWidth(); |
1676 oldLogicalTop = logicalTopForChild(r); | 1676 oldLogicalTop = logicalTopForChild(r); |
1677 } | 1677 } |
1678 | 1678 |
1679 // FIXME: We should be able to do a r->setNeedsPositionedMovementLayout(
) here instead of a full layout. Need | 1679 // FIXME: We should be able to do a r->setNeedsPositionedMovementLayout(
) here instead of a full layout. Need |
1680 // to investigate why it does not trigger the correct invalidations in t
hat case. crbug.com/350756 | 1680 // to investigate why it does not trigger the correct invalidations in t
hat case. crbug.com/350756 |
1681 if (info == ForcedLayoutAfterContainingBlockMoved) | 1681 if (info == ForcedLayoutAfterContainingBlockMoved) |
1682 r->setNeedsLayout(); | 1682 r->setNeedsLayoutAndFullRepaint(); |
1683 | 1683 |
1684 r->layoutIfNeeded(); | 1684 r->layoutIfNeeded(); |
1685 | 1685 |
1686 // Lay out again if our estimate was wrong. | 1686 // Lay out again if our estimate was wrong. |
1687 if (needsBlockDirectionLocationSetBeforeLayout && logicalTopForChild(r)
!= oldLogicalTop) | 1687 if (needsBlockDirectionLocationSetBeforeLayout && logicalTopForChild(r)
!= oldLogicalTop) |
1688 r->forceChildLayout(); | 1688 r->forceChildLayout(); |
1689 } | 1689 } |
1690 | 1690 |
1691 if (hasColumns()) | 1691 if (hasColumns()) |
1692 view()->layoutState()->setColumnInfo(columnInfo()); // FIXME: Kind of gr
oss. We just put this back into the layout state so that pop() will work. | 1692 view()->layoutState()->setColumnInfo(columnInfo()); // FIXME: Kind of gr
oss. We just put this back into the layout state so that pop() will work. |
(...skipping 3299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4992 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 4992 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
4993 { | 4993 { |
4994 showRenderObject(); | 4994 showRenderObject(); |
4995 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 4995 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
4996 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 4996 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
4997 } | 4997 } |
4998 | 4998 |
4999 #endif | 4999 #endif |
5000 | 5000 |
5001 } // namespace WebCore | 5001 } // namespace WebCore |
OLD | NEW |