OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2011 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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 visitor->trace(m_radiusY); | 334 visitor->trace(m_radiusY); |
335 CSSBasicShape::trace(visitor); | 335 CSSBasicShape::trace(visitor); |
336 } | 336 } |
337 | 337 |
338 static String buildPolygonString(const WindRule& windRule, const Vector<String>&
points, const String& layoutBox) | 338 static String buildPolygonString(const WindRule& windRule, const Vector<String>&
points, const String& layoutBox) |
339 { | 339 { |
340 ASSERT(!(points.size() % 2)); | 340 ASSERT(!(points.size() % 2)); |
341 | 341 |
342 StringBuilder result; | 342 StringBuilder result; |
343 const char evenOddOpening[] = "polygon(evenodd, "; | 343 const char evenOddOpening[] = "polygon(evenodd, "; |
344 const char nonZeroOpening[] = "polygon(nonzero, "; | 344 const char nonZeroOpening[] = "polygon("; |
345 const char commaSeparator[] = ", "; | 345 const char commaSeparator[] = ", "; |
346 COMPILE_ASSERT(sizeof(evenOddOpening) == sizeof(nonZeroOpening), polygon_str
ing_openings_have_same_length); | 346 COMPILE_ASSERT(sizeof(evenOddOpening) > sizeof(nonZeroOpening), polygon_stri
ng_openings_have_same_length); |
347 | 347 |
348 // Compute the required capacity in advance to reduce allocations. | 348 // Compute the required capacity in advance to reduce allocations. |
349 size_t length = sizeof(evenOddOpening) - 1; | 349 size_t length = sizeof(evenOddOpening) - 1; |
350 for (size_t i = 0; i < points.size(); i += 2) { | 350 for (size_t i = 0; i < points.size(); i += 2) { |
351 if (i) | 351 if (i) |
352 length += (sizeof(commaSeparator) - 1); | 352 length += (sizeof(commaSeparator) - 1); |
353 // add length of two strings, plus one for the space separator. | 353 // add length of two strings, plus one for the space separator. |
354 length += points[i].length() + 1 + points[i + 1].length(); | 354 length += points[i].length() + 1 + points[i + 1].length(); |
355 } | 355 } |
356 if (!layoutBox.isEmpty()) | 356 if (!layoutBox.isEmpty()) |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 visitor->trace(m_left); | 600 visitor->trace(m_left); |
601 visitor->trace(m_topLeftRadius); | 601 visitor->trace(m_topLeftRadius); |
602 visitor->trace(m_topRightRadius); | 602 visitor->trace(m_topRightRadius); |
603 visitor->trace(m_bottomRightRadius); | 603 visitor->trace(m_bottomRightRadius); |
604 visitor->trace(m_bottomLeftRadius); | 604 visitor->trace(m_bottomLeftRadius); |
605 CSSBasicShape::trace(visitor); | 605 CSSBasicShape::trace(visitor); |
606 } | 606 } |
607 | 607 |
608 } // namespace WebCore | 608 } // namespace WebCore |
609 | 609 |
OLD | NEW |