Bug 69631 - Towards making PopupMenuClient more testable
Summary: Towards making PopupMenuClient more testable
Status: REOPENED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Fady Samuel
URL:
Keywords:
Depends on: 69894
Blocks: 66062
  Show dependency treegraph
 
Reported: 2011-10-07 08:45 PDT by Fady Samuel
Modified: 2011-10-14 12:40 PDT (History)
8 users (show)

See Also:


Attachments
Patch (18.92 KB, patch)
2011-10-07 08:49 PDT, Fady Samuel
no flags Details | Formatted Diff | Diff
Patch (19.80 KB, patch)
2011-10-11 15:42 PDT, Fady Samuel
no flags Details | Formatted Diff | Diff
Patch for landing (19.64 KB, patch)
2011-10-11 16:32 PDT, Fady Samuel
no flags Details | Formatted Diff | Diff
Patch (30.55 KB, patch)
2011-10-13 15:50 PDT, Fady Samuel
no flags Details | Formatted Diff | Diff
Patch (30.61 KB, patch)
2011-10-13 16:25 PDT, Fady Samuel
no flags Details | Formatted Diff | Diff
Patch (32.77 KB, patch)
2011-10-13 22:10 PDT, Fady Samuel
no flags Details | Formatted Diff | Diff
Patch (32.77 KB, patch)
2011-10-13 22:13 PDT, Fady Samuel
no flags Details | Formatted Diff | Diff
Patch (33.46 KB, patch)
2011-10-14 01:37 PDT, Fady Samuel
no flags Details | Formatted Diff | Diff
Patch (33.46 KB, patch)
2011-10-14 07:39 PDT, Fady Samuel
no flags Details | Formatted Diff | Diff
Patch (34.09 KB, patch)
2011-10-14 12:40 PDT, Fady Samuel
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Fady Samuel 2011-10-07 08:45:33 PDT
Towards making PopupMenuClient more testable
Comment 1 Fady Samuel 2011-10-07 08:49:58 PDT
Created attachment 110151 [details]
Patch
Comment 2 WebKit Review Bot 2011-10-07 09:29:08 PDT
Comment on attachment 110151 [details]
Patch

Attachment 110151 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/10007233

New failing tests:
fast/dom/select-element-height.html
Comment 3 Simon Fraser (smfr) 2011-10-11 11:55:01 PDT
Comment on attachment 110151 [details]
Patch

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

I like the general pattern, but see comments for nits.

> Source/WebCore/rendering/RenderObject.h:301
> +    virtual PopupMenuClient* popupMenuClient() { return 0; }

popupMenuClient() should only be present in derived classes, not here.

> Source/WebCore/rendering/RenderTextControlSingleLine.cpp:618
> +    return absoluteBoundingBoxRect(true);

Aren't we using an enum now?

> Source/WebCore/testing/Internals.idl:69
> +        int popupClientPaddingLeft(in Element element) raises (DOMException);
> +        int popupClientPaddingRight(in Element element) raises (DOMException);

Is it really useful to test paddingLeft and paddingRight?
Comment 4 Fady Samuel 2011-10-11 12:27:56 PDT
Comment on attachment 110151 [details]
Patch

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

>> Source/WebCore/rendering/RenderObject.h:301
>> +    virtual PopupMenuClient* popupMenuClient() { return 0; }
> 
> popupMenuClient() should only be present in derived classes, not here.

I'm not sure how to get around this. There is an issue with casting and multiple inheritance. RenderMenuList uses multiple inheritance. If I cast RenderObject to PopupMenuClient in Internals.cpp, it might not do the necessary thunking: http://en.wikipedia.org/wiki/Virtual_method_table because it has no idea where the appropriate vtable is. I suppose if I rearrange public RenderDeprecatedFlexibleBox, public ListPopupMenuClient to public ListPopupMenuClient, public RenderDeprecatedFlexibleBox the problem will fix itself (depending on compiler) but this would make the code very sensitive to breakage in the future that will be very hard to debug.

>> Source/WebCore/rendering/RenderTextControlSingleLine.cpp:618
>> +    return absoluteBoundingBoxRect(true);
> 
> Aren't we using an enum now?

No. The signature is absoluteBoundingBoxRect(bool useTransforms = true),  alternatively there's an absoluteBoundingBoxRectIgnoringTransforms().

See https://bugs.webkit.org/show_bug.cgi?id=69009

>> Source/WebCore/testing/Internals.idl:69
>> +        int popupClientPaddingRight(in Element element) raises (DOMException);
> 
> Is it really useful to test paddingLeft and paddingRight?

I believe so, at some point you asked me to make sure they take page scale factor into account for this patch:

