#ifndef BidiResolver_h
#define BidiResolver_h
+#include "platform/text/BidiCharacterRun.h"
#include "platform/text/BidiContext.h"
#include "platform/text/BidiRunList.h"
#include "platform/text/TextDirection.h"
return !(status1 == status2);
}
-struct BidiCharacterRun {
- BidiCharacterRun(int start, int stop, BidiContext* context, WTF::Unicode::Direction dir)
- : m_override(context->override())
- , m_next(0)
- , m_start(start)
- , m_stop(stop)
- {
- ASSERT(m_start <= m_stop);
- if (dir == WTF::Unicode::OtherNeutral)
- dir = context->dir();
-
- m_level = context->level();
-
- // add level of run (cases I1 & I2)
- if (m_level % 2) {
- if (dir == WTF::Unicode::LeftToRight || dir == WTF::Unicode::ArabicNumber || dir == WTF::Unicode::EuropeanNumber)
- m_level++;
- } else {
- if (dir == WTF::Unicode::RightToLeft)
- m_level++;
- else if (dir == WTF::Unicode::ArabicNumber || dir == WTF::Unicode::EuropeanNumber)
- m_level += 2;
- }
- }
-
- int start() const { return m_start; }
- int stop() const { return m_stop; }
- unsigned char level() const { return m_level; }
- bool reversed(bool visuallyOrdered) const { return m_level % 2 && !visuallyOrdered; }
- bool dirOverride(bool visuallyOrdered) { return m_override || visuallyOrdered; }
- TextDirection direction() const { return reversed(false) ? RTL : LTR; }
-
- BidiCharacterRun* next() const { return m_next; }
- void setNext(BidiCharacterRun* next) { m_next = next; }
-
- // Do not add anything apart from bitfields until after m_next. See https://bugs.webkit.org/show_bug.cgi?id=100173
- bool m_override : 1;
- bool m_hasHyphen : 1; // Used by BidiRun subclass which is a layering violation but enables us to save 8 bytes per object on 64-bit.
- bool m_startsSegment : 1; // Same comment as m_hasHyphen.
- unsigned char m_level;
- BidiCharacterRun* m_next;
- int m_start;
- int m_stop;
-};
-
enum VisualDirectionOverride {
NoVisualOverride,
VisualLeftToRightOverride,