Skip to content

Commit

Permalink
fix CanCopy2() when handling framesets
Browse files Browse the repository at this point in the history
  • Loading branch information
roytam1 committed May 22, 2018
1 parent b55a76c commit 888e6d5
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions k-meleon/app/BrowserWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,19 +164,26 @@ class CBrowserWrapper
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;
}

Expand Down

0 comments on commit 888e6d5

Please sign in to comment.