OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Christian Dywan <christian@imendio.com> | 3 * Copyright (C) 2008 Christian Dywan <christian@imendio.com> |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 textDirectionMenu.appendItem(ltr); | 185 textDirectionMenu.appendItem(ltr); |
186 textDirectionMenu.appendItem(rtl); | 186 textDirectionMenu.appendItem(rtl); |
187 | 187 |
188 textDirectionMenuItem.setSubMenu(&textDirectionMenu); | 188 textDirectionMenuItem.setSubMenu(&textDirectionMenu); |
189 } | 189 } |
190 #endif | 190 #endif |
191 | 191 |
192 static bool selectionContainsPossibleWord(Frame* frame) | 192 static bool selectionContainsPossibleWord(Frame* frame) |
193 { | 193 { |
194 // Current algorithm: look for a character that's not just a separator. | 194 // Current algorithm: look for a character that's not just a separator. |
195 for (TextIterator it(frame->selection()->toRange().get()); !it.atEnd(); it.a
dvance()) { | 195 for (TextIterator it(frame->selection()->toNormalizedRange().get()); !it.atE
nd(); it.advance()) { |
196 int length = it.length(); | 196 int length = it.length(); |
197 const UChar* characters = it.characters(); | 197 const UChar* characters = it.characters(); |
198 for (int i = 0; i < length; ++i) | 198 for (int i = 0; i < length; ++i) |
199 if (!(category(characters[i]) & (Separator_Space | Separator_Line |
Separator_Paragraph))) | 199 if (!(category(characters[i]) & (Separator_Space | Separator_Line |
Separator_Paragraph))) |
200 return true; | 200 return true; |
201 } | 201 } |
202 return false; | 202 return false; |
203 } | 203 } |
204 | 204 |
205 void ContextMenu::populate() | 205 void ContextMenu::populate() |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 case ContextMenuItemBaseApplicationTag: | 648 case ContextMenuItemBaseApplicationTag: |
649 break; | 649 break; |
650 } | 650 } |
651 | 651 |
652 item.setChecked(shouldCheck); | 652 item.setChecked(shouldCheck); |
653 item.setEnabled(shouldEnable); | 653 item.setEnabled(shouldEnable); |
654 } | 654 } |
655 | 655 |
656 } | 656 } |
657 | 657 |
OLD | NEW |