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 Apple Inc. All r
ights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r
ights 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 5465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5476 | 5476 |
5477 if (!currChild) | 5477 if (!currChild) |
5478 return; | 5478 return; |
5479 | 5479 |
5480 // If the child already has style, then it has already been created, so we j
ust want | 5480 // If the child already has style, then it has already been created, so we j
ust want |
5481 // to update it. | 5481 // to update it. |
5482 if (currChild->parent()->style()->styleType() == FIRST_LETTER) { | 5482 if (currChild->parent()->style()->styleType() == FIRST_LETTER) { |
5483 RenderObject* firstLetter = currChild->parent(); | 5483 RenderObject* firstLetter = currChild->parent(); |
5484 RenderObject* firstLetterContainer = firstLetter->parent(); | 5484 RenderObject* firstLetterContainer = firstLetter->parent(); |
5485 RenderStyle* pseudoStyle = styleForFirstLetter(firstLetterBlock, firstLe
tterContainer); | 5485 RenderStyle* pseudoStyle = styleForFirstLetter(firstLetterBlock, firstLe
tterContainer); |
| 5486 ASSERT(firstLetter->isFloating() || firstLetter->isInline()); |
5486 | 5487 |
5487 if (Node::diff(firstLetter->style(), pseudoStyle) == Node::Detach) { | 5488 if (Node::diff(firstLetter->style(), pseudoStyle) == Node::Detach) { |
5488 // The first-letter renderer needs to be replaced. Create a new rend
erer of the right type. | 5489 // The first-letter renderer needs to be replaced. Create a new rend
erer of the right type. |
5489 RenderObject* newFirstLetter; | 5490 RenderObject* newFirstLetter; |
5490 if (pseudoStyle->display() == INLINE) | 5491 if (pseudoStyle->display() == INLINE) |
5491 newFirstLetter = new (renderArena()) RenderInline(document()); | 5492 newFirstLetter = new (renderArena()) RenderInline(document()); |
5492 else | 5493 else |
5493 newFirstLetter = new (renderArena()) RenderBlock(document()); | 5494 newFirstLetter = new (renderArena()) RenderBlock(document()); |
5494 newFirstLetter->setStyle(pseudoStyle); | 5495 newFirstLetter->setStyle(pseudoStyle); |
5495 | 5496 |
(...skipping 10 matching lines...) Expand all Loading... |
5506 RenderObject* nextSibling = firstLetter->nextSibling(); | 5507 RenderObject* nextSibling = firstLetter->nextSibling(); |
5507 RenderObject* next = nextSibling; | 5508 RenderObject* next = nextSibling; |
5508 while (next) { | 5509 while (next) { |
5509 if (next->isText() && toRenderText(next)->isTextFragment()) { | 5510 if (next->isText() && toRenderText(next)->isTextFragment()) { |
5510 remainingText = toRenderTextFragment(next); | 5511 remainingText = toRenderTextFragment(next); |
5511 break; | 5512 break; |
5512 } | 5513 } |
5513 next = next->nextSibling(); | 5514 next = next->nextSibling(); |
5514 } | 5515 } |
5515 if (remainingText) { | 5516 if (remainingText) { |
5516 ASSERT(remainingText->node()->renderer() == remainingText); | 5517 ASSERT(remainingText->isAnonymous() || remainingText->node()->re
nderer() == remainingText); |
5517 // Replace the old renderer with the new one. | 5518 // Replace the old renderer with the new one. |
5518 remainingText->setFirstLetter(newFirstLetter); | 5519 remainingText->setFirstLetter(newFirstLetter); |
5519 } | 5520 } |
5520 firstLetter->destroy(); | 5521 firstLetter->destroy(); |
5521 firstLetter = newFirstLetter; | 5522 firstLetter = newFirstLetter; |
5522 firstLetterContainer->addChild(firstLetter, nextSibling); | 5523 firstLetterContainer->addChild(firstLetter, nextSibling); |
5523 } else | 5524 } else |
5524 firstLetter->setStyle(pseudoStyle); | 5525 firstLetter->setStyle(pseudoStyle); |
5525 | 5526 |
5526 for (RenderObject* genChild = firstLetter->firstChild(); genChild; genCh
ild = genChild->nextSibling()) { | 5527 for (RenderObject* genChild = firstLetter->firstChild(); genChild; genCh
ild = genChild->nextSibling()) { |
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6604 } | 6605 } |
6605 | 6606 |
6606 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) | 6607 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) |
6607 { | 6608 { |
6608 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->x(
), floatingObject->y(), floatingObject->maxX(), floatingObject->maxY()); | 6609 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->x(
), floatingObject->y(), floatingObject->maxX(), floatingObject->maxY()); |
6609 } | 6610 } |
6610 | 6611 |
6611 #endif | 6612 #endif |
6612 | 6613 |
6613 } // namespace WebCore | 6614 } // namespace WebCore |
OLD | NEW |