mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-28 13:21:28 +00:00
Bug 1451672 - part 12: Create HTMLEditor::RemoveStyleSheetWithTransaction() as implementation of nsIEditorStyleSheets::RemoveStyleSheet() r=m_kato
MozReview-Commit-ID: BIXU3jzD1rU --HG-- extra : rebase_source : ba0eb79cfbfc6c3f8a30dbed457993e436510409
This commit is contained in:
parent
bd0aa50472
commit
4131c9f033
@ -2915,9 +2915,17 @@ HTMLEditor::ReplaceStyleSheet(const nsAString& aURL)
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::RemoveStyleSheet(const nsAString& aURL)
|
||||
{
|
||||
return RemoveStyleSheetWithTransaction(aURL);
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLEditor::RemoveStyleSheetWithTransaction(const nsAString& aURL)
|
||||
{
|
||||
RefPtr<StyleSheet> sheet = GetStyleSheetForURL(aURL);
|
||||
NS_ENSURE_TRUE(sheet, NS_ERROR_UNEXPECTED);
|
||||
if (NS_WARN_IF(!sheet)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
RefPtr<RemoveStyleSheetTransaction> transaction =
|
||||
RemoveStyleSheetTransaction::Create(*this, *sheet);
|
||||
@ -3419,8 +3427,9 @@ HTMLEditor::StyleSheetLoaded(StyleSheet* aSheet,
|
||||
{
|
||||
AutoPlaceholderBatch batchIt(this);
|
||||
|
||||
if (!mLastStyleSheetURL.IsEmpty())
|
||||
RemoveStyleSheet(mLastStyleSheetURL);
|
||||
if (!mLastStyleSheetURL.IsEmpty()) {
|
||||
RemoveStyleSheetWithTransaction(mLastStyleSheetURL);
|
||||
}
|
||||
|
||||
RefPtr<AddStyleSheetTransaction> transaction =
|
||||
AddStyleSheetTransaction::Create(*this, *aSheet);
|
||||
|
@ -1193,6 +1193,12 @@ protected:
|
||||
*/
|
||||
already_AddRefed<dom::Element> GetSelectedElement(const nsAString& aTagName);
|
||||
|
||||
/**
|
||||
* RemoveStyleSheetWithTransaction() removes the given URL stylesheet
|
||||
* from mStyleSheets and mStyleSheetURLs.
|
||||
*/
|
||||
nsresult RemoveStyleSheetWithTransaction(const nsAString& aURL);
|
||||
|
||||
protected:
|
||||
RefPtr<TypeInState> mTypeInState;
|
||||
RefPtr<ComposerCommandsUpdater> mComposerCommandsUpdater;
|
||||
|
Loading…
x
Reference in New Issue
Block a user