Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: Source/core/rendering/RenderBlock.cpp

Issue 20231002: Replace RenderArena with PartitionAlloc (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderBlock.h ('k') | Source/core/rendering/RenderBlockLineLayout.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 gColumnInfoMap->take(this); 262 gColumnInfoMap->take(this);
263 263
264 if (gPercentHeightDescendantsMap) 264 if (gPercentHeightDescendantsMap)
265 removeBlockFromDescendantAndContainerMaps(this, gPercentHeightDescendant sMap, gPercentHeightContainerMap); 265 removeBlockFromDescendantAndContainerMaps(this, gPercentHeightDescendant sMap, gPercentHeightContainerMap);
266 if (gPositionedDescendantsMap) 266 if (gPositionedDescendantsMap)
267 removeBlockFromDescendantAndContainerMaps(this, gPositionedDescendantsMa p, gPositionedContainerMap); 267 removeBlockFromDescendantAndContainerMaps(this, gPositionedDescendantsMa p, gPositionedContainerMap);
268 } 268 }
269 269
270 RenderBlock* RenderBlock::createAnonymous(Document* document) 270 RenderBlock* RenderBlock::createAnonymous(Document* document)
271 { 271 {
272 RenderBlock* renderer = new (document->renderArena()) RenderBlock(0); 272 RenderBlock* renderer = new RenderBlock(0);
273 renderer->setDocumentForAnonymous(document); 273 renderer->setDocumentForAnonymous(document);
274 return renderer; 274 return renderer;
275 } 275 }
276 276
277 void RenderBlock::willBeDestroyed() 277 void RenderBlock::willBeDestroyed()
278 { 278 {
279 // Mark as being destroyed to avoid trouble with merges in removeChild(). 279 // Mark as being destroyed to avoid trouble with merges in removeChild().
280 m_beingDestroyed = true; 280 m_beingDestroyed = true;
281 281
282 if (!documentBeingDestroyed()) { 282 if (!documentBeingDestroyed()) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 if (isAnonymousBlock()) { 317 if (isAnonymousBlock()) {
318 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLi neBox()) { 318 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLi neBox()) {
319 while (InlineBox* childBox = box->firstChild()) 319 while (InlineBox* childBox = box->firstChild())
320 childBox->remove(); 320 childBox->remove();
321 } 321 }
322 } 322 }
323 } else if (parent()) 323 } else if (parent())
324 parent()->dirtyLinesFromChangedChild(this); 324 parent()->dirtyLinesFromChangedChild(this);
325 } 325 }
326 326
327 m_lineBoxes.deleteLineBoxes(renderArena()); 327 m_lineBoxes.deleteLineBoxes();
328 328
329 if (lineGridBox()) 329 if (lineGridBox())
330 lineGridBox()->destroy(renderArena()); 330 lineGridBox()->destroy();
331 331
332 if (UNLIKELY(gDelayedUpdateScrollInfoSet != 0)) 332 if (UNLIKELY(gDelayedUpdateScrollInfoSet != 0))
333 gDelayedUpdateScrollInfoSet->remove(this); 333 gDelayedUpdateScrollInfoSet->remove(this);
334 334
335 RenderBox::willBeDestroyed(); 335 RenderBox::willBeDestroyed();
336 } 336 }
337 337
338 void RenderBlock::styleWillChange(StyleDifference diff, const RenderStyle* newSt yle) 338 void RenderBlock::styleWillChange(StyleDifference diff, const RenderStyle* newSt yle)
339 { 339 {
340 RenderStyle* oldStyle = style(); 340 RenderStyle* oldStyle = style();
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 727
728 if (madeNewBeforeBlock) 728 if (madeNewBeforeBlock)
729 block->moveChildrenTo(pre, boxFirst, 0, true); 729 block->moveChildrenTo(pre, boxFirst, 0, true);
730 730
731 splitBlocks(pre, post, newBlockBox, beforeChild, oldCont); 731 splitBlocks(pre, post, newBlockBox, beforeChild, oldCont);
732 732
733 // We already know the newBlockBox isn't going to contain inline kids, so av oid wasting 733 // We already know the newBlockBox isn't going to contain inline kids, so av oid wasting
734 // time in makeChildrenNonInline by just setting this explicitly up front. 734 // time in makeChildrenNonInline by just setting this explicitly up front.
735 newBlockBox->setChildrenInline(false); 735 newBlockBox->setChildrenInline(false);
736 736
737 // We delayed adding the newChild until now so that the |newBlockBox| would be fully
738 // connected, thus allowing newChild access to a renderArena should it need
739 // to wrap itself in additional boxes (e.g., table construction).
740 newBlockBox->addChild(newChild); 737 newBlockBox->addChild(newChild);
741 738
742 // Always just do a full layout in order to ensure that line boxes (especial ly wrappers for images) 739 // Always just do a full layout in order to ensure that line boxes (especial ly wrappers for images)
743 // get deleted properly. Because objects moves from the pre block into the post block, we want to 740 // get deleted properly. Because objects moves from the pre block into the post block, we want to
744 // make new line boxes instead of leaving the old line boxes around. 741 // make new line boxes instead of leaving the old line boxes around.
745 pre->setNeedsLayoutAndPrefWidthsRecalc(); 742 pre->setNeedsLayoutAndPrefWidthsRecalc();
746 block->setNeedsLayoutAndPrefWidthsRecalc(); 743 block->setNeedsLayoutAndPrefWidthsRecalc();
747 post->setNeedsLayoutAndPrefWidthsRecalc(); 744 post->setNeedsLayoutAndPrefWidthsRecalc();
748 } 745 }
749 746
(...skipping 29 matching lines...) Expand all
779 block->setChildrenInline(false); 776 block->setChildrenInline(false);
780 777
781 // 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). 778 // 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).
782 block->moveChildrenTo(pre, boxFirst, beforeChild, true); 779 block->moveChildrenTo(pre, boxFirst, beforeChild, true);
783 block->moveChildrenTo(post, beforeChild, 0, true); 780 block->moveChildrenTo(post, beforeChild, 0, true);
784 781
785 // We already know the newBlockBox isn't going to contain inline kids, so av oid wasting 782 // We already know the newBlockBox isn't going to contain inline kids, so av oid wasting
786 // time in makeChildrenNonInline by just setting this explicitly up front. 783 // time in makeChildrenNonInline by just setting this explicitly up front.
787 newBlockBox->setChildrenInline(false); 784 newBlockBox->setChildrenInline(false);
788 785
789 // We delayed adding the newChild until now so that the |newBlockBox| would be fully
790 // connected, thus allowing newChild access to a renderArena should it need
791 // to wrap itself in additional boxes (e.g., table construction).
792 newBlockBox->addChild(newChild); 786 newBlockBox->addChild(newChild);
793 787
794 // Always just do a full layout in order to ensure that line boxes (especial ly wrappers for images) 788 // Always just do a full layout in order to ensure that line boxes (especial ly wrappers for images)
795 // get deleted properly. Because objects moved from the pre block into the post block, we want to 789 // get deleted properly. Because objects moved from the pre block into the post block, we want to
796 // make new line boxes instead of leaving the old line boxes around. 790 // make new line boxes instead of leaving the old line boxes around.
797 if (pre) 791 if (pre)
798 pre->setNeedsLayoutAndPrefWidthsRecalc(); 792 pre->setNeedsLayoutAndPrefWidthsRecalc();
799 block->setNeedsLayoutAndPrefWidthsRecalc(); 793 block->setNeedsLayoutAndPrefWidthsRecalc();
800 if (post) 794 if (post)
801 post->setNeedsLayoutAndPrefWidthsRecalc(); 795 post->setNeedsLayoutAndPrefWidthsRecalc();
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 { 1013 {
1020 if (containsFloats()) { 1014 if (containsFloats()) {
1021 // Clear references to originating lines, since the lines are being dele ted 1015 // Clear references to originating lines, since the lines are being dele ted
1022 const FloatingObjectSet& floatingObjectSet = floatingObjects()->set(); 1016 const FloatingObjectSet& floatingObjectSet = floatingObjects()->set();
1023 FloatingObjectSetIterator end = floatingObjectSet.end(); 1017 FloatingObjectSetIterator end = floatingObjectSet.end();
1024 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end ; ++it) { 1018 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end ; ++it) {
1025 ASSERT(!((*it)->m_originatingLine) || (*it)->m_originatingLine->rend erer() == this); 1019 ASSERT(!((*it)->m_originatingLine) || (*it)->m_originatingLine->rend erer() == this);
1026 (*it)->m_originatingLine = 0; 1020 (*it)->m_originatingLine = 0;
1027 } 1021 }
1028 } 1022 }
1029 m_lineBoxes.deleteLineBoxTree(renderArena()); 1023 m_lineBoxes.deleteLineBoxTree();
1030 1024
1031 if (AXObjectCache* cache = document()->existingAXObjectCache()) 1025 if (AXObjectCache* cache = document()->existingAXObjectCache())
1032 cache->recomputeIsIgnored(this); 1026 cache->recomputeIsIgnored(this);
1033 } 1027 }
1034 1028
1035 RootInlineBox* RenderBlock::createRootInlineBox() 1029 RootInlineBox* RenderBlock::createRootInlineBox()
1036 { 1030 {
1037 return new (renderArena()) RootInlineBox(this); 1031 return new RootInlineBox(this);
1038 } 1032 }
1039 1033
1040 RootInlineBox* RenderBlock::createAndAppendRootInlineBox() 1034 RootInlineBox* RenderBlock::createAndAppendRootInlineBox()
1041 { 1035 {
1042 RootInlineBox* rootBox = createRootInlineBox(); 1036 RootInlineBox* rootBox = createRootInlineBox();
1043 m_lineBoxes.appendLineBox(rootBox); 1037 m_lineBoxes.appendLineBox(rootBox);
1044 1038
1045 if (UNLIKELY(AXObjectCache::accessibilityEnabled()) && m_lineBoxes.firstLine Box() == rootBox) { 1039 if (UNLIKELY(AXObjectCache::accessibilityEnabled()) && m_lineBoxes.firstLine Box() == rootBox) {
1046 if (AXObjectCache* cache = document()->existingAXObjectCache()) 1040 if (AXObjectCache* cache = document()->existingAXObjectCache())
1047 cache->recomputeIsIgnored(this); 1041 cache->recomputeIsIgnored(this);
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
1945 } 1939 }
1946 } 1940 }
1947 1941
1948 RenderBoxModelObject* RenderBlock::createReplacementRunIn(RenderBoxModelObject* runIn) 1942 RenderBoxModelObject* RenderBlock::createReplacementRunIn(RenderBoxModelObject* runIn)
1949 { 1943 {
1950 ASSERT(runIn->isRunIn()); 1944 ASSERT(runIn->isRunIn());
1951 ASSERT(runIn->node()); 1945 ASSERT(runIn->node());
1952 1946
1953 RenderBoxModelObject* newRunIn = 0; 1947 RenderBoxModelObject* newRunIn = 0;
1954 if (!runIn->isRenderBlock()) 1948 if (!runIn->isRenderBlock())
1955 newRunIn = new (renderArena()) RenderBlock(runIn->node()); 1949 newRunIn = new RenderBlock(runIn->node());
1956 else 1950 else
1957 newRunIn = new (renderArena()) RenderInline(toElement(runIn->node())); 1951 newRunIn = new RenderInline(toElement(runIn->node()));
1958 1952
1959 runIn->node()->setRenderer(newRunIn); 1953 runIn->node()->setRenderer(newRunIn);
1960 newRunIn->setStyle(runIn->style()); 1954 newRunIn->setStyle(runIn->style());
1961 1955
1962 runIn->moveAllChildrenTo(newRunIn, true); 1956 runIn->moveAllChildrenTo(newRunIn, true);
1963 1957
1964 return newRunIn; 1958 return newRunIn;
1965 } 1959 }
1966 1960
1967 void RenderBlock::moveRunInUnderSiblingBlockIfNeeded(RenderObject* runIn) 1961 void RenderBlock::moveRunInUnderSiblingBlockIfNeeded(RenderObject* runIn)
(...skipping 4816 matching lines...) Expand 10 before | Expand all | Expand 10 after
6784 if (!shouldSkipForFirstLetter(c)) 6778 if (!shouldSkipForFirstLetter(c))
6785 break; 6779 break;
6786 6780
6787 if (isPunctuationForFirstLetter(c)) 6781 if (isPunctuationForFirstLetter(c))
6788 length = scanLength + 1; 6782 length = scanLength + 1;
6789 } 6783 }
6790 6784
6791 // Construct a text fragment for the text after the first letter. 6785 // Construct a text fragment for the text after the first letter.
6792 // This text fragment might be empty. 6786 // This text fragment might be empty.
6793 RenderTextFragment* remainingText = 6787 RenderTextFragment* remainingText =
6794 new (renderArena()) RenderTextFragment(textObj->node() ? textObj->no de() : textObj->document(), oldText.get(), length, oldText->length() - length); 6788 new RenderTextFragment(textObj->node() ? textObj->node() : textObj-> document(), oldText.get(), length, oldText->length() - length);
6795 remainingText->setStyle(textObj->style()); 6789 remainingText->setStyle(textObj->style());
6796 if (remainingText->node()) 6790 if (remainingText->node())
6797 remainingText->node()->setRenderer(remainingText); 6791 remainingText->node()->setRenderer(remainingText);
6798 6792
6799 firstLetterContainer->addChild(remainingText, textObj); 6793 firstLetterContainer->addChild(remainingText, textObj);
6800 firstLetterContainer->removeChild(textObj); 6794 firstLetterContainer->removeChild(textObj);
6801 remainingText->setFirstLetter(firstLetter); 6795 remainingText->setFirstLetter(firstLetter);
6802 toRenderBoxModelObject(firstLetter)->setFirstLetterRemainingText(remaini ngText); 6796 toRenderBoxModelObject(firstLetter)->setFirstLetterRemainingText(remaini ngText);
6803 6797
6804 // construct text fragment for the first letter 6798 // construct text fragment for the first letter
6805 RenderTextFragment* letter = 6799 RenderTextFragment* letter =
6806 new (renderArena()) RenderTextFragment(remainingText->node() ? remai ningText->node() : remainingText->document(), oldText.get(), 0, length); 6800 new RenderTextFragment(remainingText->node() ? remainingText->node() : remainingText->document(), oldText.get(), 0, length);
6807 letter->setStyle(pseudoStyle); 6801 letter->setStyle(pseudoStyle);
6808 firstLetter->addChild(letter); 6802 firstLetter->addChild(letter);
6809 6803
6810 textObj->destroy(); 6804 textObj->destroy();
6811 } 6805 }
6812 } 6806 }
6813 6807
6814 void RenderBlock::updateFirstLetter() 6808 void RenderBlock::updateFirstLetter()
6815 { 6809 {
6816 if (!document()->styleSheetCollection()->usesFirstLetterRules()) 6810 if (!document()->styleSheetCollection()->usesFirstLetterRules())
(...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after
8272 } 8266 }
8273 8267
8274 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl oatingObject* floatingObject) 8268 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl oatingObject* floatingObject)
8275 { 8269 {
8276 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped MaxY()); 8270 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped MaxY());
8277 } 8271 }
8278 8272
8279 #endif 8273 #endif
8280 8274
8281 } // namespace WebCore 8275 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBlock.h ('k') | Source/core/rendering/RenderBlockLineLayout.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698