Bug 91592

Summary: [EFL] Highlight the element under mouse on web inspector
Product: WebKit Reporter: Seokju Kwon <seokju.kwon>
Component: WebKit EFLAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, gyuyoung.kim, gyuyoung.kim, haraken, lucas.de.marchi, rakuco, sw0524.lee, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Other   
OS: Linux   
Bug Depends on:    
Bug Blocks: 100303    
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Seokju Kwon 2012-07-18 00:06:16 PDT
Implement highlighting the nodes when using the inspector
Comment 1 Seokju Kwon 2012-07-18 00:13:23 PDT
Created attachment 152947 [details]
Patch
Comment 2 Chris Dumez 2012-07-24 04:38:28 PDT
Comment on attachment 152947 [details]
Patch

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

> Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp:110
> +    hideHighlight();

This looks a bit odd this way. Maybe we should move the code in hideHighlight() to a new invalidateView(inspectedView) method and call this new function is both highlight() and hideHighlight()? This would be more understandable for me.

> Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp:118
> +        WebCore::IntRect rect(0, 0, width, height);

I would create this as late as possible, that is to say: after the NULL page check.

> Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp:122
> +            page->mainFrame()->view()->invalidateRect(rect);

page->mainFrame()->view()->invalidateRect(WebCore::IntRect(0, 0, width, height)); ?

> Source/WebKit/efl/ewk/ewk_paint_context.cpp:181
> +        if (controller && controller->highlightedNode())

page->inspectorController() cannot return NULL so the first check is not needed. Use an ASSERT() instead if you want to be safe.
Comment 3 Seokju Kwon 2012-07-24 19:52:43 PDT
(In reply to comment #2)
> (From update of attachment 152947 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=152947&action=review
> 
> > Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp:110
> > +    hideHighlight();
> 
> This looks a bit odd this way. Maybe we should move the code in hideHighlight() to a new invalidateView(inspectedView) method and call this new function is both highlight() and hideHighlight()? This would be more understandable for me.
> 
> > Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp:118
> > +        WebCore::IntRect rect(0, 0, width, height);
> 
> I would create this as late as possible, that is to say: after the NULL page check.
> 
> > Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp:122
> > +            page->mainFrame()->view()->invalidateRect(rect);
> 
> page->mainFrame()->view()->invalidateRect(WebCore::IntRect(0, 0, width, height)); ?
> 
> > Source/WebKit/efl/ewk/ewk_paint_context.cpp:181
> > +        if (controller && controller->highlightedNode())
> 
> page->inspectorController() cannot return NULL so the first check is not needed. Use an ASSERT() instead if you want to be safe.

I will fix all things you mentioned. Thanks for reviewing.
Comment 4 Seokju Kwon 2012-07-24 19:55:14 PDT
Created attachment 154224 [details]
Patch
Comment 5 Chris Dumez 2012-07-24 22:39:48 PDT
Comment on attachment 154224 [details]
Patch

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

> Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.h:65
> +    void invalidateView(Evas_Object*);

I don't think invalidateView() needs to be public. I would have just used a static function in the cpp file.
Comment 6 Gyuyoung Kim 2012-07-24 22:59:42 PDT
Comment on attachment 154224 [details]
Patch

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

> Source/WebKit/efl/ewk/ewk_paint_context.cpp:23
> +#if ENABLE(INSPECTOR)

EFL port has used ENABLE(...) below regular include list.

Please see ewk_view.cpp.
http://trac.webkit.org/browser/trunk/Source/WebKit/efl/ewk/ewk_view.cpp#L81
Comment 7 Seokju Kwon 2012-07-25 16:30:13 PDT
(In reply to comment #6)
> (From update of attachment 154224 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=154224&action=review
> 
> > Source/WebKit/efl/ewk/ewk_paint_context.cpp:23
> > +#if ENABLE(INSPECTOR)
> 
> EFL port has used ENABLE(...) below regular include list.
> 
> Please see ewk_view.cpp.
> http://trac.webkit.org/browser/trunk/Source/WebKit/efl/ewk/ewk_view.cpp#L81

you're right. I will move it.
Comment 8 Seokju Kwon 2012-07-25 16:31:31 PDT
(In reply to comment #5)
> (From update of attachment 154224 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=154224&action=review
> 
> > Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.h:65
> > +    void invalidateView(Evas_Object*);
> 
> I don't think invalidateView() needs to be public. I would have just used a static function in the cpp file.

It makes sense.
Comment 9 Seokju Kwon 2012-07-25 16:31:44 PDT
Created attachment 154473 [details]
Patch
Comment 10 Gyuyoung Kim 2012-07-25 18:10:50 PDT
Comment on attachment 154473 [details]
Patch

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

The rest looks good.

> Source/WebKit/efl/ewk/ewk_paint_context.cpp:181
> +        WebCore::InspectorController* controller = page->inspectorController();

I wonder if page always has inspector controller. If not, I think below condition is good to avoid crash.

if (WebCore::InspectorController* controller = page->inspectorController())
    if (controller->highlightedNode())
        controller->drawHighlight(*context->graphicContext);
Comment 11 Seokju Kwon 2012-07-25 19:11:19 PDT
(In reply to comment #10)
> (From update of attachment 154473 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=154473&action=review
> 
> The rest looks good.
> 
> > Source/WebKit/efl/ewk/ewk_paint_context.cpp:181
> > +        WebCore::InspectorController* controller = page->inspectorController();
> 
> I wonder if page always has inspector controller. If not, I think below condition is good to avoid crash.
> 
> if (WebCore::InspectorController* controller = page->inspectorController())
>     if (controller->highlightedNode())
>         controller->drawHighlight(*context->graphicContext);

It seems to me that page always has inspectorController.
Comment 12 Gyuyoung Kim 2012-07-25 19:18:14 PDT
Comment on attachment 154473 [details]
Patch

LGTM now.
Comment 13 Chris Dumez 2012-07-25 22:31:12 PDT
Comment on attachment 154473 [details]
Patch

LGTM.
Comment 14 Kentaro Hara 2012-07-26 18:21:12 PDT
Comment on attachment 154473 [details]
Patch

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

Looks OK. rs=me

>>> Source/WebKit/efl/ewk/ewk_paint_context.cpp:181
>>> +        WebCore::InspectorController* controller = page->inspectorController();
>> 
>> I wonder if page always has inspector controller. If not, I think below condition is good to avoid crash.
>> 
>> if (WebCore::InspectorController* controller = page->inspectorController())
>>     if (controller->highlightedNode())
>>         controller->drawHighlight(*context->graphicContext);
> 
> It seems to me that page always has inspectorController.

Looks so to me too.
Comment 15 WebKit Review Bot 2012-07-26 19:41:53 PDT
Comment on attachment 154473 [details]
Patch

Clearing flags on attachment: 154473

Committed r123831: <http://trac.webkit.org/changeset/123831>
Comment 16 WebKit Review Bot 2012-07-26 19:41:59 PDT
All reviewed patches have been landed.  Closing bug.