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

Side by Side Diff: Source/core/editing/HTMLInterchange.cpp

Issue 799403008: replace COMPILE_ASSERT with static_assert in core/editing/ (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 | 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) 2004, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2008 Apple Inc. 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 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 24 matching lines...) Expand all
35 35
36 namespace blink { 36 namespace blink {
37 37
38 String convertHTMLTextToInterchangeFormat(const String& in, const Text& node) 38 String convertHTMLTextToInterchangeFormat(const String& in, const Text& node)
39 { 39 {
40 // Assume all the text comes from node. 40 // Assume all the text comes from node.
41 if (node.renderer() && node.renderer()->style()->preserveNewline()) 41 if (node.renderer() && node.renderer()->style()->preserveNewline())
42 return in; 42 return in;
43 43
44 const char convertedSpaceString[] = "<span class=\"" AppleConvertedSpace "\" >\xA0</span>"; 44 const char convertedSpaceString[] = "<span class=\"" AppleConvertedSpace "\" >\xA0</span>";
45 COMPILE_ASSERT((static_cast<unsigned char>('\xA0') == noBreakSpace), Convert edSpaceStringSpaceIsNoBreakSpace); 45 static_assert((static_cast<unsigned char>('\xA0') == noBreakSpace), "\\xA0 s hould be non-breaking space");
46 46
47 StringBuilder s; 47 StringBuilder s;
48 48
49 unsigned i = 0; 49 unsigned i = 0;
50 unsigned consumed = 0; 50 unsigned consumed = 0;
51 while (i < in.length()) { 51 while (i < in.length()) {
52 consumed = 1; 52 consumed = 1;
53 if (isCollapsibleWhitespace(in[i])) { 53 if (isCollapsibleWhitespace(in[i])) {
54 // count number of adjoining spaces 54 // count number of adjoining spaces
55 unsigned j = i + 1; 55 unsigned j = i + 1;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 } 91 }
92 } else 92 } else
93 s.append(in[i]); 93 s.append(in[i]);
94 i += consumed; 94 i += consumed;
95 } 95 }
96 96
97 return s.toString(); 97 return s.toString();
98 } 98 }
99 99
100 } // namespace blink 100 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698