Title: [136821] trunk/Source/WebCore
Revision
136821
Author
[email protected]
Date
2012-12-06 01:03:28 -0800 (Thu, 06 Dec 2012)

Log Message

Page popup should align to the right when the anchor element is rtl
https://bugs.webkit.org/show_bug.cgi?id=104219

Reviewed by Kent Tamura.

Page popup should align to the right edge of the anchor element when the anchor element is rtl.

No new tests. Mock page popup can't test popup window position.

* Resources/pagepopups/pickerCommon.js:
(_adjustWindowRectHorizontally): Align to the right edge when anchor element is rtl. Removed some redundant lines.
(setWindowRect): If the window is hidden we want to move first then resize so the popup doesn't flicker.
(isWindowHidden): Returns true if the window is hidden using hideWindow().

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (136820 => 136821)


--- trunk/Source/WebCore/ChangeLog	2012-12-06 09:01:57 UTC (rev 136820)
+++ trunk/Source/WebCore/ChangeLog	2012-12-06 09:03:28 UTC (rev 136821)
@@ -1,3 +1,19 @@
+2012-12-06  Keishi Hattori  <[email protected]>
+
+        Page popup should align to the right when the anchor element is rtl
+        https://bugs.webkit.org/show_bug.cgi?id=104219
+
+        Reviewed by Kent Tamura.
+
+        Page popup should align to the right edge of the anchor element when the anchor element is rtl.
+
+        No new tests. Mock page popup can't test popup window position.
+
+        * Resources/pagepopups/pickerCommon.js:
+        (_adjustWindowRectHorizontally): Align to the right edge when anchor element is rtl. Removed some redundant lines.
+        (setWindowRect): If the window is hidden we want to move first then resize so the popup doesn't flicker.
+        (isWindowHidden): Returns true if the window is hidden using hideWindow().
+
 2012-12-06  Kentaro Hara  <[email protected]>
 
         [V8] Make an Isolate mandatory for v8StringOrNull() and v8StringOrUndefined()

Modified: trunk/Source/WebCore/Resources/pagepopups/pickerCommon.js (136820 => 136821)


--- trunk/Source/WebCore/Resources/pagepopups/pickerCommon.js	2012-12-06 09:01:57 UTC (rev 136820)
+++ trunk/Source/WebCore/Resources/pagepopups/pickerCommon.js	2012-12-06 09:03:28 UTC (rev 136821)
@@ -150,9 +150,8 @@
     windowRect.width = Math.min(windowRect.width, availRect.width);
     windowRect.width = Math.max(windowRect.width, minWidth);
     windowRect.x = anchorRect.x;
-    var availableSpaceToRight = availRect.maxX - anchorRect.x;
-    if (windowRect.width > availableSpaceToRight)
-        windowRect.x -= (windowRect.width - availableSpaceToRight);
+    if (global.params.isRTL)
+        windowRect.x += anchorRect.width - windowRect.width;
     windowRect.x = Math.min(windowRect.x, availRect.maxX - windowRect.width);
     windowRect.x = Math.max(windowRect.x, availRect.x);
 }
@@ -165,8 +164,13 @@
         window.frameElement.style.width = rect.width + "px";
         window.frameElement.style.height = rect.height + "px";
     } else {
-        window.moveTo(rect.x - window.screen.availLeft, rect.y - window.screen.availTop);
-        window.resizeTo(rect.width, rect.height);
+        if (isWindowHidden()) {
+            window.moveTo(rect.x - window.screen.availLeft, rect.y - window.screen.availTop);
+            window.resizeTo(rect.width, rect.height);
+        } else {
+            window.resizeTo(rect.width, rect.height);
+            window.moveTo(rect.x - window.screen.availLeft, rect.y - window.screen.availTop);
+        }
     }
 }
 
@@ -174,8 +178,15 @@
     resizeWindow(1, 1);
 }
 
+/**
+ * @return {!boolean}
+ */
+function isWindowHidden() {
+    return window.innerWidth === 1 && window.innerHeight === 1;
+}
+
 window.addEventListener("resize", function() {
-    if (window.innerWidth === 1 && window.innerHeight === 1)
+    if (isWindowHidden())
         window.dispatchEvent(new CustomEvent("didHide"));
     else
         window.dispatchEvent(new CustomEvent("didOpenPicker"));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to