[iOS] Input type=time elements styled with SVG fonts have 0 width
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Jun 2014 21:28:40 +0000 (21:28 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Jun 2014 21:28:40 +0000 (21:28 +0000)
commit1f783da3de59207d65973e2a848ec0a24c1567fb
tree24b110161a16b15a2f269ea304a62ebf5a3cf82b
parent5e9d45ee81d1ffa042e222cc25d61cead02c769b
[iOS] Input type=time elements styled with SVG fonts have 0 width
https://bugs.webkit.org/show_bug.cgi?id=133524

Reviewed by Simon Fraser.

Source/WebCore:
Refactor how the LocalizedDateCache returns maximum widths for input elements. Currently,
measuring the width of an SVG font requires a RenderObject for context, which the
LocalizedDateCache can't know about (it would be a platform violation). Instead, the
LocalizedDateCache can return the strings that it would use to measure the width, and the
caller can actually run the width computation.

Test: fast/forms/time-input-svg-font.html

* platform/text/PlatformLocale.h:
* platform/text/ios/LocalizedDateCache.h:
* platform/text/ios/LocalizedDateCache.mm:
(WebCore::LocalizedDateCache::maximumWidthForDateType): Take a delegate which can
measure text
(WebCore::LocalizedDateCache::calculateMaximumWidth): Perform maximum width
computation using delegate.
* platform/text/mac/LocaleMac.h:
* platform/text/mac/LocaleMac.mm:
(WebCore::LocaleMac::formatDateTime):
(WebCore::LocaleMac::maximumWidthForDateType): Deleted. Short-circuit this and go
directly to the LocalizedDateCache. This makes sense because we have to explicitly
insert computed values back into the cache in this new model.
* rendering/RenderThemeIOS.mm:
(WebCore::adjustInputElementButtonStyle): Create a delegate and pass it to the
LocalizedDateCache

LayoutTests:
Simply render a variety of input elements with SVG fonts, and make sure they have sane widths. Note that this
test is not platform-specific, even though the bug is.

* fast/forms/time-input-svg-font-expected.txt: Added.
* fast/forms/time-input-svg-font.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@170072 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/forms/time-input-svg-font-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/time-input-svg-font.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/efl/RenderThemeEfl.cpp
Source/WebCore/platform/efl/RenderThemeEfl.h
Source/WebCore/platform/gtk/RenderThemeGtk.cpp
Source/WebCore/platform/gtk/RenderThemeGtk.h
Source/WebCore/platform/text/PlatformLocale.h
Source/WebCore/platform/text/ios/LocalizedDateCache.h
Source/WebCore/platform/text/ios/LocalizedDateCache.mm
Source/WebCore/platform/text/mac/LocaleMac.h
Source/WebCore/platform/text/mac/LocaleMac.mm
Source/WebCore/rendering/RenderTheme.cpp
Source/WebCore/rendering/RenderTheme.h
Source/WebCore/rendering/RenderThemeIOS.h
Source/WebCore/rendering/RenderThemeIOS.mm
Source/WebCore/rendering/RenderThemeMac.h
Source/WebCore/rendering/RenderThemeMac.mm