OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 #include "platform/text/TextCheckerClient.h" | 33 #include "platform/text/TextCheckerClient.h" |
34 | 34 |
35 namespace blink { | 35 namespace blink { |
36 | 36 |
37 WebTextCheckingResult::operator TextCheckingResult() const { | 37 WebTextCheckingResult::operator TextCheckingResult() const { |
38 TextCheckingResult result; | 38 TextCheckingResult result; |
39 result.decoration = static_cast<TextDecorationType>(decoration); | 39 result.decoration = static_cast<TextDecorationType>(decoration); |
40 result.location = location; | 40 result.location = location; |
41 result.length = length; | 41 result.length = length; |
42 | 42 result.replacement = replacement; |
43 Vector<String> replacements_vec; | |
44 for (const WebString& replacement : replacements) { | |
45 replacements_vec.push_back(replacement); | |
46 } | |
47 result.replacements = replacements_vec; | |
48 | |
49 if (result.decoration == kTextDecorationTypeGrammar) { | 43 if (result.decoration == kTextDecorationTypeGrammar) { |
50 GrammarDetail detail; | 44 GrammarDetail detail; |
51 detail.location = 0; | 45 detail.location = 0; |
52 detail.length = length; | 46 detail.length = length; |
53 detail.user_description = replacements.empty() ? "" : replacements[0]; | 47 detail.user_description = replacement; |
54 result.details.push_back(detail); | 48 result.details.push_back(detail); |
55 } | 49 } |
56 | 50 |
57 return result; | 51 return result; |
58 } | 52 } |
59 | 53 |
60 } // namespace blink | 54 } // namespace blink |
OLD | NEW |