| 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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 // Passing both |textNode| and its layout object because repeated calls to | 408 // Passing both |textNode| and its layout object because repeated calls to |
| 409 // |Node::layoutObject()| are discouraged. | 409 // |Node::layoutObject()| are discouraged. |
| 410 static bool shouldUpdateLayoutByReattaching(const Text& textNode, LayoutText* te
xtLayoutObject) | 410 static bool shouldUpdateLayoutByReattaching(const Text& textNode, LayoutText* te
xtLayoutObject) |
| 411 { | 411 { |
| 412 DCHECK_EQ(textNode.layoutObject(), textLayoutObject); | 412 DCHECK_EQ(textNode.layoutObject(), textLayoutObject); |
| 413 if (!textLayoutObject) | 413 if (!textLayoutObject) |
| 414 return true; | 414 return true; |
| 415 if (!textNode.textLayoutObjectIsNeeded(*textLayoutObject->style(), *textLayo
utObject->parent())) | 415 if (!textNode.textLayoutObjectIsNeeded(*textLayoutObject->style(), *textLayo
utObject->parent())) |
| 416 return true; | 416 return true; |
| 417 if (textLayoutObject->isTextFragment()) { | 417 if (textLayoutObject->isTextFragment()) { |
| 418 FirstLetterPseudoElement* pseudo = toLayoutTextFragment(textLayoutObject
)->firstLetterPseudoElement(); | 418 // Changes of |textNode| may change first letter part, so we should |
| 419 if (pseudo && !FirstLetterPseudoElement::firstLetterTextLayoutObject(*ps
eudo)) | 419 // reattach. |
| 420 return true; | 420 return toLayoutTextFragment(textLayoutObject)->firstLetterPseudoElement(
); |
| 421 } | 421 } |
| 422 return false; | 422 return false; |
| 423 } | 423 } |
| 424 | 424 |
| 425 void Text::updateTextLayoutObject(unsigned offsetOfReplacedData, unsigned length
OfReplacedData, RecalcStyleBehavior recalcStyleBehavior) | 425 void Text::updateTextLayoutObject(unsigned offsetOfReplacedData, unsigned length
OfReplacedData, RecalcStyleBehavior recalcStyleBehavior) |
| 426 { | 426 { |
| 427 if (!inActiveDocument()) | 427 if (!inActiveDocument()) |
| 428 return; | 428 return; |
| 429 LayoutText* textLayoutObject = layoutObject(); | 429 LayoutText* textLayoutObject = layoutObject(); |
| 430 if (shouldUpdateLayoutByReattaching(*this, textLayoutObject)) { | 430 if (shouldUpdateLayoutByReattaching(*this, textLayoutObject)) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 461 result.append("; "); | 461 result.append("; "); |
| 462 result.append("value="); | 462 result.append("value="); |
| 463 result.append(s); | 463 result.append(s); |
| 464 } | 464 } |
| 465 | 465 |
| 466 strncpy(buffer, result.toString().utf8().data(), length - 1); | 466 strncpy(buffer, result.toString().utf8().data(), length - 1); |
| 467 } | 467 } |
| 468 #endif | 468 #endif |
| 469 | 469 |
| 470 } // namespace blink | 470 } // namespace blink |
| OLD | NEW |