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

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

Issue 2616863002: Remove TransformOperation::None (Closed)
Patch Set: 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
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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 int fromSize = from.operations().size(); 275 int fromSize = from.operations().size();
276 int toSize = operations().size(); 276 int toSize = operations().size();
277 int size = std::max(fromSize, toSize); 277 int size = std::max(fromSize, toSize);
278 278
279 *bounds = box; 279 *bounds = box;
280 for (int i = size - 1; i >= 0; i--) { 280 for (int i = size - 1; i >= 0; i--) {
281 RefPtr<TransformOperation> fromOperation = 281 RefPtr<TransformOperation> fromOperation =
282 (i < fromSize) ? from.operations()[i] : nullptr; 282 (i < fromSize) ? from.operations()[i] : nullptr;
283 RefPtr<TransformOperation> toOperation = 283 RefPtr<TransformOperation> toOperation =
284 (i < toSize) ? operations()[i] : nullptr; 284 (i < toSize) ? operations()[i] : nullptr;
285 if (fromOperation && fromOperation->type() == TransformOperation::None)
286 fromOperation = nullptr;
287 285
288 if (toOperation && toOperation->type() == TransformOperation::None) 286 DCHECK(fromOperation || toOperation);
289 toOperation = nullptr;
290
291 TransformOperation::OperationType interpolationType = 287 TransformOperation::OperationType interpolationType =
292 toOperation 288 toOperation ? toOperation->type() : fromOperation->type();
293 ? toOperation->type()
294 : fromOperation ? fromOperation->type() : TransformOperation::None;
295 if (fromOperation && toOperation && 289 if (fromOperation && toOperation &&
296 !fromOperation->canBlendWith(*toOperation.get())) 290 !fromOperation->canBlendWith(*toOperation.get()))
297 return false; 291 return false;
298 292
299 switch (interpolationType) { 293 switch (interpolationType) {
300 case TransformOperation::Identity: 294 case TransformOperation::Identity:
301 bounds->expandTo(box); 295 bounds->expandTo(box);
302 continue; 296 continue;
303 case TransformOperation::Translate: 297 case TransformOperation::Translate:
304 case TransformOperation::TranslateX: 298 case TransformOperation::TranslateX:
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 *bounds = boundsForArc; 394 *bounds = boundsForArc;
401 first = false; 395 first = false;
402 } else { 396 } else {
403 bounds->expandTo(boundsForArc); 397 bounds->expandTo(boundsForArc);
404 } 398 }
405 } 399 }
406 } 400 }
407 } 401 }
408 } 402 }
409 continue; 403 continue;
410 case TransformOperation::None:
411 continue;
412 case TransformOperation::Matrix: 404 case TransformOperation::Matrix:
413 case TransformOperation::Matrix3D: 405 case TransformOperation::Matrix3D:
414 case TransformOperation::Interpolated: 406 case TransformOperation::Interpolated:
415 case TransformOperation::RotateAroundOrigin: 407 case TransformOperation::RotateAroundOrigin:
416 return false; 408 return false;
417 } 409 }
418 } 410 }
419 411
420 return true; 412 return true;
421 } 413 }
422 414
423 TransformOperations TransformOperations::add( 415 TransformOperations TransformOperations::add(
424 const TransformOperations& addend) const { 416 const TransformOperations& addend) const {
425 TransformOperations result; 417 TransformOperations result;
426 result.m_operations = operations(); 418 result.m_operations = operations();
427 result.m_operations.appendVector(addend.operations()); 419 result.m_operations.appendVector(addend.operations());
428 return result; 420 return result;
429 } 421 }
430 422
431 TransformOperations TransformOperations::zoom(double factor) const { 423 TransformOperations TransformOperations::zoom(double factor) const {
432 TransformOperations result; 424 TransformOperations result;
433 for (auto& transformOperation : m_operations) 425 for (auto& transformOperation : m_operations)
434 result.m_operations.append(transformOperation->zoom(factor)); 426 result.m_operations.append(transformOperation->zoom(factor));
435 return result; 427 return result;
436 } 428 }
437 429
438 } // namespace blink 430 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698