Calendar Picker: Resize to minimal size to fit the content
authortkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Apr 2012 01:26:05 +0000 (01:26 +0000)
committertkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Apr 2012 01:26:05 +0000 (01:26 +0000)
commit3d12ca01bcdb85f47c228d3315a6354cf42a0e9a
tree4b7c0797adb279e6a563372097571bf8986c9c82
parente6f63dc3cf2dbf11b425d84b861f55e7e6eb161d
Calendar Picker: Resize to minimal size to fit the content
https://bugs.webkit.org/show_bug.cgi?id=84826

Reviewed by Hajime Morita.

.:

* ManualTests/forms/calendar-picker.html:
Sync with the size specified in CalendarPickerElement.cpp.

Source/WebCore:

Using fixed-size popup isn't nice. The calender picker popup size should
be minimal.

The minimal size depends on font settings, localized labels, and
localized formats. So we put visible objects on a transparent element,
calculate minimal size, resize the popup, then show the objects.

* Resources/calendarPicker.css:
(body): Don't use purple. It was for debugging purpose.
The body is visible for a short period becuse we use transparent element.
(#main):
 - Add nowrap to avoid text wrapping.
 - Add wider width to avoid wrapping.
 - Add opacity to hide incomplete layout.
(.year-month-upper): Don't set flexible box yet.
(.month-selector-box): Fix incorrect display value.
(.days-area):
Don't set table-layout:fixed and width:100% in order that it has the
minimal width.

* Resources/calendarPicker.js:
(initialize): Make a new functio to resize.
(fixWindowSize):
Compute the required width from the right edge of the next year button,
the maximum cell width, and so on.  Then, set CSS properties to have
correct layout.
(YearMonthController.prototype.attachTo):
Set min-width property for a long year-month string.
(YearMonthController.prototype._showPopup):
Center the _monthPopup vertically.

* html/shadow/CalendarPickerElement.cpp:
(WebCore::CalendarPickerElement::contentSize):
Specify small size for the initial size. It's better than showing a
large window then shrink the size.
* page/PagePopupClient.h:
(PagePopupClient): Remove a false comment. We should support resize*().

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@115276 268f45cc-cd09-0410-ab3c-d52691b4dbfc
ChangeLog
ManualTests/forms/calendar-picker.html
Source/WebCore/ChangeLog
Source/WebCore/Resources/calendarPicker.css
Source/WebCore/Resources/calendarPicker.js
Source/WebCore/html/shadow/CalendarPickerElement.cpp
Source/WebCore/page/PagePopupClient.h