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

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

Issue 23456046: Implement unicode bidi P2 and P3 rules in BidiResolver (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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 | « Source/core/platform/graphics/TextRunIterator.h ('k') | 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 dc5ee34fa25db4ab1b85bc6bc4e7e990f7e2f59f..435612ec3bee7ca6e563d3098f0f080128d7ceb6 100644
--- a/Source/core/platform/text/BidiResolver.h
+++ b/Source/core/platform/text/BidiResolver.h
@@ -223,6 +223,8 @@ public:
bool isEndOfParagraph(const Iterator& end) { return m_current == end || m_current.atEnd(); }
+ TextDirection determineParagraphDirectionality(bool* hasStrongDirectionality = 0);
+
protected:
void increment() { m_current.increment(); }
// FIXME: Instead of InlineBidiResolvers subclassing this method, we should
@@ -525,6 +527,36 @@ inline void BidiResolver<Iterator, Run>::reorderRunsFromLevels()
}
template <class Iterator, class Run>
+TextDirection BidiResolver<Iterator, Run>::determineParagraphDirectionality(bool* hasStrongDirectionality)
+{
+ while (!m_current.atEnd()) {
+ if (inIsolate()) {
+ increment();
+ continue;
+ }
+ if (m_current.atParagraphSeparator())
+ break;
+ if (UChar current = m_current.current()) {
+ WTF::Unicode::Direction charDirection = WTF::Unicode::direction(current);
+ if (charDirection == WTF::Unicode::LeftToRight) {
+ if (hasStrongDirectionality)
+ *hasStrongDirectionality = true;
+ return LTR;
+ }
+ if (charDirection == WTF::Unicode::RightToLeft || charDirection == WTF::Unicode::RightToLeftArabic) {
+ if (hasStrongDirectionality)
+ *hasStrongDirectionality = true;
+ return RTL;
+ }
+ }
+ increment();
+ }
+ if (hasStrongDirectionality)
+ *hasStrongDirectionality = false;
+ return LTR;
+}
+
+template <class Iterator, class Run>
void BidiResolver<Iterator, Run>::createBidiRunsForLine(const Iterator& end, VisualDirectionOverride override, bool hardLineBreak)
{
using namespace WTF::Unicode;
« no previous file with comments | « Source/core/platform/graphics/TextRunIterator.h ('k') | Source/core/rendering/InlineIterator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698