зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1599843 - Document::ChangeContentEditableCount is infallible. r=masayuki
And should take Element, not nsIContent pointers. Depends on D54993 Differential Revision: https://phabricator.services.mozilla.com/D54994 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
779f56be04
Коммит
8f0845aadf
|
@ -5299,7 +5299,7 @@ nsresult Document::EditingStateChanged() {
|
|||
// Helper class, used below in ChangeContentEditableCount().
|
||||
class DeferredContentEditableCountChangeEvent : public Runnable {
|
||||
public:
|
||||
DeferredContentEditableCountChangeEvent(Document* aDoc, nsIContent* aElement)
|
||||
DeferredContentEditableCountChangeEvent(Document* aDoc, Element* aElement)
|
||||
: mozilla::Runnable("DeferredContentEditableCountChangeEvent"),
|
||||
mDoc(aDoc),
|
||||
mElement(aElement) {}
|
||||
|
@ -5313,11 +5313,10 @@ class DeferredContentEditableCountChangeEvent : public Runnable {
|
|||
|
||||
private:
|
||||
RefPtr<Document> mDoc;
|
||||
nsCOMPtr<nsIContent> mElement;
|
||||
RefPtr<Element> mElement;
|
||||
};
|
||||
|
||||
nsresult Document::ChangeContentEditableCount(nsIContent* aElement,
|
||||
int32_t aChange) {
|
||||
void Document::ChangeContentEditableCount(Element* aElement, int32_t aChange) {
|
||||
NS_ASSERTION(int32_t(mContentEditableCount) + aChange >= 0,
|
||||
"Trying to decrement too much.");
|
||||
|
||||
|
@ -5325,11 +5324,9 @@ nsresult Document::ChangeContentEditableCount(nsIContent* aElement,
|
|||
|
||||
nsContentUtils::AddScriptRunner(
|
||||
new DeferredContentEditableCountChangeEvent(this, aElement));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void Document::DeferredContentEditableCountChange(nsIContent* aElement) {
|
||||
void Document::DeferredContentEditableCountChange(Element* aElement) {
|
||||
if (mParser ||
|
||||
(mUpdateNestLevel > 0 && (mContentEditableCount > 0) != IsEditingOn())) {
|
||||
return;
|
||||
|
|
|
@ -1747,13 +1747,11 @@ class Document : public nsINode,
|
|||
* Should be called when an element's editable changes as a result of
|
||||
* changing its contentEditable attribute/property.
|
||||
*
|
||||
* @param aElement the element for which the contentEditable
|
||||
* attribute/property was changed
|
||||
* @param aChange +1 if the contentEditable attribute/property was changed to
|
||||
* true, -1 if it was changed to false
|
||||
* The change should be +1 if the contentEditable attribute/property was
|
||||
* changed to true, -1 if it was changed to false.
|
||||
*/
|
||||
nsresult ChangeContentEditableCount(nsIContent* aElement, int32_t aChange);
|
||||
void DeferredContentEditableCountChange(nsIContent* aElement);
|
||||
void ChangeContentEditableCount(Element*, int32_t aChange);
|
||||
void DeferredContentEditableCountChange(Element*);
|
||||
|
||||
enum class EditingState : int8_t {
|
||||
eTearingDown = -2,
|
||||
|
|
Загрузка…
Ссылка в новой задаче