Title: [105834] trunk/Tools
- Revision
- 105834
- Author
- [email protected]
- Date
- 2012-01-24 16:56:23 -0800 (Tue, 24 Jan 2012)
Log Message
garden-o-matic pixel zoomer should let you look at every pixel of the image
https://bugs.webkit.org/show_bug.cgi?id=76962
Reviewed by Ojan Vafai.
Previously, you couldn't get up to the right and bottom pixels.
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/pixelzoomer.js:
Modified Paths
Diff
Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/pixelzoomer.js (105833 => 105834)
--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/pixelzoomer.js 2012-01-25 00:48:57 UTC (rev 105833)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/pixelzoomer.js 2012-01-25 00:56:23 UTC (rev 105834)
@@ -33,6 +33,12 @@
var kZoomFactor = 6;
var kDelayTimeoutMS = 400;
+var kResultWidth = 800;
+var kResultHeight = 600;
+
+var kZoomedResultWidth = kResultWidth * kZoomFactor;
+var kZoomedResultHeight = kResultHeight * kZoomFactor;
+
function matchesSelector(node, selector)
{
if (node.webkitMatchesSelector)
@@ -68,6 +74,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);
@@ -92,21 +101,10 @@
function draw(imageContainer)
{
- var containerWidth = imageContainer.offsetWidth;
- var containerHeight = imageContainer.offsetHeight;
-
- var scaledMiddleX = pixelzoomer._currentX * kZoomFactor;
- var scaledMiddleY = pixelzoomer._currentY * kZoomFactor;
-
- var left = scaledMiddleX - containerWidth / 2;
- var top = scaledMiddleY - containerHeight / 2;
-
var image = imageContainer.querySelector('img');
- image.style.width = (800 * kZoomFactor) + 'px';
- image.style.height = (600 * kZoomFactor) + 'px';
-
- image.style.top = -top + 'px';
- image.style.left = -left + 'px';
+ var containerBounds = imageContainer.getBoundingClientRect();
+ image.style.left = -(pixelzoomer._percentX * kZoomedResultWidth) + containerBounds.width/2 + 'px';
+ image.style.top = -(pixelzoomer._percentY * kZoomedResultHeight) + containerBounds.height/2 + 'px';
}
function drawAll()
@@ -132,7 +130,7 @@
return;
var container = document.querySelector('.pixel-zoom-container');
-
+
var resultContainer = (e.target.className == 'result-container') ?
e.target : parentOfType(e.target, '.result-container');
if (!resultContainer || !resultContainer.querySelector('img')) {
@@ -141,8 +139,8 @@
}
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/ChangeLog (105833 => 105834)
--- trunk/Tools/ChangeLog 2012-01-25 00:48:57 UTC (rev 105833)
+++ trunk/Tools/ChangeLog 2012-01-25 00:56:23 UTC (rev 105834)
@@ -1,3 +1,14 @@
+2012-01-24 Adam Barth <[email protected]>
+
+ garden-o-matic pixel zoomer should let you look at every pixel of the image
+ https://bugs.webkit.org/show_bug.cgi?id=76962
+
+ Reviewed by Ojan Vafai.
+
+ Previously, you couldn't get up to the right and bottom pixels.
+
+ * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/pixelzoomer.js:
+
2012-01-24 Enrica Casucci <[email protected]>
WebHTMLView should implement typingAttributes methods to work correctly with the Inspector bar in Mail.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes