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; |