| 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. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. |
| 6 * All rights reserved. | 6 * All rights reserved. |
| 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 // Construct text fragment for the first letter. | 312 // Construct text fragment for the first letter. |
| 313 LayoutTextFragment* letter = new LayoutTextFragment( | 313 LayoutTextFragment* letter = new LayoutTextFragment( |
| 314 &nextLayoutObject->document(), oldText.impl(), 0, length); | 314 &nextLayoutObject->document(), oldText.impl(), 0, length); |
| 315 letter->setFirstLetterPseudoElement(this); | 315 letter->setFirstLetterPseudoElement(this); |
| 316 letter->setStyle(pseudoStyle); | 316 letter->setStyle(pseudoStyle); |
| 317 layoutObject()->addChild(letter); | 317 layoutObject()->addChild(letter); |
| 318 | 318 |
| 319 nextLayoutObject->destroy(); | 319 nextLayoutObject->destroy(); |
| 320 } | 320 } |
| 321 | 321 |
| 322 void FirstLetterPseudoElement::didRecalcStyle(StyleRecalcChange) { | 322 void FirstLetterPseudoElement::didRecalcStyle() { |
| 323 if (!layoutObject()) | 323 if (!layoutObject()) |
| 324 return; | 324 return; |
| 325 | 325 |
| 326 // The layoutObjects inside pseudo elements are anonymous so they don't get | 326 // The layoutObjects inside pseudo elements are anonymous so they don't get |
| 327 // notified of recalcStyle and must have | 327 // notified of recalcStyle and must have |
| 328 // the style propagated downward manually similar to | 328 // the style propagated downward manually similar to |
| 329 // LayoutObject::propagateStyleToAnonymousChildren. | 329 // LayoutObject::propagateStyleToAnonymousChildren. |
| 330 LayoutObject* layoutObject = this->layoutObject(); | 330 LayoutObject* layoutObject = this->layoutObject(); |
| 331 for (LayoutObject* child = layoutObject->nextInPreOrder(layoutObject); child; | 331 for (LayoutObject* child = layoutObject->nextInPreOrder(layoutObject); child; |
| 332 child = child->nextInPreOrder(layoutObject)) { | 332 child = child->nextInPreOrder(layoutObject)) { |
| 333 // We need to re-calculate the correct style for the first letter element | 333 // We need to re-calculate the correct style for the first letter element |
| 334 // and then apply that to the container and the text fragment inside. | 334 // and then apply that to the container and the text fragment inside. |
| 335 if (child->style()->styleType() == PseudoIdFirstLetter && | 335 if (child->style()->styleType() == PseudoIdFirstLetter && |
| 336 m_remainingTextLayoutObject) { | 336 m_remainingTextLayoutObject) { |
| 337 if (ComputedStyle* pseudoStyle = | 337 if (ComputedStyle* pseudoStyle = |
| 338 styleForFirstLetter(m_remainingTextLayoutObject->parent())) | 338 styleForFirstLetter(m_remainingTextLayoutObject->parent())) |
| 339 child->setPseudoStyle(pseudoStyle); | 339 child->setPseudoStyle(pseudoStyle); |
| 340 continue; | 340 continue; |
| 341 } | 341 } |
| 342 | 342 |
| 343 // We only manage the style for the generated content items. | 343 // We only manage the style for the generated content items. |
| 344 if (!child->isText() && !child->isQuote() && !child->isImage()) | 344 if (!child->isText() && !child->isQuote() && !child->isImage()) |
| 345 continue; | 345 continue; |
| 346 | 346 |
| 347 child->setPseudoStyle(layoutObject->mutableStyle()); | 347 child->setPseudoStyle(layoutObject->mutableStyle()); |
| 348 } | 348 } |
| 349 } | 349 } |
| 350 | 350 |
| 351 } // namespace blink | 351 } // namespace blink |
| OLD | NEW |