diff --git a/mozilla/content/base/src/nsDocument.cpp b/mozilla/content/base/src/nsDocument.cpp index 742c2982c76..805dfd004b5 100644 --- a/mozilla/content/base/src/nsDocument.cpp +++ b/mozilla/content/base/src/nsDocument.cpp @@ -3116,12 +3116,14 @@ nsDocument::CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection) if (NS_SUCCEEDED(aSelection->GetFocusNode(getter_AddRefs(focus)))) { if (focus.get() == anchor.get()) - rootElement = do_QueryInterface(focus);//set root to top of selection - if (!rootElement)//maybe its a text node since both are the same. both parents are the same. pick one { - nsCOMPtr parent; - anchor->GetParentNode(getter_AddRefs(parent)); - rootElement = do_QueryInterface(parent);//set root to top of selection + rootElement = do_QueryInterface(focus);//set root to top of selection + if (!rootElement)//maybe its a text node since both are the same. both parents are the same. pick one + { + nsCOMPtr parent; + anchor->GetParentNode(getter_AddRefs(parent)); + rootElement = do_QueryInterface(parent);//set root to top of selection + } } } } diff --git a/mozilla/layout/base/src/nsDocument.cpp b/mozilla/layout/base/src/nsDocument.cpp index 742c2982c76..805dfd004b5 100644 --- a/mozilla/layout/base/src/nsDocument.cpp +++ b/mozilla/layout/base/src/nsDocument.cpp @@ -3116,12 +3116,14 @@ nsDocument::CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection) if (NS_SUCCEEDED(aSelection->GetFocusNode(getter_AddRefs(focus)))) { if (focus.get() == anchor.get()) - rootElement = do_QueryInterface(focus);//set root to top of selection - if (!rootElement)//maybe its a text node since both are the same. both parents are the same. pick one { - nsCOMPtr parent; - anchor->GetParentNode(getter_AddRefs(parent)); - rootElement = do_QueryInterface(parent);//set root to top of selection + rootElement = do_QueryInterface(focus);//set root to top of selection + if (!rootElement)//maybe its a text node since both are the same. both parents are the same. pick one + { + nsCOMPtr parent; + anchor->GetParentNode(getter_AddRefs(parent)); + rootElement = do_QueryInterface(parent);//set root to top of selection + } } } }