https://bugs.webkit.org/show_bug.cgi?id=66062
Comment 5 Fady Samuel 2011-10-11 15:42:22 PDT
Created attachment 110592 [details]
Patch
Comment 6 Simon Fraser (smfr) 2011-10-11 16:11:25 PDT
Comment on attachment 110592 [details]
Patch

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

> Source/WebCore/rendering/RenderMenuList.cpp:307
> +    m_popup->show(boundingBoxRect(), document()->view(),
>          select->optionToListIndex(select->selectedIndex()));

You could unwrap this line.

> Source/WebCore/testing/Internals.cpp:457
> +    return reinterpret_cast<PopupMenuClient*>(object);

This should be a static_cast too.

> Source/WebCore/testing/Internals.cpp:472
> +    return 0;
> +
> +}

Extra blank line.

> Source/WebCore/testing/Internals.h:107
> +    static const PopupMenuClient* toPopupMenuClient(RenderObject*);

I don't think there's any benefit in this being a class method. It could just be static in the impl.
Comment 7 Fady Samuel 2011-10-11 16:32:44 PDT
Created attachment 110601 [details]
Patch for landing
Comment 8 Fady Samuel 2011-10-11 16:34:25 PDT
Comment on attachment 110592 [details]
Patch

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

>> Source/WebCore/rendering/RenderMenuList.cpp:307
>>          select->optionToListIndex(select->selectedIndex()));
> 
> You could unwrap this line.

Done.

>> Source/WebCore/testing/Internals.cpp:457
>> +    return reinterpret_cast<PopupMenuClient*>(object);
> 
> This should be a static_cast too.

This can't be a static cast. A PopupMenuClient is not a subclass of RenderObject.

>> Source/WebCore/testing/Internals.cpp:472
>> +}
> 
> Extra blank line.

Done.

>> Source/WebCore/testing/Internals.h:107
>> +    static const PopupMenuClient* toPopupMenuClient(RenderObject*);
> 
> I don't think there's any benefit in this being a class method. It could just be static in the impl.

Done.
Comment 9 WebKit Review Bot 2011-10-11 17:18:37 PDT
Comment on attachment 110601 [details]
Patch for landing

Clearing flags on attachment: 110601

Committed r97202: <http://trac.webkit.org/changeset/97202>
Comment 10 WebKit Review Bot 2011-10-11 17:18:42 PDT
All reviewed patches have been landed.  Closing bug.
Comment 11 Ryosuke Niwa 2011-10-11 18:12:28 PDT
This patch broke Chromium Windows build. Build fix attempted in http://trac.webkit.org/changeset/97207.
Comment 12 Ryosuke Niwa 2011-10-11 19:01:28 PDT
This patch also broke Mac builds:
http://build.webkit.org/builders/SnowLeopard%20Intel%20Release%20%28Build%29/builds/34669/steps/compile-webkit/logs/stdio

Undefined symbols:
  "__ZN7WebCore9InlineBox14selectionStateEv", referenced from:
      __ZTVN7WebCore9InlineBoxE in Internals.o
  "__ZN7WebCore9InlineBox11nodeAtPointERKNS_14HitTestRequestERNS_13HitTestResultERKNS_8IntPointES8_ii", referenced from:
      __ZTVN7WebCore9InlineBoxE in Internals.o
  "__ZN7WebCore9InlineBox11extractLineEv", referenced from:
      __ZTVN7WebCore9InlineBoxE in Internals.o
  "__ZN7WebCore9InlineBox5paintERNS_9PaintInfoERKNS_8IntPointEii", referenced from:
      __ZTVN7WebCore9InlineBoxE in Internals.o
  "__ZN7WebCore9InlineBox7destroyEPNS_11RenderArenaE", referenced from:
      __ZTVN7WebCore9InlineBoxE in Internals.o
  "__ZN7WebCore9InlineBox14adjustPositionEff", referenced from:
      __ZTVN7WebCore9InlineBoxE in Internals.o
  "__ZN7WebCore9InlineBoxdlEPvm", referenced from:
      __ZN7WebCore9InlineBoxD0Ev in Internals.o
  "__ZNK7WebCore9InlineBox14caretMaxOffsetEv", referenced from:
      __ZTVN7WebCore9InlineBoxE in Internals.o
  "__ZN7WebCore9InlineBox22canAccommodateEllipsisEbii", referenced from:
      __ZTVN7WebCore9InlineBoxE in Internals.o
  "__ZN7WebCore9InlineBox10attachLineEv", referenced from:
      __ZTVN7WebCore9InlineBoxE in Internals.o
  "__ZN7WebCore9InlineBox16placeEllipsisBoxEbfffRb", referenced from:
      __ZTVN7WebCore9InlineBoxE in Internals.o
  "__ZN7WebCore9InlineBox10deleteLineEPNS_11RenderArenaE", referenced from:
      __ZTVN7WebCore9InlineBoxE in Internals.o
  "__ZNK7WebCore9InlineBox14caretMinOffsetEv", referenced from:
      __ZTVN7WebCore9InlineBoxE in Internals.o

