fast/dom/HTMLImageElement/image-alt-text.html and fast/dom/HTMLInputElement/input-image-alt-text.html are failing
https://bugs.webkit.org/show_bug.cgi?id=94198

Reviewed by Darin Adler.

Source/WebCore:

Fix alt text not being displayed for img elements or input of type
"image" due to insufficient size. imageSizeForError() was adding
padding for the alt text but setImageSizeForAltText() was not. The
issue was occurring in paintReplaced() because the contentWidth() /
contentHeight() would be exactly the same size as the alt text.
However, paintReplaced() first draws an outline rect where the
image should be and then reduces the usable width / height for the
alt text by 2 so that the text does not get printed over the rect
borders. However, after decreasing the usable width / height, there
is no longer enough space to draw the text.

No new tests, already covered by existing tests.

* rendering/RenderImage.cpp:
(WebCore::RenderImage::setImageSizeForAltText): Add padding to the text size
so that the alt text can still be drawn, despite the outline rect
borders. Such padding was already used in imageSizeForError(). Also use
ceilf() for the value returned by Font::width() instead of truncating it.
This is needed because we need to fit the whole text in the image and this
may not be the case if we truncate.
(WebCore::RenderImage::paintReplaced):

LayoutTests:

Rebaseline several test cases that have better result now and add those
tests to TestExpectations for other ports since they will need a
rebaseline.

* platform/chromium/TestExpectations:
* platform/efl/fast/block/float/002-expected.png:
* platform/efl/fast/block/float/017-expected.png:
* platform/efl/fast/dom/HTMLImageElement/image-alt-text-expected.png:
* platform/efl/fast/dom/HTMLImageElement/image-alt-text-expected.txt:
* platform/efl/fast/dom/HTMLInputElement/input-image-alt-text-expected.png:
* platform/efl/fast/dom/HTMLInputElement/input-image-alt-text-expected.txt:
* platform/efl/fast/encoding/utf-16-big-endian-expected.png:
* platform/efl/fast/encoding/utf-16-big-endian-expected.txt:
* platform/efl/fast/encoding/utf-16-little-endian-expected.png:
* platform/efl/fast/encoding/utf-16-little-endian-expected.txt:
* platform/efl/fast/flexbox/023-expected.png:
* platform/efl/fast/flexbox/024-expected.png:
* platform/efl/fast/forms/input-value-expected.png:
* platform/efl/fast/forms/input-value-expected.txt:
* platform/efl/fast/invalid/012-expected.png:
* platform/efl/fast/lists/inlineBoxWrapperNullCheck-expected.png:
* platform/efl/fast/lists/inlineBoxWrapperNullCheck-expected.txt:
* platform/efl/fast/parser/comment-in-script-expected.png:
* platform/efl/fast/text/whitespace/normal-after-nowrap-breaking-expected.png:
* platform/efl/tables/mozilla/bugs/bug2997-expected.png:
* platform/efl/tables/mozilla/collapsing_borders/bug41262-3-expected.png:
* platform/efl/tables/mozilla/collapsing_borders/bug41262-3-expected.txt:
* platform/gtk/TestExpectations:
* platform/mac/TestExpectations:
* platform/qt/TestExpectations:
* platform/win/TestExpectations:


git-svn-id: svn://svn.chromium.org/blink/trunk@147492 bbb929c8-8fbe-4397-9dbb-9b2b20218538
30 files changed