Browse Source

fix CanCopy2() when handling framesets

master v76g-20180825
roytam1 4 years ago
parent
commit
888e6d509f
  1. 29
      k-meleon/app/BrowserWindow.h

29
k-meleon/app/BrowserWindow.h

@ -164,19 +164,26 @@ public:
BOOL CanCopy2()
{
nsCOMPtr<nsIDOMWindow> dom;
if (mWebBrowser) mWebBrowser->GetContentDOMWindow(getter_AddRefs(dom));
nsCOMPtr<nsPIDOMWindow> domWindow = do_QueryInterface(dom);
nsCOMPtr<nsIEditor> editor;
nsCOMPtr<nsISelection> domSelection;
if (GetEditor1(editor) || GetEditor2(domWindow, editor)) {
editor->GetSelection(getter_AddRefs(domSelection));
} else {
domWindow->GetSelection(getter_AddRefs(domSelection));
}
NS_ENSURE_TRUE(domSelection, false);
nsresult rv;
if (mWebBrowser) {
nsCOMPtr<nsIWebBrowserFocus> focus = do_GetInterface(mWebBrowser);
rv = focus->GetFocusedWindow(getter_AddRefs(dom));
if (NS_FAILED(rv))
mWebBrowser->GetContentDOMWindow(getter_AddRefs(dom));
}
nsCOMPtr<nsPIDOMWindow> domWindow = do_QueryInterface(dom);
nsCOMPtr<nsIEditor> editor;
nsCOMPtr<nsISelection> domSelection;
if (GetEditor1(editor) || GetEditor2(domWindow, editor)) {
editor->GetSelection(getter_AddRefs(domSelection));
} else {
domWindow->GetSelection(getter_AddRefs(domSelection));
}
NS_ENSURE_TRUE(domSelection, false);
bool selectionCollapsed = false;
domSelection->GetIsCollapsed(&selectionCollapsed);
// printf("CBrowserWrapper::CanCopy2() = %d\n", !selectionCollapsed);
return !selectionCollapsed;
}

Loading…
Cancel
Save