Hi folks,
Even stranger things spotted now. A WebView calls -initWithFrame on
a plugin whenever:
[1] The webview becomes key (eg. tabbing from the URL field to the
webview)
[2] The plugin moves about on the page (eg. on an editable page, as
per e-mail below).
This isn't the correct behaviour surely: if a view (eg. plugin) is
'moved' within its superview, the superview should just call the
plugin's -setFrame / -setFrameSize / -setFrameOrigin, yes?
Looking in ObjectAlloc at my (vanilla) WebView app, it generates a
new plugin instance each time I tab back into the webview (from my
URL field) or move HTML (and the plugin) about within the web page
being edited. Granted it also releases the previous incarnation,
but that means any computation my plugin has done (i.e. anything it
needs to know that wasn't passed into it via the HTML EMBED
parameters) is lost. Also surely this would be a performance knock,
freeing / allocating RAM for a whole new view (plugin) vs. just
moving the view (plugin) about?
Am I totally misunderstanding the way this should work?!
Any sanity checks gratefully received,
Ken
On 24 Nov 2005, at 5:27 pm, Ken Tabb wrote:
Hi folks,
I'm currently developing a WebKit plugin for an HTML-editing app,
which allows data to be dragged in and dropped on it (from other
apps, typically). Works like a charm, generally speaking, with a
default "no data selected" / visual rendering of the data where
appropriate.
As such, because the data isn't known about at the time of writing
the HTML page, the markup to embed the plugin involves a 'dummy'
filetype (eg. src="noSuchFile.noSuchType", which the plugin duly
ignores during the -webPlugInInitialize method - it only exists to
force the page to add an instance of the plugin, onto which data
can then be dropped by the user.
However, I've noticed that if the plugin sits in an editable
WebView then whenever my plugin gets moved (eg. selecting the
words of text before & after the plugin, and dragging them
elsewhere in the page to rearrange it all), my plugin's -
webPlugInInitialize gets called again, effectively blanking any
knowledge that something had been dragged and dropped onto it
prior to the move (and drawing it with "no data selected").
Am I misunderstanding the API? Should it be zapping my plugin
simply because it's moved on the page? Is there an obvious way
around this? I'm guessing not, as the data is not yet known at the
time of -webPlugInInitialize being called. Should I set the "no
data set" flag in the plugin's -init / -initWithFrame method
rather than the -webPlugInInitialize method? I'm guessing it
doesn't call -initWithFrame each time the page is rearranged?
I'm using Xcode 2.2 / Mac OS X 10.4.3 if that makes any difference.
Thanks in advance for any light you can shed,
Ken
- - - - - - - - - -
Dr. Ken Tabb
Mac & UNIX Developer - Health & Human Sciences
Machine Vision & Neural Network researcher - School of Computer
Science
University of Hertfordshire, UK
http://www.health.herts.ac.uk/ken/
Certified non-Microsoft Solution Provider
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webkitsdk-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webkitsdk-dev/email@hidden
This email sent to email@hidden