diff options
Diffstat (limited to 'Source/WebKit/chromium/src/ContextMenuClientImpl.cpp')
-rw-r--r-- | Source/WebKit/chromium/src/ContextMenuClientImpl.cpp | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp index 49de043..0f82d38 100644 --- a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp +++ b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp @@ -41,6 +41,7 @@ #include "EventHandler.h" #include "FrameLoader.h" #include "FrameView.h" +#include "HistoryItem.h" #include "HitTestResult.h" #include "HTMLMediaElement.h" #include "HTMLNames.h" @@ -60,6 +61,7 @@ #include "WebPlugin.h" #include "WebPluginContainerImpl.h" #include "WebPoint.h" +#include "WebSpellCheckClient.h" #include "WebString.h" #include "WebURL.h" #include "WebURLResponse.h" @@ -205,7 +207,7 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( if (mediaElement->hasVideo()) data.mediaFlags |= WebContextMenuData::MediaHasVideo; if (mediaElement->controls()) - data.mediaFlags |= WebContextMenuData::MediaControls; + data.mediaFlags |= WebContextMenuData::MediaControlRootElement; } else if (r.innerNonSharedNode()->hasTagName(HTMLNames::objectTag) || r.innerNonSharedNode()->hasTagName(HTMLNames::embedTag)) { RenderObject* object = r.innerNonSharedNode()->renderer(); @@ -240,8 +242,12 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( // Send the frame and page URLs in any case. data.pageURL = urlFromFrame(m_webView->mainFrameImpl()->frame()); - if (selectedFrame != m_webView->mainFrameImpl()->frame()) + if (selectedFrame != m_webView->mainFrameImpl()->frame()) { data.frameURL = urlFromFrame(selectedFrame); + RefPtr<HistoryItem> historyItem = selectedFrame->loader()->history()->currentItem(); + if (historyItem) + data.frameHistoryItem = WebHistoryItem(historyItem); + } if (r.isSelected()) data.selectedText = selectedFrame->editor()->selectedText().stripWhiteSpace(); @@ -251,19 +257,24 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( if (m_webView->focusedWebCoreFrame()->editor()->isContinuousSpellCheckingEnabled()) { data.isSpellCheckingEnabled = true; // Spellchecking might be enabled for the field, but could be disabled on the node. - if (m_webView->focusedWebCoreFrame()->editor()->isSpellCheckingEnabledInFocusedNode()) + if (m_webView->focusedWebCoreFrame()->editor()->isSpellCheckingEnabledInFocusedNode()) { data.misspelledWord = selectMisspelledWord(defaultMenu, selectedFrame); + if (m_webView->spellCheckClient()) { + int misspelledOffset, misspelledLength; + m_webView->spellCheckClient()->spellCheck( + data.misspelledWord, misspelledOffset, misspelledLength, + &data.dictionarySuggestions); + if (!misspelledLength) + data.misspelledWord.reset(); + } + } } } #if OS(DARWIN) - ExceptionCode ec = 0; - RefPtr<CSSStyleDeclaration> style = selectedFrame->document()->createCSSStyleDeclaration(); - style->setProperty(CSSPropertyDirection, "ltr", false, ec); - if (selectedFrame->editor()->selectionHasStyle(style.get()) != FalseTriState) + if (selectedFrame->editor()->selectionHasStyle(CSSPropertyDirection, "ltr") != FalseTriState) data.writingDirectionLeftToRight |= WebContextMenuData::CheckableMenuItemChecked; - style->setProperty(CSSPropertyDirection, "rtl", false, ec); - if (selectedFrame->editor()->selectionHasStyle(style.get()) != FalseTriState) + if (selectedFrame->editor()->selectionHasStyle(CSSPropertyDirection, "rtl") != FalseTriState) data.writingDirectionRightToLeft |= WebContextMenuData::CheckableMenuItemChecked; #endif // OS(DARWIN) |