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

Side by Side Diff: Source/core/rendering/RenderInline.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/RenderImage.cpp ('k') | Source/core/rendering/RenderLayer.h » ('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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 15 matching lines...) Expand all
26 #include "core/dom/FullscreenController.h" 26 #include "core/dom/FullscreenController.h"
27 #include "core/editing/VisiblePosition.h" 27 #include "core/editing/VisiblePosition.h"
28 #include "core/page/Chrome.h" 28 #include "core/page/Chrome.h"
29 #include "core/page/Frame.h" 29 #include "core/page/Frame.h"
30 #include "core/page/Page.h" 30 #include "core/page/Page.h"
31 #include "core/platform/graphics/FloatQuad.h" 31 #include "core/platform/graphics/FloatQuad.h"
32 #include "core/platform/graphics/GraphicsContext.h" 32 #include "core/platform/graphics/GraphicsContext.h"
33 #include "core/platform/graphics/transforms/TransformState.h" 33 #include "core/platform/graphics/transforms/TransformState.h"
34 #include "core/rendering/HitTestResult.h" 34 #include "core/rendering/HitTestResult.h"
35 #include "core/rendering/InlineTextBox.h" 35 #include "core/rendering/InlineTextBox.h"
36 #include "core/rendering/RenderArena.h"
37 #include "core/rendering/RenderBlock.h" 36 #include "core/rendering/RenderBlock.h"
38 #include "core/rendering/RenderFlowThread.h" 37 #include "core/rendering/RenderFlowThread.h"
39 #include "core/rendering/RenderFullScreen.h" 38 #include "core/rendering/RenderFullScreen.h"
40 #include "core/rendering/RenderGeometryMap.h" 39 #include "core/rendering/RenderGeometryMap.h"
41 #include "core/rendering/RenderLayer.h" 40 #include "core/rendering/RenderLayer.h"
42 #include "core/rendering/RenderTheme.h" 41 #include "core/rendering/RenderTheme.h"
43 #include "core/rendering/RenderView.h" 42 #include "core/rendering/RenderView.h"
44 #include "core/rendering/style/StyleInheritedData.h" 43 #include "core/rendering/style/StyleInheritedData.h"
45 44
46 using namespace std; 45 using namespace std;
47 46
48 namespace WebCore { 47 namespace WebCore {
49 48
50 RenderInline::RenderInline(Element* element) 49 RenderInline::RenderInline(Element* element)
51 : RenderBoxModelObject(element) 50 : RenderBoxModelObject(element)
52 , m_alwaysCreateLineBoxes(false) 51 , m_alwaysCreateLineBoxes(false)
53 { 52 {
54 setChildrenInline(true); 53 setChildrenInline(true);
55 } 54 }
56 55
57 RenderInline* RenderInline::createAnonymous(Document* document) 56 RenderInline* RenderInline::createAnonymous(Document* document)
58 { 57 {
59 RenderInline* renderer = new (document->renderArena()) RenderInline(0); 58 RenderInline* renderer = new RenderInline(0);
60 renderer->setDocumentForAnonymous(document); 59 renderer->setDocumentForAnonymous(document);
61 return renderer; 60 return renderer;
62 } 61 }
63 62
64 void RenderInline::willBeDestroyed() 63 void RenderInline::willBeDestroyed()
65 { 64 {
66 #if !ASSERT_DISABLED 65 #if !ASSERT_DISABLED
67 // Make sure we do not retain "this" in the continuation outline table map o f our containing blocks. 66 // Make sure we do not retain "this" in the continuation outline table map o f our containing blocks.
68 if (parent() && style()->visibility() == VISIBLE && hasOutline()) { 67 if (parent() && style()->visibility() == VISIBLE && hasOutline()) {
69 bool containingBlockPaintsContinuationOutline = continuation() || isInli neElementContinuation(); 68 bool containingBlockPaintsContinuationOutline = continuation() || isInli neElementContinuation();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // not have a parent that means they are either already disconnected or 103 // not have a parent that means they are either already disconnected or
105 // root lines that can just be destroyed without disconnecting. 104 // root lines that can just be destroyed without disconnecting.
106 if (firstLineBox()->parent()) { 105 if (firstLineBox()->parent()) {
107 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLi neBox()) 106 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLi neBox())
108 box->remove(); 107 box->remove();
109 } 108 }
110 } else if (parent()) 109 } else if (parent())
111 parent()->dirtyLinesFromChangedChild(this); 110 parent()->dirtyLinesFromChangedChild(this);
112 } 111 }
113 112
114 m_lineBoxes.deleteLineBoxes(renderArena()); 113 m_lineBoxes.deleteLineBoxes();
115 114
116 RenderBoxModelObject::willBeDestroyed(); 115 RenderBoxModelObject::willBeDestroyed();
117 } 116 }
118 117
119 RenderInline* RenderInline::inlineElementContinuation() const 118 RenderInline* RenderInline::inlineElementContinuation() const
120 { 119 {
121 RenderBoxModelObject* continuation = this->continuation(); 120 RenderBoxModelObject* continuation = this->continuation();
122 if (!continuation || continuation->isInline()) 121 if (!continuation || continuation->isInline())
123 return toRenderInline(continuation); 122 return toRenderInline(continuation);
124 return toRenderBlock(continuation)->inlineElementContinuation(); 123 return toRenderBlock(continuation)->inlineElementContinuation();
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 return; 324 return;
326 } 325 }
327 326
328 RenderBoxModelObject::addChild(newChild, beforeChild); 327 RenderBoxModelObject::addChild(newChild, beforeChild);
329 328
330 newChild->setNeedsLayoutAndPrefWidthsRecalc(); 329 newChild->setNeedsLayoutAndPrefWidthsRecalc();
331 } 330 }
332 331
333 RenderInline* RenderInline::clone() const 332 RenderInline* RenderInline::clone() const
334 { 333 {
335 RenderInline* cloneInline = new (renderArena()) RenderInline(node()); 334 RenderInline* cloneInline = new RenderInline(node());
336 cloneInline->setStyle(style()); 335 cloneInline->setStyle(style());
337 cloneInline->setFlowThreadState(flowThreadState()); 336 cloneInline->setFlowThreadState(flowThreadState());
338 return cloneInline; 337 return cloneInline;
339 } 338 }
340 339
341 void RenderInline::splitInlines(RenderBlock* fromBlock, RenderBlock* toBlock, 340 void RenderInline::splitInlines(RenderBlock* fromBlock, RenderBlock* toBlock,
342 RenderBlock* middleBlock, 341 RenderBlock* middleBlock,
343 RenderObject* beforeChild, RenderBoxModelObject* oldCont) 342 RenderObject* beforeChild, RenderBoxModelObject* oldCont)
344 { 343 {
345 // Create a clone of this inline. 344 // Create a clone of this inline.
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 no->setNeedsLayoutAndPrefWidthsRecalc(); 467 no->setNeedsLayoutAndPrefWidthsRecalc();
469 } 468 }
470 } 469 }
471 470
472 splitInlines(pre, post, newBlockBox, beforeChild, oldCont); 471 splitInlines(pre, post, newBlockBox, beforeChild, oldCont);
473 472
474 // We already know the newBlockBox isn't going to contain inline kids, so av oid wasting 473 // We already know the newBlockBox isn't going to contain inline kids, so av oid wasting
475 // time in makeChildrenNonInline by just setting this explicitly up front. 474 // time in makeChildrenNonInline by just setting this explicitly up front.
476 newBlockBox->setChildrenInline(false); 475 newBlockBox->setChildrenInline(false);
477 476
478 // We delayed adding the newChild until now so that the |newBlockBox| would be fully
479 // connected, thus allowing newChild access to a renderArena should it need
480 // to wrap itself in additional boxes (e.g., table construction).
481 newBlockBox->addChild(newChild); 477 newBlockBox->addChild(newChild);
482 478
483 // Always just do a full layout in order to ensure that line boxes (especial ly wrappers for images) 479 // Always just do a full layout in order to ensure that line boxes (especial ly wrappers for images)
484 // get deleted properly. Because objects moves from the pre block into the post block, we want to 480 // get deleted properly. Because objects moves from the pre block into the post block, we want to
485 // make new line boxes instead of leaving the old line boxes around. 481 // make new line boxes instead of leaving the old line boxes around.
486 pre->setNeedsLayoutAndPrefWidthsRecalc(); 482 pre->setNeedsLayoutAndPrefWidthsRecalc();
487 block->setNeedsLayoutAndPrefWidthsRecalc(); 483 block->setNeedsLayoutAndPrefWidthsRecalc();
488 post->setNeedsLayoutAndPrefWidthsRecalc(); 484 post->setNeedsLayoutAndPrefWidthsRecalc();
489 } 485 }
490 486
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 result.setInnerNode(n); 1233 result.setInnerNode(n);
1238 if (!result.innerNonSharedNode()) 1234 if (!result.innerNonSharedNode())
1239 result.setInnerNonSharedNode(n); 1235 result.setInnerNonSharedNode(n);
1240 result.setLocalPoint(localPoint); 1236 result.setLocalPoint(localPoint);
1241 } 1237 }
1242 } 1238 }
1243 1239
1244 void RenderInline::dirtyLineBoxes(bool fullLayout) 1240 void RenderInline::dirtyLineBoxes(bool fullLayout)
1245 { 1241 {
1246 if (fullLayout) { 1242 if (fullLayout) {
1247 m_lineBoxes.deleteLineBoxes(renderArena()); 1243 m_lineBoxes.deleteLineBoxes();
1248 return; 1244 return;
1249 } 1245 }
1250 1246
1251 if (!alwaysCreateLineBoxes()) { 1247 if (!alwaysCreateLineBoxes()) {
1252 // We have to grovel into our children in order to dirty the appropriate lines. 1248 // We have to grovel into our children in order to dirty the appropriate lines.
1253 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling() ) { 1249 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling() ) {
1254 if (curr->isFloatingOrOutOfFlowPositioned()) 1250 if (curr->isFloatingOrOutOfFlowPositioned())
1255 continue; 1251 continue;
1256 if (curr->isBox() && !curr->needsLayout()) { 1252 if (curr->isBox() && !curr->needsLayout()) {
1257 RenderBox* currBox = toRenderBox(curr); 1253 RenderBox* currBox = toRenderBox(curr);
(...skipping 10 matching lines...) Expand all
1268 childText->root()->markDirty(); 1264 childText->root()->markDirty();
1269 } 1265 }
1270 } 1266 }
1271 } 1267 }
1272 } else 1268 } else
1273 m_lineBoxes.dirtyLineBoxes(); 1269 m_lineBoxes.dirtyLineBoxes();
1274 } 1270 }
1275 1271
1276 void RenderInline::deleteLineBoxTree() 1272 void RenderInline::deleteLineBoxTree()
1277 { 1273 {
1278 m_lineBoxes.deleteLineBoxTree(renderArena()); 1274 m_lineBoxes.deleteLineBoxTree();
1279 } 1275 }
1280 1276
1281 InlineFlowBox* RenderInline::createInlineFlowBox() 1277 InlineFlowBox* RenderInline::createInlineFlowBox()
1282 { 1278 {
1283 return new (renderArena()) InlineFlowBox(this); 1279 return new InlineFlowBox(this);
1284 } 1280 }
1285 1281
1286 InlineFlowBox* RenderInline::createAndAppendInlineFlowBox() 1282 InlineFlowBox* RenderInline::createAndAppendInlineFlowBox()
1287 { 1283 {
1288 setAlwaysCreateLineBoxes(); 1284 setAlwaysCreateLineBoxes();
1289 InlineFlowBox* flowBox = createInlineFlowBox(); 1285 InlineFlowBox* flowBox = createInlineFlowBox();
1290 m_lineBoxes.appendLineBox(flowBox); 1286 m_lineBoxes.appendLineBox(flowBox);
1291 return flowBox; 1287 return flowBox;
1292 } 1288 }
1293 1289
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
1582 container = this; 1578 container = this;
1583 1579
1584 FloatPoint absPos = container->localToAbsolute(); 1580 FloatPoint absPos = container->localToAbsolute();
1585 region.bounds.setX(absPos.x() + region.bounds.x()); 1581 region.bounds.setX(absPos.x() + region.bounds.x());
1586 region.bounds.setY(absPos.y() + region.bounds.y()); 1582 region.bounds.setY(absPos.y() + region.bounds.y());
1587 1583
1588 regions.append(region); 1584 regions.append(region);
1589 } 1585 }
1590 1586
1591 } // namespace WebCore 1587 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderImage.cpp ('k') | Source/core/rendering/RenderLayer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698