Title: [105856] trunk
Revision
105856
Author
[email protected]
Date
2012-01-25 01:57:51 -0800 (Wed, 25 Jan 2012)

Log Message

Update results.html version of PixelZoomer
https://bugs.webkit.org/show_bug.cgi?id=76965

Reviewed by Ojan Vafai.

Tools: 

Improve readability as suggested by Ojan.

* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/pixelzoomer.js:

LayoutTests: 

Update result.html with changes from PixelZoomer.js.

* fast/harness/results.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (105855 => 105856)


--- trunk/LayoutTests/ChangeLog	2012-01-25 08:54:19 UTC (rev 105855)
+++ trunk/LayoutTests/ChangeLog	2012-01-25 09:57:51 UTC (rev 105856)
@@ -1,3 +1,14 @@
+2012-01-25  Adam Barth  <[email protected]>
+
+        Update results.html version of PixelZoomer
+        https://bugs.webkit.org/show_bug.cgi?id=76965
+
+        Reviewed by Ojan Vafai.
+
+        Update result.html with changes from PixelZoomer.js.
+
+        * fast/harness/results.html:
+
 2012-01-25  Csaba Osztrogonác  <[email protected]>
 
         Unskip now passing tests after r105813.

Modified: trunk/LayoutTests/fast/harness/results.html (105855 => 105856)


--- trunk/LayoutTests/fast/harness/results.html	2012-01-25 08:54:19 UTC (rev 105855)
+++ trunk/LayoutTests/fast/harness/results.html	2012-01-25 09:57:51 UTC (rev 105856)
@@ -785,9 +785,14 @@
 var PixelZoomer = {};
 
 PixelZoomer.showOnDelay = true;
-
 PixelZoomer._zoomFactor = 6;
 
+var kResultWidth = 800;
+var kResultHeight = 600;
+
+var kZoomedResultWidth = kResultWidth * PixelZoomer._zoomFactor;
+var kZoomedResultHeight = kResultHeight * PixelZoomer._zoomFactor;
+
 PixelZoomer._zoomImageContainer = function(url)
 {
     var container = document.createElement('div');
@@ -805,6 +810,9 @@
     
     var image = new Image();
     image.src = ""
+    image.style.width = kZoomedResultWidth + 'px';
+    image.style.height = kZoomedResultHeight + 'px';
+    image.style.border = '1px solid black';
     imageContainer.appendChild(image);
     container.appendChild(imageContainer);
     
@@ -838,21 +846,10 @@
 
 PixelZoomer._draw = function(imageContainer)
 {
-    var containerWidth = imageContainer.offsetWidth;
-    var containerHeight = imageContainer.offsetHeight;
-  
-    var scaledMiddleX = PixelZoomer._currentX * PixelZoomer._zoomFactor;
-    var scaledMiddleY = PixelZoomer._currentY * PixelZoomer._zoomFactor;
-    
-    var left = scaledMiddleX - containerWidth / 2;
-    var top = scaledMiddleY - containerHeight / 2;
-    
     var image = imageContainer.querySelector('img');
-    image.style.width = (800 * PixelZoomer._zoomFactor) + 'px';
-    image.style.height = (600 * PixelZoomer._zoomFactor) + 'px';
-
-    image.style.top = -top + 'px';
-    image.style.left = -left + 'px';
+    var containerBounds = imageContainer.getBoundingClientRect();
+    image.style.left = (containerBounds.width / 2 - PixelZoomer._percentX * kZoomedResultWidth) + 'px';
+    image.style.top = (containerBounds.height / 2 - PixelZoomer._percentY * kZoomedResultHeight) + 'px';
 }
 
 PixelZoomer._drawAll = function()
@@ -887,10 +884,10 @@
             remove(container);
         return;
     }
-    
+
     var targetLocation = e.target.getBoundingClientRect();
-    PixelZoomer._currentX = e.clientX - targetLocation.left;
-    PixelZoomer._currentY = e.clientY - targetLocation.top;
+    PixelZoomer._percentX = (e.clientX - targetLocation.left) / targetLocation.width;
+    PixelZoomer._percentY = (e.clientY - targetLocation.top) / targetLocation.height;
 
     if (!container) {
         if (PixelZoomer.showOnDelay) {

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/pixelzoomer.js (105855 => 105856)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/pixelzoomer.js	2012-01-25 08:54:19 UTC (rev 105855)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/pixelzoomer.js	2012-01-25 09:57:51 UTC (rev 105856)
@@ -103,8 +103,8 @@
 {
     var image = imageContainer.querySelector('img');
     var containerBounds = imageContainer.getBoundingClientRect();
-    image.style.left = -(pixelzoomer._percentX * kZoomedResultWidth) + containerBounds.width/2 + 'px';
-    image.style.top = -(pixelzoomer._percentY * kZoomedResultHeight) + containerBounds.height/2 + 'px';
+    image.style.left = (containerBounds.width / 2 - pixelzoomer._percentX * kZoomedResultWidth) + 'px';
+    image.style.top = (containerBounds.height / 2 - pixelzoomer._percentY * kZoomedResultHeight) + 'px';
 }
 
 function drawAll()

Modified: trunk/Tools/ChangeLog (105855 => 105856)


--- trunk/Tools/ChangeLog	2012-01-25 08:54:19 UTC (rev 105855)
+++ trunk/Tools/ChangeLog	2012-01-25 09:57:51 UTC (rev 105856)
@@ -1,3 +1,14 @@
+2012-01-25  Adam Barth  <[email protected]>
+
+        Update results.html version of PixelZoomer
+        https://bugs.webkit.org/show_bug.cgi?id=76965
+
+        Reviewed by Ojan Vafai.
+
+        Improve readability as suggested by Ojan.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/pixelzoomer.js:
+
 2012-01-25  Carlos Garcia Campos  <[email protected]>
 
         [GTK] Page clients don't need to be GObjects anymore in WebKit2 GTK+ API
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to