Bug 1460509 - part 31: Make HTMLEditRules::GetInlineStyles() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato

MozReview-Commit-ID: 3Nk1gBttuwM

--HG--
extra : rebase_source : b9e0d63683407d9e5440157309cb61d213524223
This commit is contained in:
Masayuki Nakano 2018-05-14 23:20:28 +09:00
Родитель d13545d1b1
Коммит 5c4be41f42
2 изменённых файлов: 8 добавлений и 4 удалений

Просмотреть файл

@ -8516,6 +8516,9 @@ HTMLEditRules::GetInlineStyles(nsINode* aNode,
isSet = CSSEditUtils::IsCSSEquivalentToHTMLInlineStyleSet(
aNode, aStyleCache[j].tag, aStyleCache[j].attr, outValue,
CSSEditUtils::eComputed);
if (NS_WARN_IF(!CanHandleEditAction())) {
return NS_ERROR_EDITOR_DESTROYED;
}
}
if (isSet) {
aStyleCache[j].mPresent = true;
@ -8556,7 +8559,7 @@ HTMLEditRules::ReapplyCachedStyles()
InitStyleCacheArray(styleAtInsertionPoint);
nsresult rv = GetInlineStyles(selNode, styleAtInsertionPoint);
if (NS_WARN_IF(NS_FAILED(rv))) {
return NS_OK;
return rv == NS_ERROR_EDITOR_DESTROYED ? NS_ERROR_EDITOR_DESTROYED : NS_OK;
}
for (size_t i = 0; i < SIZE_STYLE_TABLE; ++i) {

Просмотреть файл

@ -778,10 +778,11 @@ protected:
/**
* GetInlineStyles() retrieves the style of aNode and modifies each item of
* aStyleCache.
* aStyleCache. This might cause flushing layout at retrieving computed
* values of CSS properties.
*/
nsresult GetInlineStyles(nsINode* aNode,
StyleCache aStyleCache[SIZE_STYLE_TABLE]);
MOZ_MUST_USE nsresult
GetInlineStyles(nsINode* aNode, StyleCache aStyleCache[SIZE_STYLE_TABLE]);
protected:
HTMLEditor* mHTMLEditor;