mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1204872 - Make AccessibleCaret testable. r=roc
Remove the assert of the existence of PresShell in the constructor since there's no PresShell in gtest. Also make AccessibleCaret inheritable.
This commit is contained in:
parent
dabe955e3e
commit
2f8290c259
@ -57,13 +57,14 @@ AccessibleCaret::AccessibleCaret(nsIPresShell* aPresShell)
|
||||
: mPresShell(aPresShell)
|
||||
{
|
||||
// Check all resources required.
|
||||
MOZ_ASSERT(mPresShell);
|
||||
MOZ_ASSERT(RootFrame());
|
||||
MOZ_ASSERT(mPresShell->GetDocument());
|
||||
MOZ_ASSERT(mPresShell->GetCanvasFrame());
|
||||
MOZ_ASSERT(mPresShell->GetCanvasFrame()->GetCustomContentContainer());
|
||||
if (mPresShell) {
|
||||
MOZ_ASSERT(RootFrame());
|
||||
MOZ_ASSERT(mPresShell->GetDocument());
|
||||
MOZ_ASSERT(mPresShell->GetCanvasFrame());
|
||||
MOZ_ASSERT(mPresShell->GetCanvasFrame()->GetCustomContentContainer());
|
||||
|
||||
InjectCaretElement(mPresShell->GetDocument());
|
||||
InjectCaretElement(mPresShell->GetDocument());
|
||||
}
|
||||
|
||||
static bool prefsAdded = false;
|
||||
if (!prefsAdded) {
|
||||
@ -77,7 +78,9 @@ AccessibleCaret::AccessibleCaret(nsIPresShell* aPresShell)
|
||||
|
||||
AccessibleCaret::~AccessibleCaret()
|
||||
{
|
||||
RemoveCaretElement(mPresShell->GetDocument());
|
||||
if (mPresShell) {
|
||||
RemoveCaretElement(mPresShell->GetDocument());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -37,11 +37,11 @@ namespace mozilla {
|
||||
// that SetPosition() works correctly, the caller must make sure the layout is
|
||||
// up to date.
|
||||
//
|
||||
class AccessibleCaret final
|
||||
class AccessibleCaret
|
||||
{
|
||||
public:
|
||||
explicit AccessibleCaret(nsIPresShell* aPresShell);
|
||||
~AccessibleCaret();
|
||||
virtual ~AccessibleCaret();
|
||||
|
||||
// This enumeration representing the visibility and visual style of an
|
||||
// AccessibleCaret.
|
||||
@ -74,7 +74,7 @@ public:
|
||||
return mAppearance;
|
||||
}
|
||||
|
||||
void SetAppearance(Appearance aAppearance);
|
||||
virtual void SetAppearance(Appearance aAppearance);
|
||||
|
||||
// Return true if current appearance is either Normal, NormalNotShown, Left,
|
||||
// or Right.
|
||||
@ -92,7 +92,7 @@ public:
|
||||
|
||||
// Set true to enable the "Text Selection Bar" described in "Text Selection
|
||||
// Visual Spec" in bug 921965.
|
||||
void SetSelectionBarEnabled(bool aEnabled);
|
||||
virtual void SetSelectionBarEnabled(bool aEnabled);
|
||||
|
||||
// This enumeration representing the result returned by SetPosition().
|
||||
enum class PositionChangedResult : uint8_t {
|
||||
@ -105,7 +105,7 @@ public:
|
||||
// Position is out of scroll port.
|
||||
Invisible
|
||||
};
|
||||
PositionChangedResult SetPosition(nsIFrame* aFrame, int32_t aOffset);
|
||||
virtual PositionChangedResult SetPosition(nsIFrame* aFrame, int32_t aOffset);
|
||||
|
||||
// Does two AccessibleCarets overlap?
|
||||
bool Intersects(const AccessibleCaret& aCaret) const;
|
||||
@ -127,7 +127,7 @@ public:
|
||||
return mCaretElementHolder->GetContentNode();
|
||||
}
|
||||
|
||||
private:
|
||||
protected:
|
||||
// Argument aRect should be relative to CustomContentContainerFrame().
|
||||
void SetCaretElementStyle(const nsRect& aRect);
|
||||
void SetSelectionBarElementStyle(const nsRect& aRect);
|
||||
|
Loading…
Reference in New Issue
Block a user