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) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. |
7 * Copyright (C) 2009 Google Inc. All rights reserved. | 7 * Copyright (C) 2009 Google Inc. All rights reserved. |
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 return node() && node()->renderer() == this && node()->hasTagName(marqueeTag
); | 276 return node() && node()->renderer() == this && node()->hasTagName(marqueeTag
); |
277 } | 277 } |
278 | 278 |
279 void RenderObject::addChild(RenderObject* newChild, RenderObject* beforeChild) | 279 void RenderObject::addChild(RenderObject* newChild, RenderObject* beforeChild) |
280 { | 280 { |
281 RenderObjectChildList* children = virtualChildren(); | 281 RenderObjectChildList* children = virtualChildren(); |
282 ASSERT(children); | 282 ASSERT(children); |
283 if (!children) | 283 if (!children) |
284 return; | 284 return; |
285 | 285 |
| 286 RenderObject* beforeContent = 0; |
| 287 bool beforeChildHasBeforeAndAfterContent = false; |
| 288 if (beforeChild && (beforeChild->isTable() || beforeChild->isTableSection()
|| beforeChild->isTableRow())) { |
| 289 beforeContent = beforeChild->findBeforeContentRenderer(); |
| 290 RenderObject* afterContent = beforeChild->findAfterContentRenderer(); |
| 291 if (beforeContent && afterContent) { |
| 292 beforeChildHasBeforeAndAfterContent = true; |
| 293 beforeContent->destroy(); |
| 294 } |
| 295 } |
| 296 |
286 bool needsTable = false; | 297 bool needsTable = false; |
287 | 298 |
288 if (newChild->isTableCol() && newChild->style()->display() == TABLE_COLUMN_G
ROUP) | 299 if (newChild->isTableCol() && newChild->style()->display() == TABLE_COLUMN_G
ROUP) |
289 needsTable = !isTable(); | 300 needsTable = !isTable(); |
290 else if (newChild->isRenderBlock() && newChild->style()->display() == TABLE_
CAPTION) | 301 else if (newChild->isRenderBlock() && newChild->style()->display() == TABLE_
CAPTION) |
291 needsTable = !isTable(); | 302 needsTable = !isTable(); |
292 else if (newChild->isTableSection()) | 303 else if (newChild->isTableSection()) |
293 needsTable = !isTable(); | 304 needsTable = !isTable(); |
294 else if (newChild->isTableRow()) | 305 else if (newChild->isTableRow()) |
295 needsTable = !isTableSection(); | 306 needsTable = !isTableSection(); |
(...skipping 18 matching lines...) Expand all Loading... |
314 newStyle->inheritFrom(style()); | 325 newStyle->inheritFrom(style()); |
315 newStyle->setDisplay(TABLE); | 326 newStyle->setDisplay(TABLE); |
316 table->setStyle(newStyle.release()); | 327 table->setStyle(newStyle.release()); |
317 addChild(table, beforeChild); | 328 addChild(table, beforeChild); |
318 } | 329 } |
319 table->addChild(newChild); | 330 table->addChild(newChild); |
320 } else { | 331 } else { |
321 // Just add it... | 332 // Just add it... |
322 children->insertChildNode(this, newChild, beforeChild); | 333 children->insertChildNode(this, newChild, beforeChild); |
323 } | 334 } |
| 335 |
324 if (newChild->isText() && newChild->style()->textTransform() == CAPITALIZE)
{ | 336 if (newChild->isText() && newChild->style()->textTransform() == CAPITALIZE)
{ |
325 RefPtr<StringImpl> textToTransform = toRenderText(newChild)->originalTex
t(); | 337 RefPtr<StringImpl> textToTransform = toRenderText(newChild)->originalTex
t(); |
326 if (textToTransform) | 338 if (textToTransform) |
327 toRenderText(newChild)->setText(textToTransform.release(), true); | 339 toRenderText(newChild)->setText(textToTransform.release(), true); |
328 } | 340 } |
| 341 |
| 342 if (beforeChildHasBeforeAndAfterContent) |
| 343 children->updateBeforeAfterContent(this, BEFORE); |
329 } | 344 } |
330 | 345 |
331 void RenderObject::removeChild(RenderObject* oldChild) | 346 void RenderObject::removeChild(RenderObject* oldChild) |
332 { | 347 { |
333 RenderObjectChildList* children = virtualChildren(); | 348 RenderObjectChildList* children = virtualChildren(); |
334 ASSERT(children); | 349 ASSERT(children); |
335 if (!children) | 350 if (!children) |
336 return; | 351 return; |
337 | 352 |
338 // We do this here instead of in removeChildNode, since the only extremely l
ow-level uses of remove/appendChildNode | 353 // We do this here instead of in removeChildNode, since the only extremely l
ow-level uses of remove/appendChildNode |
(...skipping 2350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2689 { | 2704 { |
2690 if (object1) { | 2705 if (object1) { |
2691 const WebCore::RenderObject* root = object1; | 2706 const WebCore::RenderObject* root = object1; |
2692 while (root->parent()) | 2707 while (root->parent()) |
2693 root = root->parent(); | 2708 root = root->parent(); |
2694 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 2709 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
2695 } | 2710 } |
2696 } | 2711 } |
2697 | 2712 |
2698 #endif | 2713 #endif |
OLD | NEW |