Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(764)

Unified Diff: Source/core/rendering/RenderText.cpp

Issue 197883020: Fix handling of bidirectional override (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/text/international/bdo-bidi-width-expected.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderText.cpp
diff --git a/Source/core/rendering/RenderText.cpp b/Source/core/rendering/RenderText.cpp
index d9b8a4533a8bb9741f84db3e02af3036a8ec54b1..7348910e716911307068569050e3eec346d767ac 100644
--- a/Source/core/rendering/RenderText.cpp
+++ b/Source/core/rendering/RenderText.cpp
@@ -936,28 +936,37 @@ void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Si
TextRun textRun(text());
BidiResolver<TextRunIterator, BidiCharacterRun> bidiResolver;
- BidiStatus status(LTR, false);
- status.last = status.lastStrong = WTF::Unicode::OtherNeutral;
- bidiResolver.setStatus(status);
- bidiResolver.setPositionIgnoringNestedIsolates(TextRunIterator(&textRun, 0));
- bool hardLineBreak = false;
- bool reorderRuns = false;
- bidiResolver.createBidiRunsForLine(TextRunIterator(&textRun, textRun.length()), NoVisualOverride, hardLineBreak, reorderRuns);
-
- BidiRunList<BidiCharacterRun>& bidiRuns = bidiResolver.runs();
- BidiCharacterRun* run = bidiRuns.firstRun();
+
+ BidiCharacterRun* run;
+ TextDirection textDirection = styleToUse->direction();
+ if (isOverride(styleToUse->unicodeBidi())) {
+ run = 0;
+ } else {
+ BidiStatus status(LTR, false);
+ status.last = status.lastStrong = WTF::Unicode::OtherNeutral;
+ bidiResolver.setStatus(status);
+ bidiResolver.setPositionIgnoringNestedIsolates(TextRunIterator(&textRun, 0));
+ bool hardLineBreak = false;
+ bool reorderRuns = false;
+ bidiResolver.createBidiRunsForLine(TextRunIterator(&textRun, textRun.length()), NoVisualOverride, hardLineBreak, reorderRuns);
+ BidiRunList<BidiCharacterRun>& bidiRuns = bidiResolver.runs();
+ run = bidiRuns.firstRun();
+ }
+
for (int i = 0; i < len; i++) {
UChar c = uncheckedCharacterAt(i);
- // Treat adjacent runs with the same resolved directionality
- // (TextDirection as opposed to WTF::Unicode::Direction) as belonging
- // to the same run to avoid breaking unnecessarily.
- while (i > run->stop() || (run->next() && run->next()->direction() == run->direction()))
- run = run->next();
+ if (run) {
+ // Treat adjacent runs with the same resolved directionality
+ // (TextDirection as opposed to WTF::Unicode::Direction) as belonging
+ // to the same run to avoid breaking unnecessarily.
+ while (i > run->stop() || (run->next() && run->next()->direction() == run->direction()))
+ run = run->next();
- ASSERT(run);
- ASSERT(i <= run->stop());
- TextDirection textDirection = run->direction();
+ ASSERT(run);
+ ASSERT(i <= run->stop());
+ textDirection = run->direction();
+ }
bool previousCharacterIsSpace = isSpace;
bool isNewline = false;
@@ -1021,7 +1030,8 @@ void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Si
}
// Terminate word boundary at bidi run boundary.
- j = min(j, run->stop() + 1);
+ if (run)
+ j = min(j, run->stop() + 1);
int wordLen = j - i;
if (wordLen) {
bool isSpace = (j < len) && c == ' ';
@@ -1117,7 +1127,8 @@ void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Si
lastWordBoundary++;
}
}
- bidiRuns.deleteRuns();
+ if (run)
+ bidiResolver.runs().deleteRuns();
if (firstGlyphLeftOverflow > 0)
glyphOverflow.left = firstGlyphLeftOverflow;
« no previous file with comments | « LayoutTests/fast/text/international/bdo-bidi-width-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698