зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1485063 Part 1 - Move preferences used in AccessibleCaret to StaticPrefsList.h r=mats
Differential Revision: https://phabricator.services.mozilla.com/D5470
This commit is contained in:
Родитель
b47b2129d2
Коммит
5d3dc041de
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include "AccessibleCaretLogger.h"
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/StaticPrefs.h"
|
||||
#include "mozilla/ToString.h"
|
||||
#include "nsCanvasFrame.h"
|
||||
#include "nsCaret.h"
|
||||
|
@ -30,10 +30,6 @@ using namespace dom;
|
|||
|
||||
NS_IMPL_ISUPPORTS(AccessibleCaret::DummyTouchListener, nsIDOMEventListener)
|
||||
|
||||
float AccessibleCaret::sWidth = 0.0f;
|
||||
float AccessibleCaret::sHeight = 0.0f;
|
||||
float AccessibleCaret::sMarginLeft = 0.0f;
|
||||
|
||||
NS_NAMED_LITERAL_STRING(AccessibleCaret::sTextOverlayElementId, "text-overlay");
|
||||
NS_NAMED_LITERAL_STRING(AccessibleCaret::sCaretImageElementId, "image");
|
||||
|
||||
|
@ -78,14 +74,6 @@ AccessibleCaret::AccessibleCaret(nsIPresShell* aPresShell)
|
|||
MOZ_ASSERT(mPresShell->GetDocument());
|
||||
InjectCaretElement(mPresShell->GetDocument());
|
||||
}
|
||||
|
||||
static bool prefsAdded = false;
|
||||
if (!prefsAdded) {
|
||||
Preferences::AddFloatVarCache(&sWidth, "layout.accessiblecaret.width");
|
||||
Preferences::AddFloatVarCache(&sHeight, "layout.accessiblecaret.height");
|
||||
Preferences::AddFloatVarCache(&sMarginLeft, "layout.accessiblecaret.margin-left");
|
||||
prefsAdded = true;
|
||||
}
|
||||
}
|
||||
|
||||
AccessibleCaret::~AccessibleCaret()
|
||||
|
@ -316,11 +304,12 @@ AccessibleCaret::SetCaretElementStyle(const nsRect& aRect, float aZoomLevel)
|
|||
nsPresContext::AppUnitsToIntCSSPixels(position.y));
|
||||
// We can't use AppendPrintf here, because it does locale-specific
|
||||
// formatting of floating-point values.
|
||||
styleStr.AppendFloat(sWidth/aZoomLevel);
|
||||
styleStr.AppendFloat(StaticPrefs::layout_accessiblecaret_width() / aZoomLevel);
|
||||
styleStr.AppendLiteral("px; height: ");
|
||||
styleStr.AppendFloat(sHeight/aZoomLevel);
|
||||
styleStr.AppendFloat(StaticPrefs::layout_accessiblecaret_height() / aZoomLevel);
|
||||
styleStr.AppendLiteral("px; margin-left: ");
|
||||
styleStr.AppendFloat(sMarginLeft/aZoomLevel);
|
||||
styleStr.AppendFloat(
|
||||
StaticPrefs::layout_accessiblecaret_margin_left() / aZoomLevel);
|
||||
styleStr.AppendLiteral("px");
|
||||
|
||||
CaretElement().SetAttr(kNameSpaceID_None, nsGkAtoms::style, styleStr, true);
|
||||
|
|
|
@ -229,9 +229,6 @@ protected:
|
|||
RefPtr<DummyTouchListener> mDummyTouchListener{new DummyTouchListener()};
|
||||
|
||||
// Static class variables
|
||||
static float sWidth;
|
||||
static float sHeight;
|
||||
static float sMarginLeft;
|
||||
static const nsLiteralString sTextOverlayElementId;
|
||||
static const nsLiteralString sCaretImageElementId;
|
||||
|
||||
|
|
|
@ -446,6 +446,26 @@ VARCACHE_PREF(
|
|||
// Layout prefs
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// CSS attributes (width, height, margin-left) of the AccessibleCaret in CSS
|
||||
// pixels.
|
||||
VARCACHE_PREF(
|
||||
"layout.accessiblecaret.width",
|
||||
layout_accessiblecaret_width,
|
||||
float, 34.0f
|
||||
)
|
||||
|
||||
VARCACHE_PREF(
|
||||
"layout.accessiblecaret.height",
|
||||
layout_accessiblecaret_height,
|
||||
float, 36.0f
|
||||
)
|
||||
|
||||
VARCACHE_PREF(
|
||||
"layout.accessiblecaret.margin-left",
|
||||
layout_accessiblecaret_margin_left,
|
||||
float, -18.5f
|
||||
)
|
||||
|
||||
// Is parallel CSS parsing enabled?
|
||||
VARCACHE_PREF(
|
||||
"layout.css.parsing.parallel",
|
||||
|
|
|
@ -5525,11 +5525,6 @@ pref("layout.accessiblecaret.enabled", false);
|
|||
// overriding the layout.accessiblecaret.enabled pref.
|
||||
pref("layout.accessiblecaret.enabled_on_touch", true);
|
||||
|
||||
// CSS attributes of the AccessibleCaret in CSS pixels.
|
||||
pref("layout.accessiblecaret.width", "34.0");
|
||||
pref("layout.accessiblecaret.height", "36.0");
|
||||
pref("layout.accessiblecaret.margin-left", "-18.5");
|
||||
|
||||
// Show the caret when long tapping on an empty content.
|
||||
pref("layout.accessiblecaret.caret_shown_when_long_tapping_on_empty_content", false);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче