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

Side by Side Diff: Source/platform/text/BidiResolver.h

Issue 103823005: Isolated elements at end of line are not being correctly treated (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years 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 unified diff | Download patch
« no previous file with comments | « Source/core/rendering/InlineIterator.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2003, 2004, 2006, 2007, 2008 Apple Inc. All right reserved. 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008 Apple Inc. All right reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 227
228 Vector<Run*>& isolatedRuns() { return m_isolatedRuns; } 228 Vector<Run*>& isolatedRuns() { return m_isolatedRuns; }
229 229
230 bool isEndOfLine(const Iterator& end) { return m_current == end || m_current .atEnd(); } 230 bool isEndOfLine(const Iterator& end) { return m_current == end || m_current .atEnd(); }
231 231
232 TextDirection determineParagraphDirectionality(bool* hasStrongDirectionality = 0); 232 TextDirection determineParagraphDirectionality(bool* hasStrongDirectionality = 0);
233 233
234 void setMidpointStateForIsolatedRun(Run*, const MidpointState<Iterator>&); 234 void setMidpointStateForIsolatedRun(Run*, const MidpointState<Iterator>&);
235 MidpointState<Iterator> midpointStateForIsolatedRun(Run*); 235 MidpointState<Iterator> midpointStateForIsolatedRun(Run*);
236 236
237 Iterator endOfLine() const { return m_endOfLine; }
238
237 protected: 239 protected:
238 void increment() { m_current.increment(); } 240 void increment() { m_current.increment(); }
239 // FIXME: Instead of InlineBidiResolvers subclassing this method, we should 241 // FIXME: Instead of InlineBidiResolvers subclassing this method, we should
240 // pass in some sort of Traits object which knows how to create runs for app ending. 242 // pass in some sort of Traits object which knows how to create runs for app ending.
241 void appendRun(); 243 void appendRun();
242 244
243 Iterator m_current; 245 Iterator m_current;
244 // sor and eor are "start of run" and "end of run" respectively and correpon d 246 // sor and eor are "start of run" and "end of run" respectively and correpon d
245 // to abreviations used in UBA spec: http://unicode.org/reports/tr9/#BD7 247 // to abreviations used in UBA spec: http://unicode.org/reports/tr9/#BD7
246 Iterator m_sor; // Points to the first character in the current run. 248 Iterator m_sor; // Points to the first character in the current run.
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 return LTR; 583 return LTR;
582 } 584 }
583 585
584 template <class Iterator, class Run> 586 template <class Iterator, class Run>
585 void BidiResolver<Iterator, Run>::createBidiRunsForLine(const Iterator& end, Vis ualDirectionOverride override, bool hardLineBreak) 587 void BidiResolver<Iterator, Run>::createBidiRunsForLine(const Iterator& end, Vis ualDirectionOverride override, bool hardLineBreak)
586 { 588 {
587 using namespace WTF::Unicode; 589 using namespace WTF::Unicode;
588 590
589 ASSERT(m_direction == OtherNeutral); 591 ASSERT(m_direction == OtherNeutral);
590 592
593 m_endOfLine = end;
594
591 if (override != NoVisualOverride) { 595 if (override != NoVisualOverride) {
592 m_emptyRun = false; 596 m_emptyRun = false;
593 m_sor = m_current; 597 m_sor = m_current;
594 m_eor = Iterator(); 598 m_eor = Iterator();
595 while (m_current != end && !m_current.atEnd()) { 599 while (m_current != end && !m_current.atEnd()) {
596 m_eor = m_current; 600 m_eor = m_current;
597 increment(); 601 increment();
598 } 602 }
599 m_direction = override == VisualLeftToRightOverride ? LeftToRight : Righ tToLeft; 603 m_direction = override == VisualLeftToRightOverride ? LeftToRight : Righ tToLeft;
600 appendRun(); 604 appendRun();
601 m_runs.setLogicallyLastRun(m_runs.lastRun()); 605 m_runs.setLogicallyLastRun(m_runs.lastRun());
602 if (override == VisualRightToLeftOverride && m_runs.runCount()) 606 if (override == VisualRightToLeftOverride && m_runs.runCount())
603 m_runs.reverseRuns(0, m_runs.runCount() - 1); 607 m_runs.reverseRuns(0, m_runs.runCount() - 1);
604 return; 608 return;
605 } 609 }
606 610
607 m_emptyRun = true; 611 m_emptyRun = true;
608 612
609 m_eor = Iterator(); 613 m_eor = Iterator();
610 m_endOfLine = end;
611 614
612 m_last = m_current; 615 m_last = m_current;
613 bool lastLineEnded = false; 616 bool lastLineEnded = false;
614 BidiResolver<Iterator, Run> stateAtEnd; 617 BidiResolver<Iterator, Run> stateAtEnd;
615 618
616 while (true) { 619 while (true) {
617 if (inIsolate() && m_emptyRun) { 620 if (inIsolate() && m_emptyRun) {
618 m_sor = m_current; 621 m_sor = m_current;
619 m_emptyRun = false; 622 m_emptyRun = false;
620 } 623 }
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 template<class Iterator, class Run> 997 template<class Iterator, class Run>
995 MidpointState<Iterator> BidiResolver<Iterator, Run>::midpointStateForIsolatedRun (Run* run) 998 MidpointState<Iterator> BidiResolver<Iterator, Run>::midpointStateForIsolatedRun (Run* run)
996 { 999 {
997 return m_midpointStateForIsolatedRun.take(run); 1000 return m_midpointStateForIsolatedRun.take(run);
998 } 1001 }
999 1002
1000 1003
1001 } // namespace WebCore 1004 } // namespace WebCore
1002 1005
1003 #endif // BidiResolver_h 1006 #endif // BidiResolver_h
OLDNEW
« no previous file with comments | « Source/core/rendering/InlineIterator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698