Bug 83865

Summary: [EFL] Add Web Inspector to WebKit-EFL
Product: WebKit Reporter: Seokju Kwon <seokju.kwon>
Component: WebKit EFLAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: gyuyoung.kim, gyuyoung.kim, kangil.han, leandro, lucas.de.marchi, rakuco, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Bug Depends on:    
Bug Blocks: 87935    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch none

Description Seokju Kwon 2012-04-13 00:11:55 PDT
Add EFL port implementation for Web Inspector
Comment 1 Seokju Kwon 2012-04-13 00:32:52 PDT
Created attachment 137052 [details]
Patch
Comment 2 Leandro Pereira 2012-04-19 16:37:49 PDT
Comment on attachment 137052 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=137052&action=review

It's a good start, but there are some issues to take care first.

> Source/WebKit/ChangeLog:6
> +        [EFL] Add Web Inspector to WebKit-EFL
> +        https://bugs.webkit.org/show_bug.cgi?id=83865
> +
> +        Add EFL port implementation for Web Inspector

Please try to be more descriptive in the changelog entries.

> Source/WebKit/PlatformEfl.cmake:291
> +    FILE(COPY ${WEB_INSPECTOR_DATA} DESTINATION ${WEB_INSPECTOR_DIR})
> +    FILE(COPY ${WEB_INSPECTOR_UGLIFYJS_DATA} DESTINATION ${WEB_INSPECTOR_UGLIFYJS_DIR})
> +    FILE(COPY ${WEB_INSPECTOR_IMAGES_DATA} DESTINATION ${WEB_INSPECTOR_IMAGES_DIR})

This will be executed only during the build process; unless I'm mistaken, the inspector won't work properly unless these are actually installed.

> Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp:34
> +    InspectorFrontendClientEfl* inspectorFrontendClient = (InspectorFrontendClientEfl*)userData;

C++-style cast.

> Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp:36
> +        inspectorFrontendClient->destroyInspectorWindow(true);

I'm not sure what 'true' means here; consider using an enum.

> Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp:41
> +public:
> +    virtual ~InspectorFrontendSettingsEfl() { }

