Closed
Bug 467144
Opened 16 years ago
Closed 15 years ago
nsIMutationObserver::AttributeChanged should provide old attribute value
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
People
(Reporter: surkov, Assigned: davidb)
References
(Blocks 3 open bugs)
Details
Attachments
(1 file, 3 obsolete files)
25.37 KB,
patch
|
bzbarsky
:
review+
sicking
:
superreview+
|
Details | Diff | Splinter Review |
nsIMutationObserver::AttributeChanged should provide old attribute value. This will allow to send accessibility events correctly (bug 467143 and bug 452388) when ARIA attributes are changed. Does this sound well enough to start the work on patch?
Comment 1•16 years ago
|
||
1) This would impose a noticeable performance penalty on some common operations (e.g. setting foo.style.whatever). 2) This _could_ probably be done in most cases without too much performance penalty if bug 314286 is fixed. 3) Is a AttributeWillChange which provides the new value (and the element, so you can get the old value) a reasonable solution here? See also bug 231676.
Blocks: 381599
Reporter | ||
Comment 2•16 years ago
|
||
(In reply to comment #1) > 3) Is a AttributeWillChange which provides the new value (and the element, so > you > can get the old value) a reasonable solution here? Almost all we need is to notify AT. We could use delayed events in the case of AttributeWillChange. Therefore I think it should be good way if the change of AttributeChanged method hits performance.
Comment 3•16 years ago
|
||
Could a11y cache the attribute values it needs? Maybe there isn't need to cache the string value, but just some enum or integer?
Assignee | ||
Comment 4•16 years ago
|
||
(In reply to comment #3) > Could a11y cache the attribute values it needs? Maybe there isn't need to > cache the string value, but just some enum or integer? In theory I think we could, the ones we really care about have NMTOKEN values. Surkov? Thoughts?
Reporter | ||
Comment 5•16 years ago
|
||
I don't think caching will work until we create accessible tree on demand. In the meantime if attribute is changed then may create accessible for DOM element attribute is changed for. That means we don't have proper place to cache attribute values only if we don't want to run through whole DOM to prepare initial caching. As well we aren't restricted by NMTOKEN values. If we want to implement inverse relations properly then we need to have previous IDRefs values to avoid relation recreation.
Assignee | ||
Comment 6•16 years ago
|
||
Yeah, after running a few laps, I think Boris's AttributeWillChange approach from comment #1 is a good candidate. (I've read over the related bugs) Do we want to start exploring this, perhaps via #ifdef ACCESSIBILITY for now? And by "we", I mean probably not me (yet). Volunteers?
Assignee | ||
Comment 7•16 years ago
|
||
Olli what do you think about the AttributeWillChange approach?
Assignee | ||
Comment 8•16 years ago
|
||
Okay, Smaug mentioned on IRC that the approach sounded right. Posting this early WIP to see if we are all on the same page.
Assignee: nobody → bolterbugz
Status: NEW → ASSIGNED
Comment 9•16 years ago
|
||
You don't need a state mask there. And there are indent issues. And you probably want to send that notification even if there is no current document on the node. And nix nsIDocument::AttributeWillChange and use this notification instead. With those nits, looks about right.
Assignee | ||
Comment 10•16 years ago
|
||
Tweaked slightly since last try server run (which passed fine with a couple of known orange, perf was green). Trying this one now.
Attachment #381835 -
Attachment is obsolete: true
Assignee | ||
Comment 11•16 years ago
|
||
Comment on attachment 382150 [details] [diff] [review] wip2 How's this looking? (Try server looked ok)
Attachment #382150 -
Flags: review?(bzbarsky)
Comment 12•16 years ago
|
||
>+nsDocument::AttributeWillChange(nsIDocument* aDocument, Fix the indent of the function arguments here. >+ And don't add the blank line? >+ nsIContent* content = static_cast<nsIContent*>(this); You shouldn't need the cast. Just pass |this| to nsNodeUtils::AttributeWillChange. This applies to both cases where you do that. And fix the indent on the first caller too? > +nsXULDocument::AttributeWillChange(nsIDocument* aDocument, Again, fix the indent. >nsHTMLFramesetFrame::FrameResizePrefCallback(const char* aPref, void* aClosure) >+ nsNodeUtils::AttributeWillChange(frame->mContent, kNameSpaceID_None, Fix the indent here too? And this call should be conditioned on |doc|, no? With those nits looks ok; I'd like Jonas to look over the nsGenericElement and nsXULElement changes just to make sure that the point where we're making this call is early enough (so that we still have our original value) and that those are all the places where we need to make the call.
Assignee | ||
Comment 13•16 years ago
|
||
Okay thanks, I think I fixed the nits here. Jonas, as per comment #12, your thoughts?
Attachment #382150 -
Attachment is obsolete: true
Attachment #382290 -
Flags: review?(jonas)
Attachment #382290 -
Flags: review?(bzbarsky)
Attachment #382150 -
Flags: review?(bzbarsky)
Comment 14•16 years ago
|
||
That patch didn't fix the nsXULDocument indent, still has the unnecessary nsIContent* temporaries when calling into nodeutils, and still has the weird indent in FrameResizePrefCallback.
Assignee | ||
Comment 15•16 years ago
|
||
Agreed. There is no need for the nsIContent* temporaries -- fixing. (I could have sworn I saw this elsewhere in the same file and was trusting the precedent). I'm also going to win this indent battle with Eclipse; sorry.
Assignee | ||
Comment 16•16 years ago
|
||
OK I think the indent battle is won, and the unnecessary temp vars are removed. Note I moved the document->ForgetLink call after the AttributeWillChange notification in nsGenericElement because it seems safer?
Attachment #382290 -
Attachment is obsolete: true
Attachment #382314 -
Flags: review?(jonas)
Attachment #382314 -
Flags: review?(bzbarsky)
Attachment #382290 -
Flags: review?(jonas)
Attachment #382290 -
Flags: review?(bzbarsky)
Updated•16 years ago
|
Attachment #382314 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 17•16 years ago
|
||
While we are here... We're going to need to know when nodes are going to be removed. Perhaps the existing NodeWillBeDestroyed would suffice? Are nodes ever removed and not destroyed?
Assignee | ||
Comment 18•16 years ago
|
||
Actually a quick chat with Smaug I realize ContentRemoved should be sufficient. Please disregard comment #17 (at least for now).
Assignee | ||
Comment 19•16 years ago
|
||
Jonas, a friendly ping for your r? :)
Attachment #382314 -
Flags: review?(jonas) → superreview+
Assignee | ||
Comment 20•15 years ago
|
||
Pushed on 1.9.2: http://hg.mozilla.org/mozilla-central/rev/9c23b293dc4e
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Updated•15 years ago
|
Keywords: dev-doc-needed
Updated•15 years ago
|
Keywords: dev-doc-needed
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
•