WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WONTFIX
90928
[EFL] Add APIs to support ORIENTATION_EVENTS
https://bugs.webkit.org/show_bug.cgi?id=90928
Summary
[EFL] Add APIs to support ORIENTATION_EVENTS
Ryuan Choi
Reported
2012-07-10 18:28:05 PDT
Enable ORIENTATION_EVENTS and add APIs to get/set orientation to webkit/efl.
Attachments
Patch
(6.60 KB, patch)
2012-07-10 18:40 PDT
,
Ryuan Choi
no flags
Details
Formatted Diff
Diff
Patch
(6.60 KB, patch)
2012-07-11 01:54 PDT
,
Ryuan Choi
no flags
Details
Formatted Diff
Diff
Patch
(6.72 KB, patch)
2012-07-12 07:13 PDT
,
Ryuan Choi
no flags
Details
Formatted Diff
Diff
Patch
(10.09 KB, patch)
2012-07-13 17:31 PDT
,
Ryuan Choi
no flags
Details
Formatted Diff
Diff
Patch
(10.03 KB, patch)
2012-07-14 20:58 PDT
,
Ryuan Choi
no flags
Details
Formatted Diff
Diff
Patch
(9.97 KB, patch)
2012-07-16 18:28 PDT
,
Ryuan Choi
no flags
Details
Formatted Diff
Diff
Patch
(10.11 KB, patch)
2012-07-17 08:03 PDT
,
Ryuan Choi
no flags
Details
Formatted Diff
Diff
Show Obsolete
(6)
View All
Add attachment
proposed patch, testcase, etc.
Ryuan Choi
Comment 1
2012-07-10 18:40:10 PDT
Created
attachment 151571
[details]
Patch
Ryuan Choi
Comment 2
2012-07-11 01:54:05 PDT
Created
attachment 151648
[details]
Patch
Gyuyoung Kim
Comment 3
2012-07-11 18:19:09 PDT
Comment on
attachment 151648
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=151648&action=review
> Source/WebKit/efl/ewk/ewk_view.cpp:2015 > + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
Is it better to use EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
> Source/WebKit/efl/ewk/ewk_view.cpp:2033 > + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
Is it better to use EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1) ?
> Source/WebKit/efl/ewk/ewk_view.h:1507 > + * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise.
When target degree is same with current degree, false is returned. So, I think this is better to mention it to here as well.
Gyuyoung Kim
Comment 4
2012-07-11 18:20:06 PDT
CC'ing Grzegorz, could you take a look this API description ?
Ryuan Choi
Comment 5
2012-07-12 07:13:46 PDT
Created
attachment 151946
[details]
Patch
Ryuan Choi
Comment 6
2012-07-12 07:15:07 PDT
(In reply to
comment #3
)
> (From update of
attachment 151648
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=151648&action=review
> > > Source/WebKit/efl/ewk/ewk_view.cpp:2015 > > + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); > > Is it better to use EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
It's my mistake. fixed
> > > Source/WebKit/efl/ewk/ewk_view.cpp:2033 > > + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); > > Is it better to use EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1) ?
Ditto.
> > > Source/WebKit/efl/ewk/ewk_view.h:1507 > > + * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise. > > When target degree is same with current degree, false is returned. So, I think this is better to mention it to here as well.
Agree. I tried to mention it.
Thiago Marcos P. Santos
Comment 7
2012-07-12 14:51:59 PDT
C++ unit tests?
Grzegorz Czajkowski
Comment 8
2012-07-12 23:19:26 PDT
Comment on
attachment 151946
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=151946&action=review
> Source/WebKit/efl/ChangeLog:6 > + Reviewed by NOBODY (OOPS!).
Could you add a brief description of this API? its purpose etc.
> Source/WebKit/efl/ewk/ewk_view.cpp:2019 > + return false;
I think it's wrong practice to return false (the same value is returned in case of errors here) when we want to set a new value that has been already set before. We shouldn't treat it as the error.
> Source/WebKit/efl/ewk/ewk_view.h:1510 > +EAPI Eina_Bool ewk_view_orientation_set(Evas_Object *o, int orientation);
If this API allows to set four kind of values wouldn't it be better to expose those values only? for instance enums ? Then API usage and its description will be simpler.
Ryuan Choi
Comment 9
2012-07-13 05:41:48 PDT
(In reply to
comment #7
)
> C++ unit tests?
Do you mean the gtest? I will try it! (In reply to
comment #8
)
> (From update of
attachment 151946
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=151946&action=review
> > > Source/WebKit/efl/ChangeLog:6 > > + Reviewed by NOBODY (OOPS!). > > Could you add a brief description of this API? its purpose etc. >
OK, I will.
> > Source/WebKit/efl/ewk/ewk_view.cpp:2019 > > + return false; > > I think it's wrong practice to return false (the same value is returned in case of errors here) when we want to set a new value that has been already set before. We shouldn't treat it as the error. >
Hmm, this is really what I intended. This API is for generating onorientationchange javascript event to web contents. Because I want not to send onorientationchange event when same orientation was set, I thought that this API should notify false to application developers. But, while thinking more, we don't do that because it is extra intention which javascript doesn't do. If then, I think taht ewk_view_orientation_send looks enought. How do you think about this?
> > Source/WebKit/efl/ewk/ewk_view.h:1510 > > +EAPI Eina_Bool ewk_view_orientation_set(Evas_Object *o, int orientation); > > If this API allows to set four kind of values wouldn't it be better to expose those values only? for instance enums ? Then API usage and its description will be simpler.
As I commented
Bug 90950
, It can be limited as EWK_ORIENTATION_0, EWK_ORIENTATION_90, EWK_ORIENTATION_180, EWK_ORIENTATION_270. How do you think about them?
Ryuan Choi
Comment 10
2012-07-13 17:31:36 PDT
Created
attachment 152383
[details]
Patch
Thiago Marcos P. Santos
Comment 11
2012-07-14 02:55:05 PDT
Comment on
attachment 152383
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=152383&action=review
Thanks for pioneering writing utests for EFL. :)
> Source/WebKit/efl/tests/test_ewk_view.cpp:65 > + ewk_view_orientation_send(o, 0); > + > + // FIXME: We need a better way to receive the result from web content. > + const Ewk_Text_With_Direction* title = ewk_view_title_get(o); > + EXPECT_STREQ("window.orientation = 0", title->string);
Using title changes in utests has become a standard practice. Qt and GTK does that, although it might sound hackish, I see no problem. IMO you don't need the FIXME. Maybe it is a good idea to protect this part with: "#if ENABLE(ORIENTATION_EVENTS)". Otherwise tests will fail when the feature is disabled.
Ryuan Choi
Comment 12
2012-07-14 20:58:01 PDT
Created
attachment 152444
[details]
Patch
Ryuan Choi
Comment 13
2012-07-14 20:58:54 PDT
(In reply to
comment #11
)
> (From update of
attachment 152383
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=152383&action=review
> > Thanks for pioneering writing utests for EFL. :) > > > Source/WebKit/efl/tests/test_ewk_view.cpp:65 > > + ewk_view_orientation_send(o, 0); > > + > > + // FIXME: We need a better way to receive the result from web content. > > + const Ewk_Text_With_Direction* title = ewk_view_title_get(o); > > + EXPECT_STREQ("window.orientation = 0", title->string); > > Using title changes in utests has become a standard practice. Qt and GTK does that, although it might sound hackish, I see no problem. IMO you don't need the FIXME.
OK. I removed.
> > Maybe it is a good idea to protect this part with: "#if ENABLE(ORIENTATION_EVENTS)". Otherwise tests will fail when the feature is disabled.
My mistake. fixed.
Gyuyoung Kim
Comment 14
2012-07-15 04:43:50 PDT
Comment on
attachment 152444
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=152444&action=review
> Source/WebKit/efl/ewk/ewk_view.cpp:2017 > +
If current orientation is same with orientation, I think we don't need to send orientation event. It seems to me you need to add below code. if (priv->mainFrame->orientation() == orientation) return;
> Source/WebKit/efl/ewk/ewk_view.h:1503 > + * 90 degrees when it's left side is at the top,
if possible, is it better to adhere indentation for comment ? As this below, orientation will be 0 degrees when the device is oriented to natural position, 90 degrees when it's left side is at the top, -90 degrees when it's right side is at the top, 180 degrees when it is upside down. In addition, there are two spaces in *be 0*.
Ryuan Choi
Comment 15
2012-07-16 03:35:25 PDT
(In reply to
comment #14
)
> (From update of
attachment 152444
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=152444&action=review
> > > Source/WebKit/efl/ewk/ewk_view.cpp:2017 > > + > > If current orientation is same with orientation, I think we don't need to send orientation event. > > It seems to me you need to add below code. > > if (priv->mainFrame->orientation() == orientation) > return; >
It was in my previous patch and this limitation is helpful to avoid logical error But I change my mind because I am not sure whether we should limit only for orientationchange. If I am right, We didn't limit other events such as mouse down. For example, applications may send ewk_frame_feed_mouse_down twice without mouse_up. And also, we can generate events in javascript side similarly. In web page, they can generate same events twice including mouse, keyboad and orientationchange also. Anyway, because it's not important, I will add this if you want.
> > Source/WebKit/efl/ewk/ewk_view.h:1503 > > + * 90 degrees when it's left side is at the top, > > if possible, is it better to adhere indentation for comment ? > > As this below, > > orientation will be 0 degrees when the device is oriented to natural position, > 90 degrees when it's left side is at the top, > -90 degrees when it's right side is at the top, > 180 degrees when it is upside down. > > In addition, there are two spaces in *be 0*.
I thought it is more readable. but I will fix it. Thank you.
Gyuyoung Kim
Comment 16
2012-07-16 17:53:50 PDT
Comment on
attachment 152444
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=152444&action=review
>>> Source/WebKit/efl/ewk/ewk_view.cpp:2017 >>> + >> >> If current orientation is same with orientation, I think we don't need to send orientation event. >> >> It seems to me you need to add below code. >> >> if (priv->mainFrame->orientation() == orientation) >> return; > > It was in my previous patch and this limitation is helpful to avoid logical error > > But I change my mind because I am not sure whether we should limit only for orientationchange. > > If I am right, We didn't limit other events such as mouse down. > For example, applications may send ewk_frame_feed_mouse_down twice without mouse_up. > > And also, we can generate events in javascript side similarly. > In web page, they can generate same events twice including mouse, keyboad and orientationchange also. > > Anyway, because it's not important, I will add this if you want.
In my opinion, we don't need to send events when orientation is already same with target orientation. In addition, blackberry port has same logic.
Ryuan Choi
Comment 17
2012-07-16 18:28:25 PDT
Created
attachment 152674
[details]
Patch
Gyuyoung Kim
Comment 18
2012-07-17 03:46:02 PDT
Comment on
attachment 152674
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=152674&action=review
> Source/WebKit/efl/ewk/ewk_view.h:1502 > + * orientation will be 0 degrees when the device is oriented to natural position,
I just wanted to use below, orientation will be 0 degrees when the device is oriented to natural position, 90 degrees when it's left side is at the top, -90 degrees when it's right side is at the top, 180 degrees when it is upside down
Ryuan Choi
Comment 19
2012-07-17 08:03:44 PDT
Created
attachment 152765
[details]
Patch
Ryuan Choi
Comment 20
2012-07-17 08:04:38 PDT
(In reply to
comment #18
)
> (From update of
attachment 152674
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=152674&action=review
> > > Source/WebKit/efl/ewk/ewk_view.h:1502 > > + * orientation will be 0 degrees when the device is oriented to natural position, > > I just wanted to use below, > > orientation will be 0 degrees when the device is oriented to natural position, > 90 degrees when it's left side is at the top, > -90 degrees when it's right side is at the top, > 180 degrees when it is upside down
I misunderstand your comment. Updated like you mentioned.
Gyuyoung Kim
Comment 21
2012-07-17 17:28:47 PDT
Comment on
attachment 152765
[details]
Patch Looks good to me now. Thanks.
Gyuyoung Kim
Comment 22
2012-09-02 22:09:21 PDT
Comment on
attachment 152765
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=152765&action=review
> Source/WebKit/efl/tests/test_ewk_view.cpp:58 > +* @brief Checking whether function send orientation to contents.
Add a space before *.
> Source/WebKit/efl/tests/test_ewk_view.cpp:60 > +static void ewkViewOrientationSendCb(void* eventInfo, Evas_Object* o, void* data)
Please use full name for parameter name.
Gyuyoung Kim
Comment 23
2012-10-07 20:50:49 PDT
Comment on
attachment 152765
[details]
Patch Cleared review? from
attachment 152765
[details]
so that this bug does not appear in
http://webkit.org/pending-review
. If you would like this patch reviewed, please attach it to a new bug (or re-open this bug before marking it for review again).
Ryuan Choi
Comment 24
2014-07-20 18:15:41 PDT
ewebkit1 was dropped
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