Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above | 8 * 1. Redistributions of source code must retain the above |
| 9 * copyright notice, this list of conditions and the following | 9 * copyright notice, this list of conditions and the following |
| 10 * disclaimer. | 10 * disclaimer. |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 349 } | 349 } |
| 350 default: | 350 default: |
| 351 break; | 351 break; |
| 352 } | 352 } |
| 353 | 353 |
| 354 if (basicShapeValue->layoutBox()) | 354 if (basicShapeValue->layoutBox()) |
| 355 basicShape->setLayoutBox(LayoutBox(*basicShapeValue->layoutBox())); | 355 basicShape->setLayoutBox(LayoutBox(*basicShapeValue->layoutBox())); |
| 356 | 356 |
| 357 return basicShape.release(); | 357 return basicShape.release(); |
| 358 } | 358 } |
| 359 | |
| 360 FloatPoint floatPointForCenterCoordinate(const BasicShapeCenterCoordinate& cente rX, const BasicShapeCenterCoordinate& centerY, FloatSize boxSize) | |
| 361 { | |
| 362 FloatPoint p; | |
| 363 float offset = floatValueForLength(centerX.length(), boxSize.width()); | |
| 364 switch (centerX.keyword()) { | |
|
leviw_travelin_and_unemployed
2014/01/08 23:07:43
I guess what I was imagining was this single acces
| |
| 365 case BasicShapeCenterCoordinate::None: | |
| 366 case BasicShapeCenterCoordinate::Left: | |
| 367 p.setX(offset); | |
| 368 break; | |
| 369 case BasicShapeCenterCoordinate::Right: | |
| 370 p.setX(boxSize.width() - offset); | |
| 371 break; | |
| 372 default: | |
| 373 ASSERT_NOT_REACHED(); | |
| 374 } | |
| 375 | |
| 376 offset = floatValueForLength(centerY.length(), boxSize.height()); | |
| 377 switch (centerY.keyword()) { | |
| 378 case BasicShapeCenterCoordinate::None: | |
| 379 case BasicShapeCenterCoordinate::Top: | |
| 380 p.setY(offset); | |
| 381 break; | |
| 382 case BasicShapeCenterCoordinate::Bottom: | |
| 383 p.setY(boxSize.height() - offset); | |
| 384 break; | |
| 385 default: | |
| 386 ASSERT_NOT_REACHED(); | |
| 387 } | |
| 388 | |
| 389 return p; | |
| 359 } | 390 } |
| 391 | |
| 392 } | |
| OLD | NEW |