WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
69963
InjectedBundleHitTestResult::imageRect() should return rect in WKView coordinates
https://bugs.webkit.org/show_bug.cgi?id=69963
Summary
InjectedBundleHitTestResult::imageRect() should return rect in WKView coordin...
Jeff Miller
Reported
2011-10-12 14:24:13 PDT
Since WebKit2 clients only know about the WKView coordinate space, this rectangle is only useful if it's in that space.
Attachments
Patch
(2.27 KB, patch)
2011-10-12 14:30 PDT
,
Jeff Miller
no flags
Details
Formatted Diff
Diff
Patch
(9.15 KB, patch)
2011-10-14 13:08 PDT
,
Jeff Miller
simon.fraser
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2011-10-12 14:24:33 PDT
<
rdar://problem/10275376
>
Jeff Miller
Comment 2
2011-10-12 14:30:04 PDT
Created
attachment 110747
[details]
Patch
Adam Roben (:aroben)
Comment 3
2011-10-12 14:35:59 PDT
Comment on
attachment 110747
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=110747&action=review
Is it possible to write a test for this?
> Source/WebKit2/ChangeLog:7 > + InjectedBundleHitTestResult::imageRect() should return rect in WKView coordinates > +
https://bugs.webkit.org/show_bug.cgi?id=69963
> + > + Use the confusingly-named ScrollView::contentsToWindow() function to convert the image rect > + from frame to WKView coordinates.
Can you give a little justification as to why WKView coordinates are better than whatever coordinates we were previously using?
Sam Weinig
Comment 4
2011-10-12 14:48:38 PDT
In the immortal words of Adam Roben, "this should have an API test."
Adam Roben (:aroben)
Comment 5
2011-10-12 14:49:14 PDT
(In reply to
comment #4
)
> In the immortal words of Adam Roben, "this should have an API test."
Actually, my words were: (In reply to
comment #3
)
> Is it possible to write a test for this?
Jeff Miller
Comment 6
2011-10-12 14:57:49 PDT
Comment on
attachment 110747
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=110747&action=review
>> Source/WebKit2/ChangeLog:7 >> + from frame to WKView coordinates. > > Can you give a little justification as to why WKView coordinates are better than whatever coordinates we were previously using?
The justification is in the comment in the code, but I'll elaborate in the ChangeLog.
Simon Fraser (smfr)
Comment 7
2011-10-12 15:03:00 PDT
Comment on
attachment 110747
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=110747&action=review
>>> Source/WebKit2/ChangeLog:7 >>> + from frame to WKView coordinates. >> >> Can you give a little justification as to why WKView coordinates are better than whatever coordinates we were previously using? > > The justification is in the comment in the code, but I'll elaborate in the ChangeLog.
"ToWindow" really is window coords, not view coords. The coords will be flipped in WK1.
Darin Adler
Comment 8
2011-10-13 09:15:45 PDT
Comment on
attachment 110747
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=110747&action=review
>>>> Source/WebKit2/ChangeLog:7 >>>> + from frame to WKView coordinates. >>> >>> Can you give a little justification as to why WKView coordinates are better than whatever coordinates we were previously using? >> >> The justification is in the comment in the code, but I'll elaborate in the ChangeLog. > > "ToWindow" really is window coords, not view coords. The coords will be flipped in WK1.
This is injected bundle code in WebKit2, so I don’t see how WebKit1 is relevant.
Jeff Miller
Comment 9
2011-10-13 12:51:36 PDT
Comment on
attachment 110747
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=110747&action=review
>>>>> Source/WebKit2/ChangeLog:7 >>>>> + from frame to WKView coordinates. >>>> >>>> Can you give a little justification as to why WKView coordinates are better than whatever coordinates we were previously using? >>> >>> The justification is in the comment in the code, but I'll elaborate in the ChangeLog. >> >> "ToWindow" really is window coords, not view coords. The coords will be flipped in WK1. > > This is injected bundle code in WebKit2, so I don’t see how WebKit1 is relevant.
WebKit1 isn't relevant, but the first part of Simon's comment is correct. After talking to Simon more, I'm working on a patch to add member functions to Widget and ScrollView to convert between frame view and root view coordinate systems, since there's no way to do this currently. InjectedBundleHitTestResult::imageRect() can use one of these functions, and I also need to write a WK2 API test (as Sam and Adam pointed out).
Jeff Miller
Comment 10
2011-10-14 12:57:48 PDT
I wrote
bug 70136
to cover writing the test for this, since I need to land this patch soon.
Jeff Miller
Comment 11
2011-10-14 13:08:19 PDT
Created
attachment 111062
[details]
Patch
Simon Fraser (smfr)
Comment 12
2011-10-14 14:15:33 PDT
Comment on
attachment 111062
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=111062&action=review
> Source/WebCore/platform/Widget.cpp:106 > +IntRect Widget::convertFromRootView(const IntRect& rootRect) const > +{ > + if (const ScrollView* parentScrollView = parent()) { > + IntRect parentRect = parentScrollView->convertFromRootView(rootRect); > + return convertFromContainingView(parentRect); > + } > + return rootRect; > +} > + > +IntRect Widget::convertToRootView(const IntRect& localRect) const > +{ > + if (const ScrollView* parentScrollView = parent()) { > + IntRect parentRect = convertToContainingView(localRect); > + return parentScrollView->convertToRootView(parentRect); > + } > + return localRect; > +} > + > +IntPoint Widget::convertFromRootView(const IntPoint& rootPoint) const > +{ > + if (const ScrollView* parentScrollView = parent()) { > + IntPoint parentPoint = parentScrollView->convertFromRootView(rootPoint); > + return convertFromContainingView(parentPoint); > + } > + return rootPoint; > +} > + > +IntPoint Widget::convertToRootView(const IntPoint& localPoint) const > +{ > + if (const ScrollView* parentScrollView = parent()) { > + IntPoint parentPoint = convertToContainingView(localPoint); > + return parentScrollView->convertToRootView(parentPoint); > + } > + return localPoint; > +}
How about calling these from the existing toWindow/fromWindow calls?
Jeff Miller
Comment 13
2011-10-14 14:34:16 PDT
Comment on
attachment 111062
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=111062&action=review
>> Source/WebCore/platform/Widget.cpp:106 >> +} > > How about calling these from the existing toWindow/fromWindow calls?
Good idea, but I'd rather not perturb existing code in this patch. I will file a followup bug to track this.
Jeff Miller
Comment 14
2011-10-14 15:10:22 PDT
Committed
r97514
: <
http://trac.webkit.org/changeset/97514
>
Jeff Miller
Comment 15
2011-10-14 15:16:14 PDT
I wrote
bug 70152
to track Simon's suggestion.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug