mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-16 22:04:36 +00:00
Bug 225885 nsPresShell::DoCopy does not work for embedding p=marco@gnome.org r=bz sr=bryner a=dbaron
This commit is contained in:
parent
c0f50b6f95
commit
1a56f2a7d1
@ -4549,21 +4549,28 @@ NS_IMETHODIMP PresShell::DoCopyImageContents(nsIDOMNode* aNode)
|
||||
nsresult
|
||||
PresShell::GetSelectionForCopy(nsISelection** outSelection)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
*outSelection = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
GetDocument(getter_AddRefs(doc));
|
||||
if (!doc) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIEventStateManager> manager;
|
||||
nsresult rv = mPresContext->GetEventStateManager(getter_AddRefs(manager));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!manager) return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIContent> content;
|
||||
nsCOMPtr<nsPIDOMWindow> ourWindow = do_QueryInterface(mDocument->GetScriptGlobalObject());
|
||||
if (ourWindow) {
|
||||
nsCOMPtr<nsIFocusController> focusController;
|
||||
ourWindow->GetRootFocusController(getter_AddRefs(focusController));
|
||||
if (focusController) {
|
||||
nsCOMPtr<nsIDOMElement> focusedElement;
|
||||
focusController->GetFocusedElement(getter_AddRefs(focusedElement));
|
||||
content = do_QueryInterface(focusedElement);
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISelection> sel;
|
||||
nsCOMPtr<nsIContent> content;
|
||||
rv = manager->GetFocusedContent(getter_AddRefs(content));
|
||||
if (NS_SUCCEEDED(rv) && content)
|
||||
if (content)
|
||||
{
|
||||
//check to see if we need to get selection from frame
|
||||
//optimization that MAY need to be expanded as more things implement their own "selection"
|
||||
|
@ -4549,21 +4549,28 @@ NS_IMETHODIMP PresShell::DoCopyImageContents(nsIDOMNode* aNode)
|
||||
nsresult
|
||||
PresShell::GetSelectionForCopy(nsISelection** outSelection)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
*outSelection = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
GetDocument(getter_AddRefs(doc));
|
||||
if (!doc) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIEventStateManager> manager;
|
||||
nsresult rv = mPresContext->GetEventStateManager(getter_AddRefs(manager));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!manager) return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIContent> content;
|
||||
nsCOMPtr<nsPIDOMWindow> ourWindow = do_QueryInterface(mDocument->GetScriptGlobalObject());
|
||||
if (ourWindow) {
|
||||
nsCOMPtr<nsIFocusController> focusController;
|
||||
ourWindow->GetRootFocusController(getter_AddRefs(focusController));
|
||||
if (focusController) {
|
||||
nsCOMPtr<nsIDOMElement> focusedElement;
|
||||
focusController->GetFocusedElement(getter_AddRefs(focusedElement));
|
||||
content = do_QueryInterface(focusedElement);
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISelection> sel;
|
||||
nsCOMPtr<nsIContent> content;
|
||||
rv = manager->GetFocusedContent(getter_AddRefs(content));
|
||||
if (NS_SUCCEEDED(rv) && content)
|
||||
if (content)
|
||||
{
|
||||
//check to see if we need to get selection from frame
|
||||
//optimization that MAY need to be expanded as more things implement their own "selection"
|
||||
|
Loading…
x
Reference in New Issue
Block a user