Closed
Bug 657353
Opened 14 years ago
Closed 13 years ago
Stop sending BeginUpdate/EndUpdate on content state changes
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla7
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
Details
Attachments
(3 files)
4.69 KB,
patch
|
sicking
:
review+
|
Details | Diff | Splinter Review |
41.28 KB,
patch
|
sicking
:
review+
|
Details | Diff | Splinter Review |
858 bytes,
patch
|
mounir
:
review+
|
Details | Diff | Splinter Review |
It's slow, we don't need it. See bug 653887.
Assignee | ||
Comment 1•14 years ago
|
||
Assignee | ||
Updated•14 years ago
|
Attachment #532635 -
Flags: review?(jonas)
Assignee | ||
Comment 2•14 years ago
|
||
Attachment #532636 -
Flags: review?(jonas)
Comment on attachment 532635 [details] [diff] [review]
part 1. Switch the XML prettyprinter to using a script runner instead of EndUpdate to determine when to drop prettyprinting.
Review of attachment 532635 [details] [diff] [review]:
-----------------------------------------------------------------
r=me
::: content/xml/document/src/nsXMLPrettyPrinter.cpp
@@ +203,5 @@
> mUnhookPending = PR_TRUE;
> + if (!nsContentUtils::AddScriptRunner(
> + NS_NewRunnableMethod(this, &nsXMLPrettyPrinter::Unhook))) {
> + mUnhookPending = PR_FALSE;
> + }
No need to handle the failure case here. AddScriptRunner no longer can fail due to nsTArray using infallible malloc.
(we should make it return void, but someone needs to write that patch)
Attachment #532635 -
Flags: review?(jonas) → review+
Assignee | ||
Comment 4•14 years ago
|
||
> No need to handle the failure case here.
Excellent. Fixed.
Comment on attachment 532636 [details] [diff] [review]
part 2. Switch content state updates away from calling Begin/EndUpdate.
Review of attachment 532636 [details] [diff] [review]:
-----------------------------------------------------------------
My money is on that a lot of these aren't needed, but better stay on the safe side. But do add an assertion to nsDocument::ContentStateChanged that checks that we're inside a scriptblocker so that it'll be easier to remove them in the future.
::: content/base/src/nsGenericElement.cpp
@@ +4735,5 @@
>
> if (aNotify) {
> stateMask ^= IntrinsicState();
> if (document && !stateMask.IsEmpty()) {
> + nsAutoScriptBlocker scriptBlocker;
Shouldn't we already be in a scriptblocker at this point? Wanna change this into just an assertion?
@@ +4980,5 @@
>
> if (aNotify) {
> stateMask ^= IntrinsicState();
> if (document && !stateMask.IsEmpty()) {
> + nsAutoScriptBlocker scriptBlocker;
Same here.
::: content/html/content/src/nsGenericHTMLElement.cpp
@@ +2671,5 @@
> // Go ahead and notify on that change.
> // Note: no need to notify on CanBeDisabled(), since type attr
> // changes can't affect that.
> if (doc && aNotify) {
> + nsAutoScriptBlocker scriptBlocker;
This one also doesn't seem needed for the same reason.
@@ +2988,5 @@
> aStates |= NS_EVENT_STATE_DISABLED | NS_EVENT_STATE_ENABLED;
>
> nsIDocument* doc = GetCurrentDoc();
> if (doc) {
> + nsAutoScriptBlocker scriptBlocker;
I *think* this one isn't needed either.
::: content/html/content/src/nsHTMLButtonElement.cpp
@@ +579,5 @@
>
> if (aNotify && !states.IsEmpty()) {
> nsIDocument* doc = GetCurrentDoc();
> if (doc) {
> + nsAutoScriptBlocker scriptBlocker;
Not needed.
::: content/html/content/src/nsHTMLFormElement.cpp
@@ +384,5 @@
> // Update all form elements states because they might be [no longer]
> // affected by :-moz-ui-valid or :-moz-ui-invalid.
> nsIDocument* doc = GetCurrentDoc();
> if (doc) {
> + nsAutoScriptBlocker scriptBlocker;
Not needed
::: content/html/content/src/nsHTMLInputElement.cpp
@@ +953,5 @@
> states |= NS_EVENT_STATE_MOZ_READONLY | NS_EVENT_STATE_MOZ_READWRITE;
> }
>
> if (doc && !states.IsEmpty()) {
> + nsAutoScriptBlocker scriptBlocker;
Not needed
::: content/html/content/src/nsHTMLTextAreaElement.cpp
@@ +1223,5 @@
> states |= NS_EVENT_STATE_MOZ_READONLY | NS_EVENT_STATE_MOZ_READWRITE;
> }
>
> if (doc && !states.IsEmpty()) {
> + nsAutoScriptBlocker scriptBlocker;
Not needed
::: content/xul/content/src/nsXULElement.cpp
@@ +1470,5 @@
>
> if (aNotify) {
> stateMask ^= IntrinsicState();
> if (doc && !stateMask.IsEmpty()) {
> + nsAutoScriptBlocker scriptBlocker;
Not needed
Attachment #532636 -
Flags: review?(jonas) → review+
Assignee | ||
Comment 6•13 years ago
|
||
> do add an assertion to nsDocument::ContentStateChanged
Done.
> Shouldn't we already be in a scriptblocker at this point?
Yes. The nsDocument assert will catch it. This used to not be the case when we had removable scriptblockers.
> I *think* this one isn't needed either.
It will be later; I'd rather keep it.
Removed the others.
Assignee | ||
Comment 7•13 years ago
|
||
Pushed:
http://hg.mozilla.org/projects/cedar/rev/d47a10acc66d
http://hg.mozilla.org/projects/cedar/rev/acd4a2d5d3d1
then pushed http://hg.mozilla.org/projects/cedar/rev/963cd7a109be to fix the resulting asserts.
Flags: in-testsuite-
Whiteboard: [need review] → fixed-in-cedar
Target Milestone: --- → mozilla7
Assignee | ||
Comment 8•13 years ago
|
||
Attachment #536519 -
Flags: review?(mounir.lamouri)
Comment 9•13 years ago
|
||
Pushed:
http://hg.mozilla.org/mozilla-central/rev/d47a10acc66d
http://hg.mozilla.org/mozilla-central/rev/acd4a2d5d3d1
Status: NEW → RESOLVED
Closed: 13 years ago
OS: Mac OS X → All
Hardware: x86 → All
Resolution: --- → FIXED
Whiteboard: fixed-in-cedar
Comment 10•13 years ago
|
||
Status: RESOLVED → UNCONFIRMED
Ever confirmed: false
OS: All → Mac OS X
Hardware: All → x86
Resolution: FIXED → ---
Updated•13 years ago
|
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago → 13 years ago
OS: Mac OS X → All
Hardware: x86 → All
Resolution: --- → FIXED
Comment 11•13 years ago
|
||
Comment on attachment 536519 [details] [diff] [review]
The test fix that I pushed
Review of attachment 536519 [details] [diff] [review]:
-----------------------------------------------------------------
Attachment #536519 -
Flags: review?(mounir.lamouri) → review+
Comment 12•13 years ago
|
||
Could you give me a testcase on how i can verify that the issue was fixed?
Thanks.
Assignee | ||
Comment 13•13 years ago
|
||
You can't very easily, short of reading the code and verifying that the change was made. This was just an architectural change laying the groundwork for other changes without a huge amount of user-visible impact. Maybe a small performance win in some cases.
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•