No need to implement this.
Comment 3 Seokju Kwon 2012-04-23 00:59:03 PDT
(In reply to comment #2)
> (From update of attachment 137052 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=137052&action=review
> 
> It's a good start, but there are some issues to take care first.
> 
> > Source/WebKit/ChangeLog:6
> > +        [EFL] Add Web Inspector to WebKit-EFL
> > +        https://bugs.webkit.org/show_bug.cgi?id=83865
> > +
> > +        Add EFL port implementation for Web Inspector
> 
> Please try to be more descriptive in the changelog entries.
> 
I will add additional comments in changelog entries.

> > Source/WebKit/PlatformEfl.cmake:291
> > +    FILE(COPY ${WEB_INSPECTOR_DATA} DESTINATION ${WEB_INSPECTOR_DIR})
> > +    FILE(COPY ${WEB_INSPECTOR_UGLIFYJS_DATA} DESTINATION ${WEB_INSPECTOR_UGLIFYJS_DIR})
> > +    FILE(COPY ${WEB_INSPECTOR_IMAGES_DATA} DESTINATION ${WEB_INSPECTOR_IMAGES_DIR})
> 
> This will be executed only during the build process; unless I'm mistaken, the inspector won't work properly unless these are actually installed.
> 
You're right. I will chanage it for these are actually installed.

> > Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp:34
> > +    InspectorFrontendClientEfl* inspectorFrontendClient = (InspectorFrontendClientEfl*)userData;
> 
> C++-style cast.
>
Ok, I will fix it.

> > Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp:36
> > +        inspectorFrontendClient->destroyInspectorWindow(true);
> 
> I'm not sure what 'true' means here; consider using an enum.

The argument of destoryInspectorWindow(bool notifyInspectorController) decides whether to notify inspectorController when destorying window. Other ports(Qt, GTK) are also using it like this.

> > Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp:41
> > +public:
> > +    virtual ~InspectorFrontendSettingsEfl() { }
> 
> No need to implement this.

Sure, I will remove it.
Comment 4 Seokju Kwon 2012-04-23 01:02:23 PDT
Created attachment 138304 [details]
Patch
Comment 5 Kangil Han 2012-05-16 02:59:57 PDT
acidx: Could you please review this patch?
Comment 6 Gyuyoung Kim 2012-05-22 22:10:42 PDT
Comment on attachment 138304 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=138304&action=review

I wonder how many test cases are covered by this patch.

> Source/WebKit/ChangeLog:7
> +        - Add a stub implementation of InspectorClientEfl

Generally, WebKit tends not to use - in ChangeLog.

> Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp:96
> +    InspectorController* controller = ewk_view_core_page_get(m_inspectorView)->inspectorController();

ewk_view_core_page_get() was removed. Use EWKPrivate::corePage()

> Source/WebKit/efl/ewk/ewk_view.h:2446
> +EAPI void ewk_view_web_inspector_show(Evas_Object *o);

It looks it is good to add const keyword as below,

const Evas_Object *o

> Source/WebKit/efl/ewk/ewk_view.h:2453
> +EAPI void ewk_view_web_inspector_close(Evas_Object *o);

ditto.
Comment 7 Seokju Kwon 2012-05-23 04:14:30 PDT
Created attachment 143527 [details]
Patch
Comment 8 Seokju Kwon 2012-05-23 04:19:57 PDT
(In reply to comment #6)
> (From update of attachment 138304 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=138304&action=review
> 
> I wonder how many test cases are covered by this patch.
> 
I have added web inspector to EWebLauncher with this patch.
And I am working on DRT related to Inspector in WebKit-EFL with this patch now.

This patch is too old. Others have been fixed.
> > Source/WebKit/ChangeLog:7
> > +        - Add a stub implementation of InspectorClientEfl
> 
> Generally, WebKit tends not to use - in ChangeLog.
> 
> > Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp:96
> > +    InspectorController* controller = ewk_view_core_page_get(m_inspectorView)->inspectorController();
> 
> ewk_view_core_page_get() was removed. Use EWKPrivate::corePage()
> 
> > Source/WebKit/efl/ewk/ewk_view.h:2446
> > +EAPI void ewk_view_web_inspector_show(Evas_Object *o);
> 
> It looks it is good to add const keyword as below,
> 
> const Evas_Object *o
> 
> > Source/WebKit/efl/ewk/ewk_view.h:2453
> > +EAPI void ewk_view_web_inspector_close(Evas_Object *o);
> 
> ditto.
Comment 9 Seokju Kwon 2012-05-29 18:19:49 PDT
(In reply to comment #6)
> (From update of attachment 138304 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=138304&action=review
> 
> I wonder how many test cases are covered by this patch.

I have done below test cases with this patch. As you know, It is the first step.
LayoutTests/inspector : 261/280 tests passed (93.2%)
Comment 10 Gyuyoung Kim 2012-05-29 18:32:04 PDT
(In reply to comment #9)
> (In reply to comment #6)
> > (From update of attachment 138304 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=138304&action=review
> > 
> > I wonder how many test cases are covered by this patch.
> 
> I have done below test cases with this patch. As you know, It is the first step.
> LayoutTests/inspector : 261/280 tests passed (93.2%)

Wow, good news !!. Could you file a bug for this tests supported by this patch ? And also, link it to this bug. I will review it.
Comment 11 Gyuyoung Kim 2012-05-31 00:35:51 PDT
Comment on attachment 143527 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=143527&action=review

> Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp:27
> +#include "ewk_private.h"

Remove unneeded include.

> Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp:56
> +InspectorClientEfl::InspectorClientEfl(Evas_Object* view)

I wonder whether view is webview. 157 line have used inspectorView for parameter name. Don't you need more clear name?

> Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp:129
> +#if ENABLE(INSPECTOR)

By the way, should we use ENABLE(INSPECTOR) macro in each function? I think we can do InspectorClientEfl.cpp isn't included in CMake file When ENABLE_INSPECTOR feature is disabled. If so, we don't need to use ENABLE(INSPECTOR) macro per a function.

> Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp:146
> +    String inspectorFilesPath = "file://"WEB_INSPECTOR_INSTALL_DIR"/inspector.html";

Use string utility function to combine multiple strings. For example, makeString().
Comment 12 Seokju Kwon 2012-05-31 01:58:58 PDT
(In reply to comment #11)
> (From update of attachment 143527 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=143527&action=review
> 
> > Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp:27
> > +#include "ewk_private.h"
> 
> Remove unneeded include.
I will remove it.

> > Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp:56
> > +InspectorClientEfl::InspectorClientEfl(Evas_Object* view)
> 
> I wonder whether view is webview. 157 line have used inspectorView for parameter name. Don't you need more clear name?
You're right. webView is better than view. I will fix it.

> > Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp:129
> > +#if ENABLE(INSPECTOR)
> 
> By the way, should we use ENABLE(INSPECTOR) macro in each function? I think we can do InspectorClientEfl.cpp isn't included in CMake file When ENABLE_INSPECTOR feature is disabled. If so, we don't need to use ENABLE(INSPECTOR) macro per a function.
InspectorClientEfl can be created regardless of ENABLE_INSPECTOR feature in _ewk_view_priv_new function. I can remove some macro only to prevent build break minimally, (for example WEB_INSPECTOR_DIR, InspectorController) if you want it. 
 
> > Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp:146
> > +    String inspectorFilesPath = "file://"WEB_INSPECTOR_INSTALL_DIR"/inspector.html";
> 
> Use string utility function to combine multiple strings. For example, makeString().
Oh thanks, I will use it.
Comment 13 Seokju Kwon 2012-05-31 02:06:46 PDT
(In reply to comment #10)
> (In reply to comment #9)
> > (In reply to comment #6)
> > > (From update of attachment 138304 [details] [details] [details])
> > > View in context: https://bugs.webkit.org/attachment.cgi?id=138304&action=review
> > > 
> > > I wonder how many test cases are covered by this patch.
> > 
> > I have done below test cases with this patch. As you know, It is the first step.
> > LayoutTests/inspector : 261/280 tests passed (93.2%)
> 
> Wow, good news !!. Could you file a bug for this tests supported by this patch ? And also, link it to this bug. I will review it.


I have made a bug : [EFL][DRT] Add support for Web Inspector in WebKit-EFL DRT (https://bugs.webkit.org/show_bug.cgi?id=87935)

Test result on 2012/05/30
LayoutTests/inspector : 261/280 tests passed (93.2%) 
LayoutTests/http/test/inspector : 61/82 test passed (74.4%)
LayoutTests/http/test/inspector-enabled : 10/10 tests passed (100%)
Comment 14 Seokju Kwon 2012-05-31 04:38:56 PDT
Created attachment 145050 [details]
Patch
Comment 15 Gyuyoung Kim 2012-06-17 17:31:57 PDT
Comment on attachment 145050 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=145050&action=review

I think this patch is much better than before. Submit modified patch again.

> Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp:84
> +    evas_object_smart_callback_call(m_inspectedView, "inspector,view,create", &inspectorView);

It looks m_inspectedView is webview. If so, you have to mention description of this signal to ewk_view.h

http://trac.webkit.org/browser/trunk/Source/WebKit/efl/ewk/ewk_view.h#L35

> Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp:167
> +    evas_object_smart_callback_del(m_inspectorView, "inspector,view,destroy", notifyWebInspectorDestroy);

ditto.

> Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp:225
> +    evas_object_smart_callback_call(m_inspectedView, "inspector,view,close", m_inspectorView);

ditto.
Comment 16 Seokju Kwon 2012-06-19 20:02:23 PDT
Created attachment 148490 [details]
Patch
Comment 17 Seokju Kwon 2012-06-20 00:55:35 PDT
(In reply to comment #15)
> (From update of attachment 145050 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=145050&action=review
> 
> I think this patch is much better than before. Submit modified patch again.
> 
> > Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp:84
> > +    evas_object_smart_callback_call(m_inspectedView, "inspector,view,create", &inspectorView);
> 
> It looks m_inspectedView is webview. If so, you have to mention description of this signal to ewk_view.h
> 
> http://trac.webkit.org/browser/trunk/Source/WebKit/efl/ewk/ewk_view.h#L35
> 
> > Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp:167
> > +    evas_object_smart_callback_del(m_inspectorView, "inspector,view,destroy", notifyWebInspectorDestroy);
> 
> ditto.
> 
> > Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp:225
> > +    evas_object_smart_callback_call(m_inspectedView, "inspector,view,close", m_inspectorView);
> 
> ditto.

I have done what you said. Thank you for reviewing this patch.
Comment 18 Gyuyoung Kim 2012-06-20 19:20:45 PDT
Comment on attachment 148490 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=148490&action=review

> Source/WebKit/efl/ewk/ewk_view.h:2643
> + * "inspector,view,create" and "inspector,view,close"

No, you have to move this signal description to signal description list as I already said.

http://trac.webkit.org/browser/trunk/Source/WebKit/efl/ewk/ewk_view.h#L35
Comment 19 Seokju Kwon 2012-06-20 20:14:42 PDT
Created attachment 148718 [details]
Patch
Comment 20 Seokju Kwon 2012-06-20 20:29:56 PDT
(In reply to comment #18)
> (From update of attachment 148490 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=148490&action=review
> 
> > Source/WebKit/efl/ewk/ewk_view.h:2643
> > + * "inspector,view,create" and "inspector,view,close"
> 
> No, you have to move this signal description to signal description list as I already said.
> 
> http://trac.webkit.org/browser/trunk/Source/WebKit/efl/ewk/ewk_view.h#L35

Oops, I am sorry that I have missed it(In reply to comment #18)
> (From update of attachment 148490 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=148490&action=review
> 
> > Source/WebKit/efl/ewk/ewk_view.h:2643
> > + * "inspector,view,create" and "inspector,view,close"
> 
> No, you have to move this signal description to signal description list as I already said.
> 
> http://trac.webkit.org/browser/trunk/Source/WebKit/efl/ewk/ewk_view.h#L35

Oops, I missed it. Another patch has been uploaded.
Comment 21 Seokju Kwon 2012-06-28 22:13:52 PDT
Created attachment 150085 [details]
Patch
Comment 22 Gyuyoung Kim 2012-07-01 21:50:05 PDT
Comment on attachment 150085 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=150085&action=review

> Source/WebKit/efl/ewk/ewk_view.cpp:44
> +#include "InspectorController.h"

Hmm, I don't know why style checker didn't find this style error. Adhere alphabetic order.

> Source/WebKit/efl/ewk/ewk_view.h:2686
> +EAPI void ewk_view_web_inspector_view_set(Evas_Object* o, Evas_Object* obj);

If possible, I think we need to use more meaningful parameter name. Is it better to use inspector_view ?

In addition, move * to variable side.
Comment 23 Gyuyoung Kim 2012-07-01 22:46:21 PDT
Comment on attachment 150085 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=150085&action=review

>> Source/WebKit/efl/ewk/ewk_view.cpp:44
>> +#include "InspectorController.h"
> 
> Hmm, I don't know why style checker didn't find this style error. Adhere alphabetic order.

Oops. I'm sorry. this is correct now.
Comment 24 Seokju Kwon 2012-07-01 23:42:44 PDT
Created attachment 150363 [details]
Patch
Comment 25 Seokju Kwon 2012-07-01 23:53:37 PDT
Created attachment 150364 [details]
Patch
Comment 26 Gyuyoung Kim 2012-07-04 17:58:34 PDT
Comment on attachment 150364 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=150364&action=review

Need to rebase.

> Source/WebKit/efl/ewk/ewk_view.h:109
> + *  - "inspector,view,create", void: request to create the new view for web inspector.

Adhere alphabetical order.
Comment 27 Seokju Kwon 2012-07-05 03:22:10 PDT
Created attachment 150913 [details]
Patch
Comment 28 Gyuyoung Kim 2012-07-05 03:24:42 PDT
Comment on attachment 150913 [details]
Patch

LGTM.
Comment 29 Pavel Feldman 2012-07-05 21:31:04 PDT
Comment on attachment 150913 [details]
Patch

This looks sane to me. There is a lot of detail in the plumbing implementation, but if you followed the Qt or Gtk code, you should be fine. Please test following scenarios of closing the inspector prior to landing:
1) via closing inspector view
2) via clicking inspector's close button
3) make sure that inspector closes upon inspected view close.

You should be able to re-open inspector for these cases. Also, make sure things are working for multiple tabs and inspected page reloads. I think it is safe to land this as a first cut and follow up with the bugfixes as problems arise.
Comment 30 Seokju Kwon 2012-07-05 21:53:23 PDT
(In reply to comment #29)
> (From update of attachment 150913 [details])
> This looks sane to me. There is a lot of detail in the plumbing implementation, but if you followed the Qt or Gtk code, you should be fine. Please test following scenarios of closing the inspector prior to landing:
> 1) via closing inspector view
> 2) via clicking inspector's close button
> 3) make sure that inspector closes upon inspected view close.
> 
> You should be able to re-open inspector for these cases. Also, make sure things are working for multiple tabs and inspected page reloads. I think it is safe to land this as a first cut and follow up with the bugfixes as problems arise.

I have already tested your scenarios with EWebLauncher browser and Dumprendertree.
Also I will upload some patches for using web inspector.
Comment 31 Seokju Kwon 2012-07-05 23:20:23 PDT
Created attachment 151021 [details]
Patch
Comment 32 WebKit Review Bot 2012-07-06 00:17:39 PDT
Comment on attachment 151021 [details]
Patch

Clearing flags on attachment: 151021

Committed r121947: <http://trac.webkit.org/changeset/121947>
Comment 33 WebKit Review Bot 2012-07-06 00:17:45 PDT
All reviewed patches have been landed.  Closing bug.