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

Side by Side Diff: Source/core/css/CSSBasicShapes.cpp

Issue 809823002: replace COMPILE_ASSERT with static assert in core/css/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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 | « no previous file | Source/core/css/CSSProperty.cpp » ('j') | 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) 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 } 228 }
229 229
230 static String buildPolygonString(const WindRule& windRule, const Vector<String>& points, const String& box) 230 static String buildPolygonString(const WindRule& windRule, const Vector<String>& points, const String& box)
231 { 231 {
232 ASSERT(!(points.size() % 2)); 232 ASSERT(!(points.size() % 2));
233 233
234 StringBuilder result; 234 StringBuilder result;
235 const char evenOddOpening[] = "polygon(evenodd, "; 235 const char evenOddOpening[] = "polygon(evenodd, ";
236 const char nonZeroOpening[] = "polygon("; 236 const char nonZeroOpening[] = "polygon(";
237 const char commaSeparator[] = ", "; 237 const char commaSeparator[] = ", ";
238 COMPILE_ASSERT(sizeof(evenOddOpening) > sizeof(nonZeroOpening), polygon_stri ng_openings_have_same_length); 238 static_assert(sizeof(evenOddOpening) > sizeof(nonZeroOpening), "polygon stri ng openings should be the same length");
239 239
240 // Compute the required capacity in advance to reduce allocations. 240 // Compute the required capacity in advance to reduce allocations.
241 size_t length = sizeof(evenOddOpening) - 1; 241 size_t length = sizeof(evenOddOpening) - 1;
242 for (size_t i = 0; i < points.size(); i += 2) { 242 for (size_t i = 0; i < points.size(); i += 2) {
243 if (i) 243 if (i)
244 length += (sizeof(commaSeparator) - 1); 244 length += (sizeof(commaSeparator) - 1);
245 // add length of two strings, plus one for the space separator. 245 // add length of two strings, plus one for the space separator.
246 length += points[i].length() + 1 + points[i + 1].length(); 246 length += points[i].length() + 1 + points[i + 1].length();
247 } 247 }
248 if (!box.isEmpty()) 248 if (!box.isEmpty())
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 visitor->trace(m_left); 443 visitor->trace(m_left);
444 visitor->trace(m_topLeftRadius); 444 visitor->trace(m_topLeftRadius);
445 visitor->trace(m_topRightRadius); 445 visitor->trace(m_topRightRadius);
446 visitor->trace(m_bottomRightRadius); 446 visitor->trace(m_bottomRightRadius);
447 visitor->trace(m_bottomLeftRadius); 447 visitor->trace(m_bottomLeftRadius);
448 CSSBasicShape::trace(visitor); 448 CSSBasicShape::trace(visitor);
449 } 449 }
450 450
451 } // namespace blink 451 } // namespace blink
452 452
OLDNEW
« no previous file with comments | « no previous file | Source/core/css/CSSProperty.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698