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, 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 255 matching lines...) Loading... |
266 | 266 |
267 // FIXME: This would already have been calculated in firstLetterLayoutObject
. Can we pass the length through? | 267 // FIXME: This would already have been calculated in firstLetterLayoutObject
. Can we pass the length through? |
268 unsigned length = FirstLetterPseudoElement::firstLetterLength(oldText); | 268 unsigned length = FirstLetterPseudoElement::firstLetterLength(oldText); |
269 | 269 |
270 // Construct a text fragment for the text after the first letter. | 270 // Construct a text fragment for the text after the first letter. |
271 // This text fragment might be empty. | 271 // This text fragment might be empty. |
272 LayoutTextFragment* remainingText = | 272 LayoutTextFragment* remainingText = |
273 new LayoutTextFragment(nextLayoutObject->node() ? nextLayoutObject->node
() : &nextLayoutObject->document(), oldText.impl(), length, oldText.length() - l
ength); | 273 new LayoutTextFragment(nextLayoutObject->node() ? nextLayoutObject->node
() : &nextLayoutObject->document(), oldText.impl(), length, oldText.length() - l
ength); |
274 remainingText->setFirstLetterPseudoElement(this); | 274 remainingText->setFirstLetterPseudoElement(this); |
275 remainingText->setIsRemainingTextLayoutObject(true); | 275 remainingText->setIsRemainingTextLayoutObject(true); |
| 276 // Copy all properties, but assert that we're copying from a text node. Text
nodes only have |
| 277 // their inheritable properties set, while other nodes (HTML elements, for i
nstance) may have |
| 278 // anything set. We only want to set inheritable properties on text fragment
s (just like for |
| 279 // regular text nodes). |
| 280 ASSERT(nextLayoutObject->isText() && !nextLayoutObject->isBR()); |
276 remainingText->setStyle(nextLayoutObject->mutableStyle()); | 281 remainingText->setStyle(nextLayoutObject->mutableStyle()); |
277 | 282 |
278 if (remainingText->node()) | 283 if (remainingText->node()) |
279 remainingText->node()->setLayoutObject(remainingText); | 284 remainingText->node()->setLayoutObject(remainingText); |
280 | 285 |
281 m_remainingTextLayoutObject = remainingText; | 286 m_remainingTextLayoutObject = remainingText; |
282 | 287 |
283 LayoutObject* nextSibling = layoutObject()->nextSibling(); | 288 LayoutObject* nextSibling = layoutObject()->nextSibling(); |
284 layoutObject()->parent()->addChild(remainingText, nextSibling); | 289 layoutObject()->parent()->addChild(remainingText, nextSibling); |
285 | 290 |
(...skipping 25 matching lines...) Loading... |
311 | 316 |
312 // We only manage the style for the generated content items. | 317 // We only manage the style for the generated content items. |
313 if (!child->isText() && !child->isQuote() && !child->isImage()) | 318 if (!child->isText() && !child->isQuote() && !child->isImage()) |
314 continue; | 319 continue; |
315 | 320 |
316 child->setPseudoStyle(layoutObject->mutableStyle()); | 321 child->setPseudoStyle(layoutObject->mutableStyle()); |
317 } | 322 } |
318 } | 323 } |
319 | 324 |
320 } // namespace blink | 325 } // namespace blink |
OLD | NEW |