mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 566131 - make nsCoreUtils::GetPresShellFor return raw pointer, r=davidb
This commit is contained in:
parent
5be95f4ad7
commit
59029e95f1
@ -256,7 +256,7 @@ nsAccEvent::CaptureIsFromUserInput(EIsFromUserInput aIsFromUserInput)
|
||||
if (!targetNode)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell = nsCoreUtils::GetPresShellFor(targetNode);
|
||||
nsIPresShell *presShell = nsCoreUtils::GetPresShellFor(targetNode);
|
||||
if (!presShell) {
|
||||
NS_NOTREACHED("Threre should always be an pres shell for an event");
|
||||
return;
|
||||
|
@ -352,7 +352,7 @@ nsAccUtils::HasAccessibleChildren(nsIDOMNode *aNode)
|
||||
if (!content)
|
||||
return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell = nsCoreUtils::GetPresShellFor(aNode);
|
||||
nsIPresShell *presShell = nsCoreUtils::GetPresShellFor(aNode);
|
||||
if (!presShell)
|
||||
return PR_FALSE;
|
||||
|
||||
|
@ -705,10 +705,9 @@ nsAccessNode::GetDocAccessibleFor(nsIDocShellTreeItem *aContainer,
|
||||
nsDocAccessible*
|
||||
nsAccessNode::GetDocAccessibleFor(nsIDOMNode *aNode)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> eventShell = nsCoreUtils::GetPresShellFor(aNode);
|
||||
if (eventShell) {
|
||||
return GetDocAccessibleFor(eventShell->GetDocument());
|
||||
}
|
||||
nsIPresShell *presShell = nsCoreUtils::GetPresShellFor(aNode);
|
||||
if (presShell)
|
||||
return GetDocAccessibleFor(presShell->GetDocument());
|
||||
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(aNode));
|
||||
if (doc) {
|
||||
@ -720,7 +719,7 @@ nsAccessNode::GetDocAccessibleFor(nsIDOMNode *aNode)
|
||||
|
||||
already_AddRefed<nsIDOMNode> nsAccessNode::GetCurrentFocus()
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell = nsCoreUtils::GetPresShellFor(mDOMNode);
|
||||
nsIPresShell *shell = nsCoreUtils::GetPresShellFor(mDOMNode);
|
||||
NS_ENSURE_TRUE(shell, nsnull);
|
||||
nsCOMPtr<nsIDocument> doc = shell->GetDocument();
|
||||
NS_ENSURE_TRUE(doc, nsnull);
|
||||
|
@ -321,7 +321,7 @@ nsCaretAccessible::GetCaretRect(nsIWidget **aOutWidget)
|
||||
lastAccessNode->GetDOMNode(getter_AddRefs(lastNodeWithCaret));
|
||||
NS_ENSURE_TRUE(lastNodeWithCaret, caretRect);
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell =
|
||||
nsIPresShell *presShell =
|
||||
nsCoreUtils::GetPresShellFor(lastNodeWithCaret);
|
||||
NS_ENSURE_TRUE(presShell, caretRect);
|
||||
|
||||
@ -371,7 +371,7 @@ nsCaretAccessible::GetSelectionControllerForNode(nsIDOMNode *aNode)
|
||||
if (!aNode)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell = nsCoreUtils::GetPresShellFor(aNode);
|
||||
nsIPresShell *presShell = nsCoreUtils::GetPresShellFor(aNode);
|
||||
if (!presShell)
|
||||
return nsnull;
|
||||
|
||||
|
@ -526,25 +526,6 @@ nsCoreUtils::IsCorrectFrameType(nsIFrame *aFrame, nsIAtom *aAtom)
|
||||
return aFrame->GetType() == aAtom;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIPresShell>
|
||||
nsCoreUtils::GetPresShellFor(nsIDOMNode *aNode)
|
||||
{
|
||||
nsCOMPtr<nsIDOMDocument> domDocument;
|
||||
aNode->GetOwnerDocument(getter_AddRefs(domDocument));
|
||||
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDocument));
|
||||
if (!doc) // This is necessary when the node is the document node
|
||||
doc = do_QueryInterface(aNode);
|
||||
|
||||
nsIPresShell *presShell = nsnull;
|
||||
if (doc) {
|
||||
presShell = doc->GetPrimaryShell();
|
||||
NS_IF_ADDREF(presShell);
|
||||
}
|
||||
|
||||
return presShell;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMNode>
|
||||
nsCoreUtils::GetDOMNodeForContainer(nsIDocShellTreeItem *aContainer)
|
||||
{
|
||||
|
@ -243,7 +243,12 @@ public:
|
||||
/**
|
||||
* Return presShell for the document containing the given DOM node.
|
||||
*/
|
||||
static already_AddRefed<nsIPresShell> GetPresShellFor(nsIDOMNode *aNode);
|
||||
static nsIPresShell *GetPresShellFor(nsIDOMNode *aNode)
|
||||
{
|
||||
nsCOMPtr<nsINode> node(do_QueryInterface(aNode));
|
||||
nsIDocument *document = node->GetOwnerDoc();
|
||||
return document ? document->GetPrimaryShell() : nsnull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return document node for the given document shell tree item.
|
||||
|
@ -507,8 +507,7 @@ nsRootAccessible::FireAccessibleFocusEvent(nsIAccessible *aAccessible,
|
||||
nsCOMPtr<nsIContent> focusContent = do_QueryInterface(finalFocusNode);
|
||||
nsIFrame *focusFrame = nsnull;
|
||||
if (focusContent) {
|
||||
nsCOMPtr<nsIPresShell> shell =
|
||||
nsCoreUtils::GetPresShellFor(finalFocusNode);
|
||||
nsIPresShell *shell = nsCoreUtils::GetPresShellFor(finalFocusNode);
|
||||
|
||||
NS_ASSERTION(shell, "No pres shell for final focus node!");
|
||||
if (!shell)
|
||||
@ -635,7 +634,7 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresShell> eventShell = nsCoreUtils::GetPresShellFor(aTargetNode);
|
||||
nsIPresShell *eventShell = nsCoreUtils::GetPresShellFor(aTargetNode);
|
||||
if (!eventShell) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ nsTextEquivUtils::AppendTextEquivFromContent(nsIAccessible *aInitiatorAcc,
|
||||
gInitiatorAcc = aInitiatorAcc;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(aContent));
|
||||
nsCOMPtr<nsIPresShell> shell = nsCoreUtils::GetPresShellFor(DOMNode);
|
||||
nsIPresShell *shell = nsCoreUtils::GetPresShellFor(DOMNode);
|
||||
if (!shell) {
|
||||
NS_ASSERTION(PR_TRUE, "There is no presshell!");
|
||||
gInitiatorAcc = nsnull;
|
||||
|
Loading…
Reference in New Issue
Block a user