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; |
943 status.context = BidiContext::create(0, 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 while (i > run->stop() || (run->next() && run->next()->direction() == ru n->direction())) |
leviw_travelin_and_unemployed
2014/03/03 19:27:46
Add a comment explaining what this does, and LGTM.
| |
955 run = run->next(); | 956 run = run->next(); |
956 | 957 |
957 ASSERT(run); | 958 ASSERT(run); |
958 ASSERT(i >= run->start() && i <= run->stop()); | 959 ASSERT(i <= run->stop()); |
959 TextDirection textDirection = run->direction(); | 960 TextDirection textDirection = run->direction(); |
960 | 961 |
961 bool previousCharacterIsSpace = isSpace; | 962 bool previousCharacterIsSpace = isSpace; |
962 bool isNewline = false; | 963 bool isNewline = false; |
963 if (c == '\n') { | 964 if (c == '\n') { |
964 if (styleToUse->preserveNewline()) { | 965 if (styleToUse->preserveNewline()) { |
965 m_hasBreak = true; | 966 m_hasBreak = true; |
966 isNewline = true; | 967 isNewline = true; |
967 isSpace = false; | 968 isSpace = false; |
968 } else | 969 } else |
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1867 } | 1868 } |
1868 secureTextTimer->restartWithNewText(lastTypedCharacterOffset); | 1869 secureTextTimer->restartWithNewText(lastTypedCharacterOffset); |
1869 } | 1870 } |
1870 | 1871 |
1871 PassRefPtr<AbstractInlineTextBox> RenderText::firstAbstractInlineTextBox() | 1872 PassRefPtr<AbstractInlineTextBox> RenderText::firstAbstractInlineTextBox() |
1872 { | 1873 { |
1873 return AbstractInlineTextBox::getOrCreate(this, m_firstTextBox); | 1874 return AbstractInlineTextBox::getOrCreate(this, m_firstTextBox); |
1874 } | 1875 } |
1875 | 1876 |
1876 } // namespace WebCore | 1877 } // namespace WebCore |
OLD | NEW |