Summary: | Would like to have a callback when an HTML element is first added to the DOM | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Aaron Boodman <aa> | ||||||||||||
Component: | WebKit API | Assignee: | Nobody <webkit-unassigned> | ||||||||||||
Status: | RESOLVED FIXED | ||||||||||||||
Severity: | Normal | CC: | ap, hyatt, oliver | ||||||||||||
Priority: | P2 | ||||||||||||||
Version: | 528+ (Nightly build) | ||||||||||||||
Hardware: | Mac | ||||||||||||||
OS: | OS X 10.5 | ||||||||||||||
Attachments: |
|
Description
Aaron Boodman
2009-02-03 11:34:20 PST
Created attachment 27282 [details]
Adds htmlElementAvailable() callback to FrameLoaderClient
This is a first cut of what I'm talking about. It works for HTML and XHTML documents, but not SVG. SVG is not critical for my use case, and it looks like parsing works much differently in SVG.
Also, please let me know what the right way is to add testing for something like this.
Comment on attachment 27282 [details]
Adds htmlElementAvailable() callback to FrameLoaderClient
I think this callback should just be documentElementAvailable rather than being specific to <html>.
You did not patch XHTML, but only patched the HTML parser.
You'd also need to implement the new method for all platforms rather than just Mac, otherwise the build will break. Created attachment 27300 [details]
Fixes per review feedback
Changed callback name to documentElementAvailable(), implemented for XML documents (which should cover SVG, XHTML, and WML I believe), and added empty implementations of callback for other platforms.
Created attachment 27301 [details]
Fix whitespace issues in previous patch
Comment on attachment 27301 [details]
Fix whitespace issues in previous patch
Nearly there...
Looks like your Changelog needs to be regenerated?
The change to HTMLParser.cpp could just be a single if statement.
if (localName == htmlTag && document->frame())
I don't know if Qt wants this or not but for completeness you would need to patch their XMLTokenizer as well.
Created attachment 27343 [details]
More fixes
Updated ChangeLog, made changes as suggested in HTMLParser, and added an implementation to XMLTokenizerQt.cpp.
Comment on attachment 27343 [details] More fixes >Index: WebCore/ChangeLog ... >+2009-02-04 Aaron Boodman <set EMAIL_ADDRESS environment variable> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ WARNING: NO TEST CASES ADDED OR CHANGED >+ Usually, this is where people add a link to the bug and a description of the change. Created attachment 27344 [details]
Add description and link to bug to ChangeLog files
Whoops, you are right. Fixed now.
Comment on attachment 27344 [details]
Add description and link to bug to ChangeLog files
r=me
Landed as http://trac.webkit.org/changeset/40694. This broke the gtk build: http://build.webkit.org/builders/trunk-qt-linux-release/builds/13432/steps/compile-release_2/logs/stdio /home/zrusin/WebKit-BuildSlave/trunk-qt-linux-release/build/WebKitBuild/Release/lib/libQtWebKit.so: undefined reference to `non-virtual thunk to WebCore::FrameLoaderClientQt::documentElementAvailable()' /home/zrusin/WebKit-BuildSlave/trunk-qt-linux-release/build/WebKitBuild/Release/lib/libQtWebKit.so: undefined reference to `WebCore::FrameLoaderClientQt::documentElementAvailable()' |