I don't think we wan to expose all these symbols from WebCore.
Comment 14 Ryosuke Niwa 2011-10-11 19:27:06 PDT
Apparently including RenderMenuList.h causes Internals.cpp to use InlineBox's destructor.
Comment 15 Ryosuke Niwa 2011-10-11 19:48:09 PDT
Reopen the bug since the patch was rolled out.
Comment 16 Collabora GTK+ EWS bot 2011-10-12 04:42:41 PDT
Comment on attachment 110601 [details]
Patch for landing

Attachment 110601 [details] did not pass gtk-ews (gtk):
Output: http://queues.webkit.org/results/10028827
Comment 17 Fady Samuel 2011-10-12 13:03:34 PDT
(In reply to comment #12)
> This patch also broke Mac builds:
> http://build.webkit.org/builders/SnowLeopard%20Intel%20Release%20%28Build%29/builds/34669/steps/compile-webkit/logs/stdio
> 
> Undefined symbols:
>   "__ZN7WebCore9InlineBox14selectionStateEv", referenced from:
>       __ZTVN7WebCore9InlineBoxE in Internals.o
>   "__ZN7WebCore9InlineBox11nodeAtPointERKNS_14HitTestRequestERNS_13HitTestResultERKNS_8IntPointES8_ii", referenced from:
>       __ZTVN7WebCore9InlineBoxE in Internals.o
>   "__ZN7WebCore9InlineBox11extractLineEv", referenced from:
>       __ZTVN7WebCore9InlineBoxE in Internals.o
>   "__ZN7WebCore9InlineBox5paintERNS_9PaintInfoERKNS_8IntPointEii", referenced from:
>       __ZTVN7WebCore9InlineBoxE in Internals.o
>   "__ZN7WebCore9InlineBox7destroyEPNS_11RenderArenaE", referenced from:
>       __ZTVN7WebCore9InlineBoxE in Internals.o
>   "__ZN7WebCore9InlineBox14adjustPositionEff", referenced from:
>       __ZTVN7WebCore9InlineBoxE in Internals.o
>   "__ZN7WebCore9InlineBoxdlEPvm", referenced from:
>       __ZN7WebCore9InlineBoxD0Ev in Internals.o
>   "__ZNK7WebCore9InlineBox14caretMaxOffsetEv", referenced from:
>       __ZTVN7WebCore9InlineBoxE in Internals.o
>   "__ZN7WebCore9InlineBox22canAccommodateEllipsisEbii", referenced from:
>       __ZTVN7WebCore9InlineBoxE in Internals.o
>   "__ZN7WebCore9InlineBox10attachLineEv", referenced from:
>       __ZTVN7WebCore9InlineBoxE in Internals.o
>   "__ZN7WebCore9InlineBox16placeEllipsisBoxEbfffRb", referenced from:
>       __ZTVN7WebCore9InlineBoxE in Internals.o
>   "__ZN7WebCore9InlineBox10deleteLineEPNS_11RenderArenaE", referenced from:
>       __ZTVN7WebCore9InlineBoxE in Internals.o
>   "__ZNK7WebCore9InlineBox14caretMinOffsetEv", referenced from:
>       __ZTVN7WebCore9InlineBoxE in Internals.o
> 
> I don't think we wan to expose all these symbols from WebCore.

Odd this seems to only happen on release builds.  Ryosuke and I had a discussion last night to move access to RenderMenuList to HTMLSelectElement and then export those symbols.. rather than export the symbols above.
Comment 18 Fady Samuel 2011-10-13 15:50:25 PDT
Created attachment 110918 [details]
Patch
Comment 19 Fady Samuel 2011-10-13 16:25:28 PDT
Created attachment 110927 [details]
Patch
Comment 20 Fady Samuel 2011-10-13 22:10:37 PDT
Created attachment 110955 [details]
Patch
Comment 21 Fady Samuel 2011-10-13 22:13:04 PDT
Created attachment 110957 [details]
Patch
Comment 22 Fady Samuel 2011-10-14 01:37:00 PDT
Created attachment 110978 [details]
Patch
Comment 23 Fady Samuel 2011-10-14 07:39:40 PDT
Created attachment 111014 [details]
Patch
Comment 24 Fady Samuel 2011-10-14 12:40:34 PDT
Created attachment 111054 [details]
Patch