Title: [125289] trunk/Source/WebCore
Revision
125289
Author
[email protected]
Date
2012-08-10 09:15:59 -0700 (Fri, 10 Aug 2012)

Log Message

Horizontal scrollbar appears in the month-year selector of input[type=date]
https://bugs.webkit.org/show_bug.cgi?id=93517

Patch by Kevin Ellis <[email protected]> on 2012-08-10
Reviewed by Kent Tamura.

Update size of the month-year selector popup to account for the
width of the vertical scrollbar being platform dependent.

* Resources/calendarPicker.css:
(.month-selector-popup): Suppress horizontal scrolling.
* Resources/calendarPicker.js:
(YearMonthController.prototype.attachTo): Add a sizer element to facilitate determining the scrollbar width.
(YearMonthController.prototype._showPopup): Use computed scrollbar width for popup resizing.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (125288 => 125289)


--- trunk/Source/WebCore/ChangeLog	2012-08-10 16:08:16 UTC (rev 125288)
+++ trunk/Source/WebCore/ChangeLog	2012-08-10 16:15:59 UTC (rev 125289)
@@ -1,3 +1,19 @@
+2012-08-10  Kevin Ellis  <[email protected]>
+
+        Horizontal scrollbar appears in the month-year selector of input[type=date]
+        https://bugs.webkit.org/show_bug.cgi?id=93517
+
+        Reviewed by Kent Tamura.
+
+        Update size of the month-year selector popup to account for the
+        width of the vertical scrollbar being platform dependent.
+
+        * Resources/calendarPicker.css:
+        (.month-selector-popup): Suppress horizontal scrolling.
+        * Resources/calendarPicker.js:
+        (YearMonthController.prototype.attachTo): Add a sizer element to facilitate determining the scrollbar width.
+        (YearMonthController.prototype._showPopup): Use computed scrollbar width for popup resizing.
+
 2012-08-10  Alexander Pavlov  <[email protected]>
 
         Web Inspector: Unreviewed, fix frontend compilability after r125268.

Modified: trunk/Source/WebCore/Resources/calendarPicker.css (125288 => 125289)


--- trunk/Source/WebCore/Resources/calendarPicker.css	2012-08-10 16:08:16 UTC (rev 125288)
+++ trunk/Source/WebCore/Resources/calendarPicker.css	2012-08-10 16:15:59 UTC (rev 125289)
@@ -82,7 +82,7 @@
 }
 
 .month-selector-popup {
-    -webkit-box-sizing: border-box;
+    -webkit-box-sizing: content-box;
     -webkit-box-shadow:
         0 0 0 1px rgba(0,0,0,0.1),
         0 5px 1px 1px rgba(0,0,0,0.1),
@@ -91,6 +91,7 @@
     background: #fff;
     display: none;
     max-height: 10.8em;
+    overflow-x: hidden;
     overflow-y: auto;
     position: absolute;
     white-space: nowrap;

Modified: trunk/Source/WebCore/Resources/calendarPicker.js (125288 => 125289)


--- trunk/Source/WebCore/Resources/calendarPicker.js	2012-08-10 16:08:16 UTC (rev 125288)
+++ trunk/Source/WebCore/Resources/calendarPicker.js	2012-08-10 16:15:59 UTC (rev 125289)
@@ -51,6 +51,7 @@
     MonthSelectorPopup: "month-selector-popup",
     MonthSelectorPopupContents: "month-selector-popup-contents",
     MonthSelectorPopupEntry: "month-selector-popup-entry",
+    MonthSelectorPopupSizer: "month-selector-popup-sizer",
     MonthSelectorWall: "month-selector-wall",
     NoFocusRing: "no-focus-ring",
     NotThisMonth: "not-this-month",
@@ -458,6 +459,9 @@
     this._monthPopup.tabIndex = 0;
     this._monthPopupContents = createElement("div", ClassNames.MonthSelectorPopupContents);
     this._monthPopup.appendChild(this._monthPopupContents);
+    // Sizer used to determine the width of the viewport in the popup menu.
+    var sizer = createElement("div", ClassNames.MonthSelectorPopupSizer);
+    this._monthPopup.appendChild(sizer);
     box.appendChild(this._monthPopup);
     this._month = createElement("div", ClassNames.MonthSelector);
     this._month.addEventListener("click", bind(this._showPopup, this), false);
@@ -613,7 +617,10 @@
            if (bottom > popupHeight)
                this._monthPopup.scrollTop = bottom - popupHeight;
         }
-        this._monthPopup.style.webkitPaddingEnd = '15px';
+        var sizer = document.querySelector("." + ClassNames.MonthSelectorPopupSizer);
+        var scrollWidth = this._monthPopupContents.clientWidth - sizer.clientWidth;
+        if (scrollWidth > 0)
+            this._monthPopup.style.webkitPaddingEnd = scrollWidth + 'px';
     }
     this._monthPopup.focus();
 };
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to