| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/base/ime/composition_text_util_pango.h" | 5 #include "ui/base/ime/composition_text_util_pango.h" |
| 6 | 6 |
| 7 #include <pango/pango-attributes.h> | 7 #include <pango/pango-attributes.h> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/i18n/char_iterator.h" | 10 #include "base/i18n/char_iterator.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 continue; | 69 continue; |
| 70 | 70 |
| 71 PangoAttribute* background_attr = | 71 PangoAttribute* background_attr = |
| 72 pango_attr_iterator_get(iter, PANGO_ATTR_BACKGROUND); | 72 pango_attr_iterator_get(iter, PANGO_ATTR_BACKGROUND); |
| 73 PangoAttribute* underline_attr = | 73 PangoAttribute* underline_attr = |
| 74 pango_attr_iterator_get(iter, PANGO_ATTR_UNDERLINE); | 74 pango_attr_iterator_get(iter, PANGO_ATTR_UNDERLINE); |
| 75 | 75 |
| 76 if (background_attr || underline_attr) { | 76 if (background_attr || underline_attr) { |
| 77 // Use a black thin underline by default. | 77 // Use a black thin underline by default. |
| 78 CompositionUnderline underline( | 78 CompositionUnderline underline( |
| 79 char16_offsets[start], char16_offsets[end], SK_ColorBLACK, false); | 79 char16_offsets[start], char16_offsets[end], SK_ColorBLACK, false, |
| 80 SK_ColorTRANSPARENT); |
| 80 | 81 |
| 81 // Always use thick underline for a range with background color, which | 82 // Always use thick underline for a range with background color, which |
| 82 // is usually the selection range. | 83 // is usually the selection range. |
| 83 if (background_attr) { | 84 if (background_attr) { |
| 84 underline.thick = true; | 85 underline.thick = true; |
| 85 // If the cursor is at start or end of this underline, then we treat | 86 // If the cursor is at start or end of this underline, then we treat |
| 86 // it as the selection range as well, but make sure to set the cursor | 87 // it as the selection range as well, but make sure to set the cursor |
| 87 // position to the selection end. | 88 // position to the selection end. |
| 88 if (underline.start_offset == cursor_offset) { | 89 if (underline.start_offset == cursor_offset) { |
| 89 composition->selection.set_start(underline.end_offset); | 90 composition->selection.set_start(underline.end_offset); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 102 } | 103 } |
| 103 composition->underlines.push_back(underline); | 104 composition->underlines.push_back(underline); |
| 104 } | 105 } |
| 105 } while (pango_attr_iterator_next(iter)); | 106 } while (pango_attr_iterator_next(iter)); |
| 106 pango_attr_iterator_destroy(iter); | 107 pango_attr_iterator_destroy(iter); |
| 107 } | 108 } |
| 108 | 109 |
| 109 // Use a black thin underline by default. | 110 // Use a black thin underline by default. |
| 110 if (composition->underlines.empty()) { | 111 if (composition->underlines.empty()) { |
| 111 composition->underlines.push_back( | 112 composition->underlines.push_back( |
| 112 CompositionUnderline(0, length, SK_ColorBLACK, false)); | 113 CompositionUnderline(0, length, SK_ColorBLACK, false, |
| 114 SK_ColorTRANSPARENT)); |
| 113 } | 115 } |
| 114 } | 116 } |
| 115 | 117 |
| 116 } // namespace ui | 118 } // namespace ui |
| OLD | NEW |