Positioned Replaced Elements That Aren't RenderReplaced get Incorrect Width
authorrobert@webkit.org <robert@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Jun 2013 19:03:09 +0000 (19:03 +0000)
committerrobert@webkit.org <robert@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Jun 2013 19:03:09 +0000 (19:03 +0000)
commitfd44008c8ea3a9bf9217f4a4c901962a927843e3
tree514faf35130554902060b714a1786ffe3f343c65
parent164869692806bc4d200295d04632264c3ec569ed
Positioned Replaced Elements That Aren't RenderReplaced get Incorrect Width
https://bugs.webkit.org/show_bug.cgi?id=93735

Reviewed by Darin Adler.

Source/WebCore:

Replaced elements that aren't RenderReplaced aren't |isReplaced| and don't have an
intrinsic height or width. This causes them to go down the wrong height and width computation
path in RenderBox when they are absolute positioned.

The notion of |isReplaced| is entwined with the notion of being |isInline| so it isn't really
possible to make them isReplaced without re-wiring a lot of code. So instead use an ad-hoc definition
of isReplacedElement in RenderBox to bring all replaced elements into the height and width calculation.
To make sure we get the right height and width in there, give non-RenderReplaced replaced renderers
the helpers for returning their approximation of intrinsic height and width.

Test: fast/replaced/width-and-height-of-positioned-replaced-elements.html

* rendering/RenderBox.cpp:
(WebCore::isReplacedElement):
(WebCore::RenderBox::computePositionedLogicalWidth):
(WebCore::RenderBox::computePositionedLogicalHeight):
* rendering/RenderBox.h:
(WebCore::RenderBox::intrinsicSize):
* rendering/RenderButton.h:
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::RenderListBox):
(WebCore::RenderListBox::computeLogicalHeight):
* rendering/RenderListBox.h:
* rendering/RenderMenuList.h:
* rendering/RenderReplaced.h:
* rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::RenderTextControl):
(WebCore::RenderTextControl::computeLogicalHeight):
* rendering/RenderTextControl.h:

LayoutTests:

* fast/forms/onselect-textfield-expected.txt:
* fast/replaced/width-and-height-of-positioned-replaced-elements-expected.png: Added.
* fast/replaced/width-and-height-of-positioned-replaced-elements-expected.txt: Added.
* fast/replaced/width-and-height-of-positioned-replaced-elements.html: Added.
* platform/mac-wk2/fast/replaced/width-and-height-of-positioned-replaced-elements-expected.txt: Added.
* platform/mac/fast/forms/button-positioned-expected.txt:
* platform/mac/fast/forms/input-appearance-preventDefault-expected.txt:
* platform/mac/fast/replaced/width-and-height-of-positioned-replaced-elements-expected.txt: Added.
* platform/qt/fast/forms/button-positioned-expected.txt:
* platform/qt/fast/forms/input-appearance-preventDefault-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@151451 268f45cc-cd09-0410-ab3c-d52691b4dbfc
21 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/forms/onselect-textfield-expected.txt
LayoutTests/fast/replaced/width-and-height-of-positioned-replaced-elements-expected.png [new file with mode: 0644]
LayoutTests/fast/replaced/width-and-height-of-positioned-replaced-elements-expected.txt [new file with mode: 0644]
LayoutTests/fast/replaced/width-and-height-of-positioned-replaced-elements.html [new file with mode: 0644]
LayoutTests/platform/mac-wk2/fast/replaced/width-and-height-of-positioned-replaced-elements-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/forms/button-positioned-expected.txt
LayoutTests/platform/mac/fast/forms/input-appearance-preventDefault-expected.txt
LayoutTests/platform/mac/fast/replaced/width-and-height-of-positioned-replaced-elements-expected.txt [new file with mode: 0644]
LayoutTests/platform/qt/fast/forms/button-positioned-expected.txt
LayoutTests/platform/qt/fast/forms/input-appearance-preventDefault-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderBox.h
Source/WebCore/rendering/RenderButton.h
Source/WebCore/rendering/RenderListBox.cpp
Source/WebCore/rendering/RenderListBox.h
Source/WebCore/rendering/RenderMenuList.h
Source/WebCore/rendering/RenderReplaced.h
Source/WebCore/rendering/RenderTextControl.cpp
Source/WebCore/rendering/RenderTextControl.h