| OLD | NEW |
| 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 20 matching lines...) Expand all Loading... |
| 31 #include "core/layout/LayoutObject.h" | 31 #include "core/layout/LayoutObject.h" |
| 32 #include "core/layout/LayoutText.h" | 32 #include "core/layout/LayoutText.h" |
| 33 #include "wtf/text/StringBuilder.h" | 33 #include "wtf/text/StringBuilder.h" |
| 34 #include "wtf/unicode/CharacterNames.h" | 34 #include "wtf/unicode/CharacterNames.h" |
| 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.layoutObject() && node.layoutObject()->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 static_assert((static_cast<unsigned char>('\xA0') == noBreakSpace), "\\xA0 s
hould be non-breaking space"); | 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()) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |