зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1482023 - Create HTMLEditor::EnableStyleSheetInternal() for internal use r=m_kato
HTMLEditor::EnableStyleSheet() is an XPCOM method but it's used internally. Therefore, we should create non-virtual method for internal use. Differential Revision: https://phabricator.services.mozilla.com/D3456 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
e9f6afbc49
Коммит
b01e3d2d25
|
@ -3097,7 +3097,7 @@ HTMLEditor::ReplaceOverrideStyleSheet(const nsAString& aURL)
|
|||
// Disable last sheet if not the same as new one
|
||||
if (!mLastOverrideStyleSheetURL.IsEmpty() &&
|
||||
!mLastOverrideStyleSheetURL.Equals(aURL)) {
|
||||
return EnableStyleSheet(mLastOverrideStyleSheetURL, false);
|
||||
EnableStyleSheetInternal(mLastOverrideStyleSheetURL, false);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -3152,10 +3152,21 @@ HTMLEditor::RemoveOverrideStyleSheetInternal(const nsAString& aURL)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::EnableStyleSheet(const nsAString& aURL, bool aEnable)
|
||||
HTMLEditor::EnableStyleSheet(const nsAString& aURL,
|
||||
bool aEnable)
|
||||
{
|
||||
EnableStyleSheetInternal(aURL, aEnable);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
HTMLEditor::EnableStyleSheetInternal(const nsAString& aURL,
|
||||
bool aEnable)
|
||||
{
|
||||
RefPtr<StyleSheet> sheet = GetStyleSheetForURL(aURL);
|
||||
NS_ENSURE_TRUE(sheet, NS_OK); // Don't fail if sheet not found
|
||||
if (!sheet) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Ensure the style sheet is owned by our document.
|
||||
nsCOMPtr<nsIDocument> document = GetDocument();
|
||||
|
@ -3163,7 +3174,6 @@ HTMLEditor::EnableStyleSheet(const nsAString& aURL, bool aEnable)
|
|||
document, StyleSheet::NotOwnedByDocumentOrShadowRoot);
|
||||
|
||||
sheet->SetDisabled(!aEnable);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -1008,6 +1008,17 @@ protected: // Shouldn't be used by friend classes
|
|||
*/
|
||||
nsresult RemoveOverrideStyleSheetInternal(const nsAString& aURL);
|
||||
|
||||
/**
|
||||
* Enable or disable the style sheet synchronously.
|
||||
* aURL is just a key to specify a style sheet in the internal array.
|
||||
* I.e., the style sheet has already been registered with
|
||||
* AddOverrideStyleSheetInternal().
|
||||
*
|
||||
* @param aURL URL to the style sheet.
|
||||
* @param aEnable true if enable the style sheet. false if disable it.
|
||||
*/
|
||||
void EnableStyleSheetInternal(const nsAString& aURL, bool aEnable);
|
||||
|
||||
/**
|
||||
* MaybeCollapseSelectionAtFirstEditableNode() may collapse selection at
|
||||
* proper position to staring to edit. If there is a non-editable node
|
||||
|
|
Загрузка…
Ссылка в новой задаче