mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 18:04:46 +00:00
Bug 1745882 - Move all editor prefs in all.js
to StaticPrefList.yaml
r=m_kato
Depends on D133729 Differential Revision: https://phabricator.services.mozilla.com/D133730
This commit is contained in:
parent
ebc7512e63
commit
667224045f
@ -3,16 +3,19 @@
|
||||
* 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/CSSEditUtils.h"
|
||||
#include "CSSEditUtils.h"
|
||||
|
||||
#include "ChangeStyleTransaction.h"
|
||||
#include "HTMLEditor.h"
|
||||
#include "HTMLEditUtils.h"
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/ChangeStyleTransaction.h"
|
||||
#include "mozilla/HTMLEditor.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/DeclarationBlock.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/mozalloc.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/StaticPrefs_editor.h"
|
||||
#include "mozilla/dom/Document.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsAString.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCSSProps.h"
|
||||
@ -25,7 +28,6 @@
|
||||
#include "nsAtom.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsICSSDeclaration.h"
|
||||
#include "mozilla/dom/Document.h"
|
||||
#include "nsINode.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsISupportsUtils.h"
|
||||
@ -279,10 +281,8 @@ const CSSEditUtils::CSSEquivTable hrAlignEquivTable[] = {
|
||||
#undef CSS_EQUIV_TABLE_NONE
|
||||
|
||||
CSSEditUtils::CSSEditUtils(HTMLEditor* aHTMLEditor)
|
||||
: mHTMLEditor(aHTMLEditor), mIsCSSPrefChecked(true) {
|
||||
// let's retrieve the value of the "CSS editing" pref
|
||||
mIsCSSPrefChecked = Preferences::GetBool("editor.use_css", mIsCSSPrefChecked);
|
||||
}
|
||||
: mHTMLEditor(aHTMLEditor),
|
||||
mIsCSSPrefChecked(StaticPrefs::editor_use_css()) {}
|
||||
|
||||
// Answers true if we have some CSS equivalence for the HTML style defined
|
||||
// by aProperty and/or aAttribute for the node aNode
|
||||
@ -610,7 +610,7 @@ bool CSSEditUtils::IsCSSInvertible(nsAtom& aProperty, nsAtom* aAttribute) {
|
||||
|
||||
// static
|
||||
void CSSEditUtils::GetDefaultBackgroundColor(nsAString& aColor) {
|
||||
if (Preferences::GetBool("editor.use_custom_colors", false)) {
|
||||
if (MOZ_UNLIKELY(StaticPrefs::editor_use_custom_colors())) {
|
||||
nsresult rv = Preferences::GetString("editor.background_color", aColor);
|
||||
// XXX Why don't you validate the pref value?
|
||||
if (NS_FAILED(rv)) {
|
||||
@ -637,10 +637,9 @@ void CSSEditUtils::GetDefaultBackgroundColor(nsAString& aColor) {
|
||||
|
||||
// static
|
||||
void CSSEditUtils::GetDefaultLengthUnit(nsAString& aLengthUnit) {
|
||||
nsresult rv =
|
||||
Preferences::GetString("editor.css.default_length_unit", aLengthUnit);
|
||||
// XXX Why don't you validate the pref value?
|
||||
if (NS_FAILED(rv)) {
|
||||
if (MOZ_UNLIKELY(NS_FAILED(Preferences::GetString(
|
||||
"editor.css.default_length_unit", aLengthUnit)))) {
|
||||
aLengthUnit.AssignLiteral("px");
|
||||
}
|
||||
}
|
||||
|
@ -6,17 +6,19 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "EditAction.h"
|
||||
#include "HTMLEditorEventListener.h"
|
||||
#include "HTMLEditUtils.h"
|
||||
#include "mozilla/EditAction.h"
|
||||
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/mozalloc.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/PresShell.h"
|
||||
#include "mozilla/StaticPrefs_editor.h"
|
||||
#include "mozilla/dom/AncestorIterator.h"
|
||||
#include "mozilla/dom/Selection.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/EventTarget.h"
|
||||
#include "mozilla/mozalloc.h"
|
||||
#include "nsAString.h"
|
||||
#include "nsAlgorithm.h"
|
||||
#include "nsCOMPtr.h"
|
||||
@ -611,9 +613,7 @@ nsresult HTMLEditor::SetFinalPosition(int32_t aX, int32_t aY) {
|
||||
|
||||
void HTMLEditor::AddPositioningOffset(int32_t& aX, int32_t& aY) {
|
||||
// Get the positioning offset
|
||||
int32_t positioningOffset =
|
||||
Preferences::GetInt("editor.positioning.offset", 0);
|
||||
|
||||
const int32_t positioningOffset = StaticPrefs::editor_positioning_offset();
|
||||
aX += positioningOffset;
|
||||
aY += positioningOffset;
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ HTMLEditor::HTMLEditor()
|
||||
mPositionedObjectBorderTop(0),
|
||||
mGridSize(0),
|
||||
mDefaultParagraphSeparator(
|
||||
Preferences::GetBool("editor.use_div_for_default_newlines", true)
|
||||
StaticPrefs::editor_use_div_for_default_newlines()
|
||||
? ParagraphSeparator::div
|
||||
: ParagraphSeparator::br) {
|
||||
mIsHTMLEditorClass = true;
|
||||
|
@ -7,12 +7,14 @@
|
||||
|
||||
#include "HTMLEditorEventListener.h"
|
||||
#include "HTMLEditUtils.h"
|
||||
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
#include "mozilla/MathAlgorithms.h"
|
||||
#include "mozilla/mozalloc.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/PresShell.h"
|
||||
#include "mozilla/mozalloc.h"
|
||||
#include "mozilla/StaticPrefs_editor.h"
|
||||
#include "mozilla/dom/Event.h"
|
||||
#include "mozilla/dom/MouseEvent.h"
|
||||
#include "mozilla/dom/EventTarget.h"
|
||||
@ -670,9 +672,8 @@ nsresult HTMLEditor::StartResizing(Element& aHandleElement) {
|
||||
"Element::SetAttr(nsGkAtoms::_moz_activated, true) failed");
|
||||
|
||||
// do we want to preserve ratio or not?
|
||||
bool preserveRatio =
|
||||
HTMLEditUtils::IsImage(mResizedObject) &&
|
||||
Preferences::GetBool("editor.resizing.preserve_ratio", true);
|
||||
const bool preserveRatio = StaticPrefs::editor_resizing_preserve_ratio() &&
|
||||
HTMLEditUtils::IsImage(mResizedObject);
|
||||
|
||||
// the way we change the position/size of the shadow depends on
|
||||
// the handle
|
||||
|
@ -4228,6 +4228,13 @@
|
||||
# Prefs starting with "editor"
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# Default background color of HTML editor. This is referred only when
|
||||
# "editor.use_custom_colors" is set to `true`.
|
||||
- name: editor.background_color
|
||||
type: String
|
||||
value: "#FFFFFF"
|
||||
mirror: never
|
||||
|
||||
# Use CreateElementTransaction or not. This is available only in a couple of
|
||||
# release cycles to make it possible to cancel stopping using
|
||||
# CreateElementTransaction.
|
||||
@ -4236,6 +4243,14 @@
|
||||
value: false
|
||||
mirror: always
|
||||
|
||||
# Default length unit of indent blocks with CSS.
|
||||
# TODO: Delete this pref after checking the compatibility with the other
|
||||
# browsers.
|
||||
- name: editor.css.default_length_unit
|
||||
type: String
|
||||
value: "px"
|
||||
mirror: never
|
||||
|
||||
# Allow or disallow to delete `<hr>` element when caret is at start of
|
||||
# following line of the element. If false, Backspace from start of following
|
||||
# line of an `<hr>` element causes moving caret to immediatly after the `<hr>`
|
||||
@ -4263,26 +4278,18 @@
|
||||
value: false
|
||||
mirror: always
|
||||
|
||||
# General prefs for editor, indicating whether Gecko-specific editing UI is
|
||||
# enabled by default. Those UIs are not implemented by any other browsers. So,
|
||||
# only Firefox users can change some styles with them. This means that Firefox
|
||||
# users may get unexpected result of some web apps if they assume that users
|
||||
# cannot change such styles.
|
||||
- name: editor.resizing.enabled_by_default
|
||||
type: bool
|
||||
value: false
|
||||
mirror: always
|
||||
- name: editor.inline_table_editing.enabled_by_default
|
||||
type: bool
|
||||
value: false
|
||||
mirror: always
|
||||
- name: editor.positioning.enabled_by_default
|
||||
type: bool
|
||||
value: false
|
||||
# When an element becomes absolutely positioned, this offset is applied to
|
||||
# both `left` and `top`.
|
||||
# TODO: Delete this pref after verifying that nobody uses this pref.
|
||||
- name: editor.positioning.offset
|
||||
type: int32_t
|
||||
value: 0
|
||||
mirror: always
|
||||
|
||||
# Whether user pastes should be truncated.
|
||||
- name: editor.truncate_user_pastes
|
||||
# Whether resizer keeps aspect ratio of `<img>` or can change its width/height
|
||||
# independently.
|
||||
# TODO: Delete this pref after verifying that nobody uses this pref.
|
||||
- name: editor.resizing.preserve_ratio
|
||||
type: bool
|
||||
value: true
|
||||
mirror: always
|
||||
@ -4301,6 +4308,39 @@
|
||||
value: 2
|
||||
mirror: always
|
||||
|
||||
# Whether user pastes should be truncated.
|
||||
- name: editor.truncate_user_pastes
|
||||
type: bool
|
||||
value: true
|
||||
mirror: always
|
||||
|
||||
# When this is set to `true`, "editor.background_color" must be set, then,
|
||||
# the value is treated as default background color of the HTML editor.
|
||||
# If `false` and "browser.display.use_system_colors" is set to `true`,
|
||||
# "browser.display.background_color" is used instead.
|
||||
# Otherwise, no color is used as default background color.
|
||||
# This pref is for Thunderbird and SeaMonkey.
|
||||
- name: editor.use_custom_colors
|
||||
type: bool
|
||||
value: false
|
||||
mirror: always
|
||||
|
||||
# If this is set to `true`, CSS mode of style editor is enabled by default
|
||||
# unless it's a mail editor.
|
||||
# This pref is for Thunderbird and SeaMonkey.
|
||||
- name: editor.use_css
|
||||
type: bool
|
||||
value: false
|
||||
mirror: always
|
||||
|
||||
# Whether inserting <div> when typing Enter in a block element which can
|
||||
# contain <div>. If false, inserts <br> instead.
|
||||
# TODO: Delete this pref after verifying nobody uses this pref.
|
||||
- name: editor.use_div_for_default_newlines
|
||||
type: bool
|
||||
value: true
|
||||
mirror: always
|
||||
|
||||
# Whether enabling blink compatible white-space normalizer or keep using
|
||||
# Gecko's traditional white-space normalizer.
|
||||
- name: editor.white_space_normalization.blink_compatible
|
||||
@ -4308,6 +4348,24 @@
|
||||
value: false
|
||||
mirror: always
|
||||
|
||||
# General prefs for editor, indicating whether Gecko-specific editing UI is
|
||||
# enabled by default. Those UIs are not implemented by any other browsers. So,
|
||||
# only Firefox users can change some styles with them. This means that Firefox
|
||||
# users may get unexpected result of some web apps if they assume that users
|
||||
# cannot change such styles.
|
||||
- name: editor.resizing.enabled_by_default
|
||||
type: bool
|
||||
value: false
|
||||
mirror: always
|
||||
- name: editor.inline_table_editing.enabled_by_default
|
||||
type: bool
|
||||
value: false
|
||||
mirror: always
|
||||
- name: editor.positioning.enabled_by_default
|
||||
type: bool
|
||||
value: false
|
||||
mirror: always
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Prefs starting with "extensions."
|
||||
#---------------------------------------------------------------------------
|
||||
|
@ -1001,18 +1001,6 @@ pref("print.print_edge_bottom", 0);
|
||||
pref("print.print_in_color", true);
|
||||
#endif
|
||||
|
||||
// Whether inserting <div> when typing Enter in a block element which can
|
||||
// contain <div>. If false, inserts <br> instead.
|
||||
pref("editor.use_div_for_default_newlines", true);
|
||||
|
||||
// Prefs specific to seamonkey composer belong in
|
||||
// comm-central/editor/ui/composer.js
|
||||
pref("editor.use_custom_colors", false);
|
||||
pref("editor.use_css", false);
|
||||
pref("editor.css.default_length_unit", "px");
|
||||
pref("editor.resizing.preserve_ratio", true);
|
||||
pref("editor.positioning.offset", 0);
|
||||
|
||||
// Scripts & Windows prefs
|
||||
pref("dom.beforeunload_timeout_ms", 1000);
|
||||
pref("dom.disable_window_flip", false);
|
||||
@ -2385,9 +2373,6 @@ pref("plugin.override_internal_types", false);
|
||||
// enable single finger gesture input (win7+ tablets)
|
||||
pref("gestures.enable_single_finger_input", true);
|
||||
|
||||
pref("editor.resizing.preserve_ratio", true);
|
||||
pref("editor.positioning.offset", 0);
|
||||
|
||||
pref("dom.use_watchdog", true);
|
||||
|
||||
// Stop all scripts in a compartment when the "stop script" dialog is used.
|
||||
|
Loading…
Reference in New Issue
Block a user