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

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

Issue 185123002: Init BidiResolver with Neutral directionality in RenderText (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: land Created 6 years, 10 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/rtl-space-in-ltr-element-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 d60eac1bd18d6904e6c73b16bf977a4694d396ea..cef997fa3eb0f42a0ac375ebf3d19eaba7e53a74 100644
--- a/Source/core/rendering/RenderText.cpp
+++ b/Source/core/rendering/RenderText.cpp
@@ -938,9 +938,10 @@ void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Si
bool breakAll = (styleToUse->wordBreak() == BreakAllWordBreak || styleToUse->wordBreak() == BreakWordBreak) && styleToUse->autoWrap();
TextRun textRun(text());
- textRun.setDirection(textDirection);
BidiResolver<TextRunIterator, BidiCharacterRun> bidiResolver;
- bidiResolver.setStatus(BidiStatus(textRun.direction(), textRun.directionalOverride()));
+ 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;
@@ -951,11 +952,14 @@ void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Si
for (int i = 0; i < len; i++) {
UChar c = uncheckedCharacterAt(i);
- while (i > run->stop())
+ // 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->start() && i <= run->stop());
+ ASSERT(i <= run->stop());
TextDirection textDirection = run->direction();
bool previousCharacterIsSpace = isSpace;
« no previous file with comments | « LayoutTests/fast/text/international/rtl-space-in-ltr-element-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698