| 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 * 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 16 matching lines...) Expand all Loading... |
| 27 #include "core/dom/WebCoreMemoryInstrumentation.h" | 27 #include "core/dom/WebCoreMemoryInstrumentation.h" |
| 28 #include "core/editing/VisiblePosition.h" | 28 #include "core/editing/VisiblePosition.h" |
| 29 #include "core/page/Chrome.h" | 29 #include "core/page/Chrome.h" |
| 30 #include "core/page/Frame.h" | 30 #include "core/page/Frame.h" |
| 31 #include "core/page/Page.h" | 31 #include "core/page/Page.h" |
| 32 #include "core/platform/graphics/FloatQuad.h" | 32 #include "core/platform/graphics/FloatQuad.h" |
| 33 #include "core/platform/graphics/GraphicsContext.h" | 33 #include "core/platform/graphics/GraphicsContext.h" |
| 34 #include "core/platform/graphics/transforms/TransformState.h" | 34 #include "core/platform/graphics/transforms/TransformState.h" |
| 35 #include "core/rendering/HitTestResult.h" | 35 #include "core/rendering/HitTestResult.h" |
| 36 #include "core/rendering/InlineTextBox.h" | 36 #include "core/rendering/InlineTextBox.h" |
| 37 #include "core/rendering/RenderArena.h" | |
| 38 #include "core/rendering/RenderBlock.h" | 37 #include "core/rendering/RenderBlock.h" |
| 39 #include "core/rendering/RenderFlowThread.h" | 38 #include "core/rendering/RenderFlowThread.h" |
| 40 #include "core/rendering/RenderFullScreen.h" | 39 #include "core/rendering/RenderFullScreen.h" |
| 41 #include "core/rendering/RenderGeometryMap.h" | 40 #include "core/rendering/RenderGeometryMap.h" |
| 42 #include "core/rendering/RenderLayer.h" | 41 #include "core/rendering/RenderLayer.h" |
| 43 #include "core/rendering/RenderTheme.h" | 42 #include "core/rendering/RenderTheme.h" |
| 44 #include "core/rendering/RenderView.h" | 43 #include "core/rendering/RenderView.h" |
| 45 #include "core/rendering/style/StyleInheritedData.h" | 44 #include "core/rendering/style/StyleInheritedData.h" |
| 46 | 45 |
| 47 using namespace std; | 46 using namespace std; |
| 48 | 47 |
| 49 namespace WebCore { | 48 namespace WebCore { |
| 50 | 49 |
| 51 RenderInline::RenderInline(Element* element) | 50 RenderInline::RenderInline(Element* element) |
| 52 : RenderBoxModelObject(element) | 51 : RenderBoxModelObject(element) |
| 53 , m_alwaysCreateLineBoxes(false) | 52 , m_alwaysCreateLineBoxes(false) |
| 54 { | 53 { |
| 55 setChildrenInline(true); | 54 setChildrenInline(true); |
| 56 } | 55 } |
| 57 | 56 |
| 58 RenderInline* RenderInline::createAnonymous(Document* document) | 57 RenderInline* RenderInline::createAnonymous(Document* document) |
| 59 { | 58 { |
| 60 RenderInline* renderer = new (document->renderArena()) RenderInline(0); | 59 RenderInline* renderer = new RenderInline(0); |
| 61 renderer->setDocumentForAnonymous(document); | 60 renderer->setDocumentForAnonymous(document); |
| 62 return renderer; | 61 return renderer; |
| 63 } | 62 } |
| 64 | 63 |
| 65 void RenderInline::willBeDestroyed() | 64 void RenderInline::willBeDestroyed() |
| 66 { | 65 { |
| 67 #if !ASSERT_DISABLED | 66 #if !ASSERT_DISABLED |
| 68 // Make sure we do not retain "this" in the continuation outline table map o
f our containing blocks. | 67 // Make sure we do not retain "this" in the continuation outline table map o
f our containing blocks. |
| 69 if (parent() && style()->visibility() == VISIBLE && hasOutline()) { | 68 if (parent() && style()->visibility() == VISIBLE && hasOutline()) { |
| 70 bool containingBlockPaintsContinuationOutline = continuation() || isInli
neElementContinuation(); | 69 bool containingBlockPaintsContinuationOutline = continuation() || isInli
neElementContinuation(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // not have a parent that means they are either already disconnected
or | 104 // not have a parent that means they are either already disconnected
or |
| 106 // root lines that can just be destroyed without disconnecting. | 105 // root lines that can just be destroyed without disconnecting. |
| 107 if (firstLineBox()->parent()) { | 106 if (firstLineBox()->parent()) { |
| 108 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLi
neBox()) | 107 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLi
neBox()) |
| 109 box->remove(); | 108 box->remove(); |
| 110 } | 109 } |
| 111 } else if (parent()) | 110 } else if (parent()) |
| 112 parent()->dirtyLinesFromChangedChild(this); | 111 parent()->dirtyLinesFromChangedChild(this); |
| 113 } | 112 } |
| 114 | 113 |
| 115 m_lineBoxes.deleteLineBoxes(renderArena()); | 114 m_lineBoxes.deleteLineBoxes(); |
| 116 | 115 |
| 117 RenderBoxModelObject::willBeDestroyed(); | 116 RenderBoxModelObject::willBeDestroyed(); |
| 118 } | 117 } |
| 119 | 118 |
| 120 RenderInline* RenderInline::inlineElementContinuation() const | 119 RenderInline* RenderInline::inlineElementContinuation() const |
| 121 { | 120 { |
| 122 RenderBoxModelObject* continuation = this->continuation(); | 121 RenderBoxModelObject* continuation = this->continuation(); |
| 123 if (!continuation || continuation->isInline()) | 122 if (!continuation || continuation->isInline()) |
| 124 return toRenderInline(continuation); | 123 return toRenderInline(continuation); |
| 125 return toRenderBlock(continuation)->inlineElementContinuation(); | 124 return toRenderBlock(continuation)->inlineElementContinuation(); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 return; | 325 return; |
| 327 } | 326 } |
| 328 | 327 |
| 329 RenderBoxModelObject::addChild(newChild, beforeChild); | 328 RenderBoxModelObject::addChild(newChild, beforeChild); |
| 330 | 329 |
| 331 newChild->setNeedsLayoutAndPrefWidthsRecalc(); | 330 newChild->setNeedsLayoutAndPrefWidthsRecalc(); |
| 332 } | 331 } |
| 333 | 332 |
| 334 RenderInline* RenderInline::clone() const | 333 RenderInline* RenderInline::clone() const |
| 335 { | 334 { |
| 336 RenderInline* cloneInline = new (renderArena()) RenderInline(node()); | 335 RenderInline* cloneInline = new RenderInline(node()); |
| 337 cloneInline->setStyle(style()); | 336 cloneInline->setStyle(style()); |
| 338 cloneInline->setFlowThreadState(flowThreadState()); | 337 cloneInline->setFlowThreadState(flowThreadState()); |
| 339 return cloneInline; | 338 return cloneInline; |
| 340 } | 339 } |
| 341 | 340 |
| 342 void RenderInline::splitInlines(RenderBlock* fromBlock, RenderBlock* toBlock, | 341 void RenderInline::splitInlines(RenderBlock* fromBlock, RenderBlock* toBlock, |
| 343 RenderBlock* middleBlock, | 342 RenderBlock* middleBlock, |
| 344 RenderObject* beforeChild, RenderBoxModelObject*
oldCont) | 343 RenderObject* beforeChild, RenderBoxModelObject*
oldCont) |
| 345 { | 344 { |
| 346 // Create a clone of this inline. | 345 // Create a clone of this inline. |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 pre->children()->appendChildNode(pre, block->children()->removeChild
Node(block, no)); | 467 pre->children()->appendChildNode(pre, block->children()->removeChild
Node(block, no)); |
| 469 no->setNeedsLayoutAndPrefWidthsRecalc(); | 468 no->setNeedsLayoutAndPrefWidthsRecalc(); |
| 470 } | 469 } |
| 471 } | 470 } |
| 472 | 471 |
| 473 splitInlines(pre, post, newBlockBox, beforeChild, oldCont); | 472 splitInlines(pre, post, newBlockBox, beforeChild, oldCont); |
| 474 | 473 |
| 475 // We already know the newBlockBox isn't going to contain inline kids, so av
oid wasting | 474 // We already know the newBlockBox isn't going to contain inline kids, so av
oid wasting |
| 476 // time in makeChildrenNonInline by just setting this explicitly up front. | 475 // time in makeChildrenNonInline by just setting this explicitly up front. |
| 477 newBlockBox->setChildrenInline(false); | 476 newBlockBox->setChildrenInline(false); |
| 478 | |
| 479 // We delayed adding the newChild until now so that the |newBlockBox| would
be fully | |
| 480 // connected, thus allowing newChild access to a renderArena should it need | |
| 481 // to wrap itself in additional boxes (e.g., table construction). | |
| 482 newBlockBox->addChild(newChild); | 477 newBlockBox->addChild(newChild); |
| 483 | 478 |
| 484 // 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) |
| 485 // 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 |
| 486 // 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. |
| 487 pre->setNeedsLayoutAndPrefWidthsRecalc(); | 482 pre->setNeedsLayoutAndPrefWidthsRecalc(); |
| 488 block->setNeedsLayoutAndPrefWidthsRecalc(); | 483 block->setNeedsLayoutAndPrefWidthsRecalc(); |
| 489 post->setNeedsLayoutAndPrefWidthsRecalc(); | 484 post->setNeedsLayoutAndPrefWidthsRecalc(); |
| 490 } | 485 } |
| 491 | 486 |
| (...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1238 result.setInnerNode(n); | 1233 result.setInnerNode(n); |
| 1239 if (!result.innerNonSharedNode()) | 1234 if (!result.innerNonSharedNode()) |
| 1240 result.setInnerNonSharedNode(n); | 1235 result.setInnerNonSharedNode(n); |
| 1241 result.setLocalPoint(localPoint); | 1236 result.setLocalPoint(localPoint); |
| 1242 } | 1237 } |
| 1243 } | 1238 } |
| 1244 | 1239 |
| 1245 void RenderInline::dirtyLineBoxes(bool fullLayout) | 1240 void RenderInline::dirtyLineBoxes(bool fullLayout) |
| 1246 { | 1241 { |
| 1247 if (fullLayout) { | 1242 if (fullLayout) { |
| 1248 m_lineBoxes.deleteLineBoxes(renderArena()); | 1243 m_lineBoxes.deleteLineBoxes(); |
| 1249 return; | 1244 return; |
| 1250 } | 1245 } |
| 1251 | 1246 |
| 1252 if (!alwaysCreateLineBoxes()) { | 1247 if (!alwaysCreateLineBoxes()) { |
| 1253 // 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. |
| 1254 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()
) { | 1249 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()
) { |
| 1255 if (curr->isFloatingOrOutOfFlowPositioned()) | 1250 if (curr->isFloatingOrOutOfFlowPositioned()) |
| 1256 continue; | 1251 continue; |
| 1257 if (curr->isBox() && !curr->needsLayout()) { | 1252 if (curr->isBox() && !curr->needsLayout()) { |
| 1258 RenderBox* currBox = toRenderBox(curr); | 1253 RenderBox* currBox = toRenderBox(curr); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1269 childText->root()->markDirty(); | 1264 childText->root()->markDirty(); |
| 1270 } | 1265 } |
| 1271 } | 1266 } |
| 1272 } | 1267 } |
| 1273 } else | 1268 } else |
| 1274 m_lineBoxes.dirtyLineBoxes(); | 1269 m_lineBoxes.dirtyLineBoxes(); |
| 1275 } | 1270 } |
| 1276 | 1271 |
| 1277 void RenderInline::deleteLineBoxTree() | 1272 void RenderInline::deleteLineBoxTree() |
| 1278 { | 1273 { |
| 1279 m_lineBoxes.deleteLineBoxTree(renderArena()); | 1274 m_lineBoxes.deleteLineBoxTree(); |
| 1280 } | 1275 } |
| 1281 | 1276 |
| 1282 InlineFlowBox* RenderInline::createInlineFlowBox() | 1277 InlineFlowBox* RenderInline::createInlineFlowBox() |
| 1283 { | 1278 { |
| 1284 return new (renderArena()) InlineFlowBox(this); | 1279 return new InlineFlowBox(this); |
| 1285 } | 1280 } |
| 1286 | 1281 |
| 1287 InlineFlowBox* RenderInline::createAndAppendInlineFlowBox() | 1282 InlineFlowBox* RenderInline::createAndAppendInlineFlowBox() |
| 1288 { | 1283 { |
| 1289 setAlwaysCreateLineBoxes(); | 1284 setAlwaysCreateLineBoxes(); |
| 1290 InlineFlowBox* flowBox = createInlineFlowBox(); | 1285 InlineFlowBox* flowBox = createInlineFlowBox(); |
| 1291 m_lineBoxes.appendLineBox(flowBox); | 1286 m_lineBoxes.appendLineBox(flowBox); |
| 1292 return flowBox; | 1287 return flowBox; |
| 1293 } | 1288 } |
| 1294 | 1289 |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1564 | 1559 |
| 1565 void RenderInline::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const | 1560 void RenderInline::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const |
| 1566 { | 1561 { |
| 1567 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Rendering)
; | 1562 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Rendering)
; |
| 1568 RenderBoxModelObject::reportMemoryUsage(memoryObjectInfo); | 1563 RenderBoxModelObject::reportMemoryUsage(memoryObjectInfo); |
| 1569 info.addMember(m_children, "children"); | 1564 info.addMember(m_children, "children"); |
| 1570 info.addMember(m_lineBoxes, "lineBoxes"); | 1565 info.addMember(m_lineBoxes, "lineBoxes"); |
| 1571 } | 1566 } |
| 1572 | 1567 |
| 1573 } // namespace WebCore | 1568 } // namespace WebCore |
| OLD | NEW |