I've been beating my head against this for almost a week, and've done a lot of searching - so if I've missed the obvious reference and this question is redundant, it's not that I didn't look. That said...
I want to be able to draw rectangles around specific content in a WebView. Say I have:
That draws a correctly sized rectangle, but the placement is way off - for reasons I'm pretty sure I understand. Apparently, boundingBox gives me a point of origin relative to the WebFrameView object that was used to display the node. But when I call NSFrameRect, it draws from the application's origin. Or something.
So here's my question: how can I make the NSRect I get from boundingBox show up on top of the right place in the web view, and stay there?
I've looked through the Apple documentation on webviews, webframes, webframeviews, drawing in cocoa, coordinate systems, bezierpaths... all to no avail. I'd greatly appriciate any help yall can offer.
-Beon.
I want to be able to draw rectangles around specific content in a WebView. Say I have:
Code:
DOMNode * theNode = (some node in the DOMDocument of the current MainFrame);
NSRect nodeRect = [theNode boundingBox];
NSFrameRect(nodeRect);
That draws a correctly sized rectangle, but the placement is way off - for reasons I'm pretty sure I understand. Apparently, boundingBox gives me a point of origin relative to the WebFrameView object that was used to display the node. But when I call NSFrameRect, it draws from the application's origin. Or something.
So here's my question: how can I make the NSRect I get from boundingBox show up on top of the right place in the web view, and stay there?
I've looked through the Apple documentation on webviews, webframes, webframeviews, drawing in cocoa, coordinate systems, bezierpaths... all to no avail. I'd greatly appriciate any help yall can offer.
-Beon.