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

Unified Diff: Source/core/platform/text/BidiResolver.h

Issue 24055009: Isolate elements are treated as neutral in UBA however Blink UBA implementation iterates over all t… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Proposed patch v3 Created 7 years, 3 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 | « no previous file | Source/core/rendering/InlineIterator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/platform/text/BidiResolver.h
diff --git a/Source/core/platform/text/BidiResolver.h b/Source/core/platform/text/BidiResolver.h
index 71802f9f2e34e67a9c125249a0f502ad78fa214f..dc5ee34fa25db4ab1b85bc6bc4e7e990f7e2f59f 100644
--- a/Source/core/platform/text/BidiResolver.h
+++ b/Source/core/platform/text/BidiResolver.h
@@ -178,6 +178,7 @@ public:
#endif
const Iterator& position() const { return m_current; }
+ Iterator& position() { return m_current; }
void setPositionIgnoringNestedIsolates(const Iterator& position) { m_current = position; }
void setPosition(const Iterator& position, unsigned nestedIsolatedCount)
{
@@ -185,8 +186,6 @@ public:
m_nestedIsolateCount = nestedIsolatedCount;
}
- void increment() { m_current.increment(); }
-
BidiContext* context() const { return m_status.context.get(); }
void setContext(PassRefPtr<BidiContext> c) { m_status.context = c; }
@@ -222,7 +221,10 @@ public:
Vector<Run*>& isolatedRuns() { return m_isolatedRuns; }
+ bool isEndOfParagraph(const Iterator& end) { return m_current == end || m_current.atEnd(); }
+
protected:
+ void increment() { m_current.increment(); }
// FIXME: Instead of InlineBidiResolvers subclassing this method, we should
// pass in some sort of Traits object which knows how to create runs for appending.
void appendRun();
@@ -550,12 +552,31 @@ void BidiResolver<Iterator, Run>::createBidiRunsForLine(const Iterator& end, Vis
m_eor = Iterator();
m_last = m_current;
- bool pastEnd = false;
+ bool lastParagraphEnded = false;
BidiResolver<Iterator, Run> stateAtEnd;
while (true) {
+ if (inIsolate() && m_emptyRun) {
+ m_sor = m_current;
+ m_emptyRun = false;
+ }
+
+ if (!lastParagraphEnded && isEndOfParagraph(end)) {
+ if (m_emptyRun)
+ break;
+
+ stateAtEnd.m_status = m_status;
+ stateAtEnd.m_sor = m_sor;
+ stateAtEnd.m_eor = m_eor;
+ stateAtEnd.m_last = m_last;
+ stateAtEnd.m_reachedEndOfLine = m_reachedEndOfLine;
+ stateAtEnd.m_lastBeforeET = m_lastBeforeET;
+ stateAtEnd.m_emptyRun = m_emptyRun;
+ endOfLine = m_last;
+ lastParagraphEnded = true;
+ }
Direction dirCurrent;
- if (pastEnd && (hardLineBreak || m_current.atEnd())) {
+ if (lastParagraphEnded && (hardLineBreak || m_current.atEnd())) {
BidiContext* c = context();
if (hardLineBreak) {
// A deviation from the Unicode Bidi Algorithm in order to match
@@ -842,7 +863,7 @@ void BidiResolver<Iterator, Run>::createBidiRunsForLine(const Iterator& end, Vis
break;
}
- if (pastEnd && m_eor == m_current) {
+ if (lastParagraphEnded && m_eor == m_current) {
if (!m_reachedEndOfLine) {
m_eor = endOfLine;
switch (m_status.eor) {
@@ -882,7 +903,7 @@ void BidiResolver<Iterator, Run>::createBidiRunsForLine(const Iterator& end, Vis
increment();
if (!m_currentExplicitEmbeddingSequence.isEmpty()) {
bool committed = commitExplicitEmbedding();
- if (committed && pastEnd) {
+ if (committed && lastParagraphEnded) {
m_current = end;
m_status = stateAtEnd.m_status;
m_sor = stateAtEnd.m_sor;
@@ -895,20 +916,6 @@ void BidiResolver<Iterator, Run>::createBidiRunsForLine(const Iterator& end, Vis
break;
}
}
-
- if (!pastEnd && (m_current == end || m_current.atEnd())) {
- if (m_emptyRun)
- break;
- stateAtEnd.m_status = m_status;
- stateAtEnd.m_sor = m_sor;
- stateAtEnd.m_eor = m_eor;
- stateAtEnd.m_last = m_last;
- stateAtEnd.m_reachedEndOfLine = m_reachedEndOfLine;
- stateAtEnd.m_lastBeforeET = m_lastBeforeET;
- stateAtEnd.m_emptyRun = m_emptyRun;
- endOfLine = m_last;
- pastEnd = true;
- }
}
m_runs.setLogicallyLastRun(m_runs.lastRun());
« no previous file with comments | « no previous file | Source/core/rendering/InlineIterator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698