зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1738057 - Split out BidiEmbeddingLevel into its own file; r=platform-i18n-reviewers,dminor
This should speed up re-compile times, as mozilla/intl/Bidi.h will only be included in a few places. Differential Revision: https://phabricator.services.mozilla.com/D129662
This commit is contained in:
Родитель
72b7841950
Коммит
ec908112f4
|
@ -9,7 +9,7 @@
|
|||
*/
|
||||
|
||||
#include "mozilla/dom/Selection.h"
|
||||
#include "mozilla/intl/Bidi.h"
|
||||
#include "mozilla/intl/BidiEmbeddingLevel.h"
|
||||
|
||||
#include "mozilla/AccessibleCaretEventHub.h"
|
||||
#include "mozilla/AsyncEventDispatcher.h"
|
||||
|
@ -386,8 +386,8 @@ Nullable<int16_t> Selection::GetCaretBidiLevel(
|
|||
aRv.Throw(NS_ERROR_NOT_INITIALIZED);
|
||||
return Nullable<int16_t>();
|
||||
}
|
||||
mozilla::intl::Bidi::EmbeddingLevel caretBidiLevel =
|
||||
static_cast<mozilla::intl::Bidi::EmbeddingLevel>(
|
||||
mozilla::intl::BidiEmbeddingLevel caretBidiLevel =
|
||||
static_cast<mozilla::intl::BidiEmbeddingLevel>(
|
||||
mFrameSelection->GetCaretBidiLevel());
|
||||
return (caretBidiLevel & BIDI_LEVEL_UNDEFINED)
|
||||
? Nullable<int16_t>()
|
||||
|
@ -406,7 +406,7 @@ void Selection::SetCaretBidiLevel(const Nullable<int16_t>& aCaretBidiLevel,
|
|||
mFrameSelection->UndefineCaretBidiLevel();
|
||||
} else {
|
||||
mFrameSelection->SetCaretBidiLevelAndMaybeSchedulePaint(
|
||||
mozilla::intl::Bidi::EmbeddingLevel(aCaretBidiLevel.Value()));
|
||||
mozilla::intl::BidiEmbeddingLevel(aCaretBidiLevel.Value()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1360,7 +1360,7 @@ nsIFrame* Selection::GetPrimaryOrCaretFrameForNodeOffset(nsIContent* aContent,
|
|||
CaretAssociationHint hint = mFrameSelection->GetHint();
|
||||
|
||||
if (aVisual) {
|
||||
mozilla::intl::Bidi::EmbeddingLevel caretBidiLevel =
|
||||
mozilla::intl::BidiEmbeddingLevel caretBidiLevel =
|
||||
mFrameSelection->GetCaretBidiLevel();
|
||||
|
||||
return nsCaret::GetCaretFrameForNodeOffset(
|
||||
|
@ -3302,10 +3302,10 @@ void Selection::Modify(const nsAString& aAlter, const nsAString& aDirection,
|
|||
// If the paragraph direction of the focused frame is right-to-left,
|
||||
// we may have to swap the direction of movement.
|
||||
if (nsIFrame* frame = GetPrimaryFrameForFocusNode(visual)) {
|
||||
mozilla::intl::Bidi::Direction paraDir =
|
||||
mozilla::intl::BidiDirection paraDir =
|
||||
nsBidiPresUtils::ParagraphDirection(frame);
|
||||
|
||||
if (paraDir == mozilla::intl::Bidi::Direction::RTL && visual) {
|
||||
if (paraDir == mozilla::intl::BidiDirection::RTL && visual) {
|
||||
if (amount == eSelectBeginLine) {
|
||||
amount = eSelectEndLine;
|
||||
forward = !forward;
|
||||
|
@ -3479,9 +3479,9 @@ nsresult Selection::SelectionLanguageChange(bool aLangRTL) {
|
|||
RefPtr<nsFrameSelection> frameSelection = mFrameSelection;
|
||||
|
||||
// if the direction of the language hasn't changed, nothing to do
|
||||
mozilla::intl::Bidi::EmbeddingLevel kbdBidiLevel =
|
||||
aLangRTL ? mozilla::intl::Bidi::EmbeddingLevel::RTL()
|
||||
: mozilla::intl::Bidi::EmbeddingLevel::LTR();
|
||||
mozilla::intl::BidiEmbeddingLevel kbdBidiLevel =
|
||||
aLangRTL ? mozilla::intl::BidiEmbeddingLevel::RTL()
|
||||
: mozilla::intl::BidiEmbeddingLevel::LTR();
|
||||
if (kbdBidiLevel == frameSelection->mKbdBidiLevel) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -3495,12 +3495,12 @@ nsresult Selection::SelectionLanguageChange(bool aLangRTL) {
|
|||
|
||||
auto [frameStart, frameEnd] = focusFrame->GetOffsets();
|
||||
RefPtr<nsPresContext> context = GetPresContext();
|
||||
mozilla::intl::Bidi::EmbeddingLevel levelBefore, levelAfter;
|
||||
mozilla::intl::BidiEmbeddingLevel levelBefore, levelAfter;
|
||||
if (!context) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mozilla::intl::Bidi::EmbeddingLevel level = focusFrame->GetEmbeddingLevel();
|
||||
mozilla::intl::BidiEmbeddingLevel level = focusFrame->GetEmbeddingLevel();
|
||||
int32_t focusOffset = static_cast<int32_t>(FocusOffset());
|
||||
if ((focusOffset != frameStart) && (focusOffset != frameEnd))
|
||||
// the cursor is not at a frame boundary, so the level of both the
|
||||
|
@ -3531,7 +3531,7 @@ nsresult Selection::SelectionLanguageChange(bool aLangRTL) {
|
|||
frameSelection->SetCaretBidiLevelAndMaybeSchedulePaint(level);
|
||||
} else {
|
||||
frameSelection->SetCaretBidiLevelAndMaybeSchedulePaint(
|
||||
mozilla::intl::Bidi::EmbeddingLevel(level + 1));
|
||||
mozilla::intl::BidiEmbeddingLevel(level + 1));
|
||||
}
|
||||
} else {
|
||||
// if cursor is between characters with opposite orientations, changing the
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
#include "mozilla/intl/Bidi.h"
|
||||
#include "mozilla/intl/BidiEmbeddingLevel.h"
|
||||
#include "mozilla/PresShell.h"
|
||||
#include "mozilla/PresShellInlines.h"
|
||||
#include "mozilla/SVGImageContext.h"
|
||||
|
@ -3523,11 +3523,11 @@ struct MOZ_STACK_CLASS CanvasBidiProcessor
|
|||
using ContextState = CanvasRenderingContext2D::ContextState;
|
||||
|
||||
virtual void SetText(const char16_t* aText, int32_t aLength,
|
||||
mozilla::intl::Bidi::Direction aDirection) override {
|
||||
mozilla::intl::BidiDirection aDirection) override {
|
||||
mFontgrp->UpdateUserFonts(); // ensure user font generation is current
|
||||
// adjust flags for current direction run
|
||||
gfx::ShapedTextFlags flags = mTextRunFlags;
|
||||
if (aDirection == mozilla::intl::Bidi::Direction::RTL) {
|
||||
if (aDirection == mozilla::intl::BidiDirection::RTL) {
|
||||
flags |= gfx::ShapedTextFlags::TEXT_IS_RTL;
|
||||
} else {
|
||||
flags &= ~gfx::ShapedTextFlags::TEXT_IS_RTL;
|
||||
|
@ -3894,8 +3894,8 @@ TextMetrics* CanvasRenderingContext2D::DrawOrMeasureText(
|
|||
// bounding boxes before rendering anything
|
||||
aError = nsBidiPresUtils::ProcessText(
|
||||
textToDraw.get(), textToDraw.Length(),
|
||||
isRTL ? mozilla::intl::Bidi::EmbeddingLevel::RTL()
|
||||
: mozilla::intl::Bidi::EmbeddingLevel::LTR(),
|
||||
isRTL ? mozilla::intl::BidiEmbeddingLevel::RTL()
|
||||
: mozilla::intl::BidiEmbeddingLevel::LTR(),
|
||||
presShell->GetPresContext(), processor, nsBidiPresUtils::MODE_MEASURE,
|
||||
nullptr, 0, &totalWidthCoord, &mBidiEngine);
|
||||
if (aError.Failed()) {
|
||||
|
@ -4037,8 +4037,8 @@ TextMetrics* CanvasRenderingContext2D::DrawOrMeasureText(
|
|||
|
||||
aError = nsBidiPresUtils::ProcessText(
|
||||
textToDraw.get(), textToDraw.Length(),
|
||||
isRTL ? mozilla::intl::Bidi::EmbeddingLevel::RTL()
|
||||
: mozilla::intl::Bidi::EmbeddingLevel::LTR(),
|
||||
isRTL ? mozilla::intl::BidiEmbeddingLevel::RTL()
|
||||
: mozilla::intl::BidiEmbeddingLevel::LTR(),
|
||||
presShell->GetPresContext(), processor, nsBidiPresUtils::MODE_DRAW,
|
||||
nullptr, 0, nullptr, &mBidiEngine);
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "JoinNodeTransaction.h" // for JoinNodeTransaction
|
||||
#include "PlaceholderTransaction.h" // for PlaceholderTransaction
|
||||
#include "SplitNodeTransaction.h" // for SplitNodeTransaction
|
||||
#include "mozilla/intl/Bidi.h"
|
||||
#include "mozilla/intl/BidiEmbeddingLevel.h"
|
||||
#include "mozilla/BasePrincipal.h" // for BasePrincipal
|
||||
#include "mozilla/CheckedInt.h" // for CheckedInt
|
||||
#include "mozilla/ComposerCommandsUpdater.h" // for ComposerCommandsUpdater
|
||||
|
@ -5763,13 +5763,13 @@ EditorBase::AutoCaretBidiLevelManager::AutoCaretBidiLevelManager(
|
|||
nsPrevNextBidiLevels levels = frameSelection->GetPrevNextBidiLevels(
|
||||
aPointAtCaret.GetContainerAsContent(), aPointAtCaret.Offset(), true);
|
||||
|
||||
mozilla::intl::Bidi::EmbeddingLevel levelBefore = levels.mLevelBefore;
|
||||
mozilla::intl::Bidi::EmbeddingLevel levelAfter = levels.mLevelAfter;
|
||||
mozilla::intl::BidiEmbeddingLevel levelBefore = levels.mLevelBefore;
|
||||
mozilla::intl::BidiEmbeddingLevel levelAfter = levels.mLevelAfter;
|
||||
|
||||
mozilla::intl::Bidi::EmbeddingLevel currentCaretLevel =
|
||||
mozilla::intl::BidiEmbeddingLevel currentCaretLevel =
|
||||
frameSelection->GetCaretBidiLevel();
|
||||
|
||||
mozilla::intl::Bidi::EmbeddingLevel levelOfDeletion;
|
||||
mozilla::intl::BidiEmbeddingLevel levelOfDeletion;
|
||||
levelOfDeletion = (nsIEditor::eNext == aDirectionAndAmount ||
|
||||
nsIEditor::eNextWord == aDirectionAndAmount)
|
||||
? levelAfter
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#ifndef mozilla_EditorBase_h
|
||||
#define mozilla_EditorBase_h
|
||||
|
||||
#include "mozilla/intl/Bidi.h"
|
||||
#include "mozilla/intl/BidiEmbeddingLevel.h"
|
||||
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc.
|
||||
#include "mozilla/EditAction.h" // for EditAction and EditSubAction
|
||||
#include "mozilla/EditorDOMPoint.h" // for EditorDOMPoint
|
||||
|
@ -1982,7 +1982,7 @@ class EditorBase : public nsIEditor,
|
|||
void MaybeUpdateCaretBidiLevel(const EditorBase& aEditorBase) const;
|
||||
|
||||
private:
|
||||
Maybe<mozilla::intl::Bidi::EmbeddingLevel> mNewCaretBidiLevel;
|
||||
Maybe<mozilla::intl::BidiEmbeddingLevel> mNewCaretBidiLevel;
|
||||
bool mFailed = false;
|
||||
bool mCanceled = false;
|
||||
};
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace mozilla::intl {
|
|||
|
||||
struct VisualRun {
|
||||
Span<const char16_t> string;
|
||||
Bidi::Direction direction;
|
||||
BidiDirection direction;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -19,7 +19,7 @@ struct VisualRun {
|
|||
class MOZ_STACK_CLASS VisualRunIter {
|
||||
public:
|
||||
VisualRunIter(Bidi& aBidi, Span<const char16_t> aParagraph,
|
||||
Bidi::EmbeddingLevel aLevel)
|
||||
BidiEmbeddingLevel aLevel)
|
||||
: mBidi(aBidi), mParagraph(aParagraph) {
|
||||
// Crash in case of errors by calling unwrap. If this were a real API, this
|
||||
// would be a TryCreate call.
|
||||
|
@ -35,7 +35,7 @@ class MOZ_STACK_CLASS VisualRunIter {
|
|||
int32_t stringIndex = -1;
|
||||
int32_t stringLength = -1;
|
||||
|
||||
Bidi::Direction direction =
|
||||
BidiDirection direction =
|
||||
mBidi.GetVisualRun(mRunIndex, &stringIndex, &stringLength);
|
||||
|
||||
Span<const char16_t> string(mParagraph.Elements() + stringIndex,
|
||||
|
@ -53,7 +53,7 @@ class MOZ_STACK_CLASS VisualRunIter {
|
|||
|
||||
struct LogicalRun {
|
||||
Span<const char16_t> string;
|
||||
Bidi::EmbeddingLevel embeddingLevel;
|
||||
BidiEmbeddingLevel embeddingLevel;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -63,7 +63,7 @@ struct LogicalRun {
|
|||
class MOZ_STACK_CLASS LogicalRunIter {
|
||||
public:
|
||||
LogicalRunIter(Bidi& aBidi, Span<const char16_t> aParagraph,
|
||||
Bidi::EmbeddingLevel aLevel)
|
||||
BidiEmbeddingLevel aLevel)
|
||||
: mBidi(aBidi), mParagraph(aParagraph) {
|
||||
// Crash in case of errors by calling unwrap. If this were a real API, this
|
||||
// would be a TryCreate call.
|
||||
|
@ -78,7 +78,7 @@ class MOZ_STACK_CLASS LogicalRunIter {
|
|||
|
||||
int32_t logicalLimit;
|
||||
|
||||
Bidi::EmbeddingLevel embeddingLevel;
|
||||
BidiEmbeddingLevel embeddingLevel;
|
||||
mBidi.GetLogicalRun(mRunIndex, &logicalLimit, &embeddingLevel);
|
||||
|
||||
Span<const char16_t> string(mParagraph.Elements() + mRunIndex,
|
||||
|
@ -98,7 +98,7 @@ TEST(IntlBidi, SimpleLTR)
|
|||
{
|
||||
Bidi bidi{};
|
||||
LogicalRunIter logicalRunIter(bidi, MakeStringSpan(u"this is a paragraph"),
|
||||
Bidi::EmbeddingLevel::DefaultLTR());
|
||||
BidiEmbeddingLevel::DefaultLTR());
|
||||
ASSERT_EQ(bidi.GetParagraphEmbeddingLevel(), 0);
|
||||
ASSERT_EQ(bidi.GetParagraphDirection(), Bidi::ParagraphDirection::LTR);
|
||||
|
||||
|
@ -107,7 +107,7 @@ TEST(IntlBidi, SimpleLTR)
|
|||
ASSERT_TRUE(logicalRun.isSome());
|
||||
ASSERT_EQ(logicalRun->string, MakeStringSpan(u"this is a paragraph"));
|
||||
ASSERT_EQ(logicalRun->embeddingLevel, 0);
|
||||
ASSERT_EQ(logicalRun->embeddingLevel.Direction(), Bidi::Direction::LTR);
|
||||
ASSERT_EQ(logicalRun->embeddingLevel.Direction(), BidiDirection::LTR);
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -120,7 +120,7 @@ TEST(IntlBidi, SimpleRTL)
|
|||
{
|
||||
Bidi bidi{};
|
||||
LogicalRunIter logicalRunIter(bidi, MakeStringSpan(u"فايرفوكس رائع"),
|
||||
Bidi::EmbeddingLevel::DefaultLTR());
|
||||
BidiEmbeddingLevel::DefaultLTR());
|
||||
ASSERT_EQ(bidi.GetParagraphEmbeddingLevel(), 1);
|
||||
ASSERT_EQ(bidi.GetParagraphDirection(), Bidi::ParagraphDirection::RTL);
|
||||
|
||||
|
@ -128,7 +128,7 @@ TEST(IntlBidi, SimpleRTL)
|
|||
auto logicalRun = logicalRunIter.Next();
|
||||
ASSERT_TRUE(logicalRun.isSome());
|
||||
ASSERT_EQ(logicalRun->string, MakeStringSpan(u"فايرفوكس رائع"));
|
||||
ASSERT_EQ(logicalRun->embeddingLevel.Direction(), Bidi::Direction::RTL);
|
||||
ASSERT_EQ(logicalRun->embeddingLevel.Direction(), BidiDirection::RTL);
|
||||
ASSERT_EQ(logicalRun->embeddingLevel, 1);
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ TEST(IntlBidi, MultiLevel)
|
|||
Bidi bidi{};
|
||||
LogicalRunIter logicalRunIter(
|
||||
bidi, MakeStringSpan(u"Firefox is awesome: رائع Firefox"),
|
||||
Bidi::EmbeddingLevel::DefaultLTR());
|
||||
BidiEmbeddingLevel::DefaultLTR());
|
||||
ASSERT_EQ(bidi.GetParagraphEmbeddingLevel(), 0);
|
||||
ASSERT_EQ(bidi.GetParagraphDirection(), Bidi::ParagraphDirection::Mixed);
|
||||
|
||||
|
@ -180,7 +180,7 @@ TEST(IntlBidi, RtlOverride)
|
|||
// levels can be computed.
|
||||
LogicalRunIter logicalRunIter(
|
||||
bidi, MakeStringSpan(u"ltr\u202b___رائع___\u202a___ltr__"),
|
||||
Bidi::EmbeddingLevel::DefaultLTR());
|
||||
BidiEmbeddingLevel::DefaultLTR());
|
||||
ASSERT_EQ(bidi.GetParagraphEmbeddingLevel(), 0);
|
||||
ASSERT_EQ(bidi.GetParagraphDirection(), Bidi::ParagraphDirection::Mixed);
|
||||
|
||||
|
@ -189,21 +189,21 @@ TEST(IntlBidi, RtlOverride)
|
|||
ASSERT_TRUE(logicalRun.isSome());
|
||||
ASSERT_EQ(logicalRun->string, MakeStringSpan(u"ltr"));
|
||||
ASSERT_EQ(logicalRun->embeddingLevel, 0);
|
||||
ASSERT_EQ(logicalRun->embeddingLevel.Direction(), Bidi::Direction::LTR);
|
||||
ASSERT_EQ(logicalRun->embeddingLevel.Direction(), BidiDirection::LTR);
|
||||
}
|
||||
{
|
||||
auto logicalRun = logicalRunIter.Next();
|
||||
ASSERT_TRUE(logicalRun.isSome());
|
||||
ASSERT_EQ(logicalRun->string, MakeStringSpan(u"\u202b___رائع___"));
|
||||
ASSERT_EQ(logicalRun->embeddingLevel, 1);
|
||||
ASSERT_EQ(logicalRun->embeddingLevel.Direction(), Bidi::Direction::RTL);
|
||||
ASSERT_EQ(logicalRun->embeddingLevel.Direction(), BidiDirection::RTL);
|
||||
}
|
||||
{
|
||||
auto logicalRun = logicalRunIter.Next();
|
||||
ASSERT_TRUE(logicalRun.isSome());
|
||||
ASSERT_EQ(logicalRun->string, MakeStringSpan(u"\u202a___ltr__"));
|
||||
ASSERT_EQ(logicalRun->embeddingLevel, 2);
|
||||
ASSERT_EQ(logicalRun->embeddingLevel.Direction(), Bidi::Direction::LTR);
|
||||
ASSERT_EQ(logicalRun->embeddingLevel.Direction(), BidiDirection::LTR);
|
||||
}
|
||||
{
|
||||
auto logicalRun = logicalRunIter.Next();
|
||||
|
@ -219,24 +219,24 @@ TEST(IntlBidi, VisualRuns)
|
|||
bidi,
|
||||
MakeStringSpan(
|
||||
u"first visual run التشغيل البصري الثاني third visual run"),
|
||||
Bidi::EmbeddingLevel::DefaultLTR());
|
||||
BidiEmbeddingLevel::DefaultLTR());
|
||||
{
|
||||
Maybe<VisualRun> run = visualRunIter.Next();
|
||||
ASSERT_TRUE(run.isSome());
|
||||
ASSERT_EQ(run->string, MakeStringSpan(u"first visual run "));
|
||||
ASSERT_EQ(run->direction, Bidi::Direction::LTR);
|
||||
ASSERT_EQ(run->direction, BidiDirection::LTR);
|
||||
}
|
||||
{
|
||||
Maybe<VisualRun> run = visualRunIter.Next();
|
||||
ASSERT_TRUE(run.isSome());
|
||||
ASSERT_EQ(run->string, MakeStringSpan(u"التشغيل البصري الثاني"));
|
||||
ASSERT_EQ(run->direction, Bidi::Direction::RTL);
|
||||
ASSERT_EQ(run->direction, BidiDirection::RTL);
|
||||
}
|
||||
{
|
||||
Maybe<VisualRun> run = visualRunIter.Next();
|
||||
ASSERT_TRUE(run.isSome());
|
||||
ASSERT_EQ(run->string, MakeStringSpan(u" third visual run"));
|
||||
ASSERT_EQ(run->direction, Bidi::Direction::LTR);
|
||||
ASSERT_EQ(run->direction, BidiDirection::LTR);
|
||||
}
|
||||
{
|
||||
Maybe<VisualRun> run = visualRunIter.Next();
|
||||
|
@ -250,24 +250,24 @@ TEST(IntlBidi, VisualRunsWithEmbeds)
|
|||
Bidi bidi{};
|
||||
VisualRunIter visualRunIter(
|
||||
bidi, MakeStringSpan(u"ltr\u202b___رائع___\u202a___ltr___"),
|
||||
Bidi::EmbeddingLevel::DefaultLTR());
|
||||
BidiEmbeddingLevel::DefaultLTR());
|
||||
{
|
||||
Maybe<VisualRun> run = visualRunIter.Next();
|
||||
ASSERT_TRUE(run.isSome());
|
||||
ASSERT_EQ(run->string, MakeStringSpan(u"ltr"));
|
||||
ASSERT_EQ(run->direction, Bidi::Direction::LTR);
|
||||
ASSERT_EQ(run->direction, BidiDirection::LTR);
|
||||
}
|
||||
{
|
||||
Maybe<VisualRun> run = visualRunIter.Next();
|
||||
ASSERT_TRUE(run.isSome());
|
||||
ASSERT_EQ(run->string, MakeStringSpan(u"\u202a___ltr___"));
|
||||
ASSERT_EQ(run->direction, Bidi::Direction::LTR);
|
||||
ASSERT_EQ(run->direction, BidiDirection::LTR);
|
||||
}
|
||||
{
|
||||
Maybe<VisualRun> run = visualRunIter.Next();
|
||||
ASSERT_TRUE(run.isSome());
|
||||
ASSERT_EQ(run->string, MakeStringSpan(u"\u202b___رائع___"));
|
||||
ASSERT_EQ(run->direction, Bidi::Direction::RTL);
|
||||
ASSERT_EQ(run->direction, BidiDirection::RTL);
|
||||
}
|
||||
{
|
||||
Maybe<VisualRun> run = visualRunIter.Next();
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
EXPORTS.mozilla.intl = [
|
||||
"src/Bidi.h",
|
||||
"src/BidiEmbeddingLevel.h",
|
||||
"src/Calendar.h",
|
||||
"src/Collator.h",
|
||||
"src/Currency.h",
|
||||
|
@ -31,6 +32,7 @@ EXPORTS.mozilla.intl = [
|
|||
|
||||
UNIFIED_SOURCES += [
|
||||
"src/Bidi.cpp",
|
||||
"src/BidiEmbeddingLevel.cpp",
|
||||
"src/Calendar.cpp",
|
||||
"src/Collator.cpp",
|
||||
"src/Currency.cpp",
|
||||
|
|
|
@ -14,7 +14,7 @@ Bidi::Bidi() { mBidi = ubidi_open(); }
|
|||
Bidi::~Bidi() { ubidi_close(mBidi.GetMut()); }
|
||||
|
||||
ICUResult Bidi::SetParagraph(Span<const char16_t> aParagraph,
|
||||
Bidi::EmbeddingLevel aLevel) {
|
||||
BidiEmbeddingLevel aLevel) {
|
||||
// Do not allow any reordering of the runs, as this can change the
|
||||
// performance characteristics of working with runs. In the default mode,
|
||||
// the levels can be iterated over directly, rather than relying on computing
|
||||
|
@ -54,23 +54,23 @@ Bidi::ParagraphDirection Bidi::GetParagraphDirection() const {
|
|||
}
|
||||
|
||||
/* static */
|
||||
void Bidi::ReorderVisual(const EmbeddingLevel* aLevels, int32_t aLength,
|
||||
void Bidi::ReorderVisual(const BidiEmbeddingLevel* aLevels, int32_t aLength,
|
||||
int32_t* aIndexMap) {
|
||||
ubidi_reorderVisual(reinterpret_cast<const uint8_t*>(aLevels), aLength,
|
||||
aIndexMap);
|
||||
}
|
||||
|
||||
static Bidi::Direction ToBidiDirection(UBiDiDirection aDirection) {
|
||||
static BidiDirection ToBidiDirection(UBiDiDirection aDirection) {
|
||||
switch (aDirection) {
|
||||
case UBIDI_LTR:
|
||||
return Bidi::Direction::LTR;
|
||||
return BidiDirection::LTR;
|
||||
case UBIDI_RTL:
|
||||
return Bidi::Direction::RTL;
|
||||
return BidiDirection::RTL;
|
||||
case UBIDI_MIXED:
|
||||
case UBIDI_NEUTRAL:
|
||||
MOZ_ASSERT_UNREACHABLE("Unexpected UBiDiDirection value.");
|
||||
}
|
||||
return Bidi::Direction::LTR;
|
||||
return BidiDirection::LTR;
|
||||
}
|
||||
|
||||
Result<int32_t, ICUError> Bidi::CountRuns() {
|
||||
|
@ -81,7 +81,7 @@ Result<int32_t, ICUError> Bidi::CountRuns() {
|
|||
}
|
||||
|
||||
mLength = ubidi_getProcessedLength(mBidi.GetConst());
|
||||
mLevels = mLength > 0 ? reinterpret_cast<const Bidi::EmbeddingLevel*>(
|
||||
mLevels = mLength > 0 ? reinterpret_cast<const BidiEmbeddingLevel*>(
|
||||
ubidi_getLevels(mBidi.GetMut(), &status))
|
||||
: nullptr;
|
||||
if (U_FAILURE(status)) {
|
||||
|
@ -92,10 +92,10 @@ Result<int32_t, ICUError> Bidi::CountRuns() {
|
|||
}
|
||||
|
||||
void Bidi::GetLogicalRun(int32_t aLogicalStart, int32_t* aLogicalLimitOut,
|
||||
Bidi::EmbeddingLevel* aLevelOut) {
|
||||
BidiEmbeddingLevel* aLevelOut) {
|
||||
MOZ_ASSERT(mLevels, "CountRuns hasn't been run?");
|
||||
MOZ_RELEASE_ASSERT(aLogicalStart < mLength, "Out of bound");
|
||||
EmbeddingLevel level = mLevels[aLogicalStart];
|
||||
BidiEmbeddingLevel level = mLevels[aLogicalStart];
|
||||
int32_t limit;
|
||||
for (limit = aLogicalStart + 1; limit < mLength; limit++) {
|
||||
if (mLevels[limit] != level) {
|
||||
|
@ -106,56 +106,12 @@ void Bidi::GetLogicalRun(int32_t aLogicalStart, int32_t* aLogicalLimitOut,
|
|||
*aLevelOut = level;
|
||||
}
|
||||
|
||||
bool Bidi::EmbeddingLevel::IsDefaultLTR() const {
|
||||
return mValue == UBIDI_DEFAULT_LTR;
|
||||
};
|
||||
|
||||
bool Bidi::EmbeddingLevel::IsDefaultRTL() const {
|
||||
return mValue == UBIDI_DEFAULT_RTL;
|
||||
};
|
||||
|
||||
bool Bidi::EmbeddingLevel::IsRTL() const {
|
||||
// If the least significant bit is 1, then the embedding level
|
||||
// is right-to-left.
|
||||
// If the least significant bit is 0, then the embedding level
|
||||
// is left-to-right.
|
||||
return (mValue & 0x1) == 1;
|
||||
};
|
||||
|
||||
bool Bidi::EmbeddingLevel::IsLTR() const { return !IsRTL(); };
|
||||
|
||||
bool Bidi::EmbeddingLevel::IsSameDirection(EmbeddingLevel aOther) const {
|
||||
return (((mValue ^ aOther) & 1) == 0);
|
||||
BidiEmbeddingLevel Bidi::GetParagraphEmbeddingLevel() const {
|
||||
return BidiEmbeddingLevel(ubidi_getParaLevel(mBidi.GetConst()));
|
||||
}
|
||||
|
||||
Bidi::EmbeddingLevel Bidi::EmbeddingLevel::LTR() {
|
||||
return Bidi::EmbeddingLevel(0);
|
||||
};
|
||||
|
||||
Bidi::EmbeddingLevel Bidi::EmbeddingLevel::RTL() {
|
||||
return Bidi::EmbeddingLevel(1);
|
||||
};
|
||||
|
||||
Bidi::EmbeddingLevel Bidi::EmbeddingLevel::DefaultLTR() {
|
||||
return Bidi::EmbeddingLevel(UBIDI_DEFAULT_LTR);
|
||||
};
|
||||
|
||||
Bidi::EmbeddingLevel Bidi::EmbeddingLevel::DefaultRTL() {
|
||||
return Bidi::EmbeddingLevel(UBIDI_DEFAULT_RTL);
|
||||
};
|
||||
|
||||
Bidi::Direction Bidi::EmbeddingLevel::Direction() {
|
||||
return IsRTL() ? Direction::RTL : Direction::LTR;
|
||||
};
|
||||
|
||||
uint8_t Bidi::EmbeddingLevel::Value() const { return mValue; }
|
||||
|
||||
Bidi::EmbeddingLevel Bidi::GetParagraphEmbeddingLevel() const {
|
||||
return Bidi::EmbeddingLevel(ubidi_getParaLevel(mBidi.GetConst()));
|
||||
}
|
||||
|
||||
Bidi::Direction Bidi::GetVisualRun(int32_t aRunIndex, int32_t* aLogicalStart,
|
||||
int32_t* aLength) {
|
||||
BidiDirection Bidi::GetVisualRun(int32_t aRunIndex, int32_t* aLogicalStart,
|
||||
int32_t* aLength) {
|
||||
return ToBidiDirection(
|
||||
ubidi_getVisualRun(mBidi.GetMut(), aRunIndex, aLogicalStart, aLength));
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#ifndef intl_components_Bidi_h_
|
||||
#define intl_components_Bidi_h_
|
||||
|
||||
#include "mozilla/intl/BidiEmbeddingLevel.h"
|
||||
#include "mozilla/intl/ICU4CGlue.h"
|
||||
|
||||
struct UBiDi;
|
||||
|
@ -30,17 +31,6 @@ class Bidi final {
|
|||
Bidi(const Bidi&) = delete;
|
||||
Bidi& operator=(const Bidi&) = delete;
|
||||
|
||||
/**
|
||||
* This enum unambiguously classifies text runs as either being left to right,
|
||||
* or right to left.
|
||||
*/
|
||||
enum class Direction : uint8_t {
|
||||
// Left to right text.
|
||||
LTR = 0,
|
||||
// Right to left text.
|
||||
RTL = 1,
|
||||
};
|
||||
|
||||
/**
|
||||
* This enum indicates the text direction for the set paragraph. Some
|
||||
* paragraphs are unidirectional, where they only have one direction, or a
|
||||
|
@ -49,91 +39,6 @@ class Bidi final {
|
|||
*/
|
||||
enum ParagraphDirection { LTR, RTL, Mixed };
|
||||
|
||||
/**
|
||||
* Embedding levels are numbers that indicate how deeply the bidi text is
|
||||
* embedded, and the direction of text on that embedding level. When switching
|
||||
* between strongly LTR code points and strongly RTL code points the embedding
|
||||
* level normally switches between an embedding level of 0 (LTR) and 1 (RTL).
|
||||
* The only time the embedding level increases is if the embedding code points
|
||||
* are used. This is the Left-to-Right Embedding (LRE) code point (U+202A), or
|
||||
* the Right-to-Left Embedding (RLE) code point (U+202B). The minimum
|
||||
* embedding level of text is zero, and the maximum explicit depth is 125.
|
||||
*
|
||||
* The most significant bit is reserved for additional meaning. It can be used
|
||||
* to signify in certain APIs that the text should by default be LTR or RTL if
|
||||
* no strongly directional code points are found.
|
||||
*
|
||||
* Bug 1736595: At the time of this writing, some places in Gecko code use a 1
|
||||
* in the most significant bit to indicate that an embedding level has not
|
||||
* been set. This leads to an ambiguous understanding of what the most
|
||||
* significant bit actually means.
|
||||
*/
|
||||
class EmbeddingLevel {
|
||||
public:
|
||||
explicit EmbeddingLevel(uint8_t aValue) : mValue(aValue) {}
|
||||
explicit EmbeddingLevel(int aValue)
|
||||
: mValue(static_cast<uint8_t>(aValue)) {}
|
||||
|
||||
EmbeddingLevel() = default;
|
||||
|
||||
// Enable the copy operators, but disable move as this is only a uint8_t.
|
||||
EmbeddingLevel(const EmbeddingLevel& other) = default;
|
||||
EmbeddingLevel& operator=(const EmbeddingLevel& other) = default;
|
||||
|
||||
/**
|
||||
* Determine the direction of the embedding level by looking at the least
|
||||
* significant bit. If it is 0, then it is LTR. If it is 1, then it is RTL.
|
||||
*/
|
||||
Bidi::Direction Direction();
|
||||
|
||||
/**
|
||||
* Create a left-to-right embedding level.
|
||||
*/
|
||||
static EmbeddingLevel LTR();
|
||||
|
||||
/**
|
||||
* Create an right-to-left embedding level.
|
||||
*/
|
||||
static EmbeddingLevel RTL();
|
||||
|
||||
/**
|
||||
* When passed into `SetParagraph`, the direction is determined by first
|
||||
* strongly directional character, with the default set to left-to-right if
|
||||
* none is found.
|
||||
*
|
||||
* This is encoded with the highest bit set to 1.
|
||||
*/
|
||||
static EmbeddingLevel DefaultLTR();
|
||||
|
||||
/**
|
||||
* When passed into `SetParagraph`, the direction is determined by first
|
||||
* strongly directional character, with the default set to right-to-left if
|
||||
* none is found.
|
||||
*
|
||||
* * This is encoded with the highest and lowest bits set to 1.
|
||||
*/
|
||||
static EmbeddingLevel DefaultRTL();
|
||||
|
||||
bool IsDefaultLTR() const;
|
||||
bool IsDefaultRTL() const;
|
||||
bool IsLTR() const;
|
||||
bool IsRTL() const;
|
||||
bool IsSameDirection(EmbeddingLevel aOther) const;
|
||||
|
||||
/**
|
||||
* Get the underlying value as a uint8_t.
|
||||
*/
|
||||
uint8_t Value() const;
|
||||
|
||||
/**
|
||||
* Implicitly convert to the underlying value.
|
||||
*/
|
||||
operator uint8_t() const { return mValue; }
|
||||
|
||||
private:
|
||||
uint8_t mValue = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the current paragraph of text to analyze for its bidi properties. This
|
||||
* performs the Unicode bidi algorithm as specified by:
|
||||
|
@ -143,12 +48,12 @@ class Bidi final {
|
|||
* the directionality of the paragraph text.
|
||||
*/
|
||||
ICUResult SetParagraph(Span<const char16_t> aParagraph,
|
||||
EmbeddingLevel aLevel);
|
||||
BidiEmbeddingLevel aLevel);
|
||||
|
||||
/**
|
||||
* Get the embedding level for the paragraph that was set by SetParagraph.
|
||||
*/
|
||||
EmbeddingLevel GetParagraphEmbeddingLevel() const;
|
||||
BidiEmbeddingLevel GetParagraphEmbeddingLevel() const;
|
||||
|
||||
/**
|
||||
* Get the directionality of the paragraph text that was set by SetParagraph.
|
||||
|
@ -178,7 +83,7 @@ class Bidi final {
|
|||
* the run
|
||||
*/
|
||||
void GetLogicalRun(int32_t aLogicalStart, int32_t* aLogicalLimitOut,
|
||||
EmbeddingLevel* aLevelOut);
|
||||
BidiEmbeddingLevel* aLevelOut);
|
||||
|
||||
/**
|
||||
* This is a convenience function that does not use the ICU Bidi object.
|
||||
|
@ -198,7 +103,7 @@ class Bidi final {
|
|||
* The index map will result in
|
||||
* `aIndexMap[aVisualIndex]==aLogicalIndex`.
|
||||
*/
|
||||
static void ReorderVisual(const EmbeddingLevel* aLevels, int32_t aLength,
|
||||
static void ReorderVisual(const BidiEmbeddingLevel* aLevels, int32_t aLength,
|
||||
int32_t* aIndexMap);
|
||||
|
||||
/**
|
||||
|
@ -219,8 +124,8 @@ class Bidi final {
|
|||
* Note that in right-to-left runs, the code places modifier letters before
|
||||
* base characters and second surrogates before first ones.
|
||||
*/
|
||||
Direction GetVisualRun(int32_t aRunIndex, int32_t* aLogicalStart,
|
||||
int32_t* aLength);
|
||||
BidiDirection GetVisualRun(int32_t aRunIndex, int32_t* aLogicalStart,
|
||||
int32_t* aLength);
|
||||
|
||||
private:
|
||||
ICUPointer<UBiDi> mBidi = ICUPointer<UBiDi>(nullptr);
|
||||
|
@ -229,7 +134,7 @@ class Bidi final {
|
|||
* An array of levels that is the same length as the paragraph from
|
||||
* `Bidi::SetParagraph`.
|
||||
*/
|
||||
const EmbeddingLevel* mLevels = nullptr;
|
||||
const BidiEmbeddingLevel* mLevels = nullptr;
|
||||
|
||||
/**
|
||||
* The length of the paragraph from `Bidi::SetParagraph`.
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/intl/BidiEmbeddingLevel.h"
|
||||
#include "mozilla/Casting.h"
|
||||
#include "mozilla/intl/ICU4CGlue.h"
|
||||
|
||||
#include "unicode/ubidi.h"
|
||||
|
||||
namespace mozilla::intl {
|
||||
|
||||
bool BidiEmbeddingLevel::IsDefaultLTR() const {
|
||||
return mValue == UBIDI_DEFAULT_LTR;
|
||||
};
|
||||
|
||||
bool BidiEmbeddingLevel::IsDefaultRTL() const {
|
||||
return mValue == UBIDI_DEFAULT_RTL;
|
||||
};
|
||||
|
||||
bool BidiEmbeddingLevel::IsRTL() const {
|
||||
// If the least significant bit is 1, then the embedding level
|
||||
// is right-to-left.
|
||||
// If the least significant bit is 0, then the embedding level
|
||||
// is left-to-right.
|
||||
return (mValue & 0x1) == 1;
|
||||
};
|
||||
|
||||
bool BidiEmbeddingLevel::IsLTR() const { return !IsRTL(); };
|
||||
|
||||
bool BidiEmbeddingLevel::IsSameDirection(BidiEmbeddingLevel aOther) const {
|
||||
return (((mValue ^ aOther) & 1) == 0);
|
||||
}
|
||||
|
||||
BidiEmbeddingLevel BidiEmbeddingLevel::LTR() { return BidiEmbeddingLevel(0); };
|
||||
|
||||
BidiEmbeddingLevel BidiEmbeddingLevel::RTL() { return BidiEmbeddingLevel(1); };
|
||||
|
||||
BidiEmbeddingLevel BidiEmbeddingLevel::DefaultLTR() {
|
||||
return BidiEmbeddingLevel(UBIDI_DEFAULT_LTR);
|
||||
};
|
||||
|
||||
BidiEmbeddingLevel BidiEmbeddingLevel::DefaultRTL() {
|
||||
return BidiEmbeddingLevel(UBIDI_DEFAULT_RTL);
|
||||
};
|
||||
|
||||
BidiDirection BidiEmbeddingLevel::Direction() {
|
||||
return IsRTL() ? BidiDirection::RTL : BidiDirection::LTR;
|
||||
};
|
||||
|
||||
uint8_t BidiEmbeddingLevel::Value() const { return mValue; }
|
||||
|
||||
} // namespace mozilla::intl
|
|
@ -0,0 +1,113 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#ifndef intl_components_BidiEmbeddingLevel_h_
|
||||
#define intl_components_BidiEmbeddingLevel_h_
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
/**
|
||||
* This file has the BidiEmbeddingLevel and BidiDirection enum broken out from
|
||||
* the main Bidi class for faster includes. This code is used in Layout which
|
||||
* could trigger long build times when changing core mozilla::intl files.
|
||||
*/
|
||||
namespace mozilla::intl {
|
||||
|
||||
/**
|
||||
* This enum unambiguously classifies text runs as either being left to right,
|
||||
* or right to left.
|
||||
*/
|
||||
enum class BidiDirection : uint8_t {
|
||||
// Left to right text.
|
||||
LTR = 0,
|
||||
// Right to left text.
|
||||
RTL = 1,
|
||||
};
|
||||
|
||||
/**
|
||||
* Embedding levels are numbers that indicate how deeply the bidi text is
|
||||
* embedded, and the direction of text on that embedding level. When switching
|
||||
* between strongly LTR code points and strongly RTL code points the embedding
|
||||
* level normally switches between an embedding level of 0 (LTR) and 1 (RTL).
|
||||
* The only time the embedding level increases is if the embedding code points
|
||||
* are used. This is the Left-to-Right Embedding (LRE) code point (U+202A), or
|
||||
* the Right-to-Left Embedding (RLE) code point (U+202B). The minimum
|
||||
* embedding level of text is zero, and the maximum explicit depth is 125.
|
||||
*
|
||||
* The most significant bit is reserved for additional meaning. It can be used
|
||||
* to signify in certain APIs that the text should by default be LTR or RTL if
|
||||
* no strongly directional code points are found.
|
||||
*
|
||||
* Bug 1736595: At the time of this writing, some places in Gecko code use a 1
|
||||
* in the most significant bit to indicate that an embedding level has not
|
||||
* been set. This leads to an ambiguous understanding of what the most
|
||||
* significant bit actually means.
|
||||
*/
|
||||
class BidiEmbeddingLevel {
|
||||
public:
|
||||
explicit BidiEmbeddingLevel(uint8_t aValue) : mValue(aValue) {}
|
||||
explicit BidiEmbeddingLevel(int aValue)
|
||||
: mValue(static_cast<uint8_t>(aValue)) {}
|
||||
|
||||
BidiEmbeddingLevel() = default;
|
||||
|
||||
// Enable the copy operators, but disable move as this is only a uint8_t.
|
||||
BidiEmbeddingLevel(const BidiEmbeddingLevel& other) = default;
|
||||
BidiEmbeddingLevel& operator=(const BidiEmbeddingLevel& other) = default;
|
||||
|
||||
/**
|
||||
* Determine the direction of the embedding level by looking at the least
|
||||
* significant bit. If it is 0, then it is LTR. If it is 1, then it is RTL.
|
||||
*/
|
||||
BidiDirection Direction();
|
||||
|
||||
/**
|
||||
* Create a left-to-right embedding level.
|
||||
*/
|
||||
static BidiEmbeddingLevel LTR();
|
||||
|
||||
/**
|
||||
* Create an right-to-left embedding level.
|
||||
*/
|
||||
static BidiEmbeddingLevel RTL();
|
||||
|
||||
/**
|
||||
* When passed into `SetParagraph`, the direction is determined by first
|
||||
* strongly directional character, with the default set to left-to-right if
|
||||
* none is found.
|
||||
*
|
||||
* This is encoded with the highest bit set to 1.
|
||||
*/
|
||||
static BidiEmbeddingLevel DefaultLTR();
|
||||
|
||||
/**
|
||||
* When passed into `SetParagraph`, the direction is determined by first
|
||||
* strongly directional character, with the default set to right-to-left if
|
||||
* none is found.
|
||||
*
|
||||
* * This is encoded with the highest and lowest bits set to 1.
|
||||
*/
|
||||
static BidiEmbeddingLevel DefaultRTL();
|
||||
|
||||
bool IsDefaultLTR() const;
|
||||
bool IsDefaultRTL() const;
|
||||
bool IsLTR() const;
|
||||
bool IsRTL() const;
|
||||
bool IsSameDirection(BidiEmbeddingLevel aOther) const;
|
||||
|
||||
/**
|
||||
* Get the underlying value as a uint8_t.
|
||||
*/
|
||||
uint8_t Value() const;
|
||||
|
||||
/**
|
||||
* Implicitly convert to the underlying value.
|
||||
*/
|
||||
operator uint8_t() const { return mValue; }
|
||||
|
||||
private:
|
||||
uint8_t mValue = 0;
|
||||
};
|
||||
|
||||
} // namespace mozilla::intl
|
||||
#endif
|
|
@ -41,7 +41,7 @@
|
|||
#undef REALLY_NOISY_BIDI
|
||||
|
||||
using namespace mozilla;
|
||||
using EmbeddingLevel = mozilla::intl::Bidi::EmbeddingLevel;
|
||||
using BidiEmbeddingLevel = mozilla::intl::BidiEmbeddingLevel;
|
||||
|
||||
static const char16_t kSpace = 0x0020;
|
||||
static const char16_t kZWSP = 0x200B;
|
||||
|
@ -166,7 +166,7 @@ struct MOZ_STACK_CLASS BidiParagraphData {
|
|||
nsPresContext* mPresContext;
|
||||
bool mIsVisual;
|
||||
bool mRequiresBidi;
|
||||
EmbeddingLevel mParaLevel;
|
||||
BidiEmbeddingLevel mParaLevel;
|
||||
nsIContent* mPrevContent;
|
||||
|
||||
/**
|
||||
|
@ -347,16 +347,16 @@ struct MOZ_STACK_CLASS BidiParagraphData {
|
|||
}
|
||||
|
||||
/**
|
||||
* mParaLevel can be intl::Bidi::Direction::LTR as well as
|
||||
* intl::Bidi::Direction::LTR or intl::Bidi::Direction::RTL.
|
||||
* mParaLevel can be intl::BidiDirection::LTR as well as
|
||||
* intl::BidiDirection::LTR or intl::BidiDirection::RTL.
|
||||
* GetParagraphEmbeddingLevel() returns the actual (resolved) paragraph level
|
||||
* which is always either intl::Bidi::Direction::LTR or
|
||||
* intl::Bidi::Direction::RTL
|
||||
* which is always either intl::BidiDirection::LTR or
|
||||
* intl::BidiDirection::RTL
|
||||
*/
|
||||
EmbeddingLevel GetParagraphEmbeddingLevel() {
|
||||
EmbeddingLevel paraLevel = mParaLevel;
|
||||
if (paraLevel == EmbeddingLevel::DefaultLTR() ||
|
||||
paraLevel == EmbeddingLevel::DefaultRTL()) {
|
||||
BidiEmbeddingLevel GetParagraphEmbeddingLevel() {
|
||||
BidiEmbeddingLevel paraLevel = mParaLevel;
|
||||
if (paraLevel == BidiEmbeddingLevel::DefaultLTR() ||
|
||||
paraLevel == BidiEmbeddingLevel::DefaultRTL()) {
|
||||
paraLevel = mPresContext->GetBidiEngine().GetParagraphEmbeddingLevel();
|
||||
}
|
||||
return paraLevel;
|
||||
|
@ -376,7 +376,7 @@ struct MOZ_STACK_CLASS BidiParagraphData {
|
|||
}
|
||||
|
||||
void GetLogicalRun(int32_t aLogicalStart, int32_t* aLogicalLimit,
|
||||
EmbeddingLevel* aLevel) {
|
||||
BidiEmbeddingLevel* aLevel) {
|
||||
mPresContext->GetBidiEngine().GetLogicalRun(aLogicalStart, aLogicalLimit,
|
||||
aLevel);
|
||||
if (mIsVisual) {
|
||||
|
@ -480,7 +480,7 @@ struct MOZ_STACK_CLASS BidiLineData {
|
|||
AutoTArray<nsIFrame*, 16> mLogicalFrames;
|
||||
AutoTArray<nsIFrame*, 16> mVisualFrames;
|
||||
AutoTArray<int32_t, 16> mIndexMap;
|
||||
AutoTArray<EmbeddingLevel, 16> mLevels;
|
||||
AutoTArray<BidiEmbeddingLevel, 16> mLevels;
|
||||
bool mIsReordered;
|
||||
|
||||
BidiLineData(nsIFrame* aFirstFrameOnLine, int32_t aNumFramesOnLine) {
|
||||
|
@ -492,7 +492,7 @@ struct MOZ_STACK_CLASS BidiLineData {
|
|||
bool hasRTLFrames = false;
|
||||
bool hasVirtualControls = false;
|
||||
|
||||
auto appendFrame = [&](nsIFrame* frame, EmbeddingLevel level) {
|
||||
auto appendFrame = [&](nsIFrame* frame, BidiEmbeddingLevel level) {
|
||||
mLogicalFrames.AppendElement(frame);
|
||||
mLevels.AppendElement(level);
|
||||
mIndexMap.AppendElement(0);
|
||||
|
@ -880,8 +880,7 @@ nsresult nsBidiPresUtils::ResolveParagraph(BidiParagraphData* aBpd) {
|
|||
nsresult rv = aBpd->SetPara();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
intl::Bidi::EmbeddingLevel embeddingLevel =
|
||||
aBpd->GetParagraphEmbeddingLevel();
|
||||
BidiEmbeddingLevel embeddingLevel = aBpd->GetParagraphEmbeddingLevel();
|
||||
|
||||
rv = aBpd->CountRuns(&runCount);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -937,8 +936,8 @@ nsresult nsBidiPresUtils::ResolveParagraph(BidiParagraphData* aBpd) {
|
|||
}
|
||||
|
||||
BidiParagraphData::FrameInfo lastRealFrame;
|
||||
EmbeddingLevel lastEmbeddingLevel = kBidiLevelNone;
|
||||
EmbeddingLevel precedingControl = kBidiLevelNone;
|
||||
BidiEmbeddingLevel lastEmbeddingLevel = kBidiLevelNone;
|
||||
BidiEmbeddingLevel precedingControl = kBidiLevelNone;
|
||||
|
||||
auto storeBidiDataToFrame = [&]() {
|
||||
FrameBidiData bidiData;
|
||||
|
@ -1523,11 +1522,11 @@ FrameBidiData nsBidiPresUtils::GetFrameBidiData(nsIFrame* aFrame) {
|
|||
return GetFirstLeaf(aFrame)->GetBidiData();
|
||||
}
|
||||
|
||||
EmbeddingLevel nsBidiPresUtils::GetFrameEmbeddingLevel(nsIFrame* aFrame) {
|
||||
BidiEmbeddingLevel nsBidiPresUtils::GetFrameEmbeddingLevel(nsIFrame* aFrame) {
|
||||
return GetFirstLeaf(aFrame)->GetEmbeddingLevel();
|
||||
}
|
||||
|
||||
EmbeddingLevel nsBidiPresUtils::GetFrameBaseLevel(const nsIFrame* aFrame) {
|
||||
BidiEmbeddingLevel nsBidiPresUtils::GetFrameBaseLevel(const nsIFrame* aFrame) {
|
||||
const nsIFrame* firstLeaf = aFrame;
|
||||
while (!IsBidiLeaf(firstLeaf)) {
|
||||
firstLeaf = firstLeaf->PrincipalChildList().FirstChild();
|
||||
|
@ -2161,7 +2160,7 @@ void nsBidiPresUtils::CalculateCharType(intl::Bidi* aBidiEngine,
|
|||
}
|
||||
|
||||
nsresult nsBidiPresUtils::ProcessText(const char16_t* aText, size_t aLength,
|
||||
EmbeddingLevel aBaseLevel,
|
||||
BidiEmbeddingLevel aBaseLevel,
|
||||
nsPresContext* aPresContext,
|
||||
BidiProcessor& aprocessor, Mode aMode,
|
||||
nsBidiPositionResolve* aPosResolve,
|
||||
|
@ -2199,10 +2198,10 @@ nsresult nsBidiPresUtils::ProcessText(const char16_t* aText, size_t aLength,
|
|||
}
|
||||
|
||||
for (i = 0; i < runCount; i++) {
|
||||
mozilla::intl::Bidi::Direction dir =
|
||||
mozilla::intl::BidiDirection dir =
|
||||
aBidiEngine->GetVisualRun(i, &start, &length);
|
||||
|
||||
EmbeddingLevel level;
|
||||
BidiEmbeddingLevel level;
|
||||
aBidiEngine->GetLogicalRun(start, &limit, &level);
|
||||
|
||||
dir = level.Direction();
|
||||
|
@ -2224,9 +2223,8 @@ nsresult nsBidiPresUtils::ProcessText(const char16_t* aText, size_t aLength,
|
|||
* x-coordinate of the end of the run for the start of the next run.
|
||||
*/
|
||||
|
||||
if (dir == intl::Bidi::Direction::RTL) {
|
||||
aprocessor.SetText(text + start, subRunLength,
|
||||
intl::Bidi::Direction::RTL);
|
||||
if (dir == intl::BidiDirection::RTL) {
|
||||
aprocessor.SetText(text + start, subRunLength, intl::BidiDirection::RTL);
|
||||
width = aprocessor.GetWidth();
|
||||
xOffset += width;
|
||||
xEndRun = xOffset;
|
||||
|
@ -2248,7 +2246,7 @@ nsresult nsBidiPresUtils::ProcessText(const char16_t* aText, size_t aLength,
|
|||
aprocessor.SetText(runVisualText.get(), subRunLength, dir);
|
||||
width = aprocessor.GetWidth();
|
||||
totalWidth += width;
|
||||
if (dir == mozilla::intl::Bidi::Direction::RTL) {
|
||||
if (dir == mozilla::intl::BidiDirection::RTL) {
|
||||
xOffset -= width;
|
||||
}
|
||||
if (aMode == MODE_DRAW) {
|
||||
|
@ -2318,7 +2316,7 @@ nsresult nsBidiPresUtils::ProcessText(const char16_t* aText, size_t aLength,
|
|||
// The position in the text where this run's "left part" begins.
|
||||
const char16_t* visualLeftPart;
|
||||
const char16_t* visualRightSide;
|
||||
if (dir == mozilla::intl::Bidi::Direction::RTL) {
|
||||
if (dir == mozilla::intl::BidiDirection::RTL) {
|
||||
// One day, son, this could all be replaced with
|
||||
// mPresContext->GetBidiEngine().GetVisualIndex() ...
|
||||
posResolve->visualIndex =
|
||||
|
@ -2347,7 +2345,7 @@ nsresult nsBidiPresUtils::ProcessText(const char16_t* aText, size_t aLength,
|
|||
}
|
||||
}
|
||||
|
||||
if (dir == intl::Bidi::Direction::LTR) {
|
||||
if (dir == intl::BidiDirection::LTR) {
|
||||
xOffset += width;
|
||||
}
|
||||
|
||||
|
@ -2356,7 +2354,7 @@ nsresult nsBidiPresUtils::ProcessText(const char16_t* aText, size_t aLength,
|
|||
subRunLimit = typeLimit;
|
||||
subRunLength = typeLimit - lineOffset;
|
||||
} // while
|
||||
if (dir == intl::Bidi::Direction::RTL) {
|
||||
if (dir == intl::BidiDirection::RTL) {
|
||||
xOffset = xEndRun;
|
||||
}
|
||||
|
||||
|
@ -2388,8 +2386,8 @@ class MOZ_STACK_CLASS nsIRenderingContextBidiProcessor final
|
|||
~nsIRenderingContextBidiProcessor() { mFontMetrics->SetTextRunRTL(false); }
|
||||
|
||||
virtual void SetText(const char16_t* aText, int32_t aLength,
|
||||
intl::Bidi::Direction aDirection) override {
|
||||
mFontMetrics->SetTextRunRTL(aDirection == intl::Bidi::Direction::RTL);
|
||||
intl::BidiDirection aDirection) override {
|
||||
mFontMetrics->SetTextRunRTL(aDirection == intl::BidiDirection::RTL);
|
||||
mText = aText;
|
||||
mLength = aLength;
|
||||
}
|
||||
|
@ -2420,7 +2418,7 @@ class MOZ_STACK_CLASS nsIRenderingContextBidiProcessor final
|
|||
};
|
||||
|
||||
nsresult nsBidiPresUtils::ProcessTextForRenderingContext(
|
||||
const char16_t* aText, int32_t aLength, EmbeddingLevel aBaseLevel,
|
||||
const char16_t* aText, int32_t aLength, BidiEmbeddingLevel aBaseLevel,
|
||||
nsPresContext* aPresContext, gfxContext& aRenderingContext,
|
||||
DrawTarget* aTextRunConstructionDrawTarget, nsFontMetrics& aFontMetrics,
|
||||
Mode aMode, nscoord aX, nscoord aY, nsBidiPositionResolve* aPosResolve,
|
||||
|
@ -2434,16 +2432,16 @@ nsresult nsBidiPresUtils::ProcessTextForRenderingContext(
|
|||
}
|
||||
|
||||
/* static */
|
||||
EmbeddingLevel nsBidiPresUtils::BidiLevelFromStyle(
|
||||
BidiEmbeddingLevel nsBidiPresUtils::BidiLevelFromStyle(
|
||||
ComputedStyle* aComputedStyle) {
|
||||
if (aComputedStyle->StyleTextReset()->mUnicodeBidi &
|
||||
NS_STYLE_UNICODE_BIDI_PLAINTEXT) {
|
||||
return EmbeddingLevel::DefaultLTR();
|
||||
return BidiEmbeddingLevel::DefaultLTR();
|
||||
}
|
||||
|
||||
if (aComputedStyle->StyleVisibility()->mDirection == StyleDirection::Rtl) {
|
||||
return EmbeddingLevel::RTL();
|
||||
return BidiEmbeddingLevel::RTL();
|
||||
}
|
||||
|
||||
return EmbeddingLevel::LTR();
|
||||
return BidiEmbeddingLevel::LTR();
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#define nsBidiPresUtils_h___
|
||||
|
||||
#include "gfxContext.h"
|
||||
#include "mozilla/intl/Bidi.h"
|
||||
#include "mozilla/intl/BidiEmbeddingLevel.h"
|
||||
#include "nsBidiUtils.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsCoord.h"
|
||||
|
@ -30,6 +30,9 @@ struct nsSize;
|
|||
template <class T>
|
||||
class nsTHashtable;
|
||||
namespace mozilla {
|
||||
namespace intl {
|
||||
class Bidi;
|
||||
}
|
||||
class ComputedStyle;
|
||||
class LogicalMargin;
|
||||
class WritingMode;
|
||||
|
@ -164,7 +167,7 @@ class nsBidiPresUtils {
|
|||
* mixed direction.
|
||||
*/
|
||||
virtual void SetText(const char16_t* aText, int32_t aLength,
|
||||
mozilla::intl::Bidi::Direction aDirection) = 0;
|
||||
mozilla::intl::BidiDirection aDirection) = 0;
|
||||
|
||||
/**
|
||||
* Returns the measured width of the text given in SetText. If SetText was
|
||||
|
@ -240,7 +243,7 @@ class nsBidiPresUtils {
|
|||
* @param aPosResolveCount number of items in the aPosResolve array
|
||||
*/
|
||||
static nsresult RenderText(const char16_t* aText, int32_t aLength,
|
||||
mozilla::intl::Bidi::EmbeddingLevel aBaseLevel,
|
||||
mozilla::intl::BidiEmbeddingLevel aBaseLevel,
|
||||
nsPresContext* aPresContext,
|
||||
gfxContext& aRenderingContext,
|
||||
DrawTarget* aTextRunConstructionDrawTarget,
|
||||
|
@ -254,11 +257,11 @@ class nsBidiPresUtils {
|
|||
aPosResolve, aPosResolveCount, nullptr);
|
||||
}
|
||||
|
||||
static nscoord MeasureTextWidth(
|
||||
const char16_t* aText, int32_t aLength,
|
||||
mozilla::intl::Bidi::EmbeddingLevel aBaseLevel,
|
||||
nsPresContext* aPresContext, gfxContext& aRenderingContext,
|
||||
nsFontMetrics& aFontMetrics) {
|
||||
static nscoord MeasureTextWidth(const char16_t* aText, int32_t aLength,
|
||||
mozilla::intl::BidiEmbeddingLevel aBaseLevel,
|
||||
nsPresContext* aPresContext,
|
||||
gfxContext& aRenderingContext,
|
||||
nsFontMetrics& aFontMetrics) {
|
||||
nscoord length;
|
||||
nsresult rv = ProcessTextForRenderingContext(
|
||||
aText, aLength, aBaseLevel, aPresContext, aRenderingContext,
|
||||
|
@ -311,31 +314,31 @@ class nsBidiPresUtils {
|
|||
/**
|
||||
* Get the bidi embedding level of the given (inline) frame.
|
||||
*/
|
||||
static mozilla::intl::Bidi::EmbeddingLevel GetFrameEmbeddingLevel(
|
||||
static mozilla::intl::BidiEmbeddingLevel GetFrameEmbeddingLevel(
|
||||
nsIFrame* aFrame);
|
||||
|
||||
/**
|
||||
* Get the bidi base level of the given (inline) frame.
|
||||
*/
|
||||
static mozilla::intl::Bidi::EmbeddingLevel GetFrameBaseLevel(
|
||||
static mozilla::intl::BidiEmbeddingLevel GetFrameBaseLevel(
|
||||
const nsIFrame* aFrame);
|
||||
|
||||
/**
|
||||
* Get a mozilla::intl::Bidi::Direction representing the direction implied by
|
||||
* Get a mozilla::intl::BidiDirection representing the direction implied by
|
||||
* the bidi base level of the frame.
|
||||
* @return mozilla::intl::Bidi::Direction
|
||||
* @return mozilla::intl::BidiDirection
|
||||
*/
|
||||
static mozilla::intl::Bidi::Direction ParagraphDirection(
|
||||
static mozilla::intl::BidiDirection ParagraphDirection(
|
||||
const nsIFrame* aFrame) {
|
||||
return GetFrameBaseLevel(aFrame).Direction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a mozilla::intl::Bidi::Direction representing the direction implied by
|
||||
* Get a mozilla::intl::BidiDirection representing the direction implied by
|
||||
* the bidi embedding level of the frame.
|
||||
* @return mozilla::intl::Bidi::Direction
|
||||
* @return mozilla::intl::BidiDirection
|
||||
*/
|
||||
static mozilla::intl::Bidi::Direction FrameDirection(nsIFrame* aFrame) {
|
||||
static mozilla::intl::BidiDirection FrameDirection(nsIFrame* aFrame) {
|
||||
return GetFrameEmbeddingLevel(aFrame).Direction();
|
||||
}
|
||||
|
||||
|
@ -372,7 +375,7 @@ class nsBidiPresUtils {
|
|||
* @param[out] aWidth Pointer to where the width will be stored (may be null)
|
||||
*/
|
||||
static nsresult ProcessText(const char16_t* aText, size_t aLength,
|
||||
mozilla::intl::Bidi::EmbeddingLevel aBaseLevel,
|
||||
mozilla::intl::BidiEmbeddingLevel aBaseLevel,
|
||||
nsPresContext* aPresContext,
|
||||
BidiProcessor& aprocessor, Mode aMode,
|
||||
nsBidiPositionResolve* aPosResolve,
|
||||
|
@ -384,23 +387,22 @@ class nsBidiPresUtils {
|
|||
* bidi algorithm.
|
||||
*
|
||||
* If |unicode-bidi| is set to "[-moz-]plaintext", returns
|
||||
* EmbeddingLevel::DefaultLTR, in other words the direction is determined from
|
||||
* the first strong character in the text according to rules P2 and P3 of the
|
||||
* bidi algorithm, or LTR if there is no strong character.
|
||||
* BidiEmbeddingLevel::DefaultLTR, in other words the direction is determined
|
||||
* from the first strong character in the text according to rules P2 and P3 of
|
||||
* the bidi algorithm, or LTR if there is no strong character.
|
||||
*
|
||||
* Otherwise returns EmbeddingLevel::LTR or EmbeddingLevel::RTL depending on
|
||||
* the value of |direction|
|
||||
* Otherwise returns BidiEmbeddingLevel::LTR or BidiEmbeddingLevel::RTL
|
||||
* depending on the value of |direction|
|
||||
*/
|
||||
static mozilla::intl::Bidi::EmbeddingLevel BidiLevelFromStyle(
|
||||
static mozilla::intl::BidiEmbeddingLevel BidiLevelFromStyle(
|
||||
mozilla::ComputedStyle* aComputedStyle);
|
||||
|
||||
private:
|
||||
static nsresult ProcessTextForRenderingContext(
|
||||
const char16_t* aText, int32_t aLength,
|
||||
mozilla::intl::Bidi::EmbeddingLevel aBaseLevel,
|
||||
nsPresContext* aPresContext, gfxContext& aRenderingContext,
|
||||
DrawTarget* aTextRunConstructionDrawTarget, nsFontMetrics& aFontMetrics,
|
||||
Mode aMode,
|
||||
mozilla::intl::BidiEmbeddingLevel aBaseLevel, nsPresContext* aPresContext,
|
||||
gfxContext& aRenderingContext, DrawTarget* aTextRunConstructionDrawTarget,
|
||||
nsFontMetrics& aFontMetrics, Mode aMode,
|
||||
nscoord aX, // DRAW only
|
||||
nscoord aY, // DRAW only
|
||||
nsBidiPositionResolve* aPosResolve, /* may be null */
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
#include "gfxUtils.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/intl/Bidi.h"
|
||||
#include "mozilla/intl/BidiEmbeddingLevel.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsFontMetrics.h"
|
||||
#include "nsITimer.h"
|
||||
|
@ -40,11 +40,11 @@ using namespace mozilla;
|
|||
using namespace mozilla::dom;
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
using EmbeddingLevel = mozilla::intl::Bidi::EmbeddingLevel;
|
||||
using BidiEmbeddingLevel = mozilla::intl::BidiEmbeddingLevel;
|
||||
|
||||
// The bidi indicator hangs off the caret to one side, to show which
|
||||
// direction the typing is in. It needs to be at least 2x2 to avoid looking like
|
||||
// an insignificant dot
|
||||
// direction the typing is in. It needs to be at least 2x2 to avoid looking
|
||||
// like an insignificant dot
|
||||
static const int32_t kMinBidiIndicatorPixels = 2;
|
||||
|
||||
/**
|
||||
|
@ -389,8 +389,7 @@ nsIFrame* nsCaret::GetFrameAndOffset(const Selection* aSelection,
|
|||
|
||||
nsIContent* contentNode = focusNode->AsContent();
|
||||
nsFrameSelection* frameSelection = aSelection->GetFrameSelection();
|
||||
mozilla::intl::Bidi::EmbeddingLevel bidiLevel =
|
||||
frameSelection->GetCaretBidiLevel();
|
||||
BidiEmbeddingLevel bidiLevel = frameSelection->GetCaretBidiLevel();
|
||||
|
||||
return nsCaret::GetCaretFrameForNodeOffset(
|
||||
frameSelection, contentNode, focusOffset, frameSelection->GetHint(),
|
||||
|
@ -658,11 +657,13 @@ void nsCaret::StopBlinking() {
|
|||
}
|
||||
}
|
||||
|
||||
nsIFrame* nsCaret::GetCaretFrameForNodeOffset(
|
||||
nsFrameSelection* aFrameSelection, nsIContent* aContentNode,
|
||||
int32_t aOffset, CaretAssociationHint aFrameHint,
|
||||
mozilla::intl::Bidi::EmbeddingLevel aBidiLevel,
|
||||
nsIFrame** aReturnUnadjustedFrame, int32_t* aReturnOffset) {
|
||||
nsIFrame* nsCaret::GetCaretFrameForNodeOffset(nsFrameSelection* aFrameSelection,
|
||||
nsIContent* aContentNode,
|
||||
int32_t aOffset,
|
||||
CaretAssociationHint aFrameHint,
|
||||
BidiEmbeddingLevel aBidiLevel,
|
||||
nsIFrame** aReturnUnadjustedFrame,
|
||||
int32_t* aReturnOffset) {
|
||||
if (!aFrameSelection) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -713,9 +714,9 @@ nsIFrame* nsCaret::GetCaretFrameForNodeOffset(
|
|||
|
||||
nsIFrame* frameBefore;
|
||||
nsIFrame* frameAfter;
|
||||
mozilla::intl::Bidi::EmbeddingLevel
|
||||
BidiEmbeddingLevel
|
||||
levelBefore; // Bidi level of the character before the caret
|
||||
mozilla::intl::Bidi::EmbeddingLevel
|
||||
BidiEmbeddingLevel
|
||||
levelAfter; // Bidi level of the character after the caret
|
||||
|
||||
auto [start, end] = theFrame->GetOffsets();
|
||||
|
@ -754,8 +755,7 @@ nsIFrame* nsCaret::GetCaretFrameForNodeOffset(
|
|||
// the first frame on the line has a different Bidi level from
|
||||
// the paragraph level, there is no real frame for the caret to
|
||||
// be in. We have to find the visually first frame on the line.
|
||||
mozilla::intl::Bidi::EmbeddingLevel baseLevel =
|
||||
frameAfter->GetBaseLevel();
|
||||
BidiEmbeddingLevel baseLevel = frameAfter->GetBaseLevel();
|
||||
if (baseLevel != levelAfter) {
|
||||
nsPeekOffsetStruct pos(eSelectBeginLine, eDirPrevious, 0,
|
||||
nsPoint(0, 0), false, true, false,
|
||||
|
@ -786,8 +786,7 @@ nsIFrame* nsCaret::GetCaretFrameForNodeOffset(
|
|||
// Bidi level from the paragraph level, there is no real frame
|
||||
// for the caret to be in. We have to find the visually last
|
||||
// frame on the line.
|
||||
mozilla::intl::Bidi::EmbeddingLevel baseLevel =
|
||||
frameBefore->GetBaseLevel();
|
||||
BidiEmbeddingLevel baseLevel = frameBefore->GetBaseLevel();
|
||||
if (baseLevel != levelBefore) {
|
||||
nsPeekOffsetStruct pos(eSelectEndLine, eDirNext, 0,
|
||||
nsPoint(0, 0), false, true, false,
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#ifndef nsCaret_h__
|
||||
#define nsCaret_h__
|
||||
|
||||
#include "mozilla/intl/Bidi.h"
|
||||
#include "mozilla/intl/BidiEmbeddingLevel.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/dom/Selection.h"
|
||||
#include "nsCoord.h"
|
||||
|
@ -181,7 +181,7 @@ class nsCaret final : public nsISelectionListener {
|
|||
static nsIFrame* GetCaretFrameForNodeOffset(
|
||||
nsFrameSelection* aFrameSelection, nsIContent* aContentNode,
|
||||
int32_t aOffset, CaretAssociationHint aFrameHint,
|
||||
mozilla::intl::Bidi::EmbeddingLevel aBidiLevel,
|
||||
mozilla::intl::BidiEmbeddingLevel aBidiLevel,
|
||||
nsIFrame** aReturnUnadjustedFrame, int32_t* aReturnOffset);
|
||||
static nsRect GetGeometryForFrame(nsIFrame* aFrame, int32_t aFrameOffset,
|
||||
nscoord* aBidiIndicatorSize);
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
#include "mozilla/dom/KeyframeEffect.h"
|
||||
#include "mozilla/dom/SVGViewportElement.h"
|
||||
#include "mozilla/dom/UIEvent.h"
|
||||
#include "mozilla/intl/Bidi.h"
|
||||
#include "mozilla/intl/BidiEmbeddingLevel.h"
|
||||
#include "mozilla/EffectCompositor.h"
|
||||
#include "mozilla/EffectSet.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
|
@ -1517,10 +1517,9 @@ nsRect nsLayoutUtils::GetScrolledRect(nsIFrame* aScrolledFrame,
|
|||
WritingMode wm = aScrolledFrame->GetWritingMode();
|
||||
// Potentially override the frame's direction to use the direction found
|
||||
// by ScrollFrameHelper::GetScrolledFrameDir()
|
||||
wm.SetDirectionFromBidiLevel(
|
||||
aDirection == StyleDirection::Rtl
|
||||
? mozilla::intl::Bidi::EmbeddingLevel::RTL()
|
||||
: mozilla::intl::Bidi::EmbeddingLevel::LTR());
|
||||
wm.SetDirectionFromBidiLevel(aDirection == StyleDirection::Rtl
|
||||
? mozilla::intl::BidiEmbeddingLevel::RTL()
|
||||
: mozilla::intl::BidiEmbeddingLevel::LTR());
|
||||
|
||||
nscoord x1 = aScrolledFrameOverflowArea.x,
|
||||
x2 = aScrolledFrameOverflowArea.XMost(),
|
||||
|
@ -5530,7 +5529,7 @@ nscoord nsLayoutUtils::AppUnitWidthOfStringBidi(const char16_t* aString,
|
|||
gfxContext& aContext) {
|
||||
nsPresContext* presContext = aFrame->PresContext();
|
||||
if (presContext->BidiEnabled()) {
|
||||
mozilla::intl::Bidi::EmbeddingLevel level =
|
||||
mozilla::intl::BidiEmbeddingLevel level =
|
||||
nsBidiPresUtils::BidiLevelFromStyle(aFrame->Style());
|
||||
return nsBidiPresUtils::MeasureTextWidth(
|
||||
aString, aLength, level, presContext, aContext, aFontMetrics);
|
||||
|
@ -5610,7 +5609,7 @@ void nsLayoutUtils::DrawString(const nsIFrame* aFrame,
|
|||
|
||||
nsPresContext* presContext = aFrame->PresContext();
|
||||
if (presContext->BidiEnabled()) {
|
||||
mozilla::intl::Bidi::EmbeddingLevel level =
|
||||
mozilla::intl::BidiEmbeddingLevel level =
|
||||
nsBidiPresUtils::BidiLevelFromStyle(aComputedStyle);
|
||||
rv = nsBidiPresUtils::RenderText(aString, aLength, level, presContext,
|
||||
*aContext, aContext->GetDrawTarget(),
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <ostream>
|
||||
|
||||
#include "mozilla/intl/Bidi.h"
|
||||
#include "mozilla/intl/BidiEmbeddingLevel.h"
|
||||
#include "mozilla/ComputedStyle.h"
|
||||
#include "mozilla/EnumeratedRange.h"
|
||||
|
||||
|
@ -525,7 +525,7 @@ class WritingMode {
|
|||
*
|
||||
* XXX change uint8_t to UBiDiLevel after bug 924851
|
||||
*/
|
||||
void SetDirectionFromBidiLevel(mozilla::intl::Bidi::EmbeddingLevel level) {
|
||||
void SetDirectionFromBidiLevel(mozilla::intl::BidiEmbeddingLevel level) {
|
||||
if (level.IsRTL() == IsBidiLTR()) {
|
||||
mWritingMode ^= StyleWritingMode::RTL | StyleWritingMode::INLINE_REVERSED;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include "nsFrameList.h"
|
||||
|
||||
#include "mozilla/intl/Bidi.h"
|
||||
#include "mozilla/intl/BidiEmbeddingLevel.h"
|
||||
#include "mozilla/ArenaObjectID.h"
|
||||
#include "mozilla/PresShell.h"
|
||||
#include "nsBidiPresUtils.h"
|
||||
|
@ -306,7 +306,7 @@ nsIFrame* nsFrameList::GetPrevVisualFor(nsIFrame* aFrame) const {
|
|||
nsIFrame* parent = mFirstChild->GetParent();
|
||||
if (!parent) return aFrame ? aFrame->GetPrevSibling() : LastChild();
|
||||
|
||||
mozilla::intl::Bidi::Direction paraDir =
|
||||
mozilla::intl::BidiDirection paraDir =
|
||||
nsBidiPresUtils::ParagraphDirection(mFirstChild);
|
||||
|
||||
nsAutoLineIterator iter = parent->GetLineIterator();
|
||||
|
@ -315,7 +315,7 @@ nsIFrame* nsFrameList::GetPrevVisualFor(nsIFrame* aFrame) const {
|
|||
if (parent->IsLineFrame()) {
|
||||
// Line frames are not bidi-splittable, so need to consider bidi
|
||||
// reordering
|
||||
if (paraDir == mozilla::intl::Bidi::Direction::LTR) {
|
||||
if (paraDir == mozilla::intl::BidiDirection::LTR) {
|
||||
return nsBidiPresUtils::GetFrameToLeftOf(aFrame, mFirstChild, -1);
|
||||
} else { // RTL
|
||||
return nsBidiPresUtils::GetFrameToRightOf(aFrame, mFirstChild, -1);
|
||||
|
@ -347,7 +347,7 @@ nsIFrame* nsFrameList::GetPrevVisualFor(nsIFrame* aFrame) const {
|
|||
if (aFrame) {
|
||||
auto line = iter->GetLine(thisLine).unwrap();
|
||||
|
||||
if (paraDir == mozilla::intl::Bidi::Direction::LTR) {
|
||||
if (paraDir == mozilla::intl::BidiDirection::LTR) {
|
||||
frame = nsBidiPresUtils::GetFrameToLeftOf(aFrame, line.mFirstFrameOnLine,
|
||||
line.mNumFramesOnLine);
|
||||
} else { // RTL
|
||||
|
@ -360,7 +360,7 @@ nsIFrame* nsFrameList::GetPrevVisualFor(nsIFrame* aFrame) const {
|
|||
// Get the last frame of the previous line
|
||||
auto line = iter->GetLine(thisLine - 1).unwrap();
|
||||
|
||||
if (paraDir == mozilla::intl::Bidi::Direction::LTR) {
|
||||
if (paraDir == mozilla::intl::BidiDirection::LTR) {
|
||||
frame = nsBidiPresUtils::GetFrameToLeftOf(nullptr, line.mFirstFrameOnLine,
|
||||
line.mNumFramesOnLine);
|
||||
} else { // RTL
|
||||
|
@ -377,7 +377,7 @@ nsIFrame* nsFrameList::GetNextVisualFor(nsIFrame* aFrame) const {
|
|||
nsIFrame* parent = mFirstChild->GetParent();
|
||||
if (!parent) return aFrame ? aFrame->GetPrevSibling() : mFirstChild;
|
||||
|
||||
mozilla::intl::Bidi::Direction paraDir =
|
||||
mozilla::intl::BidiDirection paraDir =
|
||||
nsBidiPresUtils::ParagraphDirection(mFirstChild);
|
||||
|
||||
nsAutoLineIterator iter = parent->GetLineIterator();
|
||||
|
@ -386,7 +386,7 @@ nsIFrame* nsFrameList::GetNextVisualFor(nsIFrame* aFrame) const {
|
|||
if (parent->IsLineFrame()) {
|
||||
// Line frames are not bidi-splittable, so need to consider bidi
|
||||
// reordering
|
||||
if (paraDir == mozilla::intl::Bidi::Direction::LTR) {
|
||||
if (paraDir == mozilla::intl::BidiDirection::LTR) {
|
||||
return nsBidiPresUtils::GetFrameToRightOf(aFrame, mFirstChild, -1);
|
||||
} else { // RTL
|
||||
return nsBidiPresUtils::GetFrameToLeftOf(aFrame, mFirstChild, -1);
|
||||
|
@ -418,7 +418,7 @@ nsIFrame* nsFrameList::GetNextVisualFor(nsIFrame* aFrame) const {
|
|||
if (aFrame) {
|
||||
auto line = iter->GetLine(thisLine).unwrap();
|
||||
|
||||
if (paraDir == mozilla::intl::Bidi::Direction::LTR) {
|
||||
if (paraDir == mozilla::intl::BidiDirection::LTR) {
|
||||
frame = nsBidiPresUtils::GetFrameToRightOf(aFrame, line.mFirstFrameOnLine,
|
||||
line.mNumFramesOnLine);
|
||||
} else { // RTL
|
||||
|
@ -432,7 +432,7 @@ nsIFrame* nsFrameList::GetNextVisualFor(nsIFrame* aFrame) const {
|
|||
// Get the first frame of the next line
|
||||
auto line = iter->GetLine(thisLine + 1).unwrap();
|
||||
|
||||
if (paraDir == mozilla::intl::Bidi::Direction::LTR) {
|
||||
if (paraDir == mozilla::intl::BidiDirection::LTR) {
|
||||
frame = nsBidiPresUtils::GetFrameToRightOf(
|
||||
nullptr, line.mFirstFrameOnLine, line.mNumFramesOnLine);
|
||||
} else { // RTL
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#include "nsFrameSelection.h"
|
||||
|
||||
#include "mozilla/intl/Bidi.h"
|
||||
#include "mozilla/intl/BidiEmbeddingLevel.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
|
@ -600,7 +600,7 @@ nsresult nsFrameSelection::ConstrainFrameAndPointToAnchorSubtree(
|
|||
}
|
||||
|
||||
void nsFrameSelection::SetCaretBidiLevelAndMaybeSchedulePaint(
|
||||
mozilla::intl::Bidi::EmbeddingLevel aLevel) {
|
||||
mozilla::intl::BidiEmbeddingLevel aLevel) {
|
||||
// If the current level is undefined, we have just inserted new text.
|
||||
// In this case, we don't want to reset the keyboard language
|
||||
mCaret.mBidiLevel = aLevel;
|
||||
|
@ -611,14 +611,13 @@ void nsFrameSelection::SetCaretBidiLevelAndMaybeSchedulePaint(
|
|||
}
|
||||
}
|
||||
|
||||
mozilla::intl::Bidi::EmbeddingLevel nsFrameSelection::GetCaretBidiLevel()
|
||||
const {
|
||||
mozilla::intl::BidiEmbeddingLevel nsFrameSelection::GetCaretBidiLevel() const {
|
||||
return mCaret.mBidiLevel;
|
||||
}
|
||||
|
||||
void nsFrameSelection::UndefineCaretBidiLevel() {
|
||||
mCaret.mBidiLevel = mozilla::intl::Bidi::EmbeddingLevel(mCaret.mBidiLevel |
|
||||
BIDI_LEVEL_UNDEFINED);
|
||||
mCaret.mBidiLevel = mozilla::intl::BidiEmbeddingLevel(mCaret.mBidiLevel |
|
||||
BIDI_LEVEL_UNDEFINED);
|
||||
}
|
||||
|
||||
#ifdef PRINT_RANGE
|
||||
|
@ -665,10 +664,10 @@ static nsINode* GetClosestInclusiveTableCellAncestor(nsINode* aDomNode) {
|
|||
static nsDirection GetCaretDirection(const nsIFrame& aFrame,
|
||||
nsDirection aDirection,
|
||||
bool aVisualMovement) {
|
||||
const mozilla::intl::Bidi::Direction paragraphDirection =
|
||||
const mozilla::intl::BidiDirection paragraphDirection =
|
||||
nsBidiPresUtils::ParagraphDirection(&aFrame);
|
||||
return (aVisualMovement &&
|
||||
paragraphDirection == mozilla::intl::Bidi::Direction::RTL)
|
||||
paragraphDirection == mozilla::intl::BidiDirection::RTL)
|
||||
? nsDirection(1 - aDirection)
|
||||
: aDirection;
|
||||
}
|
||||
|
@ -932,8 +931,8 @@ nsPrevNextBidiLevels nsFrameSelection::GetPrevNextBidiLevels(
|
|||
nsDirection direction;
|
||||
|
||||
nsPrevNextBidiLevels levels{};
|
||||
levels.SetData(nullptr, nullptr, mozilla::intl::Bidi::EmbeddingLevel::LTR(),
|
||||
mozilla::intl::Bidi::EmbeddingLevel::LTR());
|
||||
levels.SetData(nullptr, nullptr, mozilla::intl::BidiEmbeddingLevel::LTR(),
|
||||
mozilla::intl::BidiEmbeddingLevel::LTR());
|
||||
|
||||
currentFrame = GetFrameForNodeOffset(
|
||||
aNode, static_cast<int32_t>(aContentOffset), aHint, ¤tOffset);
|
||||
|
@ -952,7 +951,7 @@ nsPrevNextBidiLevels nsFrameSelection::GetPrevNextBidiLevels(
|
|||
} else {
|
||||
// we are neither at the beginning nor at the end of the frame, so we have
|
||||
// no worries
|
||||
mozilla::intl::Bidi::EmbeddingLevel currentLevel =
|
||||
mozilla::intl::BidiEmbeddingLevel currentLevel =
|
||||
currentFrame->GetEmbeddingLevel();
|
||||
levels.SetData(currentFrame, currentFrame, currentLevel, currentLevel);
|
||||
return levels;
|
||||
|
@ -964,8 +963,8 @@ nsPrevNextBidiLevels nsFrameSelection::GetPrevNextBidiLevels(
|
|||
.mFrame;
|
||||
|
||||
FrameBidiData currentBidi = currentFrame->GetBidiData();
|
||||
mozilla::intl::Bidi::EmbeddingLevel currentLevel = currentBidi.embeddingLevel;
|
||||
mozilla::intl::Bidi::EmbeddingLevel newLevel =
|
||||
mozilla::intl::BidiEmbeddingLevel currentLevel = currentBidi.embeddingLevel;
|
||||
mozilla::intl::BidiEmbeddingLevel newLevel =
|
||||
newFrame ? newFrame->GetEmbeddingLevel() : currentBidi.baseLevel;
|
||||
|
||||
// If not jumping lines, disregard br frames, since they might be positioned
|
||||
|
@ -992,11 +991,10 @@ nsPrevNextBidiLevels nsFrameSelection::GetPrevNextBidiLevels(
|
|||
|
||||
nsresult nsFrameSelection::GetFrameFromLevel(
|
||||
nsIFrame* aFrameIn, nsDirection aDirection,
|
||||
mozilla::intl::Bidi::EmbeddingLevel aBidiLevel,
|
||||
nsIFrame** aFrameOut) const {
|
||||
mozilla::intl::BidiEmbeddingLevel aBidiLevel, nsIFrame** aFrameOut) const {
|
||||
NS_ENSURE_STATE(mPresShell);
|
||||
mozilla::intl::Bidi::EmbeddingLevel foundLevel =
|
||||
mozilla::intl::Bidi::EmbeddingLevel::LTR();
|
||||
mozilla::intl::BidiEmbeddingLevel foundLevel =
|
||||
mozilla::intl::BidiEmbeddingLevel::LTR();
|
||||
nsIFrame* foundFrame = aFrameIn;
|
||||
|
||||
nsCOMPtr<nsIFrameEnumerator> frameTraversal;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#ifndef nsFrameSelection_h___
|
||||
#define nsFrameSelection_h___
|
||||
|
||||
#include "mozilla/intl/Bidi.h"
|
||||
#include "mozilla/intl/BidiEmbeddingLevel.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
|
@ -26,7 +26,7 @@
|
|||
|
||||
class nsRange;
|
||||
|
||||
#define BIDI_LEVEL_UNDEFINED mozilla::intl::Bidi::EmbeddingLevel(0x80)
|
||||
#define BIDI_LEVEL_UNDEFINED mozilla::intl::BidiEmbeddingLevel(0x80)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
|
@ -173,8 +173,8 @@ struct MOZ_STACK_CLASS nsPeekOffsetStruct {
|
|||
|
||||
struct nsPrevNextBidiLevels {
|
||||
void SetData(nsIFrame* aFrameBefore, nsIFrame* aFrameAfter,
|
||||
mozilla::intl::Bidi::EmbeddingLevel aLevelBefore,
|
||||
mozilla::intl::Bidi::EmbeddingLevel aLevelAfter) {
|
||||
mozilla::intl::BidiEmbeddingLevel aLevelBefore,
|
||||
mozilla::intl::BidiEmbeddingLevel aLevelAfter) {
|
||||
mFrameBefore = aFrameBefore;
|
||||
mFrameAfter = aFrameAfter;
|
||||
mLevelBefore = aLevelBefore;
|
||||
|
@ -182,8 +182,8 @@ struct nsPrevNextBidiLevels {
|
|||
}
|
||||
nsIFrame* mFrameBefore;
|
||||
nsIFrame* mFrameAfter;
|
||||
mozilla::intl::Bidi::EmbeddingLevel mLevelBefore;
|
||||
mozilla::intl::Bidi::EmbeddingLevel mLevelAfter;
|
||||
mozilla::intl::BidiEmbeddingLevel mLevelBefore;
|
||||
mozilla::intl::BidiEmbeddingLevel mLevelAfter;
|
||||
};
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -478,12 +478,12 @@ class nsFrameSelection final {
|
|||
CaretAssociateHint GetHint() const { return mCaret.mHint; }
|
||||
|
||||
void SetCaretBidiLevelAndMaybeSchedulePaint(
|
||||
mozilla::intl::Bidi::EmbeddingLevel aLevel);
|
||||
mozilla::intl::BidiEmbeddingLevel aLevel);
|
||||
|
||||
/**
|
||||
* GetCaretBidiLevel gets the caret bidi level.
|
||||
*/
|
||||
mozilla::intl::Bidi::EmbeddingLevel GetCaretBidiLevel() const;
|
||||
mozilla::intl::BidiEmbeddingLevel GetCaretBidiLevel() const;
|
||||
|
||||
/**
|
||||
* UndefineCaretBidiLevel sets the caret bidi level to "undefined".
|
||||
|
@ -698,7 +698,7 @@ class nsFrameSelection final {
|
|||
* @param aFrameOut will hold the frame returned
|
||||
*/
|
||||
nsresult GetFrameFromLevel(nsIFrame* aFrameIn, nsDirection aDirection,
|
||||
mozilla::intl::Bidi::EmbeddingLevel aBidiLevel,
|
||||
mozilla::intl::BidiEmbeddingLevel aBidiLevel,
|
||||
nsIFrame** aFrameOut) const;
|
||||
|
||||
/**
|
||||
|
@ -1043,7 +1043,7 @@ class nsFrameSelection final {
|
|||
// Hint to tell if the selection is at the end of this line or beginning of
|
||||
// next.
|
||||
CaretAssociateHint mHint = mozilla::CARET_ASSOCIATE_BEFORE;
|
||||
mozilla::intl::Bidi::EmbeddingLevel mBidiLevel = BIDI_LEVEL_UNDEFINED;
|
||||
mozilla::intl::BidiEmbeddingLevel mBidiLevel = BIDI_LEVEL_UNDEFINED;
|
||||
|
||||
bool IsVisualMovement(bool aContinueSelection,
|
||||
CaretMovementStyle aMovementStyle) const;
|
||||
|
@ -1051,8 +1051,8 @@ class nsFrameSelection final {
|
|||
|
||||
Caret mCaret;
|
||||
|
||||
mozilla::intl::Bidi::EmbeddingLevel mKbdBidiLevel =
|
||||
mozilla::intl::Bidi::EmbeddingLevel::LTR();
|
||||
mozilla::intl::BidiEmbeddingLevel mKbdBidiLevel =
|
||||
mozilla::intl::BidiEmbeddingLevel::LTR();
|
||||
|
||||
class DesiredCaretPos {
|
||||
public:
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "nsContainerFrame.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsNameSpaceManager.h"
|
||||
#include "mozilla/intl/Bidi.h"
|
||||
#include "mozilla/intl/BidiEmbeddingLevel.h"
|
||||
#include "mozilla/dom/DocumentInlines.h"
|
||||
#include "mozilla/gfx/gfxVars.h"
|
||||
#include "nsFontMetrics.h"
|
||||
|
@ -7138,7 +7138,7 @@ StyleDirection ScrollFrameHelper::GetScrolledFrameDir() const {
|
|||
NS_STYLE_UNICODE_BIDI_PLAINTEXT) {
|
||||
if (nsIFrame* child = mScrolledFrame->PrincipalChildList().FirstChild()) {
|
||||
return nsBidiPresUtils::ParagraphDirection(child) ==
|
||||
mozilla::intl::Bidi::Direction::LTR
|
||||
mozilla::intl::BidiDirection::LTR
|
||||
? StyleDirection::Ltr
|
||||
: StyleDirection::Rtl;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/gfx/gfxVars.h"
|
||||
#include "mozilla/gfx/PathHelpers.h"
|
||||
#include "mozilla/intl/Bidi.h"
|
||||
#include "mozilla/intl/BidiEmbeddingLevel.h"
|
||||
#include "mozilla/PresShell.h"
|
||||
#include "mozilla/PresShellInlines.h"
|
||||
#include "mozilla/ResultExtensions.h"
|
||||
|
@ -1698,7 +1698,7 @@ WritingMode nsIFrame::WritingModeForLine(WritingMode aSelfWM,
|
|||
WritingMode writingMode = aSelfWM;
|
||||
|
||||
if (StyleTextReset()->mUnicodeBidi & NS_STYLE_UNICODE_BIDI_PLAINTEXT) {
|
||||
mozilla::intl::Bidi::EmbeddingLevel frameLevel =
|
||||
mozilla::intl::BidiEmbeddingLevel frameLevel =
|
||||
nsBidiPresUtils::GetFrameBaseLevel(aSubFrame);
|
||||
writingMode.SetDirectionFromBidiLevel(frameLevel);
|
||||
}
|
||||
|
@ -9106,7 +9106,7 @@ Result<bool, nsresult> nsIFrame::IsVisuallyAtLineEdge(
|
|||
}
|
||||
|
||||
bool frameIsRTL = (nsBidiPresUtils::FrameDirection(*framePtr) ==
|
||||
mozilla::intl::Bidi::Direction::RTL);
|
||||
mozilla::intl::BidiDirection::RTL);
|
||||
if ((frameIsRTL == lineIsRTL) == (aDirection == eDirPrevious)) {
|
||||
nsIFrame::GetFirstLeaf(framePtr);
|
||||
} else {
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/gfx/CompositorHitTestInfo.h"
|
||||
#include "mozilla/gfx/MatrixFwd.h"
|
||||
#include "mozilla/intl/Bidi.h"
|
||||
#include "mozilla/intl/BidiEmbeddingLevel.h"
|
||||
#include "nsDisplayItemTypes.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsTHashSet.h"
|
||||
|
@ -404,16 +404,16 @@ struct IntrinsicSize {
|
|||
};
|
||||
|
||||
// Pseudo bidi embedding level indicating nonexistence.
|
||||
static const mozilla::intl::Bidi::EmbeddingLevel kBidiLevelNone =
|
||||
mozilla::intl::Bidi::EmbeddingLevel(0xff);
|
||||
static const mozilla::intl::BidiEmbeddingLevel kBidiLevelNone =
|
||||
mozilla::intl::BidiEmbeddingLevel(0xff);
|
||||
|
||||
struct FrameBidiData {
|
||||
mozilla::intl::Bidi::EmbeddingLevel baseLevel;
|
||||
mozilla::intl::Bidi::EmbeddingLevel embeddingLevel;
|
||||
mozilla::intl::BidiEmbeddingLevel baseLevel;
|
||||
mozilla::intl::BidiEmbeddingLevel embeddingLevel;
|
||||
// The embedding level of virtual bidi formatting character before
|
||||
// this frame if any. kBidiLevelNone is used to indicate nonexistence
|
||||
// or unnecessity of such virtual character.
|
||||
mozilla::intl::Bidi::EmbeddingLevel precedingControl;
|
||||
mozilla::intl::BidiEmbeddingLevel precedingControl;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -1330,11 +1330,11 @@ class nsIFrame : public nsQueryFrame {
|
|||
return bidiData;
|
||||
}
|
||||
|
||||
mozilla::intl::Bidi::EmbeddingLevel GetBaseLevel() const {
|
||||
mozilla::intl::BidiEmbeddingLevel GetBaseLevel() const {
|
||||
return GetBidiData().baseLevel;
|
||||
}
|
||||
|
||||
mozilla::intl::Bidi::EmbeddingLevel GetEmbeddingLevel() const {
|
||||
mozilla::intl::BidiEmbeddingLevel GetEmbeddingLevel() const {
|
||||
return GetBidiData().embeddingLevel;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "gfx2DGlue.h"
|
||||
#include "gfxContext.h"
|
||||
#include "gfxUtils.h"
|
||||
#include "mozilla/intl/Bidi.h"
|
||||
#include "mozilla/intl/BidiEmbeddingLevel.h"
|
||||
#include "mozilla/ComputedStyle.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/Encoding.h"
|
||||
|
@ -1435,26 +1435,26 @@ void nsImageFrame::DisplayAltText(nsPresContext* aPresContext,
|
|||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
if (aPresContext->BidiEnabled()) {
|
||||
mozilla::intl::Bidi::EmbeddingLevel level;
|
||||
mozilla::intl::BidiEmbeddingLevel level;
|
||||
nscoord x, y;
|
||||
|
||||
if (isVertical) {
|
||||
x = pt.x + maxDescent;
|
||||
if (wm.IsBidiLTR()) {
|
||||
y = aRect.y;
|
||||
level = mozilla::intl::Bidi::EmbeddingLevel::LTR();
|
||||
level = mozilla::intl::BidiEmbeddingLevel::LTR();
|
||||
} else {
|
||||
y = aRect.YMost() - strWidth;
|
||||
level = mozilla::intl::Bidi::EmbeddingLevel::RTL();
|
||||
level = mozilla::intl::BidiEmbeddingLevel::RTL();
|
||||
}
|
||||
} else {
|
||||
y = pt.y + maxAscent;
|
||||
if (wm.IsBidiLTR()) {
|
||||
x = aRect.x;
|
||||
level = mozilla::intl::Bidi::EmbeddingLevel::LTR();
|
||||
level = mozilla::intl::BidiEmbeddingLevel::LTR();
|
||||
} else {
|
||||
x = aRect.XMost() - strWidth;
|
||||
level = mozilla::intl::Bidi::EmbeddingLevel::RTL();
|
||||
level = mozilla::intl::BidiEmbeddingLevel::RTL();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include "gfx2DGlue.h"
|
||||
#include "gfxUtils.h"
|
||||
#include "mozilla/intl/Bidi.h"
|
||||
#include "mozilla/intl/BidiEmbeddingLevel.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ComputedStyle.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
@ -485,7 +485,7 @@ void nsTextBoxFrame::DrawText(gfxContext& aRenderingContext,
|
|||
|
||||
if (mState & NS_FRAME_IS_BIDI) {
|
||||
presContext->SetBidiEnabled();
|
||||
mozilla::intl::Bidi::EmbeddingLevel level =
|
||||
mozilla::intl::BidiEmbeddingLevel level =
|
||||
nsBidiPresUtils::BidiLevelFromStyle(Style());
|
||||
if (mAccessKeyInfo && mAccessKeyInfo->mAccesskeyIndex != kNotFound) {
|
||||
// We let the RenderText function calculate the mnemonic's
|
||||
|
|
Загрузка…
Ссылка в новой задаче