Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Unified Diff: tools/skpdiff/diff_viewer.js

Issue 20654006: download and rebaseline images using server (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix other missing filepath Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/jsondiff.py ('k') | tools/skpdiff/skpdiff_server.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/skpdiff/diff_viewer.js
diff --git a/tools/skpdiff/diff_viewer.js b/tools/skpdiff/diff_viewer.js
index 700bf4b0e4f6a958605769f9cac5b1dfb0b13c10..e7156b359f4596d5e2cc7773e4f145ee263a4bd0 100644
--- a/tools/skpdiff/diff_viewer.js
+++ b/tools/skpdiff/diff_viewer.js
@@ -1,3 +1,5 @@
+var MAX_SWAP_IMG_SIZE = 400;
+
angular.module('diff_viewer', []).
config(['$routeProvider', function($routeProvider) {
// Show the list of differences by default
@@ -28,10 +30,10 @@ directive('swapImg', function() {
image = rightImage;
}
- // Make it so the maximum size of an image is 500, and the images are scaled
- // down in halves.
+ // Make it so the maximum size of an image is MAX_SWAP_IMG_SIZE, and the images are
+ // scaled down in halves.
var divisor = 1;
- while ((image.width / divisor) > 500) {
+ while ((image.width / divisor) > MAX_SWAP_IMG_SIZE) {
divisor *= 2;
}
@@ -74,7 +76,7 @@ directive('swapImg', function() {
};
});
-function DiffListController($scope) {
+function DiffListController($scope, $http, $timeout) {
// Label each kind of differ for the sort buttons.
$scope.differs = [
{
@@ -100,4 +102,31 @@ function DiffListController($scope) {
$scope.sortingDiffer = function(record) {
return record.diffs[$scope.sortIndex].result;
};
+
+ // Flash status indicators on the rows, and then remove them so the style can potentially be
+ // reapplied later.
+ $scope.flashRowStatus = function(success, record) {
+ var flashStyle = success ? "success-flash" : "failure-flash";
+ var flashDurationMillis = success ? 500 : 800;
+
+ // Store the style in the record. The row will pick up the style this way instead of through
+ // index because index can change with sort order.
+ record.cssClasses = flashStyle;
+
+ // The animation cannot be repeated unless the class is removed the element.
+ $timeout(function() {
+ record.cssClasses = "";
+ }, flashDurationMillis);
+ }
+
+ $scope.setHashOf = function(imagePath, record) {
+ $http.post("/set_hash", {
+ "path": imagePath
+ }).success(function(data) {
+ $scope.flashRowStatus(data.success, record);
+ }).error(function() {
+ $scope.flashRowStatus(false, record);
+ });
+
+ };
}
« no previous file with comments | « tools/jsondiff.py ('k') | tools/skpdiff/skpdiff_server.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698