Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: Source/web/ContextMenuClientImpl.cpp

Issue 189573002: Convert HTMLFrameOwnerElement and FocusController to use Frame. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Missed a null check Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/testing/MockPagePopupDriver.cpp ('k') | Source/web/SpellCheckerClientImpl.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 HitTestResult r = m_webView->page()->contextMenuController().hitTestResult() ; 188 HitTestResult r = m_webView->page()->contextMenuController().hitTestResult() ;
189 LocalFrame* selectedFrame = r.innerNodeFrame(); 189 LocalFrame* selectedFrame = r.innerNodeFrame();
190 190
191 WebContextMenuData data; 191 WebContextMenuData data;
192 IntPoint mousePoint = selectedFrame->view()->contentsToWindow(r.roundedPoint InInnerNodeFrame()); 192 IntPoint mousePoint = selectedFrame->view()->contentsToWindow(r.roundedPoint InInnerNodeFrame());
193 mousePoint.scale(m_webView->pageScaleFactor(), m_webView->pageScaleFactor()) ; 193 mousePoint.scale(m_webView->pageScaleFactor(), m_webView->pageScaleFactor()) ;
194 data.mousePosition = mousePoint; 194 data.mousePosition = mousePoint;
195 195
196 // Compute edit flags. 196 // Compute edit flags.
197 data.editFlags = WebContextMenuData::CanDoNone; 197 data.editFlags = WebContextMenuData::CanDoNone;
198 if (m_webView->focusedWebCoreFrame()->editor().canUndo()) 198 if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canUndo())
199 data.editFlags |= WebContextMenuData::CanUndo; 199 data.editFlags |= WebContextMenuData::CanUndo;
200 if (m_webView->focusedWebCoreFrame()->editor().canRedo()) 200 if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canRedo())
201 data.editFlags |= WebContextMenuData::CanRedo; 201 data.editFlags |= WebContextMenuData::CanRedo;
202 if (m_webView->focusedWebCoreFrame()->editor().canCut()) 202 if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canCut())
203 data.editFlags |= WebContextMenuData::CanCut; 203 data.editFlags |= WebContextMenuData::CanCut;
204 if (m_webView->focusedWebCoreFrame()->editor().canCopy()) 204 if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canCopy())
205 data.editFlags |= WebContextMenuData::CanCopy; 205 data.editFlags |= WebContextMenuData::CanCopy;
206 if (m_webView->focusedWebCoreFrame()->editor().canPaste()) 206 if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canPaste())
207 data.editFlags |= WebContextMenuData::CanPaste; 207 data.editFlags |= WebContextMenuData::CanPaste;
208 if (m_webView->focusedWebCoreFrame()->editor().canDelete()) 208 if (toLocalFrame(m_webView->focusedWebCoreFrame())->editor().canDelete())
209 data.editFlags |= WebContextMenuData::CanDelete; 209 data.editFlags |= WebContextMenuData::CanDelete;
210 // We can always select all... 210 // We can always select all...
211 data.editFlags |= WebContextMenuData::CanSelectAll; 211 data.editFlags |= WebContextMenuData::CanSelectAll;
212 data.editFlags |= WebContextMenuData::CanTranslate; 212 data.editFlags |= WebContextMenuData::CanTranslate;
213 213
214 // Links, Images, Media tags, and Image/Media-Links take preference over 214 // Links, Images, Media tags, and Image/Media-Links take preference over
215 // all else. 215 // all else.
216 data.linkURL = r.absoluteLinkURL(); 216 data.linkURL = r.absoluteLinkURL();
217 217
218 if (!r.absoluteImageURL().isEmpty()) { 218 if (!r.absoluteImageURL().isEmpty()) {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 if (marker.description().length()) { 315 if (marker.description().length()) {
316 Vector<String> suggestions; 316 Vector<String> suggestions;
317 marker.description().split('\n', suggestions); 317 marker.description().split('\n', suggestions);
318 data.dictionarySuggestions = suggestions; 318 data.dictionarySuggestions = suggestions;
319 } else if (m_webView->spellCheckClient()) { 319 } else if (m_webView->spellCheckClient()) {
320 int misspelledOffset, misspelledLength; 320 int misspelledOffset, misspelledLength;
321 m_webView->spellCheckClient()->spellCheck(data.misspelledWord, m isspelledOffset, misspelledLength, &data.dictionarySuggestions); 321 m_webView->spellCheckClient()->spellCheck(data.misspelledWord, m isspelledOffset, misspelledLength, &data.dictionarySuggestions);
322 } 322 }
323 } else { 323 } else {
324 data.isSpellCheckingEnabled = 324 data.isSpellCheckingEnabled =
325 m_webView->focusedWebCoreFrame()->spellChecker().isContinuousSpe llCheckingEnabled(); 325 toLocalFrame(m_webView->focusedWebCoreFrame())->spellChecker().i sContinuousSpellCheckingEnabled();
326 // Spellchecking might be enabled for the field, but could be disabl ed on the node. 326 // Spellchecking might be enabled for the field, but could be disabl ed on the node.
327 if (m_webView->focusedWebCoreFrame()->spellChecker().isSpellChecking EnabledInFocusedNode()) { 327 if (toLocalFrame(m_webView->focusedWebCoreFrame())->spellChecker().i sSpellCheckingEnabledInFocusedNode()) {
328 data.misspelledWord = selectMisspelledWord(selectedFrame); 328 data.misspelledWord = selectMisspelledWord(selectedFrame);
329 if (m_webView->spellCheckClient()) { 329 if (m_webView->spellCheckClient()) {
330 int misspelledOffset, misspelledLength; 330 int misspelledOffset, misspelledLength;
331 m_webView->spellCheckClient()->spellCheck( 331 m_webView->spellCheckClient()->spellCheck(
332 data.misspelledWord, misspelledOffset, misspelledLength, 332 data.misspelledWord, misspelledOffset, misspelledLength,
333 &data.dictionarySuggestions); 333 &data.dictionarySuggestions);
334 if (!misspelledLength) 334 if (!misspelledLength)
335 data.misspelledWord.reset(); 335 data.misspelledWord.reset();
336 } 336 }
337 } 337 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 outputItems[i] = subItems[i]; 416 outputItems[i] = subItems[i];
417 subMenuItems.swap(outputItems); 417 subMenuItems.swap(outputItems);
418 } 418 }
419 419
420 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu* defaultMenu, WebContextMenuData* data) 420 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu* defaultMenu, WebContextMenuData* data)
421 { 421 {
422 populateSubMenuItems(defaultMenu->items(), data->customItems); 422 populateSubMenuItems(defaultMenu->items(), data->customItems);
423 } 423 }
424 424
425 } // namespace blink 425 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/testing/MockPagePopupDriver.cpp ('k') | Source/web/SpellCheckerClientImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698