HTML input file control "No File Selected" needs more room in some languages
authorjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Feb 2012 21:55:38 +0000 (21:55 +0000)
committerjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Feb 2012 21:55:38 +0000 (21:55 +0000)
commit07a4abdf81f6a839a57728edabc4f1e2fb5fe9a3
treedbf4833fea32aad70352c141b4143a1538d62edc
parent41bb75173ba849e2da40610d6d45f75c11e31cc9
HTML input file control "No File Selected" needs more room in some languages
https://bugs.webkit.org/show_bug.cgi?id=32366
<rdar://problem/4481028>

Reviewed by David Hyatt.

The patch exposes a function to return the "no file(s) selected" label text.

* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::fileListDefaultLabel): Added to expose the text for the label in
file upload controls when nothing has been selected.
(WebCore::RenderTheme::fileListNameForWidth): Refactor to use fileListDefaultLabel().
* rendering/RenderTheme.h: Change fileListNameForWidth() to be a const function.

* rendering/RenderThemeMac.h: Update fileListNameForWidth() to be a const function for
platform implementations.
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::fileListNameForWidth): Refactor to use fileListDefaultLabel().

Update fileListNameForWidth() to be a const function for platform implementations.
* platform/gtk/RenderThemeGtk.h:
* platform/gtk/RenderThemeGtk.cpp:
* platform/qt/RenderThemeQt.h:
* platform/qt/RenderThemeQt.cpp:

* rendering/RenderFileUploadControl.cpp:
(WebCore::RenderFileUploadControl::computePreferredLogicalWidths): Change the calculation
of the max preferred logical width. Calculate the length of the "no file(s) selected" text,
and include the button and after-button margin. Take the max of that and the original
default width, which was a string of 34 (defaultWidthNumChars) "0"'s, in the case that the
label text is too short.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108261 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/gtk/RenderThemeGtk.cpp
Source/WebCore/platform/gtk/RenderThemeGtk.h
Source/WebCore/platform/qt/RenderThemeQt.cpp
Source/WebCore/platform/qt/RenderThemeQt.h
Source/WebCore/rendering/RenderFileUploadControl.cpp
Source/WebCore/rendering/RenderFileUploadControl.h
Source/WebCore/rendering/RenderTheme.cpp
Source/WebCore/rendering/RenderTheme.h
Source/WebCore/rendering/RenderThemeMac.h
Source/WebCore/rendering/RenderThemeMac.mm