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

Side by Side Diff: third_party/WebKit/Source/platform/transforms/TransformOperations.cpp

Issue 2616863002: Remove TransformOperation::None (Closed)
Patch Set: address comments Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/transforms/TransformOperation.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 int fromSize = from.operations().size(); 276 int fromSize = from.operations().size();
277 int toSize = operations().size(); 277 int toSize = operations().size();
278 int size = std::max(fromSize, toSize); 278 int size = std::max(fromSize, toSize);
279 279
280 *bounds = box; 280 *bounds = box;
281 for (int i = size - 1; i >= 0; i--) { 281 for (int i = size - 1; i >= 0; i--) {
282 RefPtr<TransformOperation> fromOperation = 282 RefPtr<TransformOperation> fromOperation =
283 (i < fromSize) ? from.operations()[i] : nullptr; 283 (i < fromSize) ? from.operations()[i] : nullptr;
284 RefPtr<TransformOperation> toOperation = 284 RefPtr<TransformOperation> toOperation =
285 (i < toSize) ? operations()[i] : nullptr; 285 (i < toSize) ? operations()[i] : nullptr;
286 if (fromOperation && fromOperation->type() == TransformOperation::None)
287 fromOperation = nullptr;
288 286
289 if (toOperation && toOperation->type() == TransformOperation::None) 287 DCHECK(fromOperation || toOperation);
290 toOperation = nullptr;
291
292 TransformOperation::OperationType interpolationType = 288 TransformOperation::OperationType interpolationType =
293 toOperation 289 toOperation ? toOperation->type() : fromOperation->type();
294 ? toOperation->type()
295 : fromOperation ? fromOperation->type() : TransformOperation::None;
296 if (fromOperation && toOperation && 290 if (fromOperation && toOperation &&
297 !fromOperation->canBlendWith(*toOperation.get())) 291 !fromOperation->canBlendWith(*toOperation.get()))
298 return false; 292 return false;
299 293
300 switch (interpolationType) { 294 switch (interpolationType) {
301 case TransformOperation::Identity: 295 case TransformOperation::Identity:
302 bounds->expandTo(box); 296 bounds->expandTo(box);
303 continue; 297 continue;
304 case TransformOperation::Translate: 298 case TransformOperation::Translate:
305 case TransformOperation::TranslateX: 299 case TransformOperation::TranslateX:
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 *bounds = boundsForArc; 395 *bounds = boundsForArc;
402 first = false; 396 first = false;
403 } else { 397 } else {
404 bounds->expandTo(boundsForArc); 398 bounds->expandTo(boundsForArc);
405 } 399 }
406 } 400 }
407 } 401 }
408 } 402 }
409 } 403 }
410 continue; 404 continue;
411 case TransformOperation::None:
412 continue;
413 case TransformOperation::Matrix: 405 case TransformOperation::Matrix:
414 case TransformOperation::Matrix3D: 406 case TransformOperation::Matrix3D:
415 case TransformOperation::Interpolated: 407 case TransformOperation::Interpolated:
416 case TransformOperation::RotateAroundOrigin: 408 case TransformOperation::RotateAroundOrigin:
417 return false; 409 return false;
418 } 410 }
419 } 411 }
420 412
421 return true; 413 return true;
422 } 414 }
423 415
424 TransformOperations TransformOperations::add( 416 TransformOperations TransformOperations::add(
425 const TransformOperations& addend) const { 417 const TransformOperations& addend) const {
426 TransformOperations result; 418 TransformOperations result;
427 result.m_operations = operations(); 419 result.m_operations = operations();
428 result.m_operations.appendVector(addend.operations()); 420 result.m_operations.appendVector(addend.operations());
429 return result; 421 return result;
430 } 422 }
431 423
432 TransformOperations TransformOperations::zoom(double factor) const { 424 TransformOperations TransformOperations::zoom(double factor) const {
433 TransformOperations result; 425 TransformOperations result;
434 for (auto& transformOperation : m_operations) 426 for (auto& transformOperation : m_operations)
435 result.m_operations.push_back(transformOperation->zoom(factor)); 427 result.m_operations.push_back(transformOperation->zoom(factor));
436 return result; 428 return result;
437 } 429 }
438 430
439 } // namespace blink 431 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/transforms/TransformOperation.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698