зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1614208 - Remove nsStyleConsts usage from TextRange.h. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D62172 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
b997cfcaf4
Коммит
49abab29a5
|
@ -9,9 +9,9 @@
|
|||
|
||||
#include "mozilla/dom/StyledRange.h"
|
||||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/RangeBoundary.h"
|
||||
#include "mozilla/SelectionChangeEventDispatcher.h"
|
||||
#include "mozilla/TextRange.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/WeakPtr.h"
|
||||
#include "nsDirection.h"
|
||||
|
@ -45,6 +45,7 @@ class DocGroup;
|
|||
} // namespace mozilla
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace dom {
|
||||
|
||||
// Note, the ownership of mozilla::dom::Selection depends on which way the
|
||||
|
|
|
@ -5690,6 +5690,24 @@ void nsTextFrame::PaintDecorationLine(
|
|||
}
|
||||
}
|
||||
|
||||
static uint8_t ToStyleLineStyle(const TextRangeStyle& aStyle) {
|
||||
switch (aStyle.mLineStyle) {
|
||||
case TextRangeStyle::LINESTYLE_NONE:
|
||||
return NS_STYLE_TEXT_DECORATION_STYLE_NONE;
|
||||
case TextRangeStyle::LINESTYLE_WAVY:
|
||||
return NS_STYLE_TEXT_DECORATION_STYLE_WAVY;
|
||||
case TextRangeStyle::LINESTYLE_DASHED:
|
||||
return NS_STYLE_TEXT_DECORATION_STYLE_DASHED;
|
||||
case TextRangeStyle::LINESTYLE_DOTTED:
|
||||
return NS_STYLE_TEXT_DECORATION_STYLE_DOTTED;
|
||||
case TextRangeStyle::LINESTYLE_DOUBLE:
|
||||
return NS_STYLE_TEXT_DECORATION_STYLE_DOUBLE;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Unknown line style?");
|
||||
return NS_STYLE_TEXT_DECORATION_STYLE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This, plus kSelectionTypesWithDecorations, encapsulates all knowledge
|
||||
* about drawing text decoration for selections.
|
||||
|
@ -5770,7 +5788,7 @@ void nsTextFrame::DrawSelectionDecorations(
|
|||
if (aRangeStyle.mLineStyle == TextRangeStyle::LINESTYLE_NONE) {
|
||||
return;
|
||||
}
|
||||
params.style = aRangeStyle.mLineStyle;
|
||||
params.style = ToStyleLineStyle(aRangeStyle);
|
||||
relativeSize = aRangeStyle.mIsBoldLine ? 2.0f : 1.0f;
|
||||
} else if (!weDefineSelectionUnderline) {
|
||||
// There is no underline style definition.
|
||||
|
@ -7347,7 +7365,7 @@ bool nsTextFrame::CombineSelectionUnderlineRect(nsPresContext* aPresContext,
|
|||
rangeStyle.mLineStyle == TextRangeStyle::LINESTYLE_NONE) {
|
||||
continue;
|
||||
}
|
||||
params.style = rangeStyle.mLineStyle;
|
||||
params.style = ToStyleLineStyle(rangeStyle);
|
||||
relativeSize = rangeStyle.mIsBoldLine ? 2.0f : 1.0f;
|
||||
} else if (!nsTextPaintStyle::GetSelectionUnderline(
|
||||
aPresContext, index, nullptr, &relativeSize,
|
||||
|
|
|
@ -424,6 +424,8 @@ enum MouseButtonsFlag {
|
|||
e5thFlag = 0x10
|
||||
};
|
||||
|
||||
enum class TextRangeType : RawTextRangeType;
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_EventForwards_h__
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include "nsColor.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsITextInputProcessor.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -24,12 +23,12 @@ namespace mozilla {
|
|||
|
||||
struct TextRangeStyle {
|
||||
enum {
|
||||
LINESTYLE_NONE = NS_STYLE_TEXT_DECORATION_STYLE_NONE,
|
||||
LINESTYLE_SOLID = NS_STYLE_TEXT_DECORATION_STYLE_SOLID,
|
||||
LINESTYLE_DOTTED = NS_STYLE_TEXT_DECORATION_STYLE_DOTTED,
|
||||
LINESTYLE_DASHED = NS_STYLE_TEXT_DECORATION_STYLE_DASHED,
|
||||
LINESTYLE_DOUBLE = NS_STYLE_TEXT_DECORATION_STYLE_DOUBLE,
|
||||
LINESTYLE_WAVY = NS_STYLE_TEXT_DECORATION_STYLE_WAVY
|
||||
LINESTYLE_NONE,
|
||||
LINESTYLE_SOLID,
|
||||
LINESTYLE_DOTTED,
|
||||
LINESTYLE_DASHED,
|
||||
LINESTYLE_DOUBLE,
|
||||
LINESTYLE_WAVY,
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -42,6 +41,9 @@ struct TextRangeStyle {
|
|||
|
||||
// Initialize all members, because TextRange instances may be compared by
|
||||
// memcomp.
|
||||
//
|
||||
// FIXME(emilio): I don't think that'd be sound, as it has padding which the
|
||||
// compiler is not guaranteed to initialize.
|
||||
TextRangeStyle() { Clear(); }
|
||||
|
||||
void Clear() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче