author | Ehsan Akhgari <ehsan@mozilla.com> |
Thu, 20 Oct 2011 12:27:48 -0400 | |
changeset 79025 | 7324c75b47caba4cd479db1b25e1fe3310e187ca |
parent 79024 | 269ee0275709eb007bc3cc8f82fe649efe07791a |
child 79026 | 064189e08af2f25ff05157efce6fb61633070341 |
push id | 2812 |
push user | eakhgari@mozilla.com |
push date | Thu, 20 Oct 2011 16:29:30 +0000 |
treeherder | mozilla-inbound@7324c75b47ca [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | bz, peterv |
bugs | 694880 |
milestone | 10.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/content/html/document/src/nsHTMLDocument.cpp +++ b/content/html/document/src/nsHTMLDocument.cpp @@ -2694,27 +2694,25 @@ nsHTMLDocument::GetDocumentAllResult(con // There's only 0 or 1 items. Return the first one or null. *aCache = cont = docAllList->Item(0, true); return cont; } static void -NotifyEditableStateChange(nsINode *aNode, nsIDocument *aDocument, - bool aEditable) +NotifyEditableStateChange(nsINode *aNode, nsIDocument *aDocument) { for (nsIContent* child = aNode->GetFirstChild(); child; child = child->GetNextSibling()) { - if (child->HasFlag(NODE_IS_EDITABLE) != aEditable && - child->IsElement()) { + if (child->IsElement()) { child->AsElement()->UpdateState(true); } - NotifyEditableStateChange(child, aDocument, aEditable); + NotifyEditableStateChange(child, aDocument); } } void nsHTMLDocument::TearingDownEditor(nsIEditor *aEditor) { if (IsEditingOn()) { EditingState oldState = mEditingState; @@ -2797,16 +2795,18 @@ nsHTMLDocument::EditingStateChanged() (mContentEditableCount > 0 ? eContentEditable : eOff); if (mEditingState == newState) { // No changes in editing mode. return NS_OK; } if (newState == eOff) { // Editing is being turned off. + nsAutoScriptBlocker scriptBlocker; + NotifyEditableStateChange(this, this); return TurnEditingOff(); } // Flush out style changes on our _parent_ document, if any, so that // our check for a presshell won't get stale information. if (mParentDocument) { mParentDocument->FlushPendingNotifications(Flush_Style); } @@ -2953,17 +2953,17 @@ nsHTMLDocument::EditingStateChanged() mEditingState = eOff; return rv; } } if (updateState) { nsAutoScriptBlocker scriptBlocker; - NotifyEditableStateChange(this, this, designMode); + NotifyEditableStateChange(this, this); } // Resync the editor's spellcheck state. if (spellRecheckAll) { nsCOMPtr<nsISelectionController> selcon; nsresult rv = editor->GetSelectionController(getter_AddRefs(selcon)); NS_ENSURE_SUCCESS(rv, rv);
new file mode 100644 --- /dev/null +++ b/layout/reftests/editor/694880-1.html @@ -0,0 +1,10 @@ +<!DOCTYPE html> +<html> + <style> + :-moz-read-only { color: green; } + :-moz-read-write { color: red; } + </style> + <body onload="document.designMode='on';document.designMode='off'"> + <div>test</div> + </body> +</html>
new file mode 100644 --- /dev/null +++ b/layout/reftests/editor/694880-2.html @@ -0,0 +1,11 @@ +<!DOCTYPE html> +<html> + <style> + :-moz-read-only { color: green; } + :-moz-read-write { color: red; } + </style> + <body onload="document.designMode='on';document.designMode='off'"> + <div>test</div> + <div contenteditable></div> + </body> +</html>
new file mode 100644 --- /dev/null +++ b/layout/reftests/editor/694880-3.html @@ -0,0 +1,10 @@ +<!DOCTYPE html> +<html> + <style> + :-moz-read-only { color: red; } + :-moz-read-write { color: green; } + </style> + <body onload="document.designMode='on';document.designMode='off'"> + <div contenteditable>test</div> + </body> +</html>
new file mode 100644 --- /dev/null +++ b/layout/reftests/editor/694880-ref.html @@ -0,0 +1,9 @@ +<!DOCTYPE html> +<html> + <style> + div { color: green; } + </style> + <body> + <div>test</div> + </body> +</html>
--- a/layout/reftests/editor/reftest.list +++ b/layout/reftests/editor/reftest.list @@ -83,8 +83,11 @@ skip-if(Android) == 674212-spellcheck.ht skip-if(Android) == 338427-2.html 338427-2-ref.html skip-if(Android) needs-focus == 338427-3.html 338427-3-ref.html skip-if(Android) == 462758-grabbers-resizers.html 462758-grabbers-resizers-ref.html == readwrite-non-editable.html readwrite-non-editable-ref.html == readwrite-editable.html readwrite-editable-ref.html == readonly-non-editable.html readonly-non-editable-ref.html == readonly-editable.html readonly-editable-ref.html == dynamic-overflow-change.html dynamic-overflow-change-ref.html +== 694880-1.html 694880-ref.html +== 694880-2.html 694880-ref.html +== 694880-3.html 694880-ref.html