| 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, 2005, 2006, 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
| 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) | 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) |
| 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
| 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 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 float wordTrailingSpaceWidth = f.fontDescription().typesettingFeatures() & K
erning ? f.width(RenderBlockFlow::constructTextRun(this, f, &space, 1, styleToUs
e, textDirection)) + wordSpacing : 0; | 931 float wordTrailingSpaceWidth = f.fontDescription().typesettingFeatures() & K
erning ? f.width(RenderBlockFlow::constructTextRun(this, f, &space, 1, styleToUs
e, textDirection)) + wordSpacing : 0; |
| 932 | 932 |
| 933 // If automatic hyphenation is allowed, we keep track of the width of the wi
dest word (or word | 933 // If automatic hyphenation is allowed, we keep track of the width of the wi
dest word (or word |
| 934 // fragment) encountered so far, and only try hyphenating words that are wid
er. | 934 // fragment) encountered so far, and only try hyphenating words that are wid
er. |
| 935 float maxWordWidth = numeric_limits<float>::max(); | 935 float maxWordWidth = numeric_limits<float>::max(); |
| 936 int firstGlyphLeftOverflow = -1; | 936 int firstGlyphLeftOverflow = -1; |
| 937 | 937 |
| 938 bool breakAll = (styleToUse->wordBreak() == BreakAllWordBreak || styleToUse-
>wordBreak() == BreakWordBreak) && styleToUse->autoWrap(); | 938 bool breakAll = (styleToUse->wordBreak() == BreakAllWordBreak || styleToUse-
>wordBreak() == BreakWordBreak) && styleToUse->autoWrap(); |
| 939 | 939 |
| 940 TextRun textRun(text()); | 940 TextRun textRun(text()); |
| 941 textRun.setDirection(textDirection); | |
| 942 BidiResolver<TextRunIterator, BidiCharacterRun> bidiResolver; | 941 BidiResolver<TextRunIterator, BidiCharacterRun> bidiResolver; |
| 943 bidiResolver.setStatus(BidiStatus(textRun.direction(), textRun.directionalOv
erride())); | 942 BidiStatus status(LTR, false); |
| 943 status.last = status.lastStrong = WTF::Unicode::OtherNeutral; |
| 944 bidiResolver.setStatus(status); |
| 944 bidiResolver.setPositionIgnoringNestedIsolates(TextRunIterator(&textRun, 0))
; | 945 bidiResolver.setPositionIgnoringNestedIsolates(TextRunIterator(&textRun, 0))
; |
| 945 bool hardLineBreak = false; | 946 bool hardLineBreak = false; |
| 946 bool reorderRuns = false; | 947 bool reorderRuns = false; |
| 947 bidiResolver.createBidiRunsForLine(TextRunIterator(&textRun, textRun.length(
)), NoVisualOverride, hardLineBreak, reorderRuns); | 948 bidiResolver.createBidiRunsForLine(TextRunIterator(&textRun, textRun.length(
)), NoVisualOverride, hardLineBreak, reorderRuns); |
| 948 | 949 |
| 949 BidiRunList<BidiCharacterRun>& bidiRuns = bidiResolver.runs(); | 950 BidiRunList<BidiCharacterRun>& bidiRuns = bidiResolver.runs(); |
| 950 BidiCharacterRun* run = bidiRuns.firstRun(); | 951 BidiCharacterRun* run = bidiRuns.firstRun(); |
| 951 for (int i = 0; i < len; i++) { | 952 for (int i = 0; i < len; i++) { |
| 952 UChar c = uncheckedCharacterAt(i); | 953 UChar c = uncheckedCharacterAt(i); |
| 953 | 954 |
| 954 while (i > run->stop()) | 955 // Treat adjacent runs with the same resolved directionality |
| 956 // (TextDirection as opposed to WTF::Unicode::Direction) as belonging |
| 957 // to the same run to avoid breaking unnecessarily. |
| 958 while (i > run->stop() || (run->next() && run->next()->direction() == ru
n->direction())) |
| 955 run = run->next(); | 959 run = run->next(); |
| 956 | 960 |
| 957 ASSERT(run); | 961 ASSERT(run); |
| 958 ASSERT(i >= run->start() && i <= run->stop()); | 962 ASSERT(i <= run->stop()); |
| 959 TextDirection textDirection = run->direction(); | 963 TextDirection textDirection = run->direction(); |
| 960 | 964 |
| 961 bool previousCharacterIsSpace = isSpace; | 965 bool previousCharacterIsSpace = isSpace; |
| 962 bool isNewline = false; | 966 bool isNewline = false; |
| 963 if (c == '\n') { | 967 if (c == '\n') { |
| 964 if (styleToUse->preserveNewline()) { | 968 if (styleToUse->preserveNewline()) { |
| 965 m_hasBreak = true; | 969 m_hasBreak = true; |
| 966 isNewline = true; | 970 isNewline = true; |
| 967 isSpace = false; | 971 isSpace = false; |
| 968 } else | 972 } else |
| (...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1867 } | 1871 } |
| 1868 secureTextTimer->restartWithNewText(lastTypedCharacterOffset); | 1872 secureTextTimer->restartWithNewText(lastTypedCharacterOffset); |
| 1869 } | 1873 } |
| 1870 | 1874 |
| 1871 PassRefPtr<AbstractInlineTextBox> RenderText::firstAbstractInlineTextBox() | 1875 PassRefPtr<AbstractInlineTextBox> RenderText::firstAbstractInlineTextBox() |
| 1872 { | 1876 { |
| 1873 return AbstractInlineTextBox::getOrCreate(this, m_firstTextBox); | 1877 return AbstractInlineTextBox::getOrCreate(this, m_firstTextBox); |
| 1874 } | 1878 } |
| 1875 | 1879 |
| 1876 } // namespace WebCore | 1880 } // namespace WebCore |
| OLD | NEW |