mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Remove refcounting version of nsIPresShell::GetPresContext. Bug 253889, r+sr=roc.
This commit is contained in:
parent
eceef74c69
commit
180b0b7373
@ -75,11 +75,10 @@ nsAccessibleHyperText::nsAccessibleHyperText(nsIDOMNode* aDomNode, nsIWeakRefere
|
||||
nsIFrame *parentFrame = nsAccessible::GetParentBlockFrame(frame);
|
||||
NS_ASSERTION(parentFrame, "Error: HyperText can't get parent block frame");
|
||||
if (parentFrame) {
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
shell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsIFrame* childFrame = parentFrame->GetFirstChild(nsnull);
|
||||
PRBool bSave = PR_FALSE;
|
||||
GetAllTextChildren(presContext, childFrame, aDomNode, bSave);
|
||||
GetAllTextChildren(shell->GetPresContext(), childFrame,
|
||||
aDomNode, bSave);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -104,9 +104,8 @@ nsresult nsAccessibleText::GetSelections(nsISelectionController **aSelCon, nsISe
|
||||
// Get the selection and selection controller
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
nsCOMPtr<nsISelection> domSel;
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
frame->GetSelectionController(context, getter_AddRefs(selCon));
|
||||
frame->GetSelectionController(shell->GetPresContext(),
|
||||
getter_AddRefs(selCon));
|
||||
if (selCon)
|
||||
selCon->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(domSel));
|
||||
|
||||
@ -648,8 +647,7 @@ NS_IMETHODIMP nsAccessibleText::GetCharacterExtents(PRInt32 aOffset,
|
||||
nsIPresShell *shell = doc->GetShellAt(0);
|
||||
NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
nsPresContext *context = shell->GetPresContext();
|
||||
NS_ENSURE_TRUE(context, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mTextNode));
|
||||
|
@ -213,7 +213,9 @@ void nsAccessNode::ShutdownXPAccessibility()
|
||||
|
||||
already_AddRefed<nsIPresShell> nsAccessNode::GetPresShell()
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mWeakShell));
|
||||
nsIPresShell *presShell = nsnull;
|
||||
if (mWeakShell)
|
||||
CallQueryReferent(mWeakShell.get(), &presShell);
|
||||
if (!presShell) {
|
||||
if (mWeakShell) {
|
||||
// If our pres shell has died, but we're still holding onto
|
||||
@ -223,20 +225,16 @@ already_AddRefed<nsIPresShell> nsAccessNode::GetPresShell()
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
nsIPresShell *resultShell = presShell;
|
||||
NS_IF_ADDREF(resultShell);
|
||||
return resultShell;
|
||||
return presShell;
|
||||
}
|
||||
|
||||
already_AddRefed<nsPresContext> nsAccessNode::GetPresContext()
|
||||
nsPresContext* nsAccessNode::GetPresContext()
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> presShell(GetPresShell());
|
||||
if (!presShell) {
|
||||
return nsnull;
|
||||
}
|
||||
nsPresContext *presContext;
|
||||
presShell->GetPresContext(&presContext); // Addref'd
|
||||
return presContext;
|
||||
return presShell->GetPresContext();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIAccessibleDocument> nsAccessNode::GetDocAccessible()
|
||||
@ -410,7 +408,7 @@ NS_IMETHODIMP
|
||||
nsAccessNode::GetComputedStyleValue(const nsAString& aPseudoElt, const nsAString& aPropertyName, nsAString& aValue)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsPresContext> presContext(GetPresContext());
|
||||
nsPresContext *presContext = GetPresContext();
|
||||
NS_ENSURE_TRUE(domElement && presContext, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsISupports> container = presContext->GetContainer();
|
||||
|
@ -122,7 +122,7 @@ class nsAccessNode: public nsIAccessNode, public nsPIAccessNode
|
||||
protected:
|
||||
nsresult MakeAccessNode(nsIDOMNode *aNode, nsIAccessNode **aAccessNode);
|
||||
already_AddRefed<nsIPresShell> GetPresShell();
|
||||
already_AddRefed<nsPresContext> GetPresContext();
|
||||
nsPresContext* GetPresContext();
|
||||
already_AddRefed<nsIAccessibleDocument> GetDocAccessible();
|
||||
virtual nsIFrame* GetFrame();
|
||||
|
||||
|
@ -839,12 +839,11 @@ nsAccessibilityService::CreateHTMLTextAccessible(nsISupports *aFrame, nsIAccessi
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(weakShell));
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsIFrame* childFrame = parentFrame->GetFirstChild(nsnull);
|
||||
PRInt32 index = 0;
|
||||
nsIFrame* firstTextFrame = nsnull;
|
||||
PRBool ret = nsAccessible::FindTextFrame(index, presContext, childFrame, &firstTextFrame, frame);
|
||||
PRBool ret = nsAccessible::FindTextFrame(index, presShell->GetPresContext(),
|
||||
childFrame, &firstTextFrame, frame);
|
||||
if (!ret || index != 0)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -514,8 +514,7 @@ PRBool nsAccessible::IsPartiallyVisible(PRBool *aIsOffscreen)
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
shell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = shell->GetPresContext();
|
||||
if (!presContext)
|
||||
return PR_FALSE;
|
||||
|
||||
@ -770,7 +769,7 @@ NS_IMETHODIMP nsAccessible::GetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PR
|
||||
// Another frame, same node <- Example
|
||||
// Another frame, same node
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext(GetPresContext());
|
||||
nsPresContext *presContext = GetPresContext();
|
||||
if (!presContext)
|
||||
{
|
||||
*x = *y = *width = *height = 0;
|
||||
@ -1381,8 +1380,7 @@ nsresult nsAccessible::GetParentBlockNode(nsIPresShell *aPresShell, nsIDOMNode *
|
||||
if (! parentFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
aPresShell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = aPresShell->GetPresContext();
|
||||
nsIAtom* frameType = nsnull;
|
||||
while (frame && (frameType = frame->GetType()) != nsAccessibilityAtoms::textFrame) {
|
||||
frame = frame->GetFirstChild(nsnull);
|
||||
|
@ -104,8 +104,7 @@ NS_IMETHODIMP nsCaretAccessible::AttachNewSelectionListener(nsIDOMNode *aCurrent
|
||||
|
||||
nsIFrame *frame = nsnull;
|
||||
presShell->GetPrimaryFrameFor(content, &frame);
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
if (!frame || !presContext)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
@ -159,8 +158,7 @@ NS_IMETHODIMP nsCaretAccessible::NotifySelectionChanged(nsIDOMDocument *aDoc, ns
|
||||
nsIAccessibleEvent::EVENT_HIDE, this, nsnull);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
nsIViewManager* viewManager = presShell->GetViewManager();
|
||||
if (!presContext || !viewManager)
|
||||
return NS_OK;
|
||||
|
@ -516,10 +516,6 @@ nsresult nsDocAccessible::AddEventListeners()
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
presShell->GetPresContext(getter_AddRefs(context));
|
||||
NS_ENSURE_TRUE(context, NS_ERROR_FAILURE);
|
||||
|
||||
mWebProgress = do_GetInterface(docShellTreeItem);
|
||||
NS_ENSURE_TRUE(mWebProgress, NS_ERROR_FAILURE);
|
||||
|
||||
|
@ -114,7 +114,7 @@ NS_IMETHODIMP nsHTMLAreaAccessible::GetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *w
|
||||
|
||||
*x = *y = *width = *height = 0;
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext(GetPresContext());
|
||||
nsPresContext *presContext = GetPresContext();
|
||||
NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIContent> ourContent(do_QueryInterface(mDOMNode));
|
||||
|
@ -353,7 +353,7 @@ NS_IMETHODIMP nsHTMLTextFieldAccessible::GetState(PRUint32 *_retval)
|
||||
|
||||
nsIFrame *frame = GetFrame();
|
||||
if (frame) {
|
||||
nsCOMPtr<nsPresContext> context(GetPresContext());
|
||||
nsPresContext *context = GetPresContext();
|
||||
NS_ENSURE_TRUE(context, NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
frame->GetSelectionController(context,getter_AddRefs(selCon));
|
||||
|
@ -211,7 +211,7 @@ NS_IMETHODIMP nsHTMLSelectableAccessible::GetSelectedChildren(nsIArray **_retval
|
||||
if (!selectedAccessibles)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsCOMPtr<nsPresContext> context(GetPresContext());
|
||||
nsPresContext *context = GetPresContext();
|
||||
if (!context)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
@ -237,7 +237,7 @@ NS_IMETHODIMP nsHTMLSelectableAccessible::RefSelection(PRInt32 aIndex, nsIAccess
|
||||
if (!accService)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsPresContext> context(GetPresContext());
|
||||
nsPresContext *context = GetPresContext();
|
||||
if (!context)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
@ -1129,7 +1129,7 @@ NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetNumActions(PRUint8 *aNumActions
|
||||
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::DoAction(PRUint8 aIndex)
|
||||
{
|
||||
nsIFrame* frame = nsAccessible::GetBoundsFrame();
|
||||
nsCOMPtr<nsPresContext> context(GetPresContext());
|
||||
nsPresContext *context = GetPresContext();
|
||||
if (!frame || !context)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
@ -1189,7 +1189,7 @@ void nsHTMLComboboxButtonAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** a
|
||||
// bounding frame is the ComboboxControlFrame
|
||||
nsIFrame *frame = nsAccessible::GetBoundsFrame();
|
||||
*aBoundingFrame = frame;
|
||||
nsCOMPtr<nsPresContext> context(GetPresContext());
|
||||
nsPresContext *context = GetPresContext();
|
||||
if (!frame || !context)
|
||||
return;
|
||||
|
||||
|
@ -82,8 +82,6 @@ NS_IMETHODIMP nsHTMLTextAccessible::GetState(PRUint32 *aState)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
nsIFrame *frame = nsnull;
|
||||
// The root frame and all text frames in the document share the same
|
||||
@ -91,7 +89,8 @@ NS_IMETHODIMP nsHTMLTextAccessible::GetState(PRUint32 *aState)
|
||||
shell->GetRootFrame(&frame);
|
||||
if (frame) {
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
frame->GetSelectionController(context, getter_AddRefs(selCon));
|
||||
frame->GetSelectionController(shell->GetPresContext(),
|
||||
getter_AddRefs(selCon));
|
||||
if (selCon) {
|
||||
nsCOMPtr<nsISelection> domSel;
|
||||
selCon->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(domSel));
|
||||
|
@ -173,8 +173,7 @@ STDMETHODIMP nsTextAccessibleWrap::scrollToSubstring(
|
||||
return E_FAIL; // This accessible has been shut down
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
nsCOMPtr<nsIDOMRange> scrollToRange = do_CreateInstance(kRangeCID);
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
frame->GetSelectionController(presContext, getter_AddRefs(selCon));
|
||||
@ -227,8 +226,7 @@ nsresult nsTextAccessibleWrap::GetCharacterExtents(PRInt32 aStartOffset, PRInt32
|
||||
nsCOMPtr<nsIPresShell> presShell(GetPresShell());
|
||||
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE);
|
||||
float t2p = presContext->TwipsToPixels();
|
||||
|
||||
|
@ -947,9 +947,7 @@ nsContentSink::StartLayout(PRBool aIsFrameset)
|
||||
shell->BeginObservingDocument();
|
||||
|
||||
// Resize-reflow this time
|
||||
nsCOMPtr<nsPresContext> cx;
|
||||
shell->GetPresContext(getter_AddRefs(cx));
|
||||
nsRect r = cx->GetVisibleArea();
|
||||
nsRect r = shell->GetPresContext()->GetVisibleArea();
|
||||
shell->InitialReflow(r.width, r.height);
|
||||
|
||||
// Now trigger a refresh
|
||||
|
@ -1996,8 +1996,7 @@ nsDocument::EndLoad()
|
||||
|
||||
nsIPresShell *shell = ancestor_doc->GetShellAt(0);
|
||||
if (shell) {
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
nsCOMPtr<nsPresContext> context = shell->GetPresContext();
|
||||
|
||||
if (context) {
|
||||
// The event argument to HandleDOMEvent() is inout, and
|
||||
@ -2802,9 +2801,8 @@ nsDocument::GetDefaultView(nsIDOMAbstractView** aDefaultView)
|
||||
mPresShells.ElementAt(0));
|
||||
NS_ENSURE_TRUE(shell, NS_OK);
|
||||
|
||||
nsCOMPtr<nsPresContext> ctx;
|
||||
nsresult rv = shell->GetPresContext(getter_AddRefs(ctx));
|
||||
NS_ENSURE_TRUE(NS_SUCCEEDED(rv) && ctx, rv);
|
||||
nsPresContext *ctx = shell->GetPresContext();
|
||||
NS_ENSURE_TRUE(ctx, NS_OK);
|
||||
|
||||
nsCOMPtr<nsISupports> container = ctx->GetContainer();
|
||||
NS_ENSURE_TRUE(container, NS_OK);
|
||||
@ -2847,11 +2845,7 @@ nsDocument::SetTitle(const nsAString& aTitle)
|
||||
nsCOMPtr<nsIPresShell> shell =
|
||||
NS_STATIC_CAST(nsIPresShell*, mPresShells[i]);
|
||||
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
nsresult rv = shell->GetPresContext(getter_AddRefs(context));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsISupports> container = context->GetContainer();
|
||||
nsCOMPtr<nsISupports> container = shell->GetPresContext()->GetContainer();
|
||||
if (!container)
|
||||
continue;
|
||||
|
||||
@ -2859,7 +2853,7 @@ nsDocument::SetTitle(const nsAString& aTitle)
|
||||
if (!docShellWin)
|
||||
continue;
|
||||
|
||||
rv = docShellWin->SetTitle(PromiseFlatString(aTitle).get());
|
||||
nsresult rv = docShellWin->SetTitle(PromiseFlatString(aTitle).get());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
@ -3004,8 +2998,7 @@ nsDocument::GetDir(nsAString& aDirection)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell = (nsIPresShell*)mPresShells.SafeElementAt(0);
|
||||
if (shell) {
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
nsPresContext *context = shell->GetPresContext();
|
||||
if (context) {
|
||||
PRUint32 options = context->GetBidi();
|
||||
for (const DirTable* elt = dirAttributes; elt->mName; elt++) {
|
||||
@ -3035,8 +3028,7 @@ nsDocument::SetDir(const nsAString& aDirection)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
nsPresContext *context = shell->GetPresContext();
|
||||
NS_ENSURE_TRUE(context, NS_ERROR_UNEXPECTED);
|
||||
|
||||
PRUint32 options = context->GetBidi();
|
||||
@ -3937,11 +3929,9 @@ nsDocument::DispatchEvent(nsIDOMEvent* aEvent, PRBool *_retval)
|
||||
if (!shell)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Retrieve the context
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
shell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsCOMPtr<nsPresContext> context = shell->GetPresContext();
|
||||
|
||||
return presContext->EventStateManager()->
|
||||
return context->EventStateManager()->
|
||||
DispatchNewEvent(NS_STATIC_CAST(nsIDOMDocument*, this), aEvent, _retval);
|
||||
}
|
||||
|
||||
@ -3999,14 +3989,15 @@ nsDocument::CreateEvent(const nsAString& aEventType, nsIDOMEvent** aReturn)
|
||||
NS_ENSURE_ARG_POINTER(aReturn);
|
||||
*aReturn = nsnull;
|
||||
|
||||
// Obtain a presentation context
|
||||
// Obtain a presentation shell
|
||||
|
||||
nsIPresShell *shell = GetShellAt(0);
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
|
||||
nsPresContext *presContext = nsnull;
|
||||
|
||||
if (shell) {
|
||||
// Retrieve the context
|
||||
shell->GetPresContext(getter_AddRefs(presContext));
|
||||
presContext = shell->GetPresContext();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIEventListenerManager> manager;
|
||||
|
@ -687,8 +687,7 @@ nsImageLoadingContent::FireEvent(const nsAString& aEventType)
|
||||
nsIPresShell *shell = document->GetShellAt(0);
|
||||
NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
shell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = shell->GetPresContext();
|
||||
NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIContent> ourContent = do_QueryInterface(this);
|
||||
|
@ -1914,13 +1914,11 @@ nsEventListenerManager::DispatchEvent(nsIDOMEvent* aEvent, PRBool *_retval)
|
||||
if (!shell) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Retrieve the context
|
||||
nsCOMPtr<nsPresContext> aPresContext;
|
||||
shell->GetPresContext(getter_AddRefs(aPresContext));
|
||||
|
||||
return aPresContext->EventStateManager()->DispatchNewEvent(mTarget, aEvent,
|
||||
_retval);
|
||||
nsCOMPtr<nsPresContext> context = shell->GetPresContext();
|
||||
|
||||
return context->EventStateManager()->
|
||||
DispatchNewEvent(mTarget, aEvent, _retval);
|
||||
}
|
||||
|
||||
// nsIDOM3EventTarget interface
|
||||
|
@ -598,8 +598,8 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
if (doc) {
|
||||
nsIPresShell *shell = doc->GetShellAt(0);
|
||||
if (shell) {
|
||||
nsCOMPtr<nsPresContext> oldPresContext;
|
||||
shell->GetPresContext(getter_AddRefs(oldPresContext));
|
||||
nsCOMPtr<nsPresContext> oldPresContext =
|
||||
shell->GetPresContext();
|
||||
|
||||
nsCOMPtr<nsIEventStateManager> esm;
|
||||
esm = oldPresContext->EventStateManager();
|
||||
@ -732,8 +732,8 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
if (doc) {
|
||||
nsIPresShell *shell = doc->GetShellAt(0);
|
||||
if (shell) {
|
||||
nsCOMPtr<nsPresContext> oldPresContext;
|
||||
shell->GetPresContext(getter_AddRefs(oldPresContext));
|
||||
nsCOMPtr<nsPresContext> oldPresContext =
|
||||
shell->GetPresContext();
|
||||
|
||||
nsCOMPtr<nsIEventStateManager> esm =
|
||||
oldPresContext->EventStateManager();
|
||||
@ -822,8 +822,7 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
if (shell) {
|
||||
if (focusedElement) {
|
||||
nsCOMPtr<nsIContent> focusContent = do_QueryInterface(focusedElement);
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
nsCOMPtr<nsPresContext> context = shell->GetPresContext();
|
||||
focusContent->SetFocus(context);
|
||||
}
|
||||
|
||||
@ -887,8 +886,7 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
if (gLastFocusedContent) {
|
||||
nsIPresShell *shell = gLastFocusedDocument->GetShellAt(0);
|
||||
if (shell) {
|
||||
nsCOMPtr<nsPresContext> oldPresContext;
|
||||
shell->GetPresContext(getter_AddRefs(oldPresContext));
|
||||
nsCOMPtr<nsPresContext> oldPresContext = shell->GetPresContext();
|
||||
|
||||
nsCOMPtr<nsIDOMElement> focusedElement;
|
||||
if (focusController)
|
||||
@ -1091,8 +1089,7 @@ nsEventStateManager::HandleAccessKey(nsPresContext* aPresContext,
|
||||
continue;
|
||||
}
|
||||
|
||||
subPS->GetPresContext(getter_AddRefs(subPC));
|
||||
NS_ASSERTION(subPC, "PresShell without PresContext");
|
||||
nsPresContext *subPC = subPS->GetPresContext();
|
||||
|
||||
nsEventStateManager* esm =
|
||||
NS_STATIC_CAST(nsEventStateManager *, subPC->EventStateManager());
|
||||
@ -1122,12 +1119,11 @@ nsEventStateManager::HandleAccessKey(nsPresContext* aPresContext,
|
||||
docShell->GetChildOffset(&myOffset);
|
||||
|
||||
nsCOMPtr<nsIPresShell> parentPS;
|
||||
nsCOMPtr<nsPresContext> parentPC;
|
||||
|
||||
parentDS->GetPresShell(getter_AddRefs(parentPS));
|
||||
NS_ASSERTION(parentPS, "Our PresShell exists but the parent's does not?");
|
||||
|
||||
parentPS->GetPresContext(getter_AddRefs(parentPC));
|
||||
nsPresContext *parentPC = parentPS->GetPresContext();
|
||||
NS_ASSERTION(parentPC, "PresShell without PresContext");
|
||||
|
||||
nsEventStateManager* esm =
|
||||
@ -1575,8 +1571,7 @@ nsEventStateManager::ChangeTextSize(PRInt32 change)
|
||||
|
||||
nsIPresShell *presShell = doc->GetShellAt(0);
|
||||
if(!presShell) return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
if(!presContext) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsISupports> pcContainer = presContext->GetContainer();
|
||||
@ -1826,7 +1821,7 @@ nsEventStateManager::GetParentScrollingView(nsInputEvent *aEvent,
|
||||
pPresShell->GetPrimaryFrameFor(frameContent, &frameFrame);
|
||||
if (!frameFrame) return NS_ERROR_FAILURE;
|
||||
|
||||
pPresShell->GetPresContext(&presCtxOuter); //addrefs
|
||||
NS_IF_ADDREF(presCtxOuter = pPresShell->GetPresContext());
|
||||
targetOuterFrame = frameFrame;
|
||||
|
||||
return NS_OK;
|
||||
@ -3297,9 +3292,7 @@ nsEventStateManager::ShiftFocusInternal(PRBool aForward, nsIContent* aStart)
|
||||
nsIDocument *parent_doc = parentShell->GetDocument();
|
||||
nsIContent *docContent = parent_doc->FindContentForSubDocument(mDocument);
|
||||
|
||||
nsCOMPtr<nsPresContext> parentPC;
|
||||
parentShell->GetPresContext(getter_AddRefs(parentPC));
|
||||
|
||||
nsCOMPtr<nsPresContext> parentPC = parentShell->GetPresContext();
|
||||
nsIEventStateManager *parentESM = parentPC->EventStateManager();
|
||||
|
||||
SetContentState(nsnull, NS_EVENT_STATE_FOCUS);
|
||||
@ -3976,8 +3969,7 @@ nsEventStateManager::SendFocusBlur(nsPresContext* aPresContext,
|
||||
if (shell) {
|
||||
kungFuDeathGrip = shell->GetViewManager();
|
||||
|
||||
nsCOMPtr<nsPresContext> oldPresContext;
|
||||
shell->GetPresContext(getter_AddRefs(oldPresContext));
|
||||
nsCOMPtr<nsPresContext> oldPresContext = shell->GetPresContext();
|
||||
|
||||
//fire blur
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
|
@ -598,9 +598,7 @@ nsGenericHTMLElement::GetOffsetRect(nsRect& aRect, nsIContent** aOffsetParent)
|
||||
}
|
||||
|
||||
// Get the Presentation Context from the Shell
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
presShell->GetPresContext(getter_AddRefs(context));
|
||||
|
||||
nsPresContext *context = presShell->GetPresContext();
|
||||
if (!context) {
|
||||
return;
|
||||
}
|
||||
@ -973,8 +971,7 @@ nsGenericHTMLElement::GetScrollInfo(nsIScrollableView **aScrollableView,
|
||||
}
|
||||
|
||||
// Get the presentation context
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
if (!presContext) {
|
||||
return;
|
||||
}
|
||||
@ -2368,21 +2365,20 @@ nsGenericHTMLElement::RestoreFormControlState(nsIHTMLContent* aContent,
|
||||
}
|
||||
|
||||
// XXX This creates a dependency between content and frames
|
||||
nsresult
|
||||
nsGenericHTMLElement::GetPresContext(nsIHTMLContent* aContent,
|
||||
nsPresContext** aPresContext)
|
||||
nsPresContext*
|
||||
nsGenericHTMLElement::GetPresContext()
|
||||
{
|
||||
// Get the document
|
||||
nsIDocument* doc = aContent->GetDocument();
|
||||
nsIDocument* doc = GetDocument();
|
||||
if (doc) {
|
||||
// Get presentation shell 0
|
||||
nsIPresShell *presShell = doc->GetShellAt(0);
|
||||
if (presShell) {
|
||||
return presShell->GetPresContext(aPresContext);
|
||||
return presShell->GetPresContext();
|
||||
}
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
// XXX check all mappings against ebina's usage
|
||||
@ -3617,8 +3613,7 @@ nsGenericHTMLFrameElement::HandleChromeEvent(nsPresContext* aPresContext,
|
||||
void
|
||||
nsGenericHTMLElement::SetElementFocus(PRBool aDoFocus)
|
||||
{
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
GetPresContext(this, getter_AddRefs(presContext));
|
||||
nsCOMPtr<nsPresContext> presContext = GetPresContext();
|
||||
if (!presContext)
|
||||
return;
|
||||
|
||||
@ -3702,8 +3697,7 @@ nsGenericHTMLElement::RegUnRegAccessKey(PRBool aDoReg)
|
||||
}
|
||||
|
||||
// We have an access key, so get the ESM from the pres context.
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
GetPresContext(this, getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = GetPresContext();
|
||||
|
||||
if (presContext) {
|
||||
nsIEventStateManager *esm = presContext->EventStateManager();
|
||||
|
@ -624,12 +624,10 @@ public:
|
||||
nsIFormControl* aControl);
|
||||
|
||||
/**
|
||||
* Get the presentation context for a content node.
|
||||
* @param aContent the content node
|
||||
* @param aPresContext the presentation context [OUT]
|
||||
* Get the presentation context for this content node.
|
||||
* @return the presentation context
|
||||
*/
|
||||
static nsresult GetPresContext(nsIHTMLContent* aContent,
|
||||
nsPresContext** aPresContext);
|
||||
NS_HIDDEN_(nsPresContext*) GetPresContext();
|
||||
|
||||
// Form Helper Routines
|
||||
/**
|
||||
|
@ -334,9 +334,7 @@ nsHTMLBodyElement::Get##func_(nsAString& aColor) \
|
||||
if (NS_CONTENT_ATTR_NOT_THERE == \
|
||||
GetAttr(kNameSpaceID_None, nsHTMLAtoms::attr_, color)) { \
|
||||
\
|
||||
nsCOMPtr<nsPresContext> presContext; \
|
||||
GetPresContext(this, getter_AddRefs(presContext)); \
|
||||
\
|
||||
nsPresContext *presContext = GetPresContext(); \
|
||||
if (presContext) { \
|
||||
attrColor = presContext->Default##default_(); \
|
||||
NS_RGBToHex(attrColor, aColor); \
|
||||
|
@ -203,8 +203,7 @@ nsHTMLButtonElement::Click()
|
||||
if (doc) {
|
||||
nsIPresShell *shell = doc->GetShellAt(0);
|
||||
if (shell) {
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
nsCOMPtr<nsPresContext> context = shell->GetPresContext();
|
||||
if (context) {
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsMouseEvent event(NS_MOUSE_LEFT_CLICK);
|
||||
|
@ -564,8 +564,7 @@ nsHTMLFormElement::Submit()
|
||||
{
|
||||
// Send the submit event
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
GetPresContext(this, getter_AddRefs(presContext));
|
||||
nsCOMPtr<nsPresContext> presContext = GetPresContext();
|
||||
if (presContext) {
|
||||
if (mPendingSubmission) {
|
||||
// aha, we have a pending submission that was not flushed
|
||||
@ -585,8 +584,7 @@ nsHTMLFormElement::Reset()
|
||||
{
|
||||
// Send the reset event
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
GetPresContext(this, getter_AddRefs(presContext));
|
||||
nsCOMPtr<nsPresContext> presContext = GetPresContext();
|
||||
if (presContext) {
|
||||
// Calling HandleDOMEvent() directly so that reset() will work even if
|
||||
// the frame does not exist. This does not have an effect right now, but
|
||||
@ -1206,10 +1204,9 @@ nsHTMLFormElement::FlushPendingSubmission()
|
||||
}
|
||||
|
||||
//
|
||||
// preform the submission with the stored pending submission
|
||||
// perform the submission with the stored pending submission
|
||||
//
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
GetPresContext(this, getter_AddRefs(presContext));
|
||||
nsCOMPtr<nsPresContext> presContext = GetPresContext();
|
||||
SubmitSubmission(presContext, mPendingSubmission);
|
||||
|
||||
// now delete the pending submission object
|
||||
|
@ -272,9 +272,7 @@ nsHTMLImageElement::GetXY()
|
||||
}
|
||||
|
||||
// Get the Presentation Context from the Shell
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
presShell->GetPresContext(getter_AddRefs(context));
|
||||
|
||||
nsPresContext *context = presShell->GetPresContext();
|
||||
if (!context) {
|
||||
return point;
|
||||
}
|
||||
@ -357,9 +355,7 @@ nsHTMLImageElement::GetWidthHeight()
|
||||
size.height -= margin.top + margin.bottom;
|
||||
size.width -= margin.left + margin.right;
|
||||
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
GetPresContext(this, getter_AddRefs(context));
|
||||
|
||||
nsPresContext *context = GetPresContext();
|
||||
if (context) {
|
||||
float t2p;
|
||||
t2p = context->TwipsToPixels();
|
||||
|
@ -702,8 +702,7 @@ nsHTMLInputElement::SetValueInternal(const nsAString& aValue,
|
||||
}
|
||||
// If the frame owns the value, set the value in the frame
|
||||
if (frameOwnsValue) {
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
GetPresContext(this, getter_AddRefs(presContext));
|
||||
nsCOMPtr<nsPresContext> presContext = GetPresContext();
|
||||
formControlFrame->SetProperty(presContext, nsHTMLAtoms::value, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
@ -979,8 +978,7 @@ nsHTMLInputElement::SetCheckedInternal(PRBool aChecked, PRBool aNotify)
|
||||
//
|
||||
nsIFrame* frame = GetPrimaryFrame(PR_FALSE);
|
||||
if (frame) {
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
GetPresContext(this, getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = GetPresContext();
|
||||
|
||||
if (mType == NS_FORM_INPUT_CHECKBOX) {
|
||||
nsICheckboxControlFrame* checkboxFrame = nsnull;
|
||||
@ -1015,10 +1013,9 @@ nsHTMLInputElement::FireOnChange()
|
||||
//
|
||||
// Since the value is changing, send out an onchange event (bug 23571)
|
||||
//
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
GetPresContext(this, getter_AddRefs(presContext));
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsEvent event(NS_FORM_CHANGE);
|
||||
nsCOMPtr<nsPresContext> presContext = GetPresContext();
|
||||
HandleDOMEvent(presContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
|
||||
}
|
||||
|
||||
@ -1101,8 +1098,7 @@ nsHTMLInputElement::Select()
|
||||
// XXX Bug? We have to give the input focus before contents can be
|
||||
// selected
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
GetPresContext(this, getter_AddRefs(presContext));
|
||||
nsCOMPtr<nsPresContext> presContext = GetPresContext();
|
||||
|
||||
// If the window is not active, do not allow the select to bring the
|
||||
// window to the front. We update the focus controller, but do
|
||||
@ -1200,12 +1196,11 @@ nsHTMLInputElement::Click()
|
||||
|
||||
// Strong in case the event kills it
|
||||
nsCOMPtr<nsIDocument> doc = GetOwnerDoc();
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
|
||||
nsIPresShell *shell = doc->GetShellAt(0);
|
||||
|
||||
if (shell) {
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
nsCOMPtr<nsPresContext> context = shell->GetPresContext();
|
||||
|
||||
if (context) {
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
|
@ -551,9 +551,6 @@ nsHTMLScriptElement::ScriptAvailable(nsresult aResult,
|
||||
const nsAString& aScript)
|
||||
{
|
||||
if (!aIsInline && NS_FAILED(aResult)) {
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
GetPresContext(this, getter_AddRefs(presContext));
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsScriptErrorEvent event(NS_SCRIPT_ERROR);
|
||||
|
||||
@ -568,8 +565,8 @@ nsHTMLScriptElement::ScriptAvailable(nsresult aResult,
|
||||
NS_ConvertUTF8toUCS2 fileName(spec);
|
||||
event.fileName = fileName.get();
|
||||
|
||||
HandleDOMEvent(presContext, &event, nsnull, NS_EVENT_FLAG_INIT,
|
||||
&status);
|
||||
nsCOMPtr<nsPresContext> presContext = GetPresContext();
|
||||
HandleDOMEvent(presContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -587,11 +584,9 @@ nsHTMLScriptElement::ScriptEvaluated(nsresult aResult,
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (!aIsInline) {
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
GetPresContext(this, getter_AddRefs(presContext));
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsEvent event(NS_SUCCEEDED(aResult) ? NS_SCRIPT_LOAD : NS_SCRIPT_ERROR);
|
||||
nsCOMPtr<nsPresContext> presContext = GetPresContext();
|
||||
rv = HandleDOMEvent(presContext, &event, nsnull, NS_EVENT_FLAG_INIT,
|
||||
&status);
|
||||
}
|
||||
|
@ -537,9 +537,9 @@ nsHTMLSelectElement::InsertOptionsIntoList(nsIContent* aOptions,
|
||||
// get into the right state once it's created.
|
||||
nsISelectControlFrame* selectFrame = GetSelectFrame();
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
nsPresContext *presContext = nsnull;
|
||||
if (selectFrame) {
|
||||
GetPresContext(this, getter_AddRefs(presContext));
|
||||
presContext = GetPresContext();
|
||||
}
|
||||
|
||||
// Actually select the options if the added options warrant it
|
||||
@ -626,8 +626,7 @@ nsHTMLSelectElement::RemoveOptionsFromList(nsIContent* aOptions,
|
||||
// Tell the widget we removed the options
|
||||
nsISelectControlFrame* selectFrame = GetSelectFrame();
|
||||
if (selectFrame) {
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
GetPresContext(this, getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = GetPresContext();
|
||||
for (int i = aListIndex; i < aListIndex + numRemoved; ++i) {
|
||||
selectFrame->RemoveOption(presContext, i);
|
||||
}
|
||||
@ -1243,8 +1242,7 @@ nsHTMLSelectElement::SetOptionsSelectedByIndex(PRInt32 aStartIndex,
|
||||
nsISelectControlFrame *selectFrame = nsnull;
|
||||
PRBool did_get_frame = PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
GetPresContext(this, getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = GetPresContext();
|
||||
|
||||
if (aIsSelected) {
|
||||
// Only select the first value if it's not multiple
|
||||
|
@ -276,8 +276,7 @@ nsHTMLTextAreaElement::Select()
|
||||
// selected
|
||||
|
||||
// Just like SetFocus() but without the ScrollIntoView()!
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
GetPresContext(this, getter_AddRefs(presContext));
|
||||
nsCOMPtr<nsPresContext> presContext = GetPresContext();
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsGUIEvent event(NS_FORM_SELECTED);
|
||||
@ -401,10 +400,8 @@ nsHTMLTextAreaElement::SetValueInternal(const nsAString& aValue,
|
||||
textControlFrame->OwnsValue(&frameOwnsValue);
|
||||
}
|
||||
if (frameOwnsValue) {
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
GetPresContext(this, getter_AddRefs(presContext));
|
||||
|
||||
formControlFrame->SetProperty(presContext, nsHTMLAtoms::value, aValue);
|
||||
formControlFrame->SetProperty(GetPresContext(),
|
||||
nsHTMLAtoms::value, aValue);
|
||||
}
|
||||
else {
|
||||
if (mValue) {
|
||||
|
@ -1100,8 +1100,7 @@ nsHTMLDocument::SetCompatibilityMode(nsCompatibility aMode)
|
||||
}
|
||||
nsCOMPtr<nsIPresShell> shell = (nsIPresShell*)mPresShells.SafeElementAt(0);
|
||||
if (shell) {
|
||||
nsCOMPtr<nsPresContext> pc;
|
||||
shell->GetPresContext(getter_AddRefs(pc));
|
||||
nsPresContext *pc = shell->GetPresContext();
|
||||
if (pc) {
|
||||
pc->SetCompatibilityMode(mCompatMode);
|
||||
}
|
||||
@ -2499,9 +2498,6 @@ nsHTMLDocument::GetPixelDimensions(nsIPresShell* aShell,
|
||||
nsresult rv = aShell->GetPrimaryFrameFor(body, &frame);
|
||||
if (NS_SUCCEEDED(rv) && frame) {
|
||||
nsSize size;
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
|
||||
aShell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsIView* view = frame->GetView();
|
||||
|
||||
// If we have a view check if it's scrollable. If not,
|
||||
@ -2524,10 +2520,8 @@ nsHTMLDocument::GetPixelDimensions(nsIPresShell* aShell,
|
||||
}
|
||||
|
||||
// Convert from twips to pixels
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
rv = aShell->GetPresContext(getter_AddRefs(context));
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsPresContext *context = aShell->GetPresContext();
|
||||
if (context) {
|
||||
float scale;
|
||||
scale = context->TwipsToPixels();
|
||||
|
||||
@ -2795,9 +2789,7 @@ nsHTMLDocument::GetSelection(nsAString& aReturn)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPresContext> cx;
|
||||
|
||||
shell->GetPresContext(getter_AddRefs(cx));
|
||||
nsPresContext *cx = shell->GetPresContext();
|
||||
NS_ENSURE_TRUE(cx, NS_OK);
|
||||
|
||||
nsCOMPtr<nsISupports> container = cx->GetContainer();
|
||||
@ -3548,8 +3540,7 @@ nsHTMLDocument::SetDesignMode(const nsAString & aDesignMode)
|
||||
nsCOMPtr<nsIPresShell> shell = (nsIPresShell*)mPresShells.SafeElementAt(0);
|
||||
NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsPresContext> cx;
|
||||
shell->GetPresContext(getter_AddRefs(cx));
|
||||
nsPresContext *cx = shell->GetPresContext();
|
||||
NS_ENSURE_TRUE(cx, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsISupports> container = cx->GetContainer();
|
||||
|
@ -556,9 +556,7 @@ nsImageDocument::CheckOverflowing()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
|
||||
nsPresContext *context = shell->GetPresContext();
|
||||
nsRect visibleArea = context->GetVisibleArea();
|
||||
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mBodyContent);
|
||||
|
@ -282,9 +282,7 @@ nsMediaDocument::StartLayout()
|
||||
shell->BeginObservingDocument();
|
||||
|
||||
// Initial-reflow this time.
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
nsRect visibleArea = context->GetVisibleArea();
|
||||
nsRect visibleArea = shell->GetPresContext()->GetVisibleArea();
|
||||
shell->InitialReflow(visibleArea.width, visibleArea.height);
|
||||
|
||||
// Now trigger a refresh.
|
||||
|
@ -194,10 +194,7 @@ nsComputedDOMStyle::Init(nsIDOMElement *aElement,
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPresContext> presCtx;
|
||||
|
||||
aPresShell->GetPresContext(getter_AddRefs(presCtx));
|
||||
|
||||
nsPresContext *presCtx = aPresShell->GetPresContext();
|
||||
NS_ENSURE_TRUE(presCtx, NS_ERROR_FAILURE);
|
||||
|
||||
mT2P = presCtx->TwipsToPixels();
|
||||
@ -615,8 +612,7 @@ nsComputedDOMStyle::GetFontFamily(nsIFrame *aFrame,
|
||||
if (font) {
|
||||
nsCOMPtr<nsIPresShell> presShell = do_QueryReferent(mPresShellWeak);
|
||||
NS_ASSERTION(presShell, "pres shell is required");
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
NS_ASSERTION(presContext, "pres context is required");
|
||||
|
||||
const nsString& fontName = font->mFont.name;
|
||||
@ -2785,10 +2781,6 @@ nsComputedDOMStyle::GetAbsoluteOffset(PRUint8 aSide, nsIFrame* aFrame,
|
||||
// _not_ include the scrollbars. For fixed positioned frames,
|
||||
// the containing block is the viewport, which _does_ include
|
||||
// scrollbars. We have to do some extra work.
|
||||
nsCOMPtr<nsIPresShell> presShell = do_QueryReferent(mPresShellWeak);
|
||||
NS_ASSERTION(presShell, "Must have a presshell!");
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
// the first child in the default frame list is what we want
|
||||
nsIFrame* scrollingChild = container->GetFirstChild(nsnull);
|
||||
nsCOMPtr<nsIScrollableFrame> scrollFrame =
|
||||
|
@ -163,8 +163,7 @@ nsInspectorCSSUtils::GetStyleContextForContent(nsIContent* aContent,
|
||||
if (parent)
|
||||
parentContext = GetStyleContextForContent(parent, nsnull, aPresShell);
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
aPresShell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = aPresShell->GetPresContext();
|
||||
if (!presContext)
|
||||
return nsnull;
|
||||
|
||||
|
@ -358,8 +358,7 @@ nsSVGSVGElement::GetPixelUnitToMillimeterX(float *aPixelUnitToMillimeterX)
|
||||
if (!presShell) return NS_OK;
|
||||
|
||||
// Get the Presentation Context from the Shell
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
presShell->GetPresContext(getter_AddRefs(context));
|
||||
nsPresContext *context = presShell->GetPresContext();
|
||||
if (!context) return NS_OK;
|
||||
|
||||
*aPixelUnitToMillimeterX = context->ScaledPixelsToTwips() / TWIPS_PER_POINT_FLOAT / (72.0f * 0.03937f);
|
||||
@ -388,8 +387,7 @@ nsSVGSVGElement::GetScreenPixelToMillimeterX(float *aScreenPixelToMillimeterX)
|
||||
if (!presShell) return NS_OK;
|
||||
|
||||
// Get the Presentation Context from the Shell
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
presShell->GetPresContext(getter_AddRefs(context));
|
||||
nsPresContext *context = presShell->GetPresContext();
|
||||
if (!context) return NS_OK;
|
||||
|
||||
float TwipsPerPx;
|
||||
@ -1192,8 +1190,7 @@ void nsSVGSVGElement::GetScreenPosition(PRInt32 &x, PRInt32 &y)
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
presShell->GetPresContext(getter_AddRefs(context));
|
||||
nsPresContext *context = presShell->GetPresContext();
|
||||
if (!context) {
|
||||
NS_ERROR("couldn't get prescontext");
|
||||
return;
|
||||
|
@ -232,7 +232,7 @@ nsSVGScriptElement::ScriptAvailable(nsresult aResult,
|
||||
if (IsInDoc()) {
|
||||
nsIPresShell *presShell = GetOwnerDoc()->GetShellAt(0);
|
||||
if (presShell)
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
presContext = presShell->GetPresContext();
|
||||
}
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
@ -272,7 +272,7 @@ nsSVGScriptElement::ScriptEvaluated(nsresult aResult,
|
||||
if (IsInDoc()) {
|
||||
nsIPresShell *presShell = GetOwnerDoc()->GetShellAt(0);
|
||||
if (presShell)
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
presContext = presShell->GetPresContext();
|
||||
}
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
|
@ -2016,10 +2016,7 @@ nsXULElement::UnregisterAccessKey(const nsAString& aOldValue)
|
||||
}
|
||||
|
||||
if (validElement) {
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
shell->GetPresContext(getter_AddRefs(presContext));
|
||||
|
||||
presContext->EventStateManager()->
|
||||
shell->GetPresContext()->EventStateManager()->
|
||||
UnregisterAccessKey(this, aOldValue.First());
|
||||
}
|
||||
}
|
||||
@ -3716,12 +3713,9 @@ nsXULElement::Focus()
|
||||
|
||||
nsIPresShell *shell = mDocument->GetShellAt(0);
|
||||
|
||||
// Retrieve the context
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
shell->GetPresContext(getter_AddRefs(presContext));
|
||||
|
||||
// Set focus
|
||||
SetFocus(presContext);
|
||||
nsCOMPtr<nsPresContext> context = shell->GetPresContext();
|
||||
SetFocus(context);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -3739,12 +3733,9 @@ nsXULElement::Blur()
|
||||
|
||||
nsIPresShell *shell = mDocument->GetShellAt(0);
|
||||
|
||||
// Retrieve the context
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
shell->GetPresContext(getter_AddRefs(presContext));
|
||||
|
||||
// Set focus
|
||||
RemoveFocus(presContext);
|
||||
nsCOMPtr<nsPresContext> context = shell->GetPresContext();
|
||||
RemoveFocus(context);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -3760,11 +3751,12 @@ nsXULElement::Click()
|
||||
nsCOMPtr<nsIDocument> doc = mDocument; // Strong just in case
|
||||
if (doc) {
|
||||
PRUint32 numShells = doc->GetNumberOfShells();
|
||||
// strong ref to PresContext so events don't destroy it
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
|
||||
for (PRUint32 i = 0; i < numShells; ++i) {
|
||||
nsIPresShell *shell = doc->GetShellAt(i);
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
context = shell->GetPresContext();
|
||||
|
||||
nsMouseEvent eventDown(NS_MOUSE_LEFT_BUTTON_DOWN),
|
||||
eventUp(NS_MOUSE_LEFT_BUTTON_UP),
|
||||
@ -3801,7 +3793,7 @@ nsXULElement::DoCommand()
|
||||
|
||||
for (PRUint32 i = 0; i < numShells; ++i) {
|
||||
nsIPresShell *shell = doc->GetShellAt(i);
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
context = shell->GetPresContext();
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsMouseEvent event(NS_XUL_COMMAND);
|
||||
@ -4031,8 +4023,7 @@ nsXULElement::HideWindowChrome(PRBool aShouldHide)
|
||||
nsIFrame* frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
shell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = shell->GetPresContext();
|
||||
|
||||
if (frame && presContext) {
|
||||
nsIView* view = frame->GetClosestView();
|
||||
|
@ -329,7 +329,6 @@ XULPopupListenerImpl::FireFocusOnTargetContent(nsIDOMNode* aTargetNode)
|
||||
rv = aTargetNode->GetOwnerDocument(getter_AddRefs(domDoc));
|
||||
if(NS_SUCCEEDED(rv) && domDoc)
|
||||
{
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
nsCOMPtr<nsIDocument> tempdoc = do_QueryInterface(domDoc);
|
||||
|
||||
// Get nsIDOMElement for targetNode
|
||||
@ -337,7 +336,8 @@ XULPopupListenerImpl::FireFocusOnTargetContent(nsIDOMNode* aTargetNode)
|
||||
if (!shell)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
// strong reference to keep this from going away between events
|
||||
nsCOMPtr<nsPresContext> context = shell->GetPresContext();
|
||||
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aTargetNode);
|
||||
nsIFrame* targetFrame;
|
||||
|
@ -319,8 +319,6 @@ nsXULCommandDispatcher::RemoveCommandUpdater(nsIDOMElement* aElement)
|
||||
NS_IMETHODIMP
|
||||
nsXULCommandDispatcher::UpdateCommands(const nsAString& aEventName)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
EnsureFocusController();
|
||||
NS_ENSURE_TRUE(mFocusController, NS_ERROR_FAILURE);
|
||||
|
||||
@ -328,7 +326,7 @@ nsXULCommandDispatcher::UpdateCommands(const nsAString& aEventName)
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
mFocusController->GetFocusedElement(getter_AddRefs(element));
|
||||
if (element) {
|
||||
rv = element->GetAttribute(NS_LITERAL_STRING("id"), id);
|
||||
nsresult rv = element->GetAttribute(NS_LITERAL_STRING("id"), id);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get element's id");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
@ -377,9 +375,7 @@ nsXULCommandDispatcher::UpdateCommands(const nsAString& aEventName)
|
||||
nsIPresShell *shell = document->GetShellAt(i);
|
||||
|
||||
// Retrieve the context in which our DOM event will fire.
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
rv = shell->GetPresContext(getter_AddRefs(context));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsPresContext> context = shell->GetPresContext();
|
||||
|
||||
// Handle the DOM event
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
|
@ -1061,8 +1061,7 @@ nsXULDocument::ExecuteOnBroadcastHandlerFor(nsIContent* aBroadcaster,
|
||||
nsCOMPtr<nsIPresShell> shell =
|
||||
NS_STATIC_CAST(nsIPresShell*, mPresShells[j]);
|
||||
|
||||
nsCOMPtr<nsPresContext> aPresContext;
|
||||
shell->GetPresContext(getter_AddRefs(aPresContext));
|
||||
nsCOMPtr<nsPresContext> aPresContext = shell->GetPresContext();
|
||||
|
||||
// Handle the DOM event
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
@ -1610,16 +1609,10 @@ nsXULDocument::GetPixelDimensions(nsIPresShell* aShell, PRInt32* aWidth,
|
||||
}
|
||||
|
||||
// Convert from twips to pixels
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
result = aShell->GetPresContext(getter_AddRefs(context));
|
||||
float scale = aShell->GetPresContext()->TwipsToPixels();
|
||||
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
float scale;
|
||||
scale = context->TwipsToPixels();
|
||||
|
||||
*aWidth = NSTwipsToIntPixels(size.width, scale);
|
||||
*aHeight = NSTwipsToIntPixels(size.height, scale);
|
||||
}
|
||||
*aWidth = NSTwipsToIntPixels(size.width, scale);
|
||||
*aHeight = NSTwipsToIntPixels(size.height, scale);
|
||||
}
|
||||
else {
|
||||
*aWidth = 0;
|
||||
@ -2121,8 +2114,7 @@ nsXULDocument::StartLayout(void)
|
||||
nsIPresShell *shell = GetShellAt(i);
|
||||
|
||||
// Resize-reflow this time
|
||||
nsCOMPtr<nsPresContext> cx;
|
||||
shell->GetPresContext(getter_AddRefs(cx));
|
||||
nsPresContext *cx = shell->GetPresContext();
|
||||
NS_ASSERTION(cx != nsnull, "no pres context");
|
||||
if (! cx)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
@ -4938,8 +4938,7 @@ nsElementSH::PostCreate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
}
|
||||
|
||||
// Get the computed -moz-binding directly from the style context
|
||||
nsCOMPtr<nsPresContext> pctx;
|
||||
shell->GetPresContext(getter_AddRefs(pctx));
|
||||
nsPresContext *pctx = shell->GetPresContext();
|
||||
NS_ENSURE_TRUE(pctx, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsRefPtr<nsStyleContext> sc = pctx->StyleSet()->ResolveStyleFor(content,
|
||||
|
@ -264,8 +264,7 @@ nsFocusController::MoveFocus(PRBool aForward, nsIDOMElement* aElt)
|
||||
return NS_OK;
|
||||
|
||||
// Retrieve the context
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
shell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsCOMPtr<nsPresContext> presContext = shell->GetPresContext();
|
||||
|
||||
// Make this ESM shift the focus per our instructions.
|
||||
presContext->EventStateManager()->ShiftFocus(aForward, content);
|
||||
|
@ -2990,8 +2990,7 @@ GlobalWindowImpl::CheckForAbusePoint()
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
mDocShell->GetPresShell(getter_AddRefs(presShell));
|
||||
if (presShell) {
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
if (presContext)
|
||||
presContext->EventStateManager()->GetCurrentEvent(¤tEvent);
|
||||
}
|
||||
@ -4073,15 +4072,14 @@ GlobalWindowImpl::DispatchEvent(nsIDOMEvent* aEvent, PRBool* _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(mDocument));
|
||||
if (doc) {
|
||||
// Obtain a presentation context
|
||||
// Obtain a presentation shell
|
||||
nsIPresShell *shell = doc->GetShellAt(0);
|
||||
if (!shell) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Retrieve the context
|
||||
nsCOMPtr<nsPresContext> aPresContext;
|
||||
shell->GetPresContext(getter_AddRefs(aPresContext));
|
||||
nsCOMPtr<nsPresContext> aPresContext = shell->GetPresContext();
|
||||
aPresContext->EventStateManager()->
|
||||
DispatchNewEvent(NS_STATIC_CAST(nsIScriptGlobalObject*, this),
|
||||
aEvent, _retval);
|
||||
|
@ -235,8 +235,7 @@ nsSelectionCommandsBase::GetEventStateManagerForWindow(nsIDOMWindow *aWindow,
|
||||
GetPresShellFromWindow(aWindow, getter_AddRefs(presShell));
|
||||
if (presShell)
|
||||
{
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
if (presContext) {
|
||||
NS_ADDREF(*aEventStateManager = presContext->EventStateManager());
|
||||
return NS_OK;
|
||||
|
@ -102,8 +102,7 @@ nsWindowRoot::DispatchEvent(nsIDOMEvent* aEvt, PRBool *_retval)
|
||||
nsIPresShell *shell = doc->GetShellAt(0);
|
||||
|
||||
// Retrieve the context
|
||||
nsCOMPtr<nsPresContext> aPresContext;
|
||||
shell->GetPresContext(getter_AddRefs(aPresContext));
|
||||
nsCOMPtr<nsPresContext> aPresContext = shell->GetPresContext();
|
||||
|
||||
return aPresContext->EventStateManager()->
|
||||
DispatchNewEvent(NS_STATIC_CAST(nsIDOMEventReceiver*, this),
|
||||
|
@ -80,11 +80,7 @@ GetPresContextFromEditor(nsIEditor *aEditor, nsPresContext **aResult)
|
||||
nsCOMPtr<nsIPresShell> presShell = do_QueryInterface(selCon);
|
||||
if (!presShell) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
rv = presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
*aResult = presContext;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
NS_IF_ADDREF(*aResult = presShell->GetPresContext());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -395,9 +395,7 @@ nsEditingSession::SetupEditorOnWindow(nsIDOMWindow *aWindow)
|
||||
if (!presShell) return NS_ERROR_FAILURE;
|
||||
|
||||
// Disable animation of images in this document:
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
rv = presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
if (!presContext) return NS_ERROR_FAILURE;
|
||||
|
||||
presContext->SetImageAnimationMode(imgIContainer::kDontAnimMode);
|
||||
|
@ -267,8 +267,7 @@ NS_IMETHODIMP nsHTMLEditor::Init(nsIDOMDocument *aDoc,
|
||||
mHTMLCSSUtils->Init(this);
|
||||
|
||||
// disable links
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
aPresShell->GetPresContext(getter_AddRefs(context));
|
||||
nsPresContext *context = aPresShell->GetPresContext();
|
||||
if (!context) return NS_ERROR_NULL_POINTER;
|
||||
if (!(mFlags & eEditorPlaintextMask))
|
||||
context->SetLinkHandler(0);
|
||||
@ -5951,11 +5950,7 @@ nsHTMLEditor::GetElementOrigin(nsIDOMElement * aElement, PRInt32 & aX, PRInt32 &
|
||||
nsIFrame *frame = 0; // not ref-counted
|
||||
ps->GetPrimaryFrameFor(content, &frame);
|
||||
|
||||
float t2p;
|
||||
nsCOMPtr<nsPresContext> pcontext;
|
||||
ps->GetPresContext(getter_AddRefs(pcontext));
|
||||
t2p = pcontext->TwipsToPixels();
|
||||
|
||||
float t2p = ps->GetPresContext()->TwipsToPixels();
|
||||
|
||||
if (nsHTMLEditUtils::IsHR(aElement)) {
|
||||
frame = frame->GetNextSibling();
|
||||
|
@ -971,8 +971,7 @@ IsTargetFocused(nsIDOMEventTarget* aTarget)
|
||||
if (!shell)
|
||||
return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
shell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = shell->GetPresContext();
|
||||
if (!presContext)
|
||||
return PR_FALSE;
|
||||
|
||||
|
@ -60,10 +60,7 @@ nsTextEditRules::CheckBidiLevelForDeletion(nsIDOMNode *aSelNode,
|
||||
if (!shell)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
res = shell->GetPresContext(getter_AddRefs(context));
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
nsPresContext *context = shell->GetPresContext();
|
||||
if (!context)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
|
@ -390,9 +390,7 @@ FocusElementButNotDocument(nsIDocument* aDocument, nsIContent* aContent)
|
||||
focusController->SetFocusedElement(newFocusedElement);
|
||||
|
||||
nsIPresShell* presShell = aDocument->GetShellAt(0);
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsIEventStateManager* esm = presContext->EventStateManager();
|
||||
nsIEventStateManager* esm = presShell->GetPresContext()->EventStateManager();
|
||||
|
||||
// Temporarily set esm::mCurrentFocus so that esm::GetContentState() tells
|
||||
// layout system to show focus on this element.
|
||||
@ -457,8 +455,7 @@ void nsWebBrowserFind::SetSelectionAndScroll(nsIDOMWindow* aWindow,
|
||||
FocusElementButNotDocument(doc, content);
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsCOMPtr<nsPresContext> presContext = presShell->GetPresContext();
|
||||
PRBool isSelectionWithFocus;
|
||||
presContext->EventStateManager()->
|
||||
MoveFocusToCaret(PR_TRUE, &isSelectionWithFocus);
|
||||
@ -834,9 +831,7 @@ nsWebBrowserFind::GetFrameSelection(nsIDOMWindow* aWindow,
|
||||
|
||||
// text input controls have their independent selection controllers
|
||||
// that we must use when they have focus.
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
|
||||
nsIFrame *frame = nsnull;
|
||||
presContext->EventStateManager()->GetFocusedFrame(&frame);
|
||||
|
@ -167,11 +167,9 @@ inFlasher::DrawElementOutline(nsIDOMElement* aElement)
|
||||
if (!window) return NS_OK;
|
||||
nsCOMPtr<nsIPresShell> presShell = inLayoutUtils::GetPresShellFor(window);
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
|
||||
float p2t;
|
||||
p2t = presContext->PixelsToTwips();
|
||||
float p2t = presContext->PixelsToTwips();
|
||||
|
||||
PRBool isFirstFrame = PR_TRUE;
|
||||
nsCOMPtr<nsIRenderingContext> rcontext;
|
||||
|
@ -125,11 +125,7 @@ inLayoutUtils::GetEventStateManagerFor(nsIDOMElement *aElement)
|
||||
nsIPresShell *shell = doc->GetShellAt(0);
|
||||
NS_ASSERTION(shell, "No pres shell");
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
shell->GetPresContext(getter_AddRefs(presContext));
|
||||
NS_ASSERTION(presContext, "No pres context");
|
||||
|
||||
return presContext->EventStateManager();
|
||||
return shell->GetPresContext()->EventStateManager();
|
||||
}
|
||||
|
||||
nsPoint
|
||||
@ -171,8 +167,7 @@ inLayoutUtils::GetScreenOrigin(nsIDOMElement* aElement)
|
||||
// Flush all pending notifications so that our frames are uptodate
|
||||
doc->FlushPendingNotifications(Flush_Layout);
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
|
||||
if (presContext) {
|
||||
nsIFrame* frame = nsnull;
|
||||
|
@ -429,12 +429,9 @@ DumpFramesRecur(nsIDocShell* aDocShell, FILE* out)
|
||||
nsIFrame* root;
|
||||
shell->GetRootFrame(&root);
|
||||
if (root) {
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
shell->GetPresContext(getter_AddRefs(presContext));
|
||||
|
||||
nsIFrameDebug* fdbg;
|
||||
if (NS_SUCCEEDED(CallQueryInterface(root, &fdbg))) {
|
||||
fdbg->List(presContext, out, 0);
|
||||
fdbg->List(shell->GetPresContext(), out, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,10 +124,7 @@ nsRegressionTester::DumpFrameModel(nsIDOMWindow *aWindowToDump, nsILocalFile *aD
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
|
||||
fdbg->DumpRegressionData(presContext, fp, 0, dumpStyle);
|
||||
fdbg->DumpRegressionData(presShell->GetPresContext(), fp, 0, dumpStyle);
|
||||
if (fp != stdout)
|
||||
fclose(fp);
|
||||
|
||||
|
@ -923,10 +923,9 @@ nsTypeAheadFind::HandleChar(PRUnichar aChar)
|
||||
// If not, make sure the selection is in sync with the focus, so we can
|
||||
// start our search from there.
|
||||
nsCOMPtr<nsIContent> focusedContent;
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mFocusedWeakShell));
|
||||
NS_ENSURE_TRUE(presShell, NS_OK);
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
NS_ENSURE_TRUE(presContext, NS_OK);
|
||||
|
||||
nsIEventStateManager *esm = presContext->EventStateManager();
|
||||
@ -1209,9 +1208,7 @@ nsTypeAheadFind::FindItNow(nsIPresShell *aPresShell,
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext = presShell->GetPresContext();
|
||||
if (!presContext) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -1715,8 +1712,7 @@ nsTypeAheadFind::FindNext(PRBool aFindBackwards, nsISupportsInterfacePointer *aC
|
||||
nsCOMPtr<nsIPresShell> typeAheadPresShell(do_QueryReferent(mFocusedWeakShell));
|
||||
NS_ENSURE_TRUE(typeAheadPresShell, NS_OK);
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
typeAheadPresShell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = typeAheadPresShell->GetPresContext();
|
||||
NS_ENSURE_TRUE(presContext, NS_OK);
|
||||
|
||||
nsCOMPtr<nsISupports> container = presContext->GetContainer();
|
||||
@ -2488,9 +2484,7 @@ nsTypeAheadFind::GetTargetIfTypeAheadOkay(nsIDOMEvent *aEvent,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
if (presContext->Type() == nsPresContext::eContext_PrintPreview) {
|
||||
if (presShell->GetPresContext()->Type() == nsPresContext::eContext_PrintPreview) {
|
||||
// Typeaheadfind is not designed to work in print preview.
|
||||
// You can't navigate through the links there.
|
||||
if (lastShell != presShell) {
|
||||
@ -2514,8 +2508,7 @@ nsTypeAheadFind::GetSelection(nsIPresShell *aPresShell,
|
||||
// if aCurrentNode is nsnull, get selection for document
|
||||
*aDOMSel = nsnull;
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
aPresShell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = aPresShell->GetPresContext();
|
||||
|
||||
nsIFrame *frame = nsnull;
|
||||
aPresShell->GetRootFrame(&frame);
|
||||
@ -2715,8 +2708,7 @@ nsTypeAheadFind::DisplayStatus(PRBool aSuccess, nsIContent *aFocusedContent,
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
if (!presContext) {
|
||||
return;
|
||||
}
|
||||
|
@ -595,10 +595,7 @@ NS_IMETHODIMP mozXMLTerminal::ScreenSize(PRInt32* rows, PRInt32* cols,
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Get presentation context
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
result = presShell->GetPresContext( getter_AddRefs(presContext) );
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
|
||||
// Get the default fixed pitch font
|
||||
const nsFont* defaultFixedFont =
|
||||
|
@ -155,10 +155,8 @@ static PRInt32 GetContentState(nsIFrame* aFrame)
|
||||
if (!shell)
|
||||
return 0;
|
||||
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
PRInt32 flags = 0;
|
||||
context->EventStateManager()->GetContentState(aFrame->GetContent(), flags);
|
||||
shell->GetPresContext()->EventStateManager()->GetContentState(aFrame->GetContent(), flags);
|
||||
return flags;
|
||||
}
|
||||
|
||||
|
@ -105,10 +105,8 @@ nsNativeTheme::GetContentState(nsIFrame* aFrame, PRUint8 aWidgetType)
|
||||
if (!shell)
|
||||
return 0;
|
||||
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
PRInt32 flags = 0;
|
||||
context->EventStateManager()->GetContentState(aFrame->GetContent(), flags);
|
||||
shell->GetPresContext()->EventStateManager()->GetContentState(aFrame->GetContent(), flags);
|
||||
|
||||
if (isXULCheckboxRadio && aWidgetType == NS_THEME_RADIO) {
|
||||
if (IsFocused(aFrame))
|
||||
|
@ -7754,12 +7754,9 @@ nsCSSFrameConstructor::IsValidSibling(nsIPresShell& aPresShell,
|
||||
(NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP == aSiblingDisplay)) {
|
||||
// if we haven't already, construct a style context to find the display type of aContent
|
||||
if (UNSET_DISPLAY == aDisplay) {
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
aPresShell.GetPresContext(getter_AddRefs(context));
|
||||
|
||||
nsIFrame* parent = aSibling.GetParent();
|
||||
nsRefPtr<nsStyleContext> styleContext;
|
||||
styleContext = ResolveStyleContext(context, parent, &aContent);
|
||||
styleContext = ResolveStyleContext(aPresShell.GetPresContext(),
|
||||
aSibling.GetParent(), &aContent);
|
||||
if (!styleContext) return PR_FALSE;
|
||||
const nsStyleDisplay* display = styleContext->GetStyleDisplay();
|
||||
aDisplay = display->mDisplay;
|
||||
|
@ -117,13 +117,9 @@ NS_IMETHODIMP nsCaret::Init(nsIPresShell *inPresShell)
|
||||
|
||||
// get nsILookAndFeel from the pres context, which has one cached.
|
||||
nsILookAndFeel *lookAndFeel = nsnull;
|
||||
nsPresContext *presContext = inPresShell->GetPresContext();
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
inPresShell->GetPresContext(getter_AddRefs(presContext));
|
||||
if (presContext)
|
||||
lookAndFeel = presContext->LookAndFeel();
|
||||
if (lookAndFeel)
|
||||
{
|
||||
if (presContext && (lookAndFeel = presContext->LookAndFeel())) {
|
||||
PRInt32 tempInt;
|
||||
if (NS_SUCCEEDED(lookAndFeel->GetMetric(nsILookAndFeel::eMetric_SingleLineCaretWidth, tempInt)))
|
||||
mCaretPixelsWidth = (nscoord)tempInt;
|
||||
@ -340,11 +336,8 @@ NS_IMETHODIMP nsCaret::GetCaretCoordinates(EViewCoordinates aRelativeToType, nsI
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
// ramp up to make a rendering context for measuring text.
|
||||
// First, we get the pres context ...
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
err = presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
if (NS_FAILED(err))
|
||||
return err;
|
||||
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
|
||||
// ... then tell it to make a rendering context
|
||||
nsCOMPtr<nsIRenderingContext> rendContext;
|
||||
err = presContext->DeviceContext()->
|
||||
@ -562,9 +555,7 @@ PRBool nsCaret::SetupDrawingFrameAndOffset(nsIDOMNode* aNode, PRInt32 aOffset, n
|
||||
// NS_STYLE_DIRECTION_LTR : LTR or Default
|
||||
// NS_STYLE_DIRECTION_RTL
|
||||
// NS_STYLE_DIRECTION_INHERIT
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
rv = presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
if (presContext && presContext->BidiEnabled())
|
||||
{
|
||||
presShell->GetCaretBidiLevel(&bidiLevel);
|
||||
@ -761,16 +752,14 @@ void nsCaret::GetViewForRendering(nsIFrame *caretFrame, EViewCoordinates coordTy
|
||||
if (!presShell)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
|
||||
viewOffset.x = 0;
|
||||
viewOffset.y = 0;
|
||||
|
||||
nsPoint withinViewOffset(0, 0);
|
||||
// get the offset of this frame from its parent view (walks up frame hierarchy)
|
||||
nsIView* theView = nsnull;
|
||||
caretFrame->GetOffsetFromView(presContext, withinViewOffset, &theView);
|
||||
caretFrame->GetOffsetFromView(presShell->GetPresContext(),
|
||||
withinViewOffset, &theView);
|
||||
if (theView == nsnull) return;
|
||||
|
||||
if (outRelativeView && coordType == eClosestViewCoordinates)
|
||||
@ -953,9 +942,7 @@ void nsCaret::GetCaretRectAndInvert()
|
||||
nsCOMPtr<nsIPresShell> presShell = do_QueryReferent(mPresShell);
|
||||
if (!presShell) return;
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
if (NS_FAILED(presShell->GetPresContext(getter_AddRefs(presContext))))
|
||||
return;
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
|
||||
// if the view changed, or we don't have a rendering context, make one
|
||||
// because of drawing issues, always make a new RC at the moment. See bug 28068
|
||||
|
@ -332,8 +332,7 @@ nsFrameManager::Destroy()
|
||||
{
|
||||
NS_ASSERTION(mPresShell, "Frame manager already shut down.");
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
mPresShell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = mPresShell->GetPresContext();
|
||||
|
||||
// Destroy the frame hierarchy. Don't destroy the property lists until after
|
||||
// we've destroyed the frame hierarchy because some frames may expect to be
|
||||
@ -425,12 +424,10 @@ nsFrameManager::GetPrimaryFrameFor(nsIContent* aContent)
|
||||
// very fast in the embedded hash table.
|
||||
// This would almost completely remove the lookup penalty for things
|
||||
// like <SCRIPT> and comments in very large documents.
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
|
||||
// Give the frame construction code the opportunity to return the
|
||||
// frame that maps the content object
|
||||
mPresShell->GetPresContext(getter_AddRefs(presContext));
|
||||
NS_ASSERTION(presContext, "bad presContext");
|
||||
nsPresContext *presContext = mPresShell->GetPresContext();
|
||||
if (!presContext) {
|
||||
return nsnull;
|
||||
}
|
||||
@ -782,9 +779,7 @@ nsFrameManager::NotifyDestroyingFrame(nsIFrame* aFrame)
|
||||
DequeuePostedEventFor(aFrame);
|
||||
|
||||
// Remove all properties associated with the frame
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
mPresShell->GetPresContext(getter_AddRefs(presContext));
|
||||
|
||||
nsPresContext *presContext = mPresShell->GetPresContext();
|
||||
RemoveAllPropertiesFor(presContext, aFrame);
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -913,11 +908,9 @@ nsFrameManager::HandlePLEvent(CantRenderReplacedElementEvent* aEvent)
|
||||
|
||||
// Notify the style system and then process any reflow commands that
|
||||
// are generated
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
frameManager->mPresShell->GetPresContext(getter_AddRefs(presContext));
|
||||
frameManager->mPresShell->FrameConstructor()->
|
||||
CantRenderReplacedElement(frameManager->mPresShell, presContext,
|
||||
aEvent->mFrame);
|
||||
nsIPresShell *shell = frameManager->mPresShell;
|
||||
shell->FrameConstructor()->
|
||||
CantRenderReplacedElement(shell, shell->GetPresContext(), aEvent->mFrame);
|
||||
|
||||
#ifdef NOISY_EVENTS
|
||||
printf("nsFrameManager::HandlePLEvent() end for FM %p\n", aEvent->owner);
|
||||
@ -1990,9 +1983,8 @@ nsFrameManager::SetFrameProperty(const nsIFrame* aFrame,
|
||||
// A NULL entry->key is the sign that the entry has just been allocated
|
||||
// for us. If it's non-NULL then we have an existing entry.
|
||||
if (entry->key && propertyList->mDtorFunc) {
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
mPresShell->GetPresContext(getter_AddRefs(presContext));
|
||||
propertyList->mDtorFunc(presContext, NS_CONST_CAST(nsIFrame*, entry->key),
|
||||
propertyList->mDtorFunc(mPresShell->GetPresContext(),
|
||||
NS_CONST_CAST(nsIFrame*, entry->key),
|
||||
aPropertyName, entry->value);
|
||||
result = NS_IFRAME_MGR_PROP_OVERWRITTEN;
|
||||
}
|
||||
@ -2010,10 +2002,8 @@ nsFrameManager::RemoveFrameProperty(const nsIFrame* aFrame,
|
||||
|
||||
PropertyList* propertyList = GetPropertyListFor(aPropertyName);
|
||||
if (propertyList) {
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
mPresShell->GetPresContext(getter_AddRefs(presContext));
|
||||
|
||||
if (propertyList->RemovePropertyForFrame(presContext, aFrame))
|
||||
if (propertyList->RemovePropertyForFrame(mPresShell->GetPresContext(),
|
||||
aFrame))
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -90,8 +90,8 @@ class nsIStyleSheet;
|
||||
class nsCSSFrameConstructor;
|
||||
|
||||
#define NS_IPRESSHELL_IID \
|
||||
{ 0xde106833, 0xf56c, 0x4062, \
|
||||
{0x9c, 0x7c, 0x60, 0x67, 0x40, 0x7e, 0x88, 0x4a} }
|
||||
{ 0x16c9c6ee, 0xd9c0, 0x463d, \
|
||||
{0xbc, 0x5e, 0x4d, 0xdf, 0x60, 0xdd, 0x73, 0xfc} }
|
||||
|
||||
// Constants uses for ScrollFrameIntoView() function
|
||||
#define NS_PRESSHELL_SCROLL_TOP 0
|
||||
@ -165,7 +165,6 @@ public:
|
||||
|
||||
nsIDocument* GetDocument() { return mDocument; }
|
||||
|
||||
NS_IMETHOD GetPresContext(nsPresContext** aResult) = 0;
|
||||
nsPresContext* GetPresContext() { return mPresContext; }
|
||||
|
||||
NS_IMETHOD GetViewManager(nsIViewManager** aResult) = 0;
|
||||
|
@ -90,8 +90,8 @@ class nsIStyleSheet;
|
||||
class nsCSSFrameConstructor;
|
||||
|
||||
#define NS_IPRESSHELL_IID \
|
||||
{ 0xde106833, 0xf56c, 0x4062, \
|
||||
{0x9c, 0x7c, 0x60, 0x67, 0x40, 0x7e, 0x88, 0x4a} }
|
||||
{ 0x16c9c6ee, 0xd9c0, 0x463d, \
|
||||
{0xbc, 0x5e, 0x4d, 0xdf, 0x60, 0xdd, 0x73, 0xfc} }
|
||||
|
||||
// Constants uses for ScrollFrameIntoView() function
|
||||
#define NS_PRESSHELL_SCROLL_TOP 0
|
||||
@ -165,7 +165,6 @@ public:
|
||||
|
||||
nsIDocument* GetDocument() { return mDocument; }
|
||||
|
||||
NS_IMETHOD GetPresContext(nsPresContext** aResult) = 0;
|
||||
nsPresContext* GetPresContext() { return mPresContext; }
|
||||
|
||||
NS_IMETHOD GetViewManager(nsIViewManager** aResult) = 0;
|
||||
|
@ -117,13 +117,9 @@ NS_IMETHODIMP nsCaret::Init(nsIPresShell *inPresShell)
|
||||
|
||||
// get nsILookAndFeel from the pres context, which has one cached.
|
||||
nsILookAndFeel *lookAndFeel = nsnull;
|
||||
nsPresContext *presContext = inPresShell->GetPresContext();
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
inPresShell->GetPresContext(getter_AddRefs(presContext));
|
||||
if (presContext)
|
||||
lookAndFeel = presContext->LookAndFeel();
|
||||
if (lookAndFeel)
|
||||
{
|
||||
if (presContext && (lookAndFeel = presContext->LookAndFeel())) {
|
||||
PRInt32 tempInt;
|
||||
if (NS_SUCCEEDED(lookAndFeel->GetMetric(nsILookAndFeel::eMetric_SingleLineCaretWidth, tempInt)))
|
||||
mCaretPixelsWidth = (nscoord)tempInt;
|
||||
@ -340,11 +336,8 @@ NS_IMETHODIMP nsCaret::GetCaretCoordinates(EViewCoordinates aRelativeToType, nsI
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
// ramp up to make a rendering context for measuring text.
|
||||
// First, we get the pres context ...
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
err = presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
if (NS_FAILED(err))
|
||||
return err;
|
||||
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
|
||||
// ... then tell it to make a rendering context
|
||||
nsCOMPtr<nsIRenderingContext> rendContext;
|
||||
err = presContext->DeviceContext()->
|
||||
@ -562,9 +555,7 @@ PRBool nsCaret::SetupDrawingFrameAndOffset(nsIDOMNode* aNode, PRInt32 aOffset, n
|
||||
// NS_STYLE_DIRECTION_LTR : LTR or Default
|
||||
// NS_STYLE_DIRECTION_RTL
|
||||
// NS_STYLE_DIRECTION_INHERIT
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
rv = presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
if (presContext && presContext->BidiEnabled())
|
||||
{
|
||||
presShell->GetCaretBidiLevel(&bidiLevel);
|
||||
@ -761,16 +752,14 @@ void nsCaret::GetViewForRendering(nsIFrame *caretFrame, EViewCoordinates coordTy
|
||||
if (!presShell)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
|
||||
viewOffset.x = 0;
|
||||
viewOffset.y = 0;
|
||||
|
||||
nsPoint withinViewOffset(0, 0);
|
||||
// get the offset of this frame from its parent view (walks up frame hierarchy)
|
||||
nsIView* theView = nsnull;
|
||||
caretFrame->GetOffsetFromView(presContext, withinViewOffset, &theView);
|
||||
caretFrame->GetOffsetFromView(presShell->GetPresContext(),
|
||||
withinViewOffset, &theView);
|
||||
if (theView == nsnull) return;
|
||||
|
||||
if (outRelativeView && coordType == eClosestViewCoordinates)
|
||||
@ -953,9 +942,7 @@ void nsCaret::GetCaretRectAndInvert()
|
||||
nsCOMPtr<nsIPresShell> presShell = do_QueryReferent(mPresShell);
|
||||
if (!presShell) return;
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
if (NS_FAILED(presShell->GetPresContext(getter_AddRefs(presContext))))
|
||||
return;
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
|
||||
// if the view changed, or we don't have a rendering context, make one
|
||||
// because of drawing issues, always make a new RC at the moment. See bug 28068
|
||||
|
@ -547,8 +547,8 @@ nsTextInputSelectionImpl::RepaintSelection(PRInt16 type)
|
||||
nsCOMPtr<nsIPresShell> presShell = do_QueryReferent(mPresShellWeak);
|
||||
if (presShell)
|
||||
{
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
if (NS_SUCCEEDED(presShell->GetPresContext(getter_AddRefs(context))) && context)
|
||||
nsPresContext *context = presShell->GetPresContext();
|
||||
if (context)
|
||||
{
|
||||
return mFrameSelection->RepaintSelection(context, type);
|
||||
}
|
||||
@ -2796,13 +2796,6 @@ nsTextControlFrame::FireOnInput()
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
presShell->GetPresContext(getter_AddRefs(context));
|
||||
NS_ASSERTION(context, "No pres context");
|
||||
if (!context) {
|
||||
return;
|
||||
}
|
||||
|
||||
presShell->HandleEventWithTarget(&event, nsnull, mContent,
|
||||
NS_EVENT_FLAG_INIT, &status);
|
||||
}
|
||||
@ -2840,9 +2833,7 @@ nsTextControlFrame::FireOnChange()
|
||||
nsWeakPtr &shell = mTextSelImpl->GetPresShell();
|
||||
nsCOMPtr<nsIPresShell> presShell = do_QueryReferent(shell);
|
||||
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
if (NS_SUCCEEDED(presShell->GetPresContext(getter_AddRefs(context))) && context)
|
||||
return presShell->HandleEventWithTarget(&event, nsnull, mContent, NS_EVENT_FLAG_INIT, &status);
|
||||
return presShell->HandleEventWithTarget(&event, nsnull, mContent, NS_EVENT_FLAG_INIT, &status);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1090,8 +1090,8 @@ nsImageMap::ChangeFocus(nsIDOMEvent* aEvent, PRBool aFocus) {
|
||||
if (presShell) {
|
||||
nsIFrame* imgFrame;
|
||||
if (NS_SUCCEEDED(presShell->GetPrimaryFrameFor(targetContent, &imgFrame)) && imgFrame) {
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
if (NS_SUCCEEDED(presShell->GetPresContext(getter_AddRefs(presContext))) && presContext) {
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
if (presContext) {
|
||||
nsRect dmgRect;
|
||||
area->GetRect(presContext, dmgRect);
|
||||
imgFrame->Invalidate(dmgRect, PR_TRUE);
|
||||
|
@ -1702,10 +1702,9 @@ nsObjectFrame::Paint(nsPresContext* aPresContext,
|
||||
#endif
|
||||
|
||||
// XXX Nav 4.x always sent a SetWindow call after print. Should we do the same?
|
||||
nsCOMPtr<nsPresContext> screenPcx;
|
||||
shell->GetPresContext(getter_AddRefs(screenPcx));
|
||||
nsDidReflowStatus status = NS_FRAME_REFLOW_FINISHED; // should we use a special status?
|
||||
frame->DidReflow(screenPcx, nsnull, status); // DidReflow will take care of it
|
||||
frame->DidReflow(shell->GetPresContext(),
|
||||
nsnull, status); // DidReflow will take care of it
|
||||
|
||||
return rv; // done with printing
|
||||
}
|
||||
|
@ -741,9 +741,7 @@ NS_NewPageBreakFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
NS_PRECONDITION(aPresShell && aNewFrame, "null PresShell or OUT ptr");
|
||||
#ifdef DEBUG
|
||||
//check that we are only creating page break frames when printing
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
aPresShell->GetPresContext(getter_AddRefs(presContext));
|
||||
NS_ASSERTION(presContext->IsPaginated(), "created a page break frame while not printing");
|
||||
NS_ASSERTION(aPresShell->GetPresContext()->IsPaginated(), "created a page break frame while not printing");
|
||||
#endif
|
||||
|
||||
nsPageBreakFrame* it = new (aPresShell) nsPageBreakFrame;
|
||||
|
@ -332,8 +332,7 @@ nsFrameManager::Destroy()
|
||||
{
|
||||
NS_ASSERTION(mPresShell, "Frame manager already shut down.");
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
mPresShell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = mPresShell->GetPresContext();
|
||||
|
||||
// Destroy the frame hierarchy. Don't destroy the property lists until after
|
||||
// we've destroyed the frame hierarchy because some frames may expect to be
|
||||
@ -425,12 +424,10 @@ nsFrameManager::GetPrimaryFrameFor(nsIContent* aContent)
|
||||
// very fast in the embedded hash table.
|
||||
// This would almost completely remove the lookup penalty for things
|
||||
// like <SCRIPT> and comments in very large documents.
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
|
||||
// Give the frame construction code the opportunity to return the
|
||||
// frame that maps the content object
|
||||
mPresShell->GetPresContext(getter_AddRefs(presContext));
|
||||
NS_ASSERTION(presContext, "bad presContext");
|
||||
nsPresContext *presContext = mPresShell->GetPresContext();
|
||||
if (!presContext) {
|
||||
return nsnull;
|
||||
}
|
||||
@ -782,9 +779,7 @@ nsFrameManager::NotifyDestroyingFrame(nsIFrame* aFrame)
|
||||
DequeuePostedEventFor(aFrame);
|
||||
|
||||
// Remove all properties associated with the frame
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
mPresShell->GetPresContext(getter_AddRefs(presContext));
|
||||
|
||||
nsPresContext *presContext = mPresShell->GetPresContext();
|
||||
RemoveAllPropertiesFor(presContext, aFrame);
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -913,11 +908,9 @@ nsFrameManager::HandlePLEvent(CantRenderReplacedElementEvent* aEvent)
|
||||
|
||||
// Notify the style system and then process any reflow commands that
|
||||
// are generated
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
frameManager->mPresShell->GetPresContext(getter_AddRefs(presContext));
|
||||
frameManager->mPresShell->FrameConstructor()->
|
||||
CantRenderReplacedElement(frameManager->mPresShell, presContext,
|
||||
aEvent->mFrame);
|
||||
nsIPresShell *shell = frameManager->mPresShell;
|
||||
shell->FrameConstructor()->
|
||||
CantRenderReplacedElement(shell, shell->GetPresContext(), aEvent->mFrame);
|
||||
|
||||
#ifdef NOISY_EVENTS
|
||||
printf("nsFrameManager::HandlePLEvent() end for FM %p\n", aEvent->owner);
|
||||
@ -1990,9 +1983,8 @@ nsFrameManager::SetFrameProperty(const nsIFrame* aFrame,
|
||||
// A NULL entry->key is the sign that the entry has just been allocated
|
||||
// for us. If it's non-NULL then we have an existing entry.
|
||||
if (entry->key && propertyList->mDtorFunc) {
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
mPresShell->GetPresContext(getter_AddRefs(presContext));
|
||||
propertyList->mDtorFunc(presContext, NS_CONST_CAST(nsIFrame*, entry->key),
|
||||
propertyList->mDtorFunc(mPresShell->GetPresContext(),
|
||||
NS_CONST_CAST(nsIFrame*, entry->key),
|
||||
aPropertyName, entry->value);
|
||||
result = NS_IFRAME_MGR_PROP_OVERWRITTEN;
|
||||
}
|
||||
@ -2010,10 +2002,8 @@ nsFrameManager::RemoveFrameProperty(const nsIFrame* aFrame,
|
||||
|
||||
PropertyList* propertyList = GetPropertyListFor(aPropertyName);
|
||||
if (propertyList) {
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
mPresShell->GetPresContext(getter_AddRefs(presContext));
|
||||
|
||||
if (propertyList->RemovePropertyForFrame(presContext, aFrame))
|
||||
if (propertyList->RemovePropertyForFrame(mPresShell->GetPresContext(),
|
||||
aFrame))
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1090,8 +1090,8 @@ nsImageMap::ChangeFocus(nsIDOMEvent* aEvent, PRBool aFocus) {
|
||||
if (presShell) {
|
||||
nsIFrame* imgFrame;
|
||||
if (NS_SUCCEEDED(presShell->GetPrimaryFrameFor(targetContent, &imgFrame)) && imgFrame) {
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
if (NS_SUCCEEDED(presShell->GetPresContext(getter_AddRefs(presContext))) && presContext) {
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
if (presContext) {
|
||||
nsRect dmgRect;
|
||||
area->GetRect(presContext, dmgRect);
|
||||
imgFrame->Invalidate(dmgRect, PR_TRUE);
|
||||
|
@ -1702,10 +1702,9 @@ nsObjectFrame::Paint(nsPresContext* aPresContext,
|
||||
#endif
|
||||
|
||||
// XXX Nav 4.x always sent a SetWindow call after print. Should we do the same?
|
||||
nsCOMPtr<nsPresContext> screenPcx;
|
||||
shell->GetPresContext(getter_AddRefs(screenPcx));
|
||||
nsDidReflowStatus status = NS_FRAME_REFLOW_FINISHED; // should we use a special status?
|
||||
frame->DidReflow(screenPcx, nsnull, status); // DidReflow will take care of it
|
||||
frame->DidReflow(shell->GetPresContext(),
|
||||
nsnull, status); // DidReflow will take care of it
|
||||
|
||||
return rv; // done with printing
|
||||
}
|
||||
|
@ -741,9 +741,7 @@ NS_NewPageBreakFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
NS_PRECONDITION(aPresShell && aNewFrame, "null PresShell or OUT ptr");
|
||||
#ifdef DEBUG
|
||||
//check that we are only creating page break frames when printing
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
aPresShell->GetPresContext(getter_AddRefs(presContext));
|
||||
NS_ASSERTION(presContext->IsPaginated(), "created a page break frame while not printing");
|
||||
NS_ASSERTION(aPresShell->GetPresContext()->IsPaginated(), "created a page break frame while not printing");
|
||||
#endif
|
||||
|
||||
nsPageBreakFrame* it = new (aPresShell) nsPageBreakFrame;
|
||||
|
@ -547,8 +547,8 @@ nsTextInputSelectionImpl::RepaintSelection(PRInt16 type)
|
||||
nsCOMPtr<nsIPresShell> presShell = do_QueryReferent(mPresShellWeak);
|
||||
if (presShell)
|
||||
{
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
if (NS_SUCCEEDED(presShell->GetPresContext(getter_AddRefs(context))) && context)
|
||||
nsPresContext *context = presShell->GetPresContext();
|
||||
if (context)
|
||||
{
|
||||
return mFrameSelection->RepaintSelection(context, type);
|
||||
}
|
||||
@ -2796,13 +2796,6 @@ nsTextControlFrame::FireOnInput()
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
presShell->GetPresContext(getter_AddRefs(context));
|
||||
NS_ASSERTION(context, "No pres context");
|
||||
if (!context) {
|
||||
return;
|
||||
}
|
||||
|
||||
presShell->HandleEventWithTarget(&event, nsnull, mContent,
|
||||
NS_EVENT_FLAG_INIT, &status);
|
||||
}
|
||||
@ -2840,9 +2833,7 @@ nsTextControlFrame::FireOnChange()
|
||||
nsWeakPtr &shell = mTextSelImpl->GetPresShell();
|
||||
nsCOMPtr<nsIPresShell> presShell = do_QueryReferent(shell);
|
||||
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
if (NS_SUCCEEDED(presShell->GetPresContext(getter_AddRefs(context))) && context)
|
||||
return presShell->HandleEventWithTarget(&event, nsnull, mContent, NS_EVENT_FLAG_INIT, &status);
|
||||
return presShell->HandleEventWithTarget(&event, nsnull, mContent, NS_EVENT_FLAG_INIT, &status);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -7754,12 +7754,9 @@ nsCSSFrameConstructor::IsValidSibling(nsIPresShell& aPresShell,
|
||||
(NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP == aSiblingDisplay)) {
|
||||
// if we haven't already, construct a style context to find the display type of aContent
|
||||
if (UNSET_DISPLAY == aDisplay) {
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
aPresShell.GetPresContext(getter_AddRefs(context));
|
||||
|
||||
nsIFrame* parent = aSibling.GetParent();
|
||||
nsRefPtr<nsStyleContext> styleContext;
|
||||
styleContext = ResolveStyleContext(context, parent, &aContent);
|
||||
styleContext = ResolveStyleContext(aPresShell.GetPresContext(),
|
||||
aSibling.GetParent(), &aContent);
|
||||
if (!styleContext) return PR_FALSE;
|
||||
const nsStyleDisplay* display = styleContext->GetStyleDisplay();
|
||||
aDisplay = display->mDisplay;
|
||||
|
@ -246,9 +246,7 @@ nsMathMLTokenFrame::ReflowDirtyChild(nsIPresShell* aPresShell,
|
||||
// if we get this, it means it was called by the nsTextFrame beneath us, and
|
||||
// this means something changed in the text content. So re-process our text
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
aPresShell->GetPresContext(getter_AddRefs(presContext));
|
||||
ProcessTextData(presContext);
|
||||
ProcessTextData(aPresShell->GetPresContext());
|
||||
|
||||
mState |= NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN;
|
||||
return mParent->ReflowDirtyChild(aPresShell, this);
|
||||
|
@ -974,9 +974,7 @@ nsMathMLmoFrame::ReflowDirtyChild(nsIPresShell* aPresShell,
|
||||
// an re-build the automatic data from the parent of our outermost embellished
|
||||
// container (we ensure that we are the core, not just a sibling of the core)
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
aPresShell->GetPresContext(getter_AddRefs(presContext));
|
||||
|
||||
nsPresContext *presContext = aPresShell->GetPresContext();
|
||||
ProcessTextData(presContext);
|
||||
|
||||
nsIFrame* target = this;
|
||||
|
@ -194,10 +194,7 @@ nsComputedDOMStyle::Init(nsIDOMElement *aElement,
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPresContext> presCtx;
|
||||
|
||||
aPresShell->GetPresContext(getter_AddRefs(presCtx));
|
||||
|
||||
nsPresContext *presCtx = aPresShell->GetPresContext();
|
||||
NS_ENSURE_TRUE(presCtx, NS_ERROR_FAILURE);
|
||||
|
||||
mT2P = presCtx->TwipsToPixels();
|
||||
@ -615,8 +612,7 @@ nsComputedDOMStyle::GetFontFamily(nsIFrame *aFrame,
|
||||
if (font) {
|
||||
nsCOMPtr<nsIPresShell> presShell = do_QueryReferent(mPresShellWeak);
|
||||
NS_ASSERTION(presShell, "pres shell is required");
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
NS_ASSERTION(presContext, "pres context is required");
|
||||
|
||||
const nsString& fontName = font->mFont.name;
|
||||
@ -2785,10 +2781,6 @@ nsComputedDOMStyle::GetAbsoluteOffset(PRUint8 aSide, nsIFrame* aFrame,
|
||||
// _not_ include the scrollbars. For fixed positioned frames,
|
||||
// the containing block is the viewport, which _does_ include
|
||||
// scrollbars. We have to do some extra work.
|
||||
nsCOMPtr<nsIPresShell> presShell = do_QueryReferent(mPresShellWeak);
|
||||
NS_ASSERTION(presShell, "Must have a presshell!");
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
// the first child in the default frame list is what we want
|
||||
nsIFrame* scrollingChild = container->GetFirstChild(nsnull);
|
||||
nsCOMPtr<nsIScrollableFrame> scrollFrame =
|
||||
|
@ -163,8 +163,7 @@ nsInspectorCSSUtils::GetStyleContextForContent(nsIContent* aContent,
|
||||
if (parent)
|
||||
parentContext = GetStyleContextForContent(parent, nsnull, aPresShell);
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
aPresShell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = aPresShell->GetPresContext();
|
||||
if (!presContext)
|
||||
return nsnull;
|
||||
|
||||
|
@ -642,8 +642,7 @@ nsBox::GetBorder(nsMargin& aMargin)
|
||||
nsCOMPtr<nsIDocument> doc = content->GetDocument();
|
||||
if (doc) {
|
||||
nsIPresShell *shell = doc->GetShellAt(0);
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
nsPresContext *context = shell->GetPresContext();
|
||||
if (gTheme->ThemeSupportsWidget(context, frame, disp->mAppearance)) {
|
||||
nsMargin margin(0,0,0,0);
|
||||
gTheme->GetWidgetBorder(context->DeviceContext(), frame,
|
||||
|
@ -691,9 +691,7 @@ nsBoxFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild)
|
||||
// if we receive a ReflowDirtyChild it is because there is an HTML frame
|
||||
// just inside us. So must find the adaptor that contains the child and
|
||||
// tell it that things are dirty.
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
aPresShell->GetPresContext(getter_AddRefs(context));
|
||||
nsBoxLayoutState state(context);
|
||||
nsBoxLayoutState state(aPresShell->GetPresContext());
|
||||
|
||||
nsIBox* box = nsnull;
|
||||
GetChildBox(&box);
|
||||
|
@ -81,8 +81,8 @@ nsBoxLayoutState::nsBoxLayoutState(nsIPresShell* aShell):mReflowState(nsnull),
|
||||
mLayoutFlags(0),
|
||||
mPaintingDisabled(PR_FALSE)
|
||||
{
|
||||
aShell->GetPresContext(getter_AddRefs(mPresContext));
|
||||
NS_ASSERTION(mPresContext, "PresContext must be non-null");
|
||||
mPresContext = aShell->GetPresContext();
|
||||
NS_ASSERTION(mPresContext, "PresContext must be non-null");
|
||||
}
|
||||
|
||||
nsBoxLayoutState::nsBoxLayoutState(nsPresContext* aPresContext,
|
||||
|
@ -244,10 +244,8 @@ nsBoxObject::GetOffsetRect(nsRect& aRect)
|
||||
}
|
||||
|
||||
// Get the Presentation Context from the Shell
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
presShell->GetPresContext(getter_AddRefs(context));
|
||||
|
||||
if(context) {
|
||||
nsPresContext *context = presShell->GetPresContext();
|
||||
if (context) {
|
||||
// Get the scale from that Presentation Context
|
||||
float scale;
|
||||
scale = context->TwipsToPixels();
|
||||
@ -284,9 +282,7 @@ nsBoxObject::GetScreenRect(nsRect& aRect)
|
||||
// Flush all pending notifications so that our frames are uptodate
|
||||
doc->FlushPendingNotifications(Flush_Layout);
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
if (presContext) {
|
||||
nsIFrame* frame;
|
||||
presShell->GetPrimaryFrameFor(mContent, &frame);
|
||||
|
@ -123,9 +123,7 @@ HandleImagePLEvent(nsIContent *aContent, PRUint32 aMessage, PRUint32 aFlags)
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPresContext> pres_context;
|
||||
pres_shell->GetPresContext(getter_AddRefs(pres_context));
|
||||
|
||||
nsCOMPtr<nsPresContext> pres_context = pres_shell->GetPresContext();
|
||||
if (!pres_context) {
|
||||
return;
|
||||
}
|
||||
|
@ -572,8 +572,7 @@ nsMenuPopupFrame::AdjustClientXYForNestedDocuments ( nsIDOMXULDocument* inPopupD
|
||||
shell->GetPrimaryFrameFor(targetAsContent, &targetFrame);
|
||||
nsIView* parentView = nsnull;
|
||||
if (targetFrame) {
|
||||
nsCOMPtr<nsPresContext> targetContext;
|
||||
shell->GetPresContext(getter_AddRefs(targetContext));
|
||||
nsPresContext *targetContext = shell->GetPresContext();
|
||||
if (targetContext) {
|
||||
GetRootViewForPopup(targetContext, targetFrame, PR_TRUE, &parentView);
|
||||
if (parentView) {
|
||||
|
@ -234,10 +234,8 @@ NS_IMETHODIMP nsScrollBoxObject::ScrollToElement(nsIDOMElement *child)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// prepare for twips
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
mPresShell->GetPresContext(getter_AddRefs(context));
|
||||
float pixelsToTwips = 0.0;
|
||||
pixelsToTwips = context->PixelsToTwips();
|
||||
pixelsToTwips = mPresShell->GetPresContext()->PixelsToTwips();
|
||||
|
||||
nsIBox* scrolledBox = GetScrolledBox(this);
|
||||
if (!scrolledBox)
|
||||
@ -309,10 +307,8 @@ NS_IMETHODIMP nsScrollBoxObject::EnsureElementIsVisible(nsIDOMElement *child)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// prepare for twips
|
||||
nsCOMPtr<nsPresContext> context;
|
||||
mPresShell->GetPresContext(getter_AddRefs(context));
|
||||
float pixelsToTwips = 0.0;
|
||||
pixelsToTwips = context->PixelsToTwips();
|
||||
pixelsToTwips = mPresShell->GetPresContext()->PixelsToTwips();
|
||||
|
||||
nsIBox* scrolledBox = GetScrolledBox(this);
|
||||
if (!scrolledBox)
|
||||
|
@ -750,8 +750,7 @@ nsTreeSelection::FireOnSelectHandler()
|
||||
nsIPresShell *shell = document->GetShellAt(0);
|
||||
if (shell) {
|
||||
// Retrieve the context in which our DOM event will fire.
|
||||
nsCOMPtr<nsPresContext> aPresContext;
|
||||
shell->GetPresContext(getter_AddRefs(aPresContext));
|
||||
nsCOMPtr<nsPresContext> aPresContext = shell->GetPresContext();
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsEvent event(NS_FORM_SELECTED);
|
||||
|
@ -129,8 +129,7 @@ GetScreenOrigin(nsIDOMElement* aElement)
|
||||
nsIPresShell* presShell = doc->GetShellAt(0);
|
||||
|
||||
if (presShell) {
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
|
||||
if (presContext) {
|
||||
// Get the scale from that Presentation Context
|
||||
|
@ -427,8 +427,7 @@ nsDocLoaderImpl::GetContentViewerContainer(nsISupports* aDocumentID,
|
||||
if (doc) {
|
||||
nsIPresShell *pres = doc->GetShellAt(0);
|
||||
if (pres) {
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
pres->GetPresContext(getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = pres->GetPresContext();
|
||||
if (presContext) {
|
||||
nsCOMPtr<nsISupports> supp = presContext->GetContainer();
|
||||
if (supp) {
|
||||
|
@ -2436,14 +2436,10 @@ DumpFramesRecurse(nsIDocShell* aDocShell, FILE* out, nsString *aFilterName)
|
||||
nsIFrame* root;
|
||||
shell->GetRootFrame(&root);
|
||||
if (nsnull != root) {
|
||||
nsPresContext* presContext;
|
||||
shell->GetPresContext(&presContext);
|
||||
|
||||
nsIFrameDebug* fdbg;
|
||||
if (NS_SUCCEEDED(CallQueryInterface(root, &fdbg))) {
|
||||
fdbg->List(presContext, out, 0);
|
||||
fdbg->List(shell->GetPresContext(), out, 0);
|
||||
}
|
||||
NS_IF_RELEASE(presContext);
|
||||
}
|
||||
NS_RELEASE(shell);
|
||||
}
|
||||
|
@ -289,8 +289,7 @@ nsWebCrawler::DumpRegressionData()
|
||||
nsIFrame* root;
|
||||
shell->GetRootFrame(&root);
|
||||
if (nsnull != root) {
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
shell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsPresContext *presContext = shell->GetPresContext();
|
||||
|
||||
if (mOutputDir.Length() > 0) {
|
||||
nsAutoString regressionFileName;
|
||||
|
@ -264,7 +264,7 @@ nsBaseDragService :: GetFrameFromNode ( nsIDOMNode* inNode, nsIFrame** outFrame,
|
||||
if (doc) {
|
||||
nsIPresShell *presShell = doc->GetShellAt(0);
|
||||
if (presShell) {
|
||||
presShell->GetPresContext(outContext);
|
||||
NS_IF_ADDREF(*outContext = presShell->GetPresContext());
|
||||
presShell->GetPrimaryFrameFor(contentNode, outFrame);
|
||||
NS_ASSERTION ( *outFrame, "Can't get frame for this dom node" );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user