| OLD | NEW |
| 1 /* | 1 /* |
| 2 * (C) 1999 Lars Knoll (knoll@kde.org) | 2 * (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2000 Dirk Mueller (mueller@kde.org) | 3 * (C) 2000 Dirk Mueller (mueller@kde.org) |
| 4 * Copyright (C) 2004-2009, 2013 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004-2009, 2013 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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 } | 318 } |
| 319 | 319 |
| 320 inline UChar LayoutText::characterAt(unsigned i) const { | 320 inline UChar LayoutText::characterAt(unsigned i) const { |
| 321 if (i >= textLength()) | 321 if (i >= textLength()) |
| 322 return 0; | 322 return 0; |
| 323 | 323 |
| 324 return uncheckedCharacterAt(i); | 324 return uncheckedCharacterAt(i); |
| 325 } | 325 } |
| 326 | 326 |
| 327 inline UChar32 LayoutText::codepointAt(unsigned i) const { | 327 inline UChar32 LayoutText::codepointAt(unsigned i) const { |
| 328 UChar32 character = characterAt(i); | 328 if (i >= textLength()) |
| 329 if (!U16_IS_LEAD(character)) | 329 return 0; |
| 330 return character; | 330 if (is8Bit()) |
| 331 UChar trail = characterAt(i + 1); | 331 return characters8()[i]; |
| 332 return U16_IS_TRAIL(trail) ? U16_GET_SUPPLEMENTARY(character, trail) | 332 UChar32 c; |
| 333 : character; | 333 U16_GET(characters16(), 0, i, textLength(), c); |
| 334 return c; |
| 334 } | 335 } |
| 335 | 336 |
| 336 inline float LayoutText::hyphenWidth(const Font& font, | 337 inline float LayoutText::hyphenWidth(const Font& font, |
| 337 TextDirection direction) { | 338 TextDirection direction) { |
| 338 const ComputedStyle& style = styleRef(); | 339 const ComputedStyle& style = styleRef(); |
| 339 return font.width(constructTextRun(font, style.hyphenString().getString(), | 340 return font.width(constructTextRun(font, style.hyphenString().getString(), |
| 340 style, direction)); | 341 style, direction)); |
| 341 } | 342 } |
| 342 | 343 |
| 343 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutText, isText()); | 344 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutText, isText()); |
| 344 | 345 |
| 345 #if !ENABLE(ASSERT) | 346 #if !ENABLE(ASSERT) |
| 346 inline void LayoutText::checkConsistency() const {} | 347 inline void LayoutText::checkConsistency() const {} |
| 347 #endif | 348 #endif |
| 348 | 349 |
| 349 inline LayoutText* Text::layoutObject() const { | 350 inline LayoutText* Text::layoutObject() const { |
| 350 return toLayoutText(CharacterData::layoutObject()); | 351 return toLayoutText(CharacterData::layoutObject()); |
| 351 } | 352 } |
| 352 | 353 |
| 353 void applyTextTransform(const ComputedStyle*, String&, UChar); | 354 void applyTextTransform(const ComputedStyle*, String&, UChar); |
| 354 | 355 |
| 355 } // namespace blink | 356 } // namespace blink |
| 356 | 357 |
| 357 #endif // LayoutText_h | 358 #endif // LayoutText_h |
| OLD | NEW |