OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2012 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 | 198 |
199 // FIXME(bokan): crbug.com/371902 - We shouldn't be making these scale | 199 // FIXME(bokan): crbug.com/371902 - We shouldn't be making these scale |
200 // related coordinate transformatios in an ad hoc way. | 200 // related coordinate transformatios in an ad hoc way. |
201 PinchViewport& pinchViewport = selectedFrame->host()->pinchViewport(); | 201 PinchViewport& pinchViewport = selectedFrame->host()->pinchViewport(); |
202 mousePoint -= flooredIntSize(pinchViewport.visibleRect().location()); | 202 mousePoint -= flooredIntSize(pinchViewport.visibleRect().location()); |
203 mousePoint.scale(m_webView->pageScaleFactor(), m_webView->pageScaleFactor())
; | 203 mousePoint.scale(m_webView->pageScaleFactor(), m_webView->pageScaleFactor())
; |
204 data.mousePosition = mousePoint; | 204 data.mousePosition = mousePoint; |
205 | 205 |
206 // Compute edit flags. | 206 // Compute edit flags. |
207 data.editFlags = WebContextMenuData::CanDoNone; | 207 data.editFlags = WebContextMenuData::CanDoNone; |
208 if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canUndo()) | 208 if (toLocalFrame(m_webView->focusedCoreFrame())->editor().canUndo()) |
209 data.editFlags |= WebContextMenuData::CanUndo; | 209 data.editFlags |= WebContextMenuData::CanUndo; |
210 if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canRedo()) | 210 if (toLocalFrame(m_webView->focusedCoreFrame())->editor().canRedo()) |
211 data.editFlags |= WebContextMenuData::CanRedo; | 211 data.editFlags |= WebContextMenuData::CanRedo; |
212 if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canCut()) | 212 if (toLocalFrame(m_webView->focusedCoreFrame())->editor().canCut()) |
213 data.editFlags |= WebContextMenuData::CanCut; | 213 data.editFlags |= WebContextMenuData::CanCut; |
214 if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canCopy()) | 214 if (toLocalFrame(m_webView->focusedCoreFrame())->editor().canCopy()) |
215 data.editFlags |= WebContextMenuData::CanCopy; | 215 data.editFlags |= WebContextMenuData::CanCopy; |
216 if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canPaste()) | 216 if (toLocalFrame(m_webView->focusedCoreFrame())->editor().canPaste()) |
217 data.editFlags |= WebContextMenuData::CanPaste; | 217 data.editFlags |= WebContextMenuData::CanPaste; |
218 if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canDelete()) | 218 if (toLocalFrame(m_webView->focusedCoreFrame())->editor().canDelete()) |
219 data.editFlags |= WebContextMenuData::CanDelete; | 219 data.editFlags |= WebContextMenuData::CanDelete; |
220 if (isHTMLTextFormControlElement(r.innerNonSharedNode())) { | 220 if (isHTMLTextFormControlElement(r.innerNonSharedNode())) { |
221 if (!toHTMLTextFormControlElement(r.innerNonSharedNode())->value().isEmp
ty()) | 221 if (!toHTMLTextFormControlElement(r.innerNonSharedNode())->value().isEmp
ty()) |
222 data.editFlags |= WebContextMenuData::CanSelectAll; | 222 data.editFlags |= WebContextMenuData::CanSelectAll; |
223 } | 223 } |
224 data.editFlags |= WebContextMenuData::CanTranslate; | 224 data.editFlags |= WebContextMenuData::CanTranslate; |
225 | 225 |
226 // Links, Images, Media tags, and Image/Media-Links take preference over | 226 // Links, Images, Media tags, and Image/Media-Links take preference over |
227 // all else. | 227 // all else. |
228 data.linkURL = r.absoluteLinkURL(); | 228 data.linkURL = r.absoluteLinkURL(); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 if (description.length()) { | 330 if (description.length()) { |
331 Vector<String> suggestions; | 331 Vector<String> suggestions; |
332 description.split('\n', suggestions); | 332 description.split('\n', suggestions); |
333 data.dictionarySuggestions = suggestions; | 333 data.dictionarySuggestions = suggestions; |
334 } else if (m_webView->spellCheckClient()) { | 334 } else if (m_webView->spellCheckClient()) { |
335 int misspelledOffset, misspelledLength; | 335 int misspelledOffset, misspelledLength; |
336 m_webView->spellCheckClient()->spellCheck(data.misspelledWord, m
isspelledOffset, misspelledLength, &data.dictionarySuggestions); | 336 m_webView->spellCheckClient()->spellCheck(data.misspelledWord, m
isspelledOffset, misspelledLength, &data.dictionarySuggestions); |
337 } | 337 } |
338 } else { | 338 } else { |
339 data.isSpellCheckingEnabled = | 339 data.isSpellCheckingEnabled = |
340 toLocalFrame(m_webView->focusedWebCoreFrame())->spellChecker().i
sContinuousSpellCheckingEnabled(); | 340 toLocalFrame(m_webView->focusedCoreFrame())->spellChecker().isCo
ntinuousSpellCheckingEnabled(); |
341 // Spellchecking might be enabled for the field, but could be disabl
ed on the node. | 341 // Spellchecking might be enabled for the field, but could be disabl
ed on the node. |
342 if (toLocalFrame(m_webView->focusedWebCoreFrame())->spellChecker().i
sSpellCheckingEnabledInFocusedNode()) { | 342 if (toLocalFrame(m_webView->focusedCoreFrame())->spellChecker().isSp
ellCheckingEnabledInFocusedNode()) { |
343 data.misspelledWord = selectMisspelledWord(selectedFrame); | 343 data.misspelledWord = selectMisspelledWord(selectedFrame); |
344 if (m_webView->spellCheckClient()) { | 344 if (m_webView->spellCheckClient()) { |
345 int misspelledOffset, misspelledLength; | 345 int misspelledOffset, misspelledLength; |
346 m_webView->spellCheckClient()->spellCheck( | 346 m_webView->spellCheckClient()->spellCheck( |
347 data.misspelledWord, misspelledOffset, misspelledLength, | 347 data.misspelledWord, misspelledOffset, misspelledLength, |
348 &data.dictionarySuggestions); | 348 &data.dictionarySuggestions); |
349 if (!misspelledLength) | 349 if (!misspelledLength) |
350 data.misspelledWord.reset(); | 350 data.misspelledWord.reset(); |
351 } | 351 } |
352 } | 352 } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 outputItems[i] = subItems[i]; | 437 outputItems[i] = subItems[i]; |
438 subMenuItems.swap(outputItems); | 438 subMenuItems.swap(outputItems); |
439 } | 439 } |
440 | 440 |
441 void ContextMenuClientImpl::populateCustomMenuItems(const ContextMenu* defaultMe
nu, WebContextMenuData* data) | 441 void ContextMenuClientImpl::populateCustomMenuItems(const ContextMenu* defaultMe
nu, WebContextMenuData* data) |
442 { | 442 { |
443 populateSubMenuItems(defaultMenu->items(), data->customItems); | 443 populateSubMenuItems(defaultMenu->items(), data->customItems); |
444 } | 444 } |
445 | 445 |
446 } // namespace blink | 446 } // namespace blink |
OLD | NEW |