getClientRects doesn't work with list box option elements
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Aug 2017 08:08:16 +0000 (08:08 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Aug 2017 08:08:16 +0000 (08:08 +0000)
commite06898e267e2703eb09a0bbffdf1a5acc37cc21a
treebce73a4f05a6d3fe99697a1ebc968d58f58e3bd1
parent3d2b55eedf47ac2ac594d1110175b55222e88ce6
getClientRects doesn't work with list box option elements
https://bugs.webkit.org/show_bug.cgi?id=175016

Reviewed by Darin Adler.

Source/WebCore:

Since HTMLOptionElement and HTMLOptGroupElement don't have a renderer, we are always returning an empty list
from getClientRects. This is working fine in both chromium and firefox, option elements return its own bounding
box and group elements return the bounding box of the group label and all its children items.

Test: fast/dom/HTMLSelectElement/listbox-items-client-rects.html

* dom/Element.cpp:
(WebCore::listBoxElementBoundingBox): Helper function to return the bounding box of a HTMLOptionElement or
HTMLOptGroupElement element.
(WebCore::Element::getClientRects): Use listBoxElementBoundingBox() in case of HTMLOptionElement or
HTMLOptGroupElement.
(WebCore::Element::boundingClientRect): Ditto.

LayoutTests:

Add new test to check list box option elements client rects.

* fast/dom/HTMLSelectElement/listbox-items-client-rects-expected.txt: Added.
* fast/dom/HTMLSelectElement/listbox-items-client-rects.html: Added.
* platform/ios-simulator-wk2/fast/dom/HTMLSelectElement/listbox-items-client-rects-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220313 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/dom/HTMLSelectElement/listbox-items-client-rects-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/HTMLSelectElement/listbox-items-client-rects.html [new file with mode: 0644]
LayoutTests/platform/ios-simulator-wk2/fast/dom/HTMLSelectElement/listbox-items-client-rects-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/dom/Element.cpp