Title: [125266] trunk/Source/WebCore
Revision
125266
Author
[email protected]
Date
2012-08-10 02:46:21 -0700 (Fri, 10 Aug 2012)

Log Message

Resize calandar and color suggestion popups to show error message
https://bugs.webkit.org/show_bug.cgi?id=93695

Reviewed by Kent Tamura.

r125169 made PagePopupClient::contentSize() return zero size and so to
see the error message, we need to resize the page popup.

No new tests. Not user facing.

* Resources/calendarPicker.js:
(resizeWindow): Resizes popup window to given size.
(showMain): Initiates transition to show the main element.
(initialize):
(fixWindowSize):
* Resources/colorSuggestionPicker.js:
(resizeWindow):
(initialize):
(ColorPicker.prototype._layout):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (125265 => 125266)


--- trunk/Source/WebCore/ChangeLog	2012-08-10 09:43:07 UTC (rev 125265)
+++ trunk/Source/WebCore/ChangeLog	2012-08-10 09:46:21 UTC (rev 125266)
@@ -1,3 +1,25 @@
+2012-08-10  Keishi Hattori  <[email protected]>
+
+        Resize calandar and color suggestion popups to show error message
+        https://bugs.webkit.org/show_bug.cgi?id=93695
+
+        Reviewed by Kent Tamura.
+
+        r125169 made PagePopupClient::contentSize() return zero size and so to
+        see the error message, we need to resize the page popup.
+
+        No new tests. Not user facing.
+
+        * Resources/calendarPicker.js:
+        (resizeWindow): Resizes popup window to given size.
+        (showMain): Initiates transition to show the main element.
+        (initialize):
+        (fixWindowSize):
+        * Resources/colorSuggestionPicker.js:
+        (resizeWindow):
+        (initialize):
+        (ColorPicker.prototype._layout):
+
 2012-08-10  Yury Semikhatsky  <[email protected]>
 
         Web Inspector: further ResourceLoader memory instrumentation

Modified: trunk/Source/WebCore/Resources/calendarPicker.js (125265 => 125266)


--- trunk/Source/WebCore/Resources/calendarPicker.js	2012-08-10 09:43:07 UTC (rev 125265)
+++ trunk/Source/WebCore/Resources/calendarPicker.js	2012-08-10 09:46:21 UTC (rev 125266)
@@ -223,6 +223,25 @@
     return yearString + "-" + ("0" + (month + 1)).substr(-2, 2) + "-" + ("0" + day).substr(-2, 2);
 }
 
+/**
+ * @param {!number} width
+ * @param {!number} height
+ */
+function resizeWindow(width, height) {
+    if (window.frameElement) {
+        window.frameElement.style.width = width + "px";
+        window.frameElement.style.height = height + "px";
+    } else {
+        window.resizeTo(width, height);
+    }
+}
+
+function showMain() {
+    var main = $("main");
+    main.style.webkitTransition = "opacity 0.1s ease";
+    main.style.opacity = "1";
+}
+
 // ----------------------------------------------------------------
 // Initialization
 
@@ -285,9 +304,11 @@
     main.classList.add(ClassNames.NoFocusRing);
 
     var errorString = validateArguments(args);
-    if (errorString)
+    if (errorString) {
         main.textContent = "Internal error: " + errorString;
-    else {
+        resizeWindow(main.offsetWidth, main.offsetHeight);
+        showMain();
+    } else {
         global.params = args;
         checkLimits();
         layout();
@@ -336,14 +357,8 @@
     daysAreaElement.style.tableLayout = "fixed";
     document.getElementsByClassName(ClassNames.YearMonthUpper)[0].style.display = "-webkit-box";
     document.getElementsByClassName(ClassNames.MonthSelectorBox)[0].style.display = "block";
-    main.style.webkitTransition = "opacity 0.1s ease";
-    main.style.opacity = "1";
-    if (window.frameElement) {
-        window.frameElement.style.width = desiredBodyWidth + "px";
-        window.frameElement.style.height = mainHeight + "px";
-    } else {
-        window.resizeTo(desiredBodyWidth, mainHeight);
-    }
+    resizeWindow(desiredBodyWidth, mainHeight);
+    showMain();
 }
 
 function checkLimits() {

Modified: trunk/Source/WebCore/Resources/colorSuggestionPicker.js (125265 => 125266)


--- trunk/Source/WebCore/Resources/colorSuggestionPicker.js	2012-08-10 09:43:07 UTC (rev 125265)
+++ trunk/Source/WebCore/Resources/colorSuggestionPicker.js	2012-08-10 09:46:21 UTC (rev 125266)
@@ -71,6 +71,19 @@
 }
 
 /**
+ * @param {!number} width
+ * @param {!number} height
+ */
+function resizeWindow(width, height) {
+    if (window.frameElement) {
+        window.frameElement.style.width = width + "px";
+        window.frameElement.style.height = height + "px";
+    } else {
+        window.resizeTo(width, height);
+    }
+}
+
+/**
  * @param {Event} event
  */
 function handleMessage(event) {
@@ -85,9 +98,10 @@
     var main = $("main");
     main.innerHTML = "";
     var errorString = validateArguments(args);
-    if (errorString)
+    if (errorString) {
         main.textContent = "Internal error: " + errorString;
-    else
+        resizeWindow(main.offsetWidth, main.offsetHeight);
+    } else
         new ColorPicker(main, args);
 }
 
@@ -180,12 +194,7 @@
     this._otherButton = otherButton;
     var elementWidth = this._element.offsetWidth;
     var elementHeight = this._element.offsetHeight;
-    if (window.frameElement) {
-        window.frameElement.style.width = elementWidth + "px";
-        window.frameElement.style.height = elementHeight + "px";
-    } else {
-        window.resizeTo(elementWidth, elementHeight);
-    }
+    resizeWindow(elementWidth, elementHeight);
 };
 
 ColorPicker.prototype.selectColorAtIndex = function(index) {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to