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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 gColumnInfoMap->take(this); | 235 gColumnInfoMap->take(this); |
236 | 236 |
237 if (gPercentHeightDescendantsMap) | 237 if (gPercentHeightDescendantsMap) |
238 removeBlockFromDescendantAndContainerMaps(this, gPercentHeightDescendant
sMap, gPercentHeightContainerMap); | 238 removeBlockFromDescendantAndContainerMaps(this, gPercentHeightDescendant
sMap, gPercentHeightContainerMap); |
239 if (gPositionedDescendantsMap) | 239 if (gPositionedDescendantsMap) |
240 removeBlockFromDescendantAndContainerMaps(this, gPositionedDescendantsMa
p, gPositionedContainerMap); | 240 removeBlockFromDescendantAndContainerMaps(this, gPositionedDescendantsMa
p, gPositionedContainerMap); |
241 } | 241 } |
242 | 242 |
243 RenderBlock* RenderBlock::createAnonymous(Document* document) | 243 RenderBlock* RenderBlock::createAnonymous(Document* document) |
244 { | 244 { |
245 RenderBlock* renderer = new (document->renderArena()) RenderBlock(0); | 245 RenderBlock* renderer = new RenderBlock(0); |
246 renderer->setDocumentForAnonymous(document); | 246 renderer->setDocumentForAnonymous(document); |
247 return renderer; | 247 return renderer; |
248 } | 248 } |
249 | 249 |
250 void RenderBlock::willBeDestroyed() | 250 void RenderBlock::willBeDestroyed() |
251 { | 251 { |
252 // Mark as being destroyed to avoid trouble with merges in removeChild(). | 252 // Mark as being destroyed to avoid trouble with merges in removeChild(). |
253 m_beingDestroyed = true; | 253 m_beingDestroyed = true; |
254 | 254 |
255 // Make sure to destroy anonymous children first while they are still connec
ted to the rest of the tree, so that they will | 255 // Make sure to destroy anonymous children first while they are still connec
ted to the rest of the tree, so that they will |
(...skipping 24 matching lines...) Expand all Loading... |
280 if (isAnonymousBlock()) { | 280 if (isAnonymousBlock()) { |
281 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLi
neBox()) { | 281 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLi
neBox()) { |
282 while (InlineBox* childBox = box->firstChild()) | 282 while (InlineBox* childBox = box->firstChild()) |
283 childBox->remove(); | 283 childBox->remove(); |
284 } | 284 } |
285 } | 285 } |
286 } else if (parent()) | 286 } else if (parent()) |
287 parent()->dirtyLinesFromChangedChild(this); | 287 parent()->dirtyLinesFromChangedChild(this); |
288 } | 288 } |
289 | 289 |
290 m_lineBoxes.deleteLineBoxes(renderArena()); | 290 m_lineBoxes.deleteLineBoxes(); |
291 | 291 |
292 if (lineGridBox()) | 292 if (lineGridBox()) |
293 lineGridBox()->destroy(renderArena()); | 293 lineGridBox()->destroy(); |
294 | 294 |
295 if (UNLIKELY(gDelayedUpdateScrollInfoSet != 0)) | 295 if (UNLIKELY(gDelayedUpdateScrollInfoSet != 0)) |
296 gDelayedUpdateScrollInfoSet->remove(this); | 296 gDelayedUpdateScrollInfoSet->remove(this); |
297 | 297 |
298 RenderBox::willBeDestroyed(); | 298 RenderBox::willBeDestroyed(); |
299 } | 299 } |
300 | 300 |
301 void RenderBlock::styleWillChange(StyleDifference diff, const RenderStyle* newSt
yle) | 301 void RenderBlock::styleWillChange(StyleDifference diff, const RenderStyle* newSt
yle) |
302 { | 302 { |
303 RenderStyle* oldStyle = style(); | 303 RenderStyle* oldStyle = style(); |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 } | 565 } |
566 | 566 |
567 RenderBlock* RenderBlock::clone() const | 567 RenderBlock* RenderBlock::clone() const |
568 { | 568 { |
569 RenderBlock* cloneBlock; | 569 RenderBlock* cloneBlock; |
570 if (isAnonymousBlock()) { | 570 if (isAnonymousBlock()) { |
571 cloneBlock = createAnonymousBlock(); | 571 cloneBlock = createAnonymousBlock(); |
572 cloneBlock->setChildrenInline(childrenInline()); | 572 cloneBlock->setChildrenInline(childrenInline()); |
573 } | 573 } |
574 else { | 574 else { |
575 RenderObject* cloneRenderer = toElement(node())->createRenderer(renderAr
ena(), style()); | 575 RenderObject* cloneRenderer = toElement(node())->createRenderer(style())
; |
576 cloneBlock = toRenderBlock(cloneRenderer); | 576 cloneBlock = toRenderBlock(cloneRenderer); |
577 cloneBlock->setStyle(style()); | 577 cloneBlock->setStyle(style()); |
578 | 578 |
579 // This takes care of setting the right value of childrenInline in case | 579 // This takes care of setting the right value of childrenInline in case |
580 // generated content is added to cloneBlock and 'this' does not have | 580 // generated content is added to cloneBlock and 'this' does not have |
581 // generated content added yet. | 581 // generated content added yet. |
582 cloneBlock->setChildrenInline(cloneBlock->firstChild() ? cloneBlock->fir
stChild()->isInline() : childrenInline()); | 582 cloneBlock->setChildrenInline(cloneBlock->firstChild() ? cloneBlock->fir
stChild()->isInline() : childrenInline()); |
583 } | 583 } |
584 cloneBlock->setFlowThreadState(flowThreadState()); | 584 cloneBlock->setFlowThreadState(flowThreadState()); |
585 return cloneBlock; | 585 return cloneBlock; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 block->setChildrenInline(false); | 691 block->setChildrenInline(false); |
692 | 692 |
693 if (madeNewBeforeBlock) | 693 if (madeNewBeforeBlock) |
694 block->moveChildrenTo(pre, boxFirst, 0, true); | 694 block->moveChildrenTo(pre, boxFirst, 0, true); |
695 | 695 |
696 splitBlocks(pre, post, newBlockBox, beforeChild, oldCont); | 696 splitBlocks(pre, post, newBlockBox, beforeChild, oldCont); |
697 | 697 |
698 // We already know the newBlockBox isn't going to contain inline kids, so av
oid wasting | 698 // We already know the newBlockBox isn't going to contain inline kids, so av
oid wasting |
699 // time in makeChildrenNonInline by just setting this explicitly up front. | 699 // time in makeChildrenNonInline by just setting this explicitly up front. |
700 newBlockBox->setChildrenInline(false); | 700 newBlockBox->setChildrenInline(false); |
701 | |
702 // We delayed adding the newChild until now so that the |newBlockBox| would
be fully | |
703 // connected, thus allowing newChild access to a renderArena should it need | |
704 // to wrap itself in additional boxes (e.g., table construction). | |
705 newBlockBox->addChild(newChild); | 701 newBlockBox->addChild(newChild); |
706 | 702 |
707 // Always just do a full layout in order to ensure that line boxes (especial
ly wrappers for images) | 703 // Always just do a full layout in order to ensure that line boxes (especial
ly wrappers for images) |
708 // get deleted properly. Because objects moves from the pre block into the
post block, we want to | 704 // get deleted properly. Because objects moves from the pre block into the
post block, we want to |
709 // make new line boxes instead of leaving the old line boxes around. | 705 // make new line boxes instead of leaving the old line boxes around. |
710 pre->setNeedsLayoutAndPrefWidthsRecalc(); | 706 pre->setNeedsLayoutAndPrefWidthsRecalc(); |
711 block->setNeedsLayoutAndPrefWidthsRecalc(); | 707 block->setNeedsLayoutAndPrefWidthsRecalc(); |
712 post->setNeedsLayoutAndPrefWidthsRecalc(); | 708 post->setNeedsLayoutAndPrefWidthsRecalc(); |
713 } | 709 } |
714 | 710 |
(...skipping 28 matching lines...) Expand all Loading... |
743 block->children()->insertChildNode(block, post, boxFirst); | 739 block->children()->insertChildNode(block, post, boxFirst); |
744 block->setChildrenInline(false); | 740 block->setChildrenInline(false); |
745 | 741 |
746 // The pre/post blocks always have layers, so we know to always do a full in
sert/remove (so we pass true as the last argument). | 742 // The pre/post blocks always have layers, so we know to always do a full in
sert/remove (so we pass true as the last argument). |
747 block->moveChildrenTo(pre, boxFirst, beforeChild, true); | 743 block->moveChildrenTo(pre, boxFirst, beforeChild, true); |
748 block->moveChildrenTo(post, beforeChild, 0, true); | 744 block->moveChildrenTo(post, beforeChild, 0, true); |
749 | 745 |
750 // We already know the newBlockBox isn't going to contain inline kids, so av
oid wasting | 746 // We already know the newBlockBox isn't going to contain inline kids, so av
oid wasting |
751 // time in makeChildrenNonInline by just setting this explicitly up front. | 747 // time in makeChildrenNonInline by just setting this explicitly up front. |
752 newBlockBox->setChildrenInline(false); | 748 newBlockBox->setChildrenInline(false); |
753 | |
754 // We delayed adding the newChild until now so that the |newBlockBox| would
be fully | |
755 // connected, thus allowing newChild access to a renderArena should it need | |
756 // to wrap itself in additional boxes (e.g., table construction). | |
757 newBlockBox->addChild(newChild); | 749 newBlockBox->addChild(newChild); |
758 | 750 |
759 // Always just do a full layout in order to ensure that line boxes (especial
ly wrappers for images) | 751 // Always just do a full layout in order to ensure that line boxes (especial
ly wrappers for images) |
760 // get deleted properly. Because objects moved from the pre block into the
post block, we want to | 752 // get deleted properly. Because objects moved from the pre block into the
post block, we want to |
761 // make new line boxes instead of leaving the old line boxes around. | 753 // make new line boxes instead of leaving the old line boxes around. |
762 if (pre) | 754 if (pre) |
763 pre->setNeedsLayoutAndPrefWidthsRecalc(); | 755 pre->setNeedsLayoutAndPrefWidthsRecalc(); |
764 block->setNeedsLayoutAndPrefWidthsRecalc(); | 756 block->setNeedsLayoutAndPrefWidthsRecalc(); |
765 if (post) | 757 if (post) |
766 post->setNeedsLayoutAndPrefWidthsRecalc(); | 758 post->setNeedsLayoutAndPrefWidthsRecalc(); |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
984 { | 976 { |
985 if (containsFloats()) { | 977 if (containsFloats()) { |
986 // Clear references to originating lines, since the lines are being dele
ted | 978 // Clear references to originating lines, since the lines are being dele
ted |
987 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); | 979 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
988 FloatingObjectSetIterator end = floatingObjectSet.end(); | 980 FloatingObjectSetIterator end = floatingObjectSet.end(); |
989 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end
; ++it) { | 981 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end
; ++it) { |
990 ASSERT(!((*it)->m_originatingLine) || (*it)->m_originatingLine->rend
erer() == this); | 982 ASSERT(!((*it)->m_originatingLine) || (*it)->m_originatingLine->rend
erer() == this); |
991 (*it)->m_originatingLine = 0; | 983 (*it)->m_originatingLine = 0; |
992 } | 984 } |
993 } | 985 } |
994 m_lineBoxes.deleteLineBoxTree(renderArena()); | 986 m_lineBoxes.deleteLineBoxTree(); |
995 | 987 |
996 if (AXObjectCache* cache = document()->existingAXObjectCache()) | 988 if (AXObjectCache* cache = document()->existingAXObjectCache()) |
997 cache->recomputeIsIgnored(this); | 989 cache->recomputeIsIgnored(this); |
998 } | 990 } |
999 | 991 |
1000 RootInlineBox* RenderBlock::createRootInlineBox() | 992 RootInlineBox* RenderBlock::createRootInlineBox() |
1001 { | 993 { |
1002 return new (renderArena()) RootInlineBox(this); | 994 return new RootInlineBox(this); |
1003 } | 995 } |
1004 | 996 |
1005 RootInlineBox* RenderBlock::createAndAppendRootInlineBox() | 997 RootInlineBox* RenderBlock::createAndAppendRootInlineBox() |
1006 { | 998 { |
1007 RootInlineBox* rootBox = createRootInlineBox(); | 999 RootInlineBox* rootBox = createRootInlineBox(); |
1008 m_lineBoxes.appendLineBox(rootBox); | 1000 m_lineBoxes.appendLineBox(rootBox); |
1009 | 1001 |
1010 if (UNLIKELY(AXObjectCache::accessibilityEnabled()) && m_lineBoxes.firstLine
Box() == rootBox) { | 1002 if (UNLIKELY(AXObjectCache::accessibilityEnabled()) && m_lineBoxes.firstLine
Box() == rootBox) { |
1011 if (AXObjectCache* cache = document()->existingAXObjectCache()) | 1003 if (AXObjectCache* cache = document()->existingAXObjectCache()) |
1012 cache->recomputeIsIgnored(this); | 1004 cache->recomputeIsIgnored(this); |
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1909 } | 1901 } |
1910 } | 1902 } |
1911 | 1903 |
1912 RenderBoxModelObject* RenderBlock::createReplacementRunIn(RenderBoxModelObject*
runIn) | 1904 RenderBoxModelObject* RenderBlock::createReplacementRunIn(RenderBoxModelObject*
runIn) |
1913 { | 1905 { |
1914 ASSERT(runIn->isRunIn()); | 1906 ASSERT(runIn->isRunIn()); |
1915 ASSERT(runIn->node()); | 1907 ASSERT(runIn->node()); |
1916 | 1908 |
1917 RenderBoxModelObject* newRunIn = 0; | 1909 RenderBoxModelObject* newRunIn = 0; |
1918 if (!runIn->isRenderBlock()) | 1910 if (!runIn->isRenderBlock()) |
1919 newRunIn = new (renderArena()) RenderBlock(runIn->node()); | 1911 newRunIn = new RenderBlock(runIn->node()); |
1920 else | 1912 else |
1921 newRunIn = new (renderArena()) RenderInline(toElement(runIn->node())); | 1913 newRunIn = new RenderInline(toElement(runIn->node())); |
1922 | 1914 |
1923 runIn->node()->setRenderer(newRunIn); | 1915 runIn->node()->setRenderer(newRunIn); |
1924 newRunIn->setStyle(runIn->style()); | 1916 newRunIn->setStyle(runIn->style()); |
1925 | 1917 |
1926 runIn->moveAllChildrenTo(newRunIn, true); | 1918 runIn->moveAllChildrenTo(newRunIn, true); |
1927 | 1919 |
1928 return newRunIn; | 1920 return newRunIn; |
1929 } | 1921 } |
1930 | 1922 |
1931 void RenderBlock::moveRunInUnderSiblingBlockIfNeeded(RenderObject* runIn) | 1923 void RenderBlock::moveRunInUnderSiblingBlockIfNeeded(RenderObject* runIn) |
(...skipping 4721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6653 if (!shouldSkipForFirstLetter(c)) | 6645 if (!shouldSkipForFirstLetter(c)) |
6654 break; | 6646 break; |
6655 | 6647 |
6656 if (isPunctuationForFirstLetter(c)) | 6648 if (isPunctuationForFirstLetter(c)) |
6657 length = scanLength + 1; | 6649 length = scanLength + 1; |
6658 } | 6650 } |
6659 | 6651 |
6660 // Construct a text fragment for the text after the first letter. | 6652 // Construct a text fragment for the text after the first letter. |
6661 // This text fragment might be empty. | 6653 // This text fragment might be empty. |
6662 RenderTextFragment* remainingText = | 6654 RenderTextFragment* remainingText = |
6663 new (renderArena()) RenderTextFragment(textObj->node() ? textObj->no
de() : textObj->document(), oldText.get(), length, oldText->length() - length); | 6655 new RenderTextFragment(textObj->node() ? textObj->node() : textObj->
document(), oldText.get(), length, oldText->length() - length); |
6664 remainingText->setStyle(textObj->style()); | 6656 remainingText->setStyle(textObj->style()); |
6665 if (remainingText->node()) | 6657 if (remainingText->node()) |
6666 remainingText->node()->setRenderer(remainingText); | 6658 remainingText->node()->setRenderer(remainingText); |
6667 | 6659 |
6668 firstLetterContainer->addChild(remainingText, textObj); | 6660 firstLetterContainer->addChild(remainingText, textObj); |
6669 firstLetterContainer->removeChild(textObj); | 6661 firstLetterContainer->removeChild(textObj); |
6670 remainingText->setFirstLetter(firstLetter); | 6662 remainingText->setFirstLetter(firstLetter); |
6671 toRenderBoxModelObject(firstLetter)->setFirstLetterRemainingText(remaini
ngText); | 6663 toRenderBoxModelObject(firstLetter)->setFirstLetterRemainingText(remaini
ngText); |
6672 | 6664 |
6673 // construct text fragment for the first letter | 6665 // construct text fragment for the first letter |
6674 RenderTextFragment* letter = | 6666 RenderTextFragment* letter = |
6675 new (renderArena()) RenderTextFragment(remainingText->node() ? remai
ningText->node() : remainingText->document(), oldText.get(), 0, length); | 6667 new RenderTextFragment(remainingText->node() ? remainingText->node()
: remainingText->document(), oldText.get(), 0, length); |
6676 letter->setStyle(pseudoStyle); | 6668 letter->setStyle(pseudoStyle); |
6677 firstLetter->addChild(letter); | 6669 firstLetter->addChild(letter); |
6678 | 6670 |
6679 textObj->destroy(); | 6671 textObj->destroy(); |
6680 } | 6672 } |
6681 } | 6673 } |
6682 | 6674 |
6683 void RenderBlock::updateFirstLetter() | 6675 void RenderBlock::updateFirstLetter() |
6684 { | 6676 { |
6685 if (!document()->styleSheetCollection()->usesFirstLetterRules()) | 6677 if (!document()->styleSheetCollection()->usesFirstLetterRules()) |
(...skipping 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8109 { | 8101 { |
8110 memoryInstrumentation->addRootObject(gColumnInfoMap, WebCoreMemoryTypes::Ren
deringStructures); | 8102 memoryInstrumentation->addRootObject(gColumnInfoMap, WebCoreMemoryTypes::Ren
deringStructures); |
8111 memoryInstrumentation->addRootObject(gPositionedDescendantsMap, WebCoreMemor
yTypes::RenderingStructures); | 8103 memoryInstrumentation->addRootObject(gPositionedDescendantsMap, WebCoreMemor
yTypes::RenderingStructures); |
8112 memoryInstrumentation->addRootObject(gPercentHeightDescendantsMap, WebCoreMe
moryTypes::RenderingStructures); | 8104 memoryInstrumentation->addRootObject(gPercentHeightDescendantsMap, WebCoreMe
moryTypes::RenderingStructures); |
8113 memoryInstrumentation->addRootObject(gPositionedContainerMap, WebCoreMemoryT
ypes::RenderingStructures); | 8105 memoryInstrumentation->addRootObject(gPositionedContainerMap, WebCoreMemoryT
ypes::RenderingStructures); |
8114 memoryInstrumentation->addRootObject(gPercentHeightContainerMap, WebCoreMemo
ryTypes::RenderingStructures); | 8106 memoryInstrumentation->addRootObject(gPercentHeightContainerMap, WebCoreMemo
ryTypes::RenderingStructures); |
8115 memoryInstrumentation->addRootObject(gDelayedUpdateScrollInfoSet, WebCoreMem
oryTypes::RenderingStructures); | 8107 memoryInstrumentation->addRootObject(gDelayedUpdateScrollInfoSet, WebCoreMem
oryTypes::RenderingStructures); |
8116 } | 8108 } |
8117 | 8109 |
8118 } // namespace WebCore | 8110 } // namespace WebCore |
OLD | NEW |