Make nsIPresShell::GetPrimaryFrameFor return nsIFrame* instead of using an out
param. Bug 303779, patch by Bastiaan Jacques <b.jacques@planet.nl>, r+sr=bzbarsky
This commit is contained in:
Родитель
565f5f1764
Коммит
692c9e00f2
|
@ -69,9 +69,8 @@ nsAccessibleHyperText::nsAccessibleHyperText(nsIDOMNode* aDomNode, nsIWeakRefere
|
|||
if (shell) {
|
||||
NS_NewArray(getter_AddRefs(mTextChildren));
|
||||
if (mTextChildren) {
|
||||
nsIFrame *frame = nsnull;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aDomNode));
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
nsIFrame *frame = shell->GetPrimaryFrameFor(content);
|
||||
nsIFrame *parentFrame = nsAccessible::GetParentBlockFrame(frame);
|
||||
NS_ASSERTION(parentFrame, "Error: HyperText can't get parent block frame");
|
||||
if (parentFrame) {
|
||||
|
|
|
@ -98,8 +98,7 @@ nsresult nsAccessibleText::GetSelections(nsISelectionController **aSelCon, nsISe
|
|||
NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mTextNode));
|
||||
nsIFrame *frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
nsIFrame *frame = shell->GetPrimaryFrameFor(content);
|
||||
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
|
||||
|
||||
// Get the selection and selection controller
|
||||
|
@ -709,8 +708,7 @@ NS_IMETHODIMP nsAccessibleText::GetCharacterExtents(PRInt32 aOffset,
|
|||
nsCOMPtr<nsIContent> content(do_QueryInterface(mTextNode));
|
||||
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
|
||||
|
||||
nsIFrame *frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
nsIFrame *frame = shell->GetPrimaryFrameFor(content);
|
||||
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
|
||||
|
||||
nsIntRect frameScreenRect = frame->GetScreenRectExternal();
|
||||
|
@ -993,8 +991,7 @@ nsITextControlFrame* nsAccessibleEditableText::GetTextFrame()
|
|||
NS_ENSURE_TRUE(shell, nsnull);
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mTextNode));
|
||||
nsIFrame *frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
nsIFrame *frame = shell->GetPrimaryFrameFor(content);
|
||||
NS_ENSURE_TRUE(frame, nsnull);
|
||||
|
||||
nsITextControlFrame *textFrame;
|
||||
|
|
|
@ -118,9 +118,8 @@ nsXULTextFieldAccessible(aNode, aShell), nsAccessibleEditableText(aNode)
|
|||
if (!shell)
|
||||
return;
|
||||
|
||||
nsIFrame* frame = nsnull;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mTextNode));
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
nsIFrame* frame = shell->GetPrimaryFrameFor(content);
|
||||
|
||||
if (!frame)
|
||||
return;
|
||||
|
|
|
@ -254,10 +254,9 @@ nsIFrame* nsAccessNode::GetFrame()
|
|||
if (!shell)
|
||||
return nsnull;
|
||||
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
while (content) {
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
nsIFrame* frame = shell->GetPrimaryFrameFor(content);
|
||||
if (frame) {
|
||||
return frame;
|
||||
}
|
||||
|
|
|
@ -1830,7 +1830,7 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
|
|||
#endif
|
||||
if (!frame || content != frame->GetContent()) {
|
||||
// Frame hint not correct, get true frame, we try to optimize away from this
|
||||
aPresShell->GetPrimaryFrameFor(content, &frame);
|
||||
frame = aPresShell->GetPrimaryFrameFor(content);
|
||||
if (frame) {
|
||||
#ifdef DEBUG_aleventhal_
|
||||
// Frame hint debugging
|
||||
|
|
|
@ -162,8 +162,7 @@ nsAccessible::nsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell): nsAcces
|
|||
printf(">>> %p Created Acc - Con: %p Acc: %p PS: %p",
|
||||
(nsIAccessible*)this, aContent, aAccessible, shell.get());
|
||||
if (shell && aContent != nsnull) {
|
||||
nsIFrame* frame;
|
||||
shell->GetPrimaryFrameFor(aContent, &frame);
|
||||
nsIFrame* frame = shell->GetPrimaryFrameFor(aContent);
|
||||
char * name;
|
||||
if (GetNameForFrame(frame, &name)) {
|
||||
printf(" Name:[%s]", name);
|
||||
|
@ -1253,8 +1252,7 @@ nsresult nsAccessible::AppendFlatStringFromContentNode(nsIContent *aContent, nsA
|
|||
nsIContent *parentContent = aContent->GetParent();
|
||||
nsCOMPtr<nsIContent> appendedSubtreeStart(do_QueryInterface(mDOMNode));
|
||||
if (parentContent && parentContent != appendedSubtreeStart) {
|
||||
nsIFrame *frame;
|
||||
shell->GetPrimaryFrameFor(parentContent, &frame);
|
||||
nsIFrame *frame = shell->GetPrimaryFrameFor(parentContent);
|
||||
if (frame) {
|
||||
// If this text is inside a block level frame (as opposed to span level), we need to add spaces around that
|
||||
// block's text, so we don't get words jammed together in final name
|
||||
|
@ -2404,8 +2402,7 @@ nsresult nsAccessible::GetParentBlockNode(nsIPresShell *aPresShell, nsIDOMNode *
|
|||
if (! content)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsIFrame *frame = nsnull;
|
||||
aPresShell->GetPrimaryFrameFor(content, &frame);
|
||||
nsIFrame *frame = aPresShell->GetPrimaryFrameFor(content);
|
||||
if (! frame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
|
|
@ -103,8 +103,7 @@ NS_IMETHODIMP nsCaretAccessible::AttachNewSelectionListener(nsIDOMNode *aCurrent
|
|||
if (!content)
|
||||
content = doc->GetRootContent(); // If node is not content, use root content
|
||||
|
||||
nsIFrame *frame = nsnull;
|
||||
presShell->GetPrimaryFrameFor(content, &frame);
|
||||
nsIFrame *frame = presShell->GetPrimaryFrameFor(content);
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
if (!frame || !presContext)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -525,9 +525,7 @@ nsIFrame* nsHTMLSelectOptionAccessible::GetBoundsFrame()
|
|||
if (!presShell) {
|
||||
return nsnull;
|
||||
}
|
||||
nsIFrame *selectFrame = nsnull;
|
||||
presShell->GetPrimaryFrameFor(selectContent, &selectFrame);
|
||||
return selectFrame;
|
||||
return presShell->GetPrimaryFrameFor(selectContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -633,8 +631,7 @@ NS_IMETHODIMP nsHTMLSelectOptionAccessible::DoAction(PRUint8 index)
|
|||
if (!testSelectNode || !selectContent || !presShell || !option)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsIFrame *selectFrame = nsnull;
|
||||
presShell->GetPrimaryFrameFor(selectContent, &selectFrame);
|
||||
nsIFrame *selectFrame = presShell->GetPrimaryFrameFor(selectContent);
|
||||
nsIComboboxControlFrame *comboBoxFrame = nsnull;
|
||||
CallQueryInterface(selectFrame, &comboBoxFrame);
|
||||
if (comboBoxFrame) {
|
||||
|
@ -678,8 +675,7 @@ nsresult nsHTMLSelectOptionAccessible::GetFocusedOptionNode(nsIDOMNode *aListNod
|
|||
if (!shell)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsIFrame *frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
nsIFrame *frame = shell->GetPrimaryFrameFor(content);
|
||||
if (!frame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -1329,9 +1325,8 @@ void nsHTMLComboboxListAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** aBo
|
|||
return;
|
||||
}
|
||||
|
||||
nsIFrame* frame = nsnull;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(child));
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
nsIFrame* frame = shell->GetPrimaryFrameFor(content);
|
||||
if (!frame) {
|
||||
*aBoundingFrame = nsnull;
|
||||
return;
|
||||
|
|
|
@ -234,9 +234,8 @@ nsresult nsTextAccessibleWrap::GetCharacterExtents(PRInt32 aStartOffset, PRInt32
|
|||
NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE);
|
||||
float t2p = presContext->TwipsToPixels();
|
||||
|
||||
nsIFrame *frame = nsnull;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
presShell->GetPrimaryFrameFor(content, &frame);
|
||||
nsIFrame *frame = presShell->GetPrimaryFrameFor(content);
|
||||
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
|
||||
|
||||
nsIViewManager* viewManager = presShell->GetViewManager();
|
||||
|
|
|
@ -342,9 +342,7 @@ nsIFrame* nsXULSelectOptionAccessible::GetBoundsFrame()
|
|||
if (!presShell) {
|
||||
return nsnull;
|
||||
}
|
||||
nsIFrame *menuListFrame = nsnull;
|
||||
presShell->GetPrimaryFrameFor(menuListContent, &menuListFrame);
|
||||
return menuListFrame;
|
||||
return presShell->GetPrimaryFrameFor(menuListContent);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -108,8 +108,7 @@ NS_IMETHODIMP nsXULTabAccessible::GetState(PRUint32 *_retval)
|
|||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mWeakShell));
|
||||
if (presShell && content) {
|
||||
nsIFrame *frame = nsnull;
|
||||
presShell->GetPrimaryFrameFor(content, &frame);
|
||||
nsIFrame *frame = presShell->GetPrimaryFrameFor(content);
|
||||
if (frame) {
|
||||
const nsStyleUserInterface* ui = frame->GetStyleUserInterface();
|
||||
if (ui->mUserFocus == NS_STYLE_USER_FOCUS_NORMAL)
|
||||
|
|
|
@ -2548,9 +2548,8 @@ nsGenericElement::SetFocus(nsPresContext* aPresContext)
|
|||
// Traditionally focusable elements can take focus as long as they don't set
|
||||
// the disabled attribute
|
||||
|
||||
nsIFrame* frame = nsnull;
|
||||
nsIPresShell *presShell = aPresContext->PresShell();
|
||||
presShell->GetPrimaryFrameFor(this, &frame);
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(this);
|
||||
if (frame && frame->IsFocusable()) {
|
||||
aPresContext->EventStateManager()->SetContentState(this,
|
||||
NS_EVENT_STATE_FOCUS);
|
||||
|
|
|
@ -509,8 +509,7 @@ nsImageLoadingContent::ImageURIChanged(const nsAString& aNewURI,
|
|||
for (PRInt32 i = 0; i < numShells; ++i) {
|
||||
nsIPresShell *shell = doc->GetShellAt(i);
|
||||
if (shell) {
|
||||
nsIFrame* frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(thisContent, &frame);
|
||||
nsIFrame* frame = shell->GetPrimaryFrameFor(thisContent);
|
||||
if (frame) {
|
||||
// XXXbz I don't like this one bit... we really need a better way of
|
||||
// doing the CantRenderReplacedElement stuff.. In particular, it needs
|
||||
|
|
|
@ -2176,8 +2176,7 @@ nsEventListenerManager::GetCoordinatesFor(nsIDOMElement *aCurrentEl,
|
|||
nsPoint& aTargetPt)
|
||||
{
|
||||
nsCOMPtr<nsIContent> focusedContent(do_QueryInterface(aCurrentEl));
|
||||
nsIFrame *frame = nsnull;
|
||||
aPresShell->GetPrimaryFrameFor(focusedContent, &frame);
|
||||
nsIFrame *frame = aPresShell->GetPrimaryFrameFor(focusedContent);
|
||||
if (frame) {
|
||||
aPresShell->ScrollFrameIntoView(frame, NS_PRESSHELL_SCROLL_ANYWHERE,
|
||||
NS_PRESSHELL_SCROLL_ANYWHERE);
|
||||
|
@ -2253,7 +2252,7 @@ nsEventListenerManager::GetCoordinatesFor(nsIDOMElement *aCurrentEl,
|
|||
col->GetElement(getter_AddRefs(colElement));
|
||||
nsCOMPtr<nsIContent> colContent(do_QueryInterface(colElement));
|
||||
if (colContent) {
|
||||
aPresShell->GetPrimaryFrameFor(colContent, &frame);
|
||||
frame = aPresShell->GetPrimaryFrameFor(colContent);
|
||||
if (frame) {
|
||||
frameOrigin.y += frame->GetSize().height;
|
||||
}
|
||||
|
|
|
@ -1015,8 +1015,7 @@ nsEventStateManager::HandleAccessKey(nsPresContext* aPresContext,
|
|||
if (!content)
|
||||
return;
|
||||
|
||||
nsIFrame* frame = nsnull;
|
||||
aPresContext->PresShell()->GetPrimaryFrameFor(content, &frame);
|
||||
nsIFrame* frame = aPresContext->PresShell()->GetPrimaryFrameFor(content);
|
||||
|
||||
if (frame) {
|
||||
const nsStyleVisibility* vis = frame->GetStyleVisibility();
|
||||
|
@ -1271,8 +1270,7 @@ nsEventStateManager::FireContextClick()
|
|||
// event and it will get reset on the very next event to the correct frame).
|
||||
mCurrentTarget = nsnull;
|
||||
if ( mGestureDownContent ) {
|
||||
mPresContext->GetPresShell()->GetPrimaryFrameFor(mGestureDownFrameOwner,
|
||||
&mCurrentTarget);
|
||||
mCurrentTarget = mPresContext->GetPresShell()->GetPrimaryFrameFor(mGestureDownFrameOwner);
|
||||
|
||||
if ( mCurrentTarget ) {
|
||||
SetFrameExternalReference(mCurrentTarget);
|
||||
|
@ -1526,8 +1524,8 @@ nsEventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
|
|||
{
|
||||
NS_WARN_IF_FALSE(aPresContext, "This shouldn't happen.");
|
||||
if ( IsTrackingDragGesture() ) {
|
||||
aPresContext->GetPresShell()->GetPrimaryFrameFor(mGestureDownFrameOwner,
|
||||
&mCurrentTarget);
|
||||
mCurrentTarget = aPresContext->GetPresShell()->GetPrimaryFrameFor(mGestureDownFrameOwner);
|
||||
|
||||
if (!mCurrentTarget) {
|
||||
StopTrackingDragGesture();
|
||||
return;
|
||||
|
@ -1751,7 +1749,7 @@ nsEventStateManager::DoScrollText(nsPresContext* aPresContext,
|
|||
return NS_OK;
|
||||
// Re-resolve |aTargetFrame| in case it was destroyed by the
|
||||
// DOM event handler above, bug 257998.
|
||||
aPresContext->GetPresShell()->GetPrimaryFrameFor(targetContent, &aTargetFrame);
|
||||
aTargetFrame = aPresContext->GetPresShell()->GetPrimaryFrameFor(targetContent);
|
||||
if (!aTargetFrame) {
|
||||
// Without a frame we can't do the normal ancestor search for a view to scroll.
|
||||
// Don't fall through to the "passToParent" code at the end because that will
|
||||
|
@ -1886,8 +1884,7 @@ nsEventStateManager::GetParentScrollingView(nsInputEvent *aEvent,
|
|||
because they are not used by DoScrollText().
|
||||
*/
|
||||
|
||||
nsIFrame* frameFrame = nsnull;
|
||||
pPresShell->GetPrimaryFrameFor(frameContent, &frameFrame);
|
||||
nsIFrame* frameFrame = pPresShell->GetPrimaryFrameFor(frameContent);
|
||||
if (!frameFrame) return NS_ERROR_FAILURE;
|
||||
|
||||
NS_IF_ADDREF(presCtxOuter = pPresShell->GetPresContext());
|
||||
|
@ -2628,7 +2625,7 @@ nsEventStateManager::DispatchMouseEvent(nsGUIEvent* aEvent, PRUint32 aMessage,
|
|||
|
||||
nsIPresShell *shell = mPresContext->GetPresShell();
|
||||
if (shell) {
|
||||
shell->GetPrimaryFrameFor(aTargetContent, &targetFrame);
|
||||
targetFrame = shell->GetPrimaryFrameFor(aTargetContent);
|
||||
}
|
||||
}
|
||||
if (targetFrame) {
|
||||
|
@ -3254,7 +3251,7 @@ nsEventStateManager::ShiftFocusInternal(PRBool aForward, nsIContent* aStart)
|
|||
nsIContent *startContent = nsnull;
|
||||
|
||||
if (aStart) {
|
||||
presShell->GetPrimaryFrameFor(aStart, &curFocusFrame);
|
||||
curFocusFrame = presShell->GetPrimaryFrameFor(aStart);
|
||||
|
||||
// If there is no frame, we can't navigate from this content node, and we
|
||||
// fall back to navigating from the document root.
|
||||
|
@ -3505,7 +3502,7 @@ nsEventStateManager::GetNextTabbableContent(nsIContent* aRootContent,
|
|||
NS_ENSURE_TRUE(mPresContext, NS_ERROR_FAILURE);
|
||||
nsIPresShell *presShell = mPresContext->GetPresShell();
|
||||
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
|
||||
presShell->GetPrimaryFrameFor(aRootContent, &aStartFrame);
|
||||
aStartFrame = presShell->GetPrimaryFrameFor(aRootContent);
|
||||
NS_ENSURE_TRUE(aStartFrame, NS_ERROR_FAILURE);
|
||||
rv = trav->NewFrameTraversal(getter_AddRefs(frameTraversal), FOCUS,
|
||||
mPresContext, aStartFrame);
|
||||
|
@ -3671,7 +3668,7 @@ nsEventStateManager::GetEventTarget(nsIFrame **aFrame)
|
|||
if (mPresContext) {
|
||||
nsIPresShell *shell = mPresContext->GetPresShell();
|
||||
if (shell) {
|
||||
shell->GetPrimaryFrameFor(mCurrentTargetContent, &mCurrentTarget);
|
||||
mCurrentTarget = shell->GetPrimaryFrameFor(mCurrentTargetContent);
|
||||
|
||||
//This may be new frame that hasn't been through the ESM so we
|
||||
//must set its NS_FRAME_EXTERNAL_REFERENCE bit.
|
||||
|
@ -4185,8 +4182,7 @@ nsEventStateManager::SendFocusBlur(nsPresContext* aPresContext,
|
|||
|
||||
if (aContent) {
|
||||
// Check if the HandleDOMEvent calls above destroyed our frame (bug #118685)
|
||||
nsIFrame* frame = nsnull;
|
||||
presShell->GetPrimaryFrameFor(aContent, &frame);
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(aContent);
|
||||
if (!frame) {
|
||||
aContent = nsnull;
|
||||
}
|
||||
|
@ -4321,7 +4317,7 @@ nsEventStateManager::GetFocusedFrame(nsIFrame** aFrame)
|
|||
if (doc) {
|
||||
nsIPresShell *shell = doc->GetShellAt(0);
|
||||
if (shell) {
|
||||
shell->GetPrimaryFrameFor(mCurrentFocus, &mCurrentFocusFrame);
|
||||
mCurrentFocusFrame = shell->GetPrimaryFrameFor(mCurrentFocus);
|
||||
if (mCurrentFocusFrame)
|
||||
SetFrameExternalReference(mCurrentFocusFrame);
|
||||
}
|
||||
|
@ -4637,8 +4633,8 @@ nsEventStateManager::GetDocSelectionLocation(nsIContent **aStartContent,
|
|||
|
||||
nsIFrame *startFrame = nsnull;
|
||||
if (startContent) {
|
||||
rv = shell->GetPrimaryFrameFor(startContent, &startFrame);
|
||||
if (isCollapsed && NS_SUCCEEDED(rv)) {
|
||||
startFrame = shell->GetPrimaryFrameFor(startContent);
|
||||
if (isCollapsed) {
|
||||
// First check to see if we're in a <label>
|
||||
// We don't want to return the selection in a label, because
|
||||
// we we should be tabbing relative to what the label
|
||||
|
@ -5007,8 +5003,7 @@ nsEventStateManager::SetContentCaretVisible(nsIPresShell* aPresShell,
|
|||
|
||||
nsCOMPtr<nsIFrameSelection> frameSelection;
|
||||
if (aFocusedContent) {
|
||||
nsIFrame *focusFrame = nsnull;
|
||||
aPresShell->GetPrimaryFrameFor(aFocusedContent, &focusFrame);
|
||||
nsIFrame *focusFrame = aPresShell->GetPrimaryFrameFor(aFocusedContent);
|
||||
|
||||
GetSelection(focusFrame, mPresContext, getter_AddRefs(frameSelection));
|
||||
}
|
||||
|
|
|
@ -562,8 +562,7 @@ nsGenericHTMLElement::RecreateFrames()
|
|||
for (PRInt32 i = 0; i < numShells; ++i) {
|
||||
nsIPresShell *shell = document->GetShellAt(i);
|
||||
if (shell) {
|
||||
nsIFrame* frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(this, &frame);
|
||||
nsIFrame* frame = shell->GetPrimaryFrameFor(this);
|
||||
if (frame) {
|
||||
shell->RecreateFramesFor(this);
|
||||
}
|
||||
|
@ -623,8 +622,7 @@ nsGenericHTMLElement::GetOffsetRect(nsRect& aRect, nsIContent** aOffsetParent)
|
|||
}
|
||||
|
||||
// Get the Frame for our content
|
||||
nsIFrame* frame = nsnull;
|
||||
presShell->GetPrimaryFrameFor(this, &frame);
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(this);
|
||||
|
||||
if (!frame) {
|
||||
return;
|
||||
|
@ -1004,8 +1002,7 @@ nsGenericHTMLElement::GetScrollInfo(nsIScrollableView **aScrollableView,
|
|||
}
|
||||
|
||||
// Get the primary frame for this element
|
||||
nsIFrame *frame = nsnull;
|
||||
presShell->GetPrimaryFrameFor(this, &frame);
|
||||
nsIFrame *frame = presShell->GetPrimaryFrameFor(this);
|
||||
if (!frame) {
|
||||
return;
|
||||
}
|
||||
|
@ -1295,8 +1292,7 @@ nsGenericHTMLElement::ScrollIntoView(PRBool aTop)
|
|||
}
|
||||
|
||||
// Get the primary frame for this element
|
||||
nsIFrame *frame = nsnull;
|
||||
presShell->GetPrimaryFrameFor(this, &frame);
|
||||
nsIFrame *frame = presShell->GetPrimaryFrameFor(this);
|
||||
if (!frame) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2256,14 +2252,10 @@ nsGenericHTMLElement::GetPrimaryFrameFor(nsIContent* aContent,
|
|||
|
||||
// Get presentation shell 0
|
||||
nsIPresShell *presShell = aDocument->GetShellAt(0);
|
||||
if (!presShell)
|
||||
return nsnull;
|
||||
|
||||
nsIFrame *frame = nsnull;
|
||||
|
||||
if (presShell) {
|
||||
presShell->GetPrimaryFrameFor(aContent, &frame);
|
||||
}
|
||||
|
||||
return frame;
|
||||
return presShell->GetPrimaryFrameFor(aContent);
|
||||
}
|
||||
|
||||
// static
|
||||
|
|
|
@ -244,8 +244,7 @@ nsHTMLAnchorElement::SetFocus(nsPresContext* aPresContext)
|
|||
nsIPresShell *presShell = aPresContext->GetPresShell();
|
||||
|
||||
if (presShell) {
|
||||
nsIFrame* frame = nsnull;
|
||||
presShell->GetPrimaryFrameFor(this, &frame);
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(this);
|
||||
if (frame) {
|
||||
presShell->ScrollFrameIntoView(frame, NS_PRESSHELL_SCROLL_ANYWHERE,
|
||||
NS_PRESSHELL_SCROLL_ANYWHERE);
|
||||
|
|
|
@ -197,8 +197,7 @@ nsHTMLAreaElement::SetFocus(nsPresContext* aPresContext)
|
|||
nsIPresShell *presShell = aPresContext->GetPresShell();
|
||||
|
||||
if (presShell) {
|
||||
nsIFrame* frame = nsnull;
|
||||
presShell->GetPrimaryFrameFor(this, &frame);
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(this);
|
||||
if (frame) {
|
||||
presShell->ScrollFrameIntoView(frame, NS_PRESSHELL_SCROLL_ANYWHERE,
|
||||
NS_PRESSHELL_SCROLL_ANYWHERE);
|
||||
|
|
|
@ -276,8 +276,7 @@ nsHTMLImageElement::GetXY()
|
|||
document->FlushPendingNotifications(Flush_Layout);
|
||||
|
||||
// Get the Frame for this image
|
||||
nsIFrame* frame = nsnull;
|
||||
presShell->GetPrimaryFrameFor(this, &frame);
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(this);
|
||||
|
||||
if (!frame) {
|
||||
return point;
|
||||
|
|
|
@ -2486,9 +2486,8 @@ nsHTMLDocument::GetPixelDimensions(nsIPresShell* aShell,
|
|||
nsCOMPtr<nsIContent> body = do_QueryInterface(mBodyContent);
|
||||
|
||||
// Now grab its frame
|
||||
nsIFrame* frame;
|
||||
nsresult rv = aShell->GetPrimaryFrameFor(body, &frame);
|
||||
if (NS_SUCCEEDED(rv) && frame) {
|
||||
nsIFrame* frame = aShell->GetPrimaryFrameFor(body);
|
||||
if (frame) {
|
||||
nsSize size;
|
||||
nsIView* view = frame->GetView();
|
||||
|
||||
|
|
|
@ -240,8 +240,8 @@ nsPluginDocument::Print()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIFrame* frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(mPluginContent, &frame);
|
||||
nsIFrame* frame = shell->GetPrimaryFrameFor(mPluginContent);
|
||||
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
|
||||
|
||||
nsIObjectFrame* objectFrame = nsnull;
|
||||
CallQueryInterface(frame, &objectFrame);
|
||||
|
|
|
@ -120,8 +120,8 @@ NS_IMETHODIMP nsSVGGraphicElement::GetBBox(nsIDOMSVGRect **_retval)
|
|||
NS_ASSERTION(presShell, "no presShell");
|
||||
if (!presShell) return NS_ERROR_FAILURE;
|
||||
|
||||
nsIFrame* frame;
|
||||
presShell->GetPrimaryFrameFor(NS_STATIC_CAST(nsIStyledContent*, this), &frame);
|
||||
nsIFrame* frame =
|
||||
presShell->GetPrimaryFrameFor(NS_STATIC_CAST(nsIStyledContent*, this));
|
||||
|
||||
NS_ASSERTION(frame, "can't get bounding box for element without frame");
|
||||
|
||||
|
|
|
@ -508,8 +508,8 @@ nsSVGSVGElement::SuspendRedraw(PRUint32 max_wait_milliseconds, PRUint32 *_retval
|
|||
NS_ASSERTION(presShell, "need presShell to suspend redraw");
|
||||
if (!presShell) return NS_ERROR_FAILURE;
|
||||
|
||||
nsIFrame* frame;
|
||||
presShell->GetPrimaryFrameFor(NS_STATIC_CAST(nsIStyledContent*, this), &frame);
|
||||
nsIFrame* frame =
|
||||
presShell->GetPrimaryFrameFor(NS_STATIC_CAST(nsIStyledContent*, this));
|
||||
#ifdef DEBUG
|
||||
// XXX We sometimes hit this assertion when the svg:svg element is
|
||||
// in a binding and svg children are inserted underneath it using
|
||||
|
@ -560,8 +560,8 @@ nsSVGSVGElement::UnsuspendRedrawAll()
|
|||
NS_ASSERTION(presShell, "need presShell to unsuspend redraw");
|
||||
if (!presShell) return NS_ERROR_FAILURE;
|
||||
|
||||
nsIFrame* frame;
|
||||
presShell->GetPrimaryFrameFor(NS_STATIC_CAST(nsIStyledContent*, this), &frame);
|
||||
nsIFrame* frame =
|
||||
presShell->GetPrimaryFrameFor(NS_STATIC_CAST(nsIStyledContent*, this));
|
||||
#ifdef DEBUG
|
||||
NS_ASSERTION(frame, "unsuspending redraw w/o frame");
|
||||
#endif
|
||||
|
@ -952,8 +952,8 @@ nsSVGSVGElement::GetBBox(nsIDOMSVGRect **_retval)
|
|||
NS_ASSERTION(presShell, "no presShell");
|
||||
if (!presShell) return NS_ERROR_FAILURE;
|
||||
|
||||
nsIFrame* frame;
|
||||
presShell->GetPrimaryFrameFor(NS_STATIC_CAST(nsIStyledContent*, this), &frame);
|
||||
nsIFrame* frame =
|
||||
presShell->GetPrimaryFrameFor(NS_STATIC_CAST(nsIStyledContent*, this));
|
||||
|
||||
NS_ASSERTION(frame, "can't get bounding box for element without frame");
|
||||
|
||||
|
@ -1287,8 +1287,8 @@ nsSVGSVGElement::DidModifySVGObservable (nsISVGValue* observable,
|
|||
NS_ASSERTION(presShell, "no presShell");
|
||||
if (!presShell) return NS_ERROR_FAILURE;
|
||||
|
||||
nsIFrame* frame;
|
||||
presShell->GetPrimaryFrameFor(NS_STATIC_CAST(nsIStyledContent*, this), &frame);
|
||||
nsIFrame* frame =
|
||||
presShell->GetPrimaryFrameFor(NS_STATIC_CAST(nsIStyledContent*, this));
|
||||
if (frame) {
|
||||
nsISVGSVGFrame* svgframe;
|
||||
CallQueryInterface(frame, &svgframe);
|
||||
|
@ -1341,8 +1341,7 @@ void nsSVGSVGElement::GetScreenPosition(PRInt32 &x, PRInt32 &y)
|
|||
return;
|
||||
}
|
||||
|
||||
nsIFrame* frame;
|
||||
presShell->GetPrimaryFrameFor(this, &frame);
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(this);
|
||||
|
||||
if (frame) {
|
||||
nsIntRect rect = frame->GetScreenRect();
|
||||
|
|
|
@ -427,8 +427,8 @@ nsSVGTextElement::GetTextContentMetrics()
|
|||
return nsnull;
|
||||
}
|
||||
|
||||
nsIFrame* frame;
|
||||
presShell->GetPrimaryFrameFor(NS_STATIC_CAST(nsIStyledContent*, this), &frame);
|
||||
nsIFrame* frame =
|
||||
presShell->GetPrimaryFrameFor(NS_STATIC_CAST(nsIStyledContent*, this));
|
||||
|
||||
if (!frame) {
|
||||
NS_ERROR("no frame");
|
||||
|
|
|
@ -255,8 +255,7 @@ nsXBLResourceLoader::NotifyBoundElements()
|
|||
// will happen.
|
||||
nsIPresShell *shell = doc->GetShellAt(0);
|
||||
if (shell) {
|
||||
nsIFrame* childFrame;
|
||||
shell->GetPrimaryFrameFor(content, &childFrame);
|
||||
nsIFrame* childFrame = shell->GetPrimaryFrameFor(content);
|
||||
if (!childFrame) {
|
||||
// Check to see if it's in the undisplayed content map.
|
||||
nsStyleContext* sc =
|
||||
|
|
|
@ -164,8 +164,7 @@ public:
|
|||
// will happen.
|
||||
nsIPresShell *shell = doc->GetShellAt(0);
|
||||
if (shell) {
|
||||
nsIFrame* childFrame;
|
||||
shell->GetPrimaryFrameFor(mBoundElement, &childFrame);
|
||||
nsIFrame* childFrame = shell->GetPrimaryFrameFor(mBoundElement);
|
||||
if (!childFrame) {
|
||||
// Check to see if it's in the undisplayed content map.
|
||||
nsStyleContext* sc =
|
||||
|
|
|
@ -2980,8 +2980,7 @@ nsXULElement::HideWindowChrome(PRBool aShouldHide)
|
|||
|
||||
if (shell) {
|
||||
nsIContent* content = NS_STATIC_CAST(nsIContent*, this);
|
||||
nsIFrame* frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
nsIFrame* frame = shell->GetPrimaryFrameFor(content);
|
||||
|
||||
nsPresContext *presContext = shell->GetPresContext();
|
||||
|
||||
|
|
|
@ -340,8 +340,7 @@ XULPopupListenerImpl::FireFocusOnTargetContent(nsIDOMNode* aTargetNode)
|
|||
nsCOMPtr<nsPresContext> context = shell->GetPresContext();
|
||||
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aTargetNode);
|
||||
nsIFrame* targetFrame;
|
||||
shell->GetPrimaryFrameFor(content, &targetFrame);
|
||||
nsIFrame* targetFrame = shell->GetPrimaryFrameFor(content);
|
||||
if (!targetFrame) return NS_ERROR_FAILURE;
|
||||
|
||||
PRBool suppressBlur = PR_FALSE;
|
||||
|
|
|
@ -1591,12 +1591,11 @@ nsXULDocument::GetPixelDimensions(nsIPresShell* aShell, PRInt32* aWidth,
|
|||
{
|
||||
nsresult result = NS_OK;
|
||||
nsSize size;
|
||||
nsIFrame* frame;
|
||||
|
||||
FlushPendingNotifications(Flush_Layout);
|
||||
|
||||
result = aShell->GetPrimaryFrameFor(mRootContent, &frame);
|
||||
if (NS_SUCCEEDED(result) && frame) {
|
||||
nsIFrame* frame = aShell->GetPrimaryFrameFor(mRootContent);
|
||||
if (frame) {
|
||||
nsIView* view = frame->GetView();
|
||||
// If we have a view check if it's scrollable. If not,
|
||||
// just use the view size itself
|
||||
|
@ -1625,6 +1624,7 @@ nsXULDocument::GetPixelDimensions(nsIPresShell* aShell, PRInt32* aWidth,
|
|||
else {
|
||||
*aWidth = 0;
|
||||
*aHeight = 0;
|
||||
result = NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -3629,8 +3629,7 @@ nsDocShell::GetVisibility(PRBool * aVisibility)
|
|||
pPresShell->GetDocument()->FindContentForSubDocument(presShell->GetDocument());
|
||||
NS_ASSERTION(shellContent, "subshell not in the map");
|
||||
|
||||
nsIFrame* frame;
|
||||
pPresShell->GetPrimaryFrameFor(shellContent, &frame);
|
||||
nsIFrame* frame = pPresShell->GetPrimaryFrameFor(shellContent);
|
||||
if (frame && !frame->AreAncestorViewsVisible()) {
|
||||
*aVisibility = PR_FALSE;
|
||||
return NS_OK;
|
||||
|
@ -8138,8 +8137,7 @@ nsDocShell::SetCanvasHasFocus(PRBool aCanvasHasFocus)
|
|||
nsIContent *rootContent = doc->GetRootContent();
|
||||
if (!rootContent) return NS_ERROR_FAILURE;
|
||||
|
||||
nsIFrame* frame;
|
||||
presShell->GetPrimaryFrameFor(rootContent, &frame);
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(rootContent);
|
||||
if (frame) {
|
||||
frame = frame->GetParent();
|
||||
if (frame) {
|
||||
|
|
|
@ -6318,8 +6318,7 @@ nsElementSH::PostCreate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIFrame* frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
nsIFrame* frame = shell->GetPrimaryFrameFor(content);
|
||||
|
||||
if (frame) {
|
||||
// If we have a frame the frame has already loaded the binding.
|
||||
|
@ -7975,8 +7974,7 @@ nsHTMLExternalObjSH::GetPluginInstance(nsIXPConnectWrappedNative *wrapper,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIFrame* frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
nsIFrame* frame = shell->GetPrimaryFrameFor(content);
|
||||
|
||||
if (!frame) {
|
||||
// No frame, no plugin
|
||||
|
|
|
@ -2155,12 +2155,8 @@ GetEditorContentWindow(nsIPresShell *aPresShell, nsIDOMElement *aRoot, nsIWidget
|
|||
if (!content)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsIFrame *frame = 0; // Not ref counted
|
||||
|
||||
result = aPresShell->GetPrimaryFrameFor(content, &frame);
|
||||
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
// Not ref counted
|
||||
nsIFrame *frame = aPresShell->GetPrimaryFrameFor(content);
|
||||
|
||||
if (!frame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -3935,9 +3931,8 @@ nsEditor::IsEditable(nsIDOMNode *aNode)
|
|||
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
|
||||
if (content)
|
||||
{
|
||||
nsIFrame *resultFrame;
|
||||
nsresult result = shell->GetPrimaryFrameFor(content, &resultFrame);
|
||||
if (NS_FAILED(result) || !resultFrame) // if it has no frame, it is not editable
|
||||
nsIFrame *resultFrame = shell->GetPrimaryFrameFor(content);
|
||||
if (!resultFrame) // if it has no frame, it is not editable
|
||||
return PR_FALSE;
|
||||
nsCOMPtr<nsITextContent> text(do_QueryInterface(content));
|
||||
if (!text)
|
||||
|
@ -4278,9 +4273,7 @@ nsEditor::IsPreformatted(nsIDOMNode *aNode, PRBool *aResult)
|
|||
nsCOMPtr<nsIPresShell> ps = do_QueryReferent(mPresShellWeak);
|
||||
if (!ps) return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
nsIFrame *frame;
|
||||
nsresult result = ps->GetPrimaryFrameFor(content, &frame);
|
||||
if (NS_FAILED(result)) return result;
|
||||
nsIFrame *frame = ps->GetPrimaryFrameFor(content);
|
||||
|
||||
NS_ASSERTION(frame, "no frame, see bug #188946");
|
||||
if (!frame)
|
||||
|
@ -5489,10 +5482,9 @@ nsEditor::SwitchTextDirection()
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsIFrame *frame = nsnull;
|
||||
presShell->GetPrimaryFrameFor(content, &frame);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
nsIFrame *frame = presShell->GetPrimaryFrameFor(content);
|
||||
if (!frame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Apply the opposite direction
|
||||
if (frame->GetStyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL)
|
||||
|
|
|
@ -5832,12 +5832,11 @@ nsHTMLEditor::GetElementOrigin(nsIDOMElement * aElement, PRInt32 & aX, PRInt32 &
|
|||
if (!ps) return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
|
||||
nsIFrame *frame = 0; // not ref-counted
|
||||
ps->GetPrimaryFrameFor(content, &frame);
|
||||
nsIFrame *frame = ps->GetPrimaryFrameFor(content); // not ref-counted
|
||||
|
||||
float t2p = ps->GetPresContext()->TwipsToPixels();
|
||||
|
||||
if (nsHTMLEditUtils::IsHR(aElement)) {
|
||||
if (nsHTMLEditUtils::IsHR(aElement) && frame) {
|
||||
frame = frame->GetNextSibling();
|
||||
}
|
||||
PRInt32 offsetX = 0, offsetY = 0;
|
||||
|
|
|
@ -71,10 +71,7 @@ nsTextEditRules::CheckBidiLevelForDeletion(nsIDOMNode *aSelNode,
|
|||
if (!content)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsIFrame *primaryFrame;
|
||||
res = shell->GetPrimaryFrameFor(content, &primaryFrame);
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
nsIFrame *primaryFrame = shell->GetPrimaryFrameFor(content);
|
||||
if (!primaryFrame)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
|
|
|
@ -355,8 +355,7 @@ nsFindContentIterator::SetupInnerIterator(nsIContent* aContent)
|
|||
if (!shell)
|
||||
return;
|
||||
|
||||
nsIFrame* frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(aContent, &frame);
|
||||
nsIFrame* frame = shell->GetPrimaryFrameFor(aContent);
|
||||
if (!frame)
|
||||
return;
|
||||
|
||||
|
@ -830,8 +829,7 @@ PRBool nsFind::IsVisibleNode(nsIDOMNode *aDOMNode)
|
|||
if (!presShell)
|
||||
return PR_FALSE;
|
||||
|
||||
nsIFrame *frame = nsnull;
|
||||
presShell->GetPrimaryFrameFor(content, &frame);
|
||||
nsIFrame *frame = presShell->GetPrimaryFrameFor(content);
|
||||
if (!frame) {
|
||||
// No frame! Not visible then.
|
||||
return PR_FALSE;
|
||||
|
|
|
@ -426,7 +426,7 @@ void nsWebBrowserFind::SetSelectionAndScroll(nsIDOMWindow* aWindow,
|
|||
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
|
||||
for ( ; content; content = content->GetParent()) {
|
||||
if (!content->IsNativeAnonymous()) {
|
||||
presShell->GetPrimaryFrameFor(content, &frame);
|
||||
frame = presShell->GetPrimaryFrameFor(content);
|
||||
if (!frame)
|
||||
return;
|
||||
CallQueryInterface(frame, &tcFrame);
|
||||
|
@ -846,7 +846,7 @@ nsWebBrowserFind::GetFrameSelection(nsIDOMWindow* aWindow,
|
|||
focusController->GetFocusedElement(getter_AddRefs(focusedElement));
|
||||
if (focusedElement) {
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(focusedElement));
|
||||
presShell->GetPrimaryFrameFor(content, &frame);
|
||||
frame = presShell->GetPrimaryFrameFor(content);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,251 +0,0 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Joe Hewitt <hewitt@netscape.com> (original author)
|
||||
* Christopher A. Aillon <christopher@aillon.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "inDOMUtils.h"
|
||||
#include "inLayoutUtils.h"
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMCharacterData.h"
|
||||
#include "nsITextContent.h"
|
||||
#include "nsRuleNode.h"
|
||||
#include "nsIStyleRule.h"
|
||||
#include "nsICSSStyleRule.h"
|
||||
#include "nsICSSStyleRuleDOMWrapper.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
|
||||
static NS_DEFINE_CID(kInspectorCSSUtilsCID, NS_INSPECTORCSSUTILS_CID);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inDOMUtils::inDOMUtils()
|
||||
{
|
||||
mCSSUtils = do_GetService(kInspectorCSSUtilsCID);
|
||||
}
|
||||
|
||||
inDOMUtils::~inDOMUtils()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(inDOMUtils, inIDOMUtils)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// inIDOMUtils
|
||||
|
||||
NS_IMETHODIMP
|
||||
inDOMUtils::IsIgnorableWhitespace(nsIDOMCharacterData *aDataNode,
|
||||
PRBool *aReturn)
|
||||
{
|
||||
NS_PRECONDITION(aDataNode, "Must have a character data node");
|
||||
NS_PRECONDITION(aReturn, "Must have an out parameter");
|
||||
|
||||
*aReturn = PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsITextContent> textContent = do_QueryInterface(aDataNode);
|
||||
NS_ASSERTION(textContent, "Does not implement nsITextContent!");
|
||||
|
||||
if (!textContent->IsOnlyWhitespace()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Okay. We have only white space. Let's check the white-space
|
||||
// property now and make sure that this isn't preformatted text...
|
||||
|
||||
nsCOMPtr<nsIDOMWindowInternal> win = inLayoutUtils::GetWindowFor(aDataNode);
|
||||
if (!win) {
|
||||
// Hmm. Things are screwy if we have no window...
|
||||
NS_ERROR("No window!");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell = inLayoutUtils::GetPresShellFor(win);
|
||||
if (!presShell) {
|
||||
// Display:none iframe or something... Bail out
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aDataNode);
|
||||
presShell->GetPrimaryFrameFor(content, &frame);
|
||||
if (frame) {
|
||||
const nsStyleText* text = frame->GetStyleText();
|
||||
*aReturn = text->mWhiteSpace != NS_STYLE_WHITESPACE_PRE &&
|
||||
text->mWhiteSpace != NS_STYLE_WHITESPACE_MOZ_PRE_WRAP;
|
||||
}
|
||||
else {
|
||||
// empty inter-tag text node without frame, e.g., in between <table>\n<tr>
|
||||
*aReturn = PR_TRUE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
inDOMUtils::GetParentForNode(nsIDOMNode* aNode,
|
||||
PRBool aShowingAnonymousContent,
|
||||
nsIDOMNode** aParent)
|
||||
{
|
||||
// First do the special cases -- document nodes and anonymous content
|
||||
nsCOMPtr<nsIDOMDocument> doc(do_QueryInterface(aNode));
|
||||
nsCOMPtr<nsIDOMNode> parent;
|
||||
|
||||
if (doc) {
|
||||
parent = inLayoutUtils::GetContainerFor(doc);
|
||||
} else if (aShowingAnonymousContent) {
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
|
||||
nsCOMPtr<nsIContent> bparent;
|
||||
nsCOMPtr<nsIBindingManager> bindingManager = inLayoutUtils::GetBindingManagerFor(aNode);
|
||||
if (bindingManager) {
|
||||
bindingManager->GetInsertionParent(content, getter_AddRefs(bparent));
|
||||
}
|
||||
|
||||
parent = do_QueryInterface(bparent);
|
||||
}
|
||||
|
||||
if (!parent) {
|
||||
// Ok, just get the normal DOM parent node
|
||||
aNode->GetParentNode(getter_AddRefs(parent));
|
||||
}
|
||||
|
||||
NS_IF_ADDREF(*aParent = parent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
inDOMUtils::GetCSSStyleRules(nsIDOMElement *aElement,
|
||||
nsISupportsArray **_retval)
|
||||
{
|
||||
if (!aElement) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*_retval = nsnull;
|
||||
|
||||
nsRuleNode* ruleNode = nsnull;
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
|
||||
mCSSUtils->GetRuleNodeForContent(content, &ruleNode);
|
||||
if (!ruleNode) {
|
||||
// This can fail for content nodes that are not in the document or
|
||||
// if the document they're in doesn't have a presshell. Bail out.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupportsArray> rules;
|
||||
NS_NewISupportsArray(getter_AddRefs(rules));
|
||||
if (!rules) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsCOMPtr<nsIStyleRule> srule;
|
||||
nsCOMPtr<nsICSSStyleRule> cssRule;
|
||||
nsCOMPtr<nsIDOMCSSRule> domRule;
|
||||
for (PRBool isRoot;
|
||||
mCSSUtils->IsRuleNodeRoot(ruleNode, &isRoot), !isRoot;
|
||||
mCSSUtils->GetRuleNodeParent(ruleNode, &ruleNode))
|
||||
{
|
||||
mCSSUtils->GetRuleNodeRule(ruleNode, getter_AddRefs(srule));
|
||||
cssRule = do_QueryInterface(srule);
|
||||
if (cssRule) {
|
||||
cssRule->GetDOMRule(getter_AddRefs(domRule));
|
||||
if (domRule)
|
||||
rules->InsertElementAt(domRule, 0);
|
||||
}
|
||||
}
|
||||
|
||||
*_retval = rules;
|
||||
NS_ADDREF(*_retval);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
inDOMUtils::GetRuleLine(nsIDOMCSSStyleRule *aRule, PRUint32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
if (!aRule)
|
||||
return NS_OK;
|
||||
nsCOMPtr<nsICSSStyleRuleDOMWrapper> rule = do_QueryInterface(aRule);
|
||||
nsCOMPtr<nsICSSStyleRule> cssrule;
|
||||
rule->GetCSSStyleRule(getter_AddRefs(cssrule));
|
||||
if (cssrule)
|
||||
*_retval = cssrule->GetLineNumber();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
inDOMUtils::GetBindingURLs(nsIDOMElement *aElement, nsIArray **_retval)
|
||||
{
|
||||
return mCSSUtils->GetBindingURLs(aElement, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
inDOMUtils::SetContentState(nsIDOMElement *aElement, PRInt32 aState)
|
||||
{
|
||||
if (!aElement)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCOMPtr<nsIEventStateManager> esm = inLayoutUtils::GetEventStateManagerFor(aElement);
|
||||
if (esm) {
|
||||
nsCOMPtr<nsIContent> content;
|
||||
content = do_QueryInterface(aElement);
|
||||
|
||||
return esm->SetContentState(content, aState);
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
inDOMUtils::GetContentState(nsIDOMElement *aElement, PRInt32* aState)
|
||||
{
|
||||
*aState = 0;
|
||||
|
||||
if (!aElement)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCOMPtr<nsIEventStateManager> esm = inLayoutUtils::GetEventStateManagerFor(aElement);
|
||||
if (esm) {
|
||||
nsCOMPtr<nsIContent> content;
|
||||
content = do_QueryInterface(aElement);
|
||||
|
||||
return esm->GetContentState(content, *aState);
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
|
@ -94,10 +94,7 @@ nsIFrame*
|
|||
inLayoutUtils::GetFrameFor(nsIDOMElement* aElement, nsIPresShell* aShell)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
|
||||
nsIFrame* frame = nsnull;
|
||||
aShell->GetPrimaryFrameFor(content, &frame);
|
||||
|
||||
return frame;
|
||||
return aShell->GetPrimaryFrameFor(content);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIRenderingContext>
|
||||
|
@ -169,8 +166,7 @@ inLayoutUtils::GetScreenOrigin(nsIDOMElement* aElement)
|
|||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
|
||||
if (presContext) {
|
||||
nsIFrame* frame = nsnull;
|
||||
presShell->GetPrimaryFrameFor(content, &frame);
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(content);
|
||||
|
||||
PRInt32 offsetX = 0;
|
||||
PRInt32 offsetY = 0;
|
||||
|
|
|
@ -694,9 +694,8 @@ nsSpatialNavigation::setFocusedContent(nsIContent* c)
|
|||
//#ifdef OLDER_LAYOUT
|
||||
nsPresContext* presContext = getPresContext(c);
|
||||
|
||||
nsIFrame* frame = nsnull;
|
||||
nsIPresShell *presShell = presContext->PresShell();
|
||||
presShell->GetPrimaryFrameFor(c, &frame);
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(c);
|
||||
|
||||
if (frame) {
|
||||
presContext->EventStateManager()->SetContentState(c, NS_EVENT_STATE_FOCUS);
|
||||
|
|
|
@ -303,9 +303,8 @@ nsresult getFrameForContent(nsIContent* aContent, nsIFrame** aFrame)
|
|||
if (!doc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsIFrame* frame;
|
||||
nsIPresShell *presShell = doc->GetShellAt(0);
|
||||
presShell->GetPrimaryFrameFor(aContent, &frame);
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(aContent);
|
||||
|
||||
if (!frame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -2568,8 +2568,7 @@ nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell,
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsIFrame *frame = nsnull;
|
||||
aPresShell->GetPrimaryFrameFor(content, &frame);
|
||||
nsIFrame *frame = aPresShell->GetPrimaryFrameFor(content);
|
||||
if (!frame) {
|
||||
// No frame! Not visible then.
|
||||
|
||||
|
|
|
@ -661,12 +661,12 @@ DoCleanupFrameReferences(nsPresContext* aPresContext,
|
|||
|
||||
// Remove the mapping from the content object to its frame
|
||||
aFrameManager->SetPrimaryFrameFor(content, nsnull);
|
||||
frame->RemovedAsPrimaryFrame(aPresContext);
|
||||
aFrameIn->RemovedAsPrimaryFrame(aPresContext);
|
||||
aFrameManager->ClearAllUndisplayedContentIn(content);
|
||||
|
||||
// Recursively walk the child frames.
|
||||
// Note: we only need to look at the principal child list
|
||||
nsIFrame* childFrame = frame->GetFirstChild(nsnull);
|
||||
nsIFrame* childFrame = aFrameIn->GetFirstChild(nsnull);
|
||||
while (childFrame) {
|
||||
DoCleanupFrameReferences(aPresContext, aFrameManager, childFrame);
|
||||
|
||||
|
@ -7741,8 +7741,7 @@ nsIFrame*
|
|||
nsCSSFrameConstructor::GetFrameFor(nsIContent* aContent)
|
||||
{
|
||||
// Get the primary frame associated with the content
|
||||
nsIFrame* frame;
|
||||
mPresShell->GetPrimaryFrameFor(aContent, &frame);
|
||||
nsIFrame* frame = mPresShell->GetPrimaryFrameFor(aContent);
|
||||
|
||||
if (!frame)
|
||||
return nsnull;
|
||||
|
@ -7908,8 +7907,7 @@ FindPreviousAnonymousSibling(nsIPresShell* aPresShell,
|
|||
|
||||
// Get its frame. If it doesn't have one, continue on to the
|
||||
// anonymous element that preceded it.
|
||||
nsIFrame* prevSibling;
|
||||
aPresShell->GetPrimaryFrameFor(child, &prevSibling);
|
||||
nsIFrame* prevSibling = aPresShell->GetPrimaryFrameFor(child);
|
||||
if (prevSibling) {
|
||||
// The frame may be a special frame (a split inline frame that
|
||||
// contains a block). Get the last part of that split.
|
||||
|
@ -7988,8 +7986,7 @@ FindNextAnonymousSibling(nsIPresShell* aPresShell,
|
|||
nsCOMPtr<nsIContent> child = do_QueryInterface(node);
|
||||
|
||||
// Get its frame
|
||||
nsIFrame* nextSibling;
|
||||
aPresShell->GetPrimaryFrameFor(child, &nextSibling);
|
||||
nsIFrame* nextSibling = aPresShell->GetPrimaryFrameFor(child);
|
||||
if (nextSibling) {
|
||||
// The primary frame should never be a continuation
|
||||
NS_ASSERTION(!nextSibling->GetPrevInFlow(),
|
||||
|
@ -8094,8 +8091,7 @@ nsCSSFrameConstructor::FindPreviousSibling(nsIContent* aContainer,
|
|||
// Note: not all content objects are associated with a frame (e.g., if it's
|
||||
// `display: hidden') so keep looking until we find a previous frame
|
||||
while (iter-- != first) {
|
||||
nsIFrame* prevSibling = nsnull;
|
||||
mPresShell->GetPrimaryFrameFor(nsCOMPtr<nsIContent>(*iter), &prevSibling);
|
||||
nsIFrame* prevSibling = mPresShell->GetPrimaryFrameFor(nsCOMPtr<nsIContent>(*iter));
|
||||
|
||||
if (prevSibling) {
|
||||
// The frame may be a special frame (a split inline frame that
|
||||
|
@ -8134,7 +8130,7 @@ nsCSSFrameConstructor::FindPreviousSibling(nsIContent* aContainer,
|
|||
|
||||
#ifdef DEBUG
|
||||
nsIFrame* containerFrame = nsnull;
|
||||
mPresShell->GetPrimaryFrameFor(aContainer, &containerFrame);
|
||||
containerFrame = mPresShell->GetPrimaryFrameFor(aContainer);
|
||||
NS_ASSERTION(prevSibling != containerFrame, "Previous Sibling is the Container's frame");
|
||||
#endif
|
||||
// Found a previous sibling, we're done!
|
||||
|
@ -8167,8 +8163,8 @@ nsCSSFrameConstructor::FindNextSibling(nsIContent* aContainer,
|
|||
PRUint8 childDisplay = UNSET_DISPLAY;
|
||||
|
||||
while (++iter != last) {
|
||||
nsIFrame* nextSibling = nsnull;
|
||||
mPresShell->GetPrimaryFrameFor(nsCOMPtr<nsIContent>(*iter), &nextSibling);
|
||||
nsIFrame* nextSibling =
|
||||
mPresShell->GetPrimaryFrameFor(nsCOMPtr<nsIContent>(*iter));
|
||||
|
||||
if (nextSibling) {
|
||||
// The frame primary frame should never be a continuation
|
||||
|
@ -8683,8 +8679,7 @@ nsCSSFrameConstructor::RemoveDummyFrameFromSelect(nsIContent* aContainer,
|
|||
PRUint32 numOptions = 0;
|
||||
nsresult rv = aSelectElement->GetLength(&numOptions);
|
||||
if (NS_SUCCEEDED(rv) && numOptions > 0) {
|
||||
nsIFrame* frame;
|
||||
mPresShell->GetPrimaryFrameFor(aContainer, &frame);
|
||||
nsIFrame* frame = mPresShell->GetPrimaryFrameFor(aContainer);
|
||||
if (frame) {
|
||||
nsISelectControlFrame* listFrame = nsnull;
|
||||
CallQueryInterface(frame, &listFrame);
|
||||
|
@ -9525,8 +9520,7 @@ nsCSSFrameConstructor::ContentRemoved(nsIContent* aContainer,
|
|||
nsresult rv = NS_OK;
|
||||
|
||||
// Find the child frame that maps the content
|
||||
nsIFrame* childFrame;
|
||||
mPresShell->GetPrimaryFrameFor(aChild, &childFrame);
|
||||
nsIFrame* childFrame = mPresShell->GetPrimaryFrameFor(aChild);
|
||||
|
||||
if (! childFrame) {
|
||||
frameManager->ClearUndisplayedContentIn(aChild, aContainer);
|
||||
|
@ -9539,9 +9533,7 @@ nsCSSFrameConstructor::ContentRemoved(nsIContent* aContainer,
|
|||
nsCOMPtr<nsIDOMHTMLSelectElement> selectElement = do_QueryInterface(aContainer);
|
||||
if (selectElement) {
|
||||
// XXX temp needed only native controls
|
||||
nsIFrame* selectFrame;
|
||||
// XXX temp needed only native controls
|
||||
mPresShell->GetPrimaryFrameFor(aContainer, &selectFrame);
|
||||
nsIFrame* selectFrame = mPresShell->GetPrimaryFrameFor(aContainer);
|
||||
|
||||
// For "select" add the pseudo frame after the last item is deleted
|
||||
nsIFrame* parentFrame = childFrame->GetParent();
|
||||
|
@ -9624,7 +9616,7 @@ nsCSSFrameConstructor::ContentRemoved(nsIContent* aContainer,
|
|||
containingBlock);
|
||||
|
||||
// Recover childFrame and parentFrame
|
||||
mPresShell->GetPrimaryFrameFor(aChild, &childFrame);
|
||||
childFrame = mPresShell->GetPrimaryFrameFor(aChild);
|
||||
if (!childFrame) {
|
||||
frameManager->ClearUndisplayedContentIn(aChild, aContainer);
|
||||
return NS_OK;
|
||||
|
@ -9989,8 +9981,7 @@ nsCSSFrameConstructor::CharacterDataChanged(nsIContent* aContent,
|
|||
nsresult rv = NS_OK;
|
||||
|
||||
// Find the child frame
|
||||
nsIFrame* frame;
|
||||
mPresShell->GetPrimaryFrameFor(aContent, &frame);
|
||||
nsIFrame* frame = mPresShell->GetPrimaryFrameFor(aContent);
|
||||
|
||||
// Notify the first frame that maps the content. It will generate a reflow
|
||||
// command
|
||||
|
@ -10149,8 +10140,7 @@ nsCSSFrameConstructor::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
|
|||
#ifdef DEBUG
|
||||
// reget from content since it may have been regenerated...
|
||||
if (content) {
|
||||
nsIFrame* frame;
|
||||
mPresShell->GetPrimaryFrameFor(content, &frame);
|
||||
nsIFrame* frame = mPresShell->GetPrimaryFrameFor(content);
|
||||
if (frame) {
|
||||
mPresShell->FrameManager()->DebugVerifyStyleTree(frame);
|
||||
}
|
||||
|
@ -10208,8 +10198,7 @@ nsCSSFrameConstructor::RestyleElement(nsIContent *aContent,
|
|||
}
|
||||
#ifdef ACCESSIBILITY
|
||||
if (mPresShell->IsAccessibilityActive()) {
|
||||
nsIFrame *frame;
|
||||
mPresShell->GetPrimaryFrameFor(aContent, &frame);
|
||||
nsIFrame *frame = mPresShell->GetPrimaryFrameFor(aContent);
|
||||
NotifyAccessibleChange(prevRenderedFrameType,
|
||||
GetRenderedFrameType(frame),
|
||||
aContent);
|
||||
|
@ -10231,8 +10220,7 @@ nsCSSFrameConstructor::RestyleLaterSiblings(nsIContent *aContent)
|
|||
if (!child->IsContentOfType(nsIContent::eELEMENT))
|
||||
continue;
|
||||
|
||||
nsIFrame* primaryFrame = nsnull;
|
||||
mPresShell->GetPrimaryFrameFor(child, &primaryFrame);
|
||||
nsIFrame* primaryFrame = mPresShell->GetPrimaryFrameFor(child);
|
||||
RestyleElement(child, primaryFrame, NS_STYLE_HINT_NONE);
|
||||
}
|
||||
}
|
||||
|
@ -10256,8 +10244,7 @@ nsCSSFrameConstructor::DoContentStateChanged(nsIContent* aContent,
|
|||
NS_ASSERTION(styleSet, "couldn't get style set");
|
||||
|
||||
if (aContent) {
|
||||
nsIFrame* primaryFrame = nsnull;
|
||||
mPresShell->GetPrimaryFrameFor(aContent, &primaryFrame);
|
||||
nsIFrame* primaryFrame = mPresShell->GetPrimaryFrameFor(aContent);
|
||||
|
||||
nsChangeHint hint = NS_STYLE_HINT_NONE;
|
||||
if (primaryFrame) {
|
||||
|
@ -10296,8 +10283,7 @@ nsCSSFrameConstructor::AttributeChanged(nsIContent* aContent,
|
|||
nsCOMPtr<nsIPresShell> shell = mPresShell;
|
||||
|
||||
// Get the frame associated with the content which is the highest in the frame tree
|
||||
nsIFrame* primaryFrame;
|
||||
shell->GetPrimaryFrameFor(aContent, &primaryFrame);
|
||||
nsIFrame* primaryFrame = shell->GetPrimaryFrameFor(aContent);
|
||||
|
||||
#if 0
|
||||
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
|
||||
|
@ -11485,8 +11471,7 @@ nsCSSFrameConstructor::GetInsertionPoint(nsIFrame* aParentFrame,
|
|||
}
|
||||
|
||||
if (insertionElement) {
|
||||
nsIFrame* insertionPoint = nsnull;
|
||||
mPresShell->GetPrimaryFrameFor(insertionElement, &insertionPoint);
|
||||
nsIFrame* insertionPoint = mPresShell->GetPrimaryFrameFor(insertionElement);
|
||||
if (insertionPoint) {
|
||||
// If the insertion point is a scrollable, then walk ``through''
|
||||
// it to get the scrolled frame.
|
||||
|
@ -11513,14 +11498,11 @@ nsresult
|
|||
nsCSSFrameConstructor::CaptureStateForFramesOf(nsIContent* aContent,
|
||||
nsILayoutHistoryState* aHistoryState)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsIFrame* frame;
|
||||
rv = mPresShell->GetPrimaryFrameFor(aContent, &frame);
|
||||
if (NS_SUCCEEDED(rv) && frame) {
|
||||
nsIFrame* frame = mPresShell->GetPrimaryFrameFor(aContent);
|
||||
if (frame) {
|
||||
CaptureStateFor(frame, aHistoryState);
|
||||
}
|
||||
return rv;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Capture state for the frame tree rooted at aFrame.
|
||||
|
@ -11587,8 +11569,7 @@ nsCSSFrameConstructor::RecreateFramesForContent(nsIContent* aContent)
|
|||
// containing block from ContentRemoved() and ContentInserted(),
|
||||
// below!)
|
||||
|
||||
nsIFrame* frame;
|
||||
mPresShell->GetPrimaryFrameFor(aContent, &frame);
|
||||
nsIFrame* frame = mPresShell->GetPrimaryFrameFor(aContent);
|
||||
nsPresContext* presContext = mPresShell->GetPresContext();
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -13586,8 +13567,7 @@ nsCSSFrameConstructor::ProcessOneRestyle(nsIContent* aContent,
|
|||
return;
|
||||
}
|
||||
|
||||
nsIFrame* primaryFrame = nsnull;
|
||||
mPresShell->GetPrimaryFrameFor(aContent, &primaryFrame);
|
||||
nsIFrame* primaryFrame = mPresShell->GetPrimaryFrameFor(aContent);
|
||||
if (aRestyleHint & eReStyle_Self) {
|
||||
RestyleElement(aContent, primaryFrame, aChangeHint);
|
||||
} else if (aChangeHint &&
|
||||
|
|
|
@ -1557,9 +1557,8 @@ PRBool GetBGColorForHTMLElement( nsPresContext *aPresContext,
|
|||
if (tag == nsHTMLAtoms::html ||
|
||||
tag == nsHTMLAtoms::body) {
|
||||
// use this guy's color
|
||||
nsIFrame *pFrame = nsnull;
|
||||
if (NS_SUCCEEDED(shell->GetPrimaryFrameFor(pContent, &pFrame)) &&
|
||||
pFrame) {
|
||||
nsIFrame *pFrame = shell->GetPrimaryFrameFor(pContent);
|
||||
if (pFrame) {
|
||||
nsStyleContext *pContext = pFrame->GetStyleContext();
|
||||
if (pContext) {
|
||||
const nsStyleBackground* color = pContext->GetStyleBackground();
|
||||
|
@ -2622,10 +2621,9 @@ FindCanvasBackground(nsPresContext* aPresContext,
|
|||
// and thus |InitialReflow| on the pres shell. See bug 119351
|
||||
// for the ugly details.
|
||||
if (bodyContent) {
|
||||
nsIFrame *bodyFrame;
|
||||
nsresult rv = aPresContext->PresShell()->
|
||||
GetPrimaryFrameFor(bodyContent, &bodyFrame);
|
||||
if (NS_SUCCEEDED(rv) && bodyFrame)
|
||||
nsIFrame *bodyFrame = aPresContext->PresShell()->
|
||||
GetPrimaryFrameFor(bodyContent);
|
||||
if (bodyFrame)
|
||||
result = bodyFrame->GetStyleBackground();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2488,11 +2488,11 @@ NS_IMETHODIMP DocumentViewerImpl::ScrollToNode(nsIDOMNode* aNode)
|
|||
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
|
||||
|
||||
// Get the primary frame
|
||||
nsIFrame* frame; // Remember Frames aren't ref-counted. They are in their
|
||||
// own special little world.
|
||||
// Remember Frames aren't ref-counted. They are in their own special little
|
||||
// world.
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(content);
|
||||
|
||||
NS_ENSURE_SUCCESS(presShell->GetPrimaryFrameFor(content, &frame),
|
||||
NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
|
||||
|
||||
// tell the pres shell to scroll to the frame
|
||||
NS_ENSURE_SUCCESS(presShell->ScrollFrameIntoView(frame,
|
||||
|
|
|
@ -90,8 +90,8 @@ class nsIStyleSheet;
|
|||
class nsCSSFrameConstructor;
|
||||
|
||||
#define NS_IPRESSHELL_IID \
|
||||
{ 0x0672be76, 0x1047, 0x4905, \
|
||||
{0xad, 0xd1, 0xc5, 0xc6, 0x90, 0xe8, 0x70, 0x3a} }
|
||||
{ 0x8be1b911, 0x7a04, 0x44e8, \
|
||||
{ 0xaf, 0xaa, 0x17, 0x77, 0x26, 0x91, 0x8c, 0x19 } }
|
||||
|
||||
// Constants uses for ScrollFrameIntoView() function
|
||||
#define NS_PRESSHELL_SCROLL_TOP 0
|
||||
|
@ -301,8 +301,7 @@ public:
|
|||
* the primary frame is the frame that is out of the flow and not the
|
||||
* placeholder frame.
|
||||
*/
|
||||
NS_IMETHOD GetPrimaryFrameFor(nsIContent* aContent,
|
||||
nsIFrame** aPrimaryFrame) const = 0;
|
||||
virtual NS_HIDDEN_(nsIFrame*) GetPrimaryFrameFor(nsIContent* aContent) const = 0;
|
||||
|
||||
/**
|
||||
* Returns a layout object associated with the primary frame for the content object.
|
||||
|
|
|
@ -1110,8 +1110,7 @@ public:
|
|||
NS_IMETHOD ResizeReflow(nscoord aWidth, nscoord aHeight);
|
||||
NS_IMETHOD StyleChangeReflow();
|
||||
NS_IMETHOD GetPageSequenceFrame(nsIPageSequenceFrame** aResult) const;
|
||||
NS_IMETHOD GetPrimaryFrameFor(nsIContent* aContent,
|
||||
nsIFrame** aPrimaryFrame) const;
|
||||
virtual NS_HIDDEN_(nsIFrame*) GetPrimaryFrameFor(nsIContent* aContent) const;
|
||||
|
||||
NS_IMETHOD GetLayoutObjectFor(nsIContent* aContent,
|
||||
nsISupports** aResult) const;
|
||||
|
@ -3388,10 +3387,7 @@ PresShell::CheckVisibility(nsIDOMNode *node, PRInt16 startOffset, PRInt16 EndOff
|
|||
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
|
||||
if (!content)
|
||||
return NS_ERROR_FAILURE;
|
||||
nsIFrame *frame;
|
||||
nsresult result = GetPrimaryFrameFor(content,&frame);
|
||||
if (NS_FAILED(result)) //failure is taken as a no.
|
||||
return result;
|
||||
nsIFrame *frame = GetPrimaryFrameFor(content);
|
||||
if (!frame) //no frame to look at so it must not be visible
|
||||
return NS_OK;
|
||||
//start process now to go through all frames to find startOffset. then check chars after that to see
|
||||
|
@ -3752,8 +3748,7 @@ PresShell::GetViewToScroll(nsLayoutUtils::Direction aDirection)
|
|||
}
|
||||
}
|
||||
if (focusedContent) {
|
||||
nsIFrame* startFrame = nsnull;
|
||||
GetPrimaryFrameFor(focusedContent, &startFrame);
|
||||
nsIFrame* startFrame = GetPrimaryFrameFor(focusedContent);
|
||||
if (startFrame) {
|
||||
nsCOMPtr<nsIScrollableViewProvider> svp = do_QueryInterface(startFrame);
|
||||
// If this very frame provides a scroll view, start there instead of frame's
|
||||
|
@ -4308,8 +4303,7 @@ PresShell::GoToAnchor(const nsAString& aAnchorName, PRBool aScroll)
|
|||
if (aScroll) {
|
||||
mDocument->FlushPendingNotifications(Flush_Layout);
|
||||
// Get the primary frame
|
||||
nsIFrame* frame = nsnull;
|
||||
GetPrimaryFrameFor(content, &frame);
|
||||
nsIFrame* frame = GetPrimaryFrameFor(content);
|
||||
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
|
||||
rv = ScrollFrameIntoView(frame, NS_PRESSHELL_SCROLL_TOP,
|
||||
NS_PRESSHELL_SCROLL_ANYWHERE);
|
||||
|
@ -4731,9 +4725,7 @@ PresShell::GetSelectionForCopy(nsISelection** outSelection)
|
|||
nsCOMPtr<nsIDOMNSHTMLTextAreaElement> htmlTextAreaElement(do_QueryInterface(content));
|
||||
if (htmlInputElement || htmlTextAreaElement)
|
||||
{
|
||||
nsIFrame *htmlInputFrame;
|
||||
rv = GetPrimaryFrameFor(content, &htmlInputFrame);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsIFrame *htmlInputFrame = GetPrimaryFrameFor(content);
|
||||
if (!htmlInputFrame) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
|
@ -4878,14 +4870,13 @@ PresShell::GetGeneratedContentIterator(nsIContent* aContent,
|
|||
GeneratedContentType aType,
|
||||
nsIContentIterator** aIterator) const
|
||||
{
|
||||
nsIFrame* primaryFrame;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// Initialize OUT parameter
|
||||
*aIterator = nsnull;
|
||||
|
||||
// Get the primary frame associated with the content object
|
||||
GetPrimaryFrameFor(aContent, &primaryFrame);
|
||||
nsIFrame* primaryFrame = GetPrimaryFrameFor(aContent);
|
||||
if (primaryFrame) {
|
||||
// See whether it's a request for the before or after generated content
|
||||
if (Before == aType) {
|
||||
|
@ -5503,8 +5494,7 @@ PresShell::ContentRemoved(nsIDocument *aDocument,
|
|||
|
||||
// XXX fix for bug 304383. Remove when bug 287813 is fixed?
|
||||
if (mCaret) {
|
||||
nsIFrame* frame = nsnull;
|
||||
GetPrimaryFrameFor(aChild, &frame);
|
||||
nsIFrame* frame = GetPrimaryFrameFor(aChild);
|
||||
if (frame && (frame->GetStateBits() & NS_FRAME_EXTERNAL_REFERENCE)) {
|
||||
mCaret->EraseCaret();
|
||||
}
|
||||
|
@ -5638,12 +5628,10 @@ PresShell::StyleRuleRemoved(nsIDocument *aDocument,
|
|||
mStylesHaveChanged = PR_TRUE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::GetPrimaryFrameFor(nsIContent* aContent,
|
||||
nsIFrame** aResult) const
|
||||
nsIFrame*
|
||||
PresShell::GetPrimaryFrameFor(nsIContent* aContent) const
|
||||
{
|
||||
*aResult = FrameManager()->GetPrimaryFrameFor(aContent);
|
||||
return NS_OK;
|
||||
return FrameManager()->GetPrimaryFrameFor(aContent);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -5654,9 +5642,8 @@ PresShell::GetLayoutObjectFor(nsIContent* aContent,
|
|||
if ((nsnull!=aResult) && (nsnull!=aContent))
|
||||
{
|
||||
*aResult = nsnull;
|
||||
nsIFrame *primaryFrame=nsnull;
|
||||
result = GetPrimaryFrameFor(aContent, &primaryFrame);
|
||||
if ((NS_SUCCEEDED(result)) && (nsnull!=primaryFrame))
|
||||
nsIFrame *primaryFrame = GetPrimaryFrameFor(aContent);
|
||||
if (primaryFrame)
|
||||
{
|
||||
result = primaryFrame->QueryInterface(NS_GET_IID(nsISupports),
|
||||
(void**)aResult);
|
||||
|
@ -5849,7 +5836,7 @@ PresShell::GetCurrentEventFrame()
|
|||
// frame shouldn't get an event, nor should we even assume its
|
||||
// safe to try and find the frame.
|
||||
if (mCurrentEventContent->GetDocument()) {
|
||||
GetPrimaryFrameFor(mCurrentEventContent, &mCurrentEventFrame);
|
||||
mCurrentEventFrame = GetPrimaryFrameFor(mCurrentEventContent);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6624,8 +6611,7 @@ StartPluginInstance(PresShell *aShell, nsIContent *aContent)
|
|||
{
|
||||
// For now we just reconstruct the frame, but only if the element
|
||||
// has a plugin instance.
|
||||
nsIFrame *frame = nsnull;
|
||||
aShell->GetPrimaryFrameFor(aContent, &frame);
|
||||
nsIFrame *frame = aShell->GetPrimaryFrameFor(aContent);
|
||||
if (frame) {
|
||||
nsIObjectFrame *objFrame = nsnull;
|
||||
CallQueryInterface(frame, &objFrame);
|
||||
|
|
|
@ -669,7 +669,7 @@ nsComboboxControlFrame::GetPrimaryComboFrame(nsPresContext* aPresContext, nsICon
|
|||
// Get the primary frame from the presentation shell.
|
||||
nsIPresShell *presShell = aPresContext->GetPresShell();
|
||||
if (presShell) {
|
||||
presShell->GetPrimaryFrameFor(aContent, aFrame);
|
||||
*aFrame = presShell->GetPrimaryFrameFor(aContent);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -161,8 +161,7 @@ nsIsIndexFrame::GetInputFrame(nsPresContext* aPresContext,
|
|||
nsIPresShell *presShell = aPresContext->GetPresShell();
|
||||
if (!mInputContent) NS_WARNING("null content - cannot restore state");
|
||||
if (presShell && mInputContent) {
|
||||
nsIFrame *frame;
|
||||
presShell->GetPrimaryFrameFor(mInputContent, &frame);
|
||||
nsIFrame *frame = presShell->GetPrimaryFrameFor(mInputContent);
|
||||
if (frame) {
|
||||
return frame->QueryInterface(NS_GET_IID(nsIFormControlFrame), (void**) oFrame);
|
||||
}
|
||||
|
|
|
@ -459,7 +459,7 @@ void nsListControlFrame::PaintFocus(nsIRenderingContext& aRC, nsFramePaintLayer
|
|||
focusedContent = GetOptionContent(focusedIndex);
|
||||
// otherwise we find the focusedContent's frame and scroll to it
|
||||
if (focusedContent) {
|
||||
result = presShell->GetPrimaryFrameFor(focusedContent, &childframe);
|
||||
childframe = presShell->GetPrimaryFrameFor(focusedContent);
|
||||
}
|
||||
} else {
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> selectHTMLElement(do_QueryInterface(mContent));
|
||||
|
@ -495,7 +495,7 @@ void nsListControlFrame::PaintFocus(nsIRenderingContext& aRC, nsFramePaintLayer
|
|||
// if we found a node use, if not get the first child (this is for empty selects)
|
||||
if (node) {
|
||||
focusedContent = do_QueryInterface(node);
|
||||
result = presShell->GetPrimaryFrameFor(focusedContent, &childframe);
|
||||
childframe = presShell->GetPrimaryFrameFor(focusedContent);
|
||||
}
|
||||
if (!childframe) {
|
||||
// The only way we can get right here is that there are no options
|
||||
|
@ -505,7 +505,7 @@ void nsListControlFrame::PaintFocus(nsIRenderingContext& aRC, nsFramePaintLayer
|
|||
}
|
||||
}
|
||||
|
||||
if (NS_FAILED(result) || !childframe) return;
|
||||
if (!childframe) return;
|
||||
|
||||
// get the child rect
|
||||
nsRect fRect = childframe->GetRect();
|
||||
|
@ -661,8 +661,7 @@ GetOptGroupLabelsHeight(nsPresContext* aPresContext,
|
|||
if (::IsOptGroup(child)) {
|
||||
PRUint32 numOptions = ::GetNumberOfOptionsRecursive(child);
|
||||
nscoord optionsHeight = aRowHeight * numOptions;
|
||||
nsIFrame* frame = nsnull;
|
||||
aPresContext->GetPresShell()->GetPrimaryFrameFor(child, &frame);
|
||||
nsIFrame* frame = aPresContext->GetPresShell()->GetPrimaryFrameFor(child);
|
||||
nscoord totalHeight = frame ? frame->GetSize().height : 0;
|
||||
height += PR_MAX(0, totalHeight - optionsHeight);
|
||||
}
|
||||
|
@ -951,15 +950,14 @@ nsListControlFrame::Reflow(nsPresContext* aPresContext,
|
|||
if (heightOfARow == 0 && length > 0) {
|
||||
nsCOMPtr<nsIContent> option = GetOptionContent(0);
|
||||
if (option) {
|
||||
nsIFrame * optFrame;
|
||||
nsresult result = GetPresContext()->PresShell()->
|
||||
GetPrimaryFrameFor(option, &optFrame);
|
||||
if (NS_SUCCEEDED(result) && optFrame != nsnull) {
|
||||
nsIFrame * optFrame = GetPresContext()->PresShell()->
|
||||
GetPrimaryFrameFor(option);
|
||||
if (optFrame) {
|
||||
nsStyleContext* optStyle = optFrame->GetStyleContext();
|
||||
if (optStyle) {
|
||||
const nsStyleFont* styleFont = optStyle->GetStyleFont();
|
||||
nsCOMPtr<nsIFontMetrics> fontMet;
|
||||
result = aPresContext->DeviceContext()->
|
||||
nsresult result = aPresContext->DeviceContext()->
|
||||
GetMetricsFor(styleFont->mFont, *getter_AddRefs(fontMet));
|
||||
if (NS_SUCCEEDED(result) && fontMet) {
|
||||
if (fontMet) {
|
||||
|
@ -2713,9 +2711,8 @@ nsListControlFrame::GetIndexFromDOMEvent(nsIDOMEvent* aMouseEvent,
|
|||
// first option frame
|
||||
nsCOMPtr<nsIContent> firstOption = GetOptionContent(0);
|
||||
NS_ASSERTION(firstOption, "Can't find first option that's supposed to be there");
|
||||
nsIFrame* optionFrame;
|
||||
nsresult rv = presShell->GetPrimaryFrameFor(firstOption, &optionFrame);
|
||||
if (NS_SUCCEEDED(rv) && optionFrame) {
|
||||
nsIFrame* optionFrame = presShell->GetPrimaryFrameFor(firstOption);
|
||||
if (optionFrame) {
|
||||
nsPoint ptInOptionFrame = pt - optionFrame->GetOffsetTo(this);
|
||||
if (ptInOptionFrame.y < 0 && ptInOptionFrame.x >= 0 &&
|
||||
ptInOptionFrame.x < optionFrame->GetSize().width) {
|
||||
|
@ -2728,8 +2725,8 @@ nsListControlFrame::GetIndexFromDOMEvent(nsIDOMEvent* aMouseEvent,
|
|||
// If the event coordinate is below the last option frame, then target the
|
||||
// last option frame
|
||||
NS_ASSERTION(lastOption, "Can't find last option that's supposed to be there");
|
||||
rv = presShell->GetPrimaryFrameFor(lastOption, &optionFrame);
|
||||
if (NS_SUCCEEDED(rv) && optionFrame) {
|
||||
optionFrame = presShell->GetPrimaryFrameFor(lastOption);
|
||||
if (optionFrame) {
|
||||
nsPoint ptInOptionFrame = pt - optionFrame->GetOffsetTo(this);
|
||||
if (ptInOptionFrame.y >= optionFrame->GetSize().height && ptInOptionFrame.x >= 0 &&
|
||||
ptInOptionFrame.x < optionFrame->GetSize().width) {
|
||||
|
@ -2909,15 +2906,14 @@ nsListControlFrame::ScrollToFrame(nsIContent* aOptElement)
|
|||
// otherwise we find the content's frame and scroll to it
|
||||
nsIPresShell *presShell = GetPresContext()->PresShell();
|
||||
nsIFrame * childframe;
|
||||
nsresult result;
|
||||
if (aOptElement) {
|
||||
result = presShell->GetPrimaryFrameFor(aOptElement, &childframe);
|
||||
childframe = presShell->GetPrimaryFrameFor(aOptElement);
|
||||
} else {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(result) && childframe) {
|
||||
if (NS_SUCCEEDED(result) && scrollableView) {
|
||||
if (childframe) {
|
||||
if (scrollableView) {
|
||||
nscoord x;
|
||||
nscoord y;
|
||||
scrollableView->GetScrollPosition(x,y);
|
||||
|
@ -2944,9 +2940,8 @@ nsListControlFrame::ScrollToFrame(nsIContent* aOptElement)
|
|||
nsCOMPtr<nsIDOMHTMLOptGroupElement> optGroup(do_QueryInterface(parentContent));
|
||||
nsRect optRect(0,0,0,0);
|
||||
if (optGroup) {
|
||||
nsIFrame * optFrame;
|
||||
result = presShell->GetPrimaryFrameFor(parentContent, &optFrame);
|
||||
if (NS_SUCCEEDED(result) && optFrame) {
|
||||
nsIFrame * optFrame = presShell->GetPrimaryFrameFor(parentContent);
|
||||
if (optFrame) {
|
||||
optRect = optFrame->GetRect();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1208,18 +1208,16 @@ ContentContainsPoint(nsPresContext *aPresContext,
|
|||
|
||||
if (!presShell) return PR_FALSE;
|
||||
|
||||
nsIFrame *frame = nsnull;
|
||||
nsIFrame *frame = presShell->GetPrimaryFrameFor(aContent);
|
||||
|
||||
nsresult rv = presShell->GetPrimaryFrameFor(aContent, &frame);
|
||||
|
||||
if (NS_FAILED(rv) || !frame) return PR_FALSE;
|
||||
if (!frame) return PR_FALSE;
|
||||
|
||||
nsIView *frameView = nsnull;
|
||||
nsPoint offsetPoint;
|
||||
|
||||
// Get the view that contains the content's frame.
|
||||
|
||||
rv = frame->GetOffsetFromView(offsetPoint, &frameView);
|
||||
nsresult rv = frame->GetOffsetFromView(offsetPoint, &frameView);
|
||||
|
||||
if (NS_FAILED(rv) || !frameView) return PR_FALSE;
|
||||
|
||||
|
|
|
@ -524,7 +524,7 @@ nsImageFrame::HandleLoadError(PRInt16 aImageStatus)
|
|||
// We have to try to get the primary frame for mContent, since for
|
||||
// <object> the frame CantRenderReplacedElement wants is the
|
||||
// ObjectFrame, not us (we're an anonymous frame then)....
|
||||
presContext->PresShell()->GetPrimaryFrameFor(mContent, &primaryFrame);
|
||||
primaryFrame = presContext->PresShell()->GetPrimaryFrameFor(mContent);
|
||||
}
|
||||
|
||||
if (!primaryFrame) {
|
||||
|
|
|
@ -1047,8 +1047,8 @@ nsImageMap::ChangeFocus(nsIDOMEvent* aEvent, PRBool aFocus) {
|
|||
if (doc) {
|
||||
nsIPresShell *presShell = doc->GetShellAt(0);
|
||||
if (presShell) {
|
||||
nsIFrame* imgFrame;
|
||||
if (NS_SUCCEEDED(presShell->GetPrimaryFrameFor(targetContent, &imgFrame)) && imgFrame) {
|
||||
nsIFrame* imgFrame = presShell->GetPrimaryFrameFor(targetContent);
|
||||
if (imgFrame) {
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
if (presContext) {
|
||||
nsRect dmgRect;
|
||||
|
|
|
@ -1846,8 +1846,7 @@ nsObjectFrame::Paint(nsPresContext* aPresContext,
|
|||
NS_ENSURE_TRUE(shell, NS_ERROR_NULL_POINTER);
|
||||
|
||||
// then the shell can give us the screen frame for this content node
|
||||
nsIFrame* frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(mContent, &frame);
|
||||
nsIFrame* frame = shell->GetPrimaryFrameFor(mContent);
|
||||
NS_ENSURE_TRUE(frame, NS_ERROR_NULL_POINTER);
|
||||
|
||||
// make sure this is REALLY an nsIObjectFrame
|
||||
|
|
|
@ -1144,10 +1144,7 @@ nsSelection::ConstrainFrameAndPointToAnchorSubtree(nsPresContext *aPresContext,
|
|||
// find the closest frame aPoint.
|
||||
//
|
||||
|
||||
result = mShell->GetPrimaryFrameFor(anchorRoot, aRetFrame);
|
||||
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
*aRetFrame = mShell->GetPrimaryFrameFor(anchorRoot);
|
||||
|
||||
if (! *aRetFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -2814,10 +2811,7 @@ nsSelection::GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, HINT aHin
|
|||
}
|
||||
}
|
||||
|
||||
result = mShell->GetPrimaryFrameFor(theNode, aReturnFrame);
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
|
||||
*aReturnFrame = mShell->GetPrimaryFrameFor(theNode);
|
||||
if (!*aReturnFrame)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
|
@ -3045,8 +3039,7 @@ nsITableCellLayout*
|
|||
nsSelection::GetCellLayout(nsIContent *aCellContent)
|
||||
{
|
||||
// Get frame for cell
|
||||
nsIFrame *cellFrame = nsnull;
|
||||
mShell->GetPrimaryFrameFor(aCellContent, &cellFrame);
|
||||
nsIFrame *cellFrame = mShell->GetPrimaryFrameFor(aCellContent);
|
||||
if (!cellFrame)
|
||||
return nsnull;
|
||||
|
||||
|
@ -3060,8 +3053,7 @@ nsITableLayout*
|
|||
nsSelection::GetTableLayout(nsIContent *aTableContent)
|
||||
{
|
||||
// Get frame for table
|
||||
nsIFrame *tableFrame = nsnull;
|
||||
mShell->GetPrimaryFrameFor(aTableContent, &tableFrame);
|
||||
nsIFrame *tableFrame = mShell->GetPrimaryFrameFor(aTableContent);
|
||||
if (!tableFrame)
|
||||
return nsnull;
|
||||
|
||||
|
@ -3219,9 +3211,7 @@ printf("HandleTableSelection: Mouse down event\n");
|
|||
// We have at least 1 other selected cell
|
||||
|
||||
// Check if new cell is already selected
|
||||
nsIFrame *cellFrame = nsnull;
|
||||
result = mShell->GetPrimaryFrameFor(childContent, &cellFrame);
|
||||
if (NS_FAILED(result)) return result;
|
||||
nsIFrame *cellFrame = mShell->GetPrimaryFrameFor(childContent);
|
||||
if (!cellFrame) return NS_ERROR_NULL_POINTER;
|
||||
result = cellFrame->GetSelected(&isSelected);
|
||||
if (NS_FAILED(result)) return result;
|
||||
|
@ -4650,8 +4640,8 @@ nsTypedSelection::GetPrimaryFrameForRangeEndpoint(nsIDOMNode *aNode, PRInt32 aOf
|
|||
content = child; // releases the focusnode
|
||||
}
|
||||
}
|
||||
result = mFrameSelection->GetShell()->GetPrimaryFrameFor(content,aReturnFrame);
|
||||
return result;
|
||||
*aReturnFrame = mFrameSelection->GetShell()->GetPrimaryFrameFor(content);
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -4725,8 +4715,8 @@ nsTypedSelection::selectFrames(nsPresContext* aPresContext,
|
|||
if (NS_SUCCEEDED(result))
|
||||
{
|
||||
// First select frame of content passed in
|
||||
result = mFrameSelection->GetShell()->GetPrimaryFrameFor(aContent, &frame);
|
||||
if (NS_SUCCEEDED(result) && frame)
|
||||
frame = mFrameSelection->GetShell()->GetPrimaryFrameFor(aContent);
|
||||
if (frame)
|
||||
{
|
||||
//NOTE: eSpreadDown is now IGNORED. Selected state is set only for given frame
|
||||
frame->SetSelected(aPresContext, nsnull, aFlags, eSpreadDown);
|
||||
|
@ -4749,8 +4739,8 @@ nsTypedSelection::selectFrames(nsPresContext* aPresContext,
|
|||
{
|
||||
nsIContent *innercontent = aInnerIter->GetCurrentNode();
|
||||
|
||||
result = mFrameSelection->GetShell()->GetPrimaryFrameFor(innercontent, &frame);
|
||||
if (NS_SUCCEEDED(result) && frame)
|
||||
frame = mFrameSelection->GetShell()->GetPrimaryFrameFor(innercontent);
|
||||
if (frame)
|
||||
{
|
||||
//NOTE: eSpreadDown is now IGNORED. Selected state is set only
|
||||
//for given frame
|
||||
|
@ -4781,8 +4771,8 @@ nsTypedSelection::selectFrames(nsPresContext* aPresContext,
|
|||
}
|
||||
|
||||
#if 0
|
||||
result = mFrameSelection->GetShell()->GetPrimaryFrameFor(content, &frame);
|
||||
if (NS_SUCCEEDED(result) && frame)
|
||||
frame = mFrameSelection->GetShell()->GetPrimaryFrameFor(content);
|
||||
if (frame)
|
||||
frame->SetSelected(aRange,aFlags,eSpreadDown);//spread from here to hit all frames in flow
|
||||
#endif
|
||||
|
||||
|
@ -4846,8 +4836,8 @@ nsTypedSelection::selectFrames(nsPresContext* aPresContext, nsIDOMRange *aRange,
|
|||
|
||||
if (!content->IsContentOfType(nsIContent::eELEMENT))
|
||||
{
|
||||
result = mFrameSelection->GetShell()->GetPrimaryFrameFor(content, &frame);
|
||||
if (NS_SUCCEEDED(result) && frame)
|
||||
frame = mFrameSelection->GetShell()->GetPrimaryFrameFor(content);
|
||||
if (frame)
|
||||
frame->SetSelected(aPresContext, aRange,aFlags,eSpreadDown);//spread from here to hit all frames in flow
|
||||
}
|
||||
//end start content
|
||||
|
@ -4870,8 +4860,8 @@ nsTypedSelection::selectFrames(nsPresContext* aPresContext, nsIDOMRange *aRange,
|
|||
|
||||
if (!content->IsContentOfType(nsIContent::eELEMENT))
|
||||
{
|
||||
result = mFrameSelection->GetShell()->GetPrimaryFrameFor(content, &frame);
|
||||
if (NS_SUCCEEDED(result) && frame)
|
||||
frame = mFrameSelection->GetShell()->GetPrimaryFrameFor(content);
|
||||
if (frame)
|
||||
frame->SetSelected(aPresContext, aRange,aFlags,eSpreadDown);//spread from here to hit all frames in flow
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2468,8 +2468,7 @@ nsPrintEngine::ReflowDocList(nsPrintObject* aPO, PRBool aSetPixelScale, PRBool a
|
|||
|
||||
// Check to see if the subdocument's element has been hidden by the parent document
|
||||
if (aPO->mParent) {
|
||||
nsIFrame * frame;
|
||||
aPO->mParent->mPresShell->GetPrimaryFrameFor(aPO->mContent, &frame);
|
||||
nsIFrame * frame = aPO->mParent->mPresShell->GetPrimaryFrameFor(aPO->mContent);
|
||||
if (frame) {
|
||||
if (!frame->GetStyleVisibility()->IsVisible()) {
|
||||
aPO->mDontPrint = PR_TRUE;
|
||||
|
@ -2890,9 +2889,8 @@ nsPrintEngine::CalcPageFrameLocation(nsIPresShell * aPresShell,
|
|||
// in the parent document
|
||||
// if it comes back null it probably has the style
|
||||
// set to "display:none"
|
||||
nsIFrame * frame;
|
||||
aPresShell->GetPrimaryFrameFor(aPO->mContent, &frame);
|
||||
if (frame == nsnull) {
|
||||
nsIFrame * frame = aPresShell->GetPrimaryFrameFor(aPO->mContent);
|
||||
if (!frame) {
|
||||
aPO->mDontPrint = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -307,8 +307,7 @@ nsComputedDOMStyle::GetPropertyCSSValue(const nsAString& aPropertyName,
|
|||
nsIPresShell* presShell = document->GetShellAt(0);
|
||||
NS_ENSURE_TRUE(presShell, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
nsIFrame *frame = nsnull;
|
||||
presShell->GetPrimaryFrameFor(mContent, &frame);
|
||||
nsIFrame *frame = presShell->GetPrimaryFrameFor(mContent);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
|
|
|
@ -390,8 +390,7 @@ static nsresult GetBodyColor(nsPresContext* aPresContext, nscolor* aColor)
|
|||
nsCOMPtr<nsIDOMHTMLElement> body;
|
||||
domdoc->GetBody(getter_AddRefs(body));
|
||||
nsCOMPtr<nsIContent> bodyContent = do_QueryInterface(body);
|
||||
nsIFrame *bodyFrame;
|
||||
shell->GetPrimaryFrameFor(bodyContent, &bodyFrame);
|
||||
nsIFrame *bodyFrame = shell->GetPrimaryFrameFor(bodyContent);
|
||||
if (!bodyFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
*aColor = bodyFrame->GetStyleColor()->mColor;
|
||||
|
|
|
@ -148,9 +148,8 @@ nsInspectorCSSUtils::GetStyleContextForContent(nsIContent* aContent,
|
|||
nsIPresShell* aPresShell)
|
||||
{
|
||||
if (!aPseudo) {
|
||||
nsIFrame* frame = nsnull;
|
||||
aPresShell->FlushPendingNotifications(Flush_StyleReresolves);
|
||||
aPresShell->GetPrimaryFrameFor(aContent, &frame);
|
||||
nsIFrame* frame = aPresShell->GetPrimaryFrameFor(aContent);
|
||||
if (frame) {
|
||||
nsStyleContext* result = GetStyleContextForFrame(frame);
|
||||
// this function returns an addrefed style context
|
||||
|
|
|
@ -164,7 +164,7 @@ nsresult nsSVGUtils::GetReferencedFrame(nsIFrame **aRefFrame, nsCAutoString& uri
|
|||
if (!aPresShell)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
rv = aPresShell->GetPrimaryFrameFor(aGContent, aRefFrame);
|
||||
*aRefFrame = aPresShell->GetPrimaryFrameFor(aGContent);
|
||||
NS_ASSERTION(*aRefFrame, "Get referenced SVG frame -- can't find primary frame");
|
||||
if (!(*aRefFrame)) return NS_ERROR_FAILURE;
|
||||
return rv;
|
||||
|
|
|
@ -50,10 +50,7 @@ nsXTFFrameUtils::GetContentInsertionFrame(nsIFrame *aFrame)
|
|||
|
||||
NS_ASSERTION(content, "element not implementing nsIContent!?");
|
||||
|
||||
nsIFrame* insertionFrame = nsnull;
|
||||
aFrame->GetPresContext()->PresShell()->GetPrimaryFrameFor(content,
|
||||
&insertionFrame);
|
||||
return insertionFrame;
|
||||
return aFrame->GetPresContext()->PresShell()->GetPrimaryFrameFor(content);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -163,12 +163,11 @@ nsBoxObject::InvalidatePresentationStuff()
|
|||
nsIFrame*
|
||||
nsBoxObject::GetFrame()
|
||||
{
|
||||
nsIFrame* frame = nsnull;
|
||||
if (mPresShell) {
|
||||
mPresShell->FlushPendingNotifications(Flush_Frames);
|
||||
mPresShell->GetPrimaryFrameFor(mContent, &frame);
|
||||
}
|
||||
return frame;
|
||||
if (!mPresShell)
|
||||
return nsnull;
|
||||
|
||||
mPresShell->FlushPendingNotifications(Flush_Frames);
|
||||
return mPresShell->GetPrimaryFrameFor(mContent);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -192,9 +191,8 @@ nsBoxObject::GetOffsetRect(nsRect& aRect)
|
|||
doc->FlushPendingNotifications(Flush_Layout);
|
||||
|
||||
// Get the Frame for our content
|
||||
nsIFrame* frame = nsnull;
|
||||
presShell->GetPrimaryFrameFor(mContent, &frame);
|
||||
if(frame != nsnull) {
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(mContent);
|
||||
if(frame) {
|
||||
// Get its origin
|
||||
nsPoint origin = frame->GetPosition();
|
||||
|
||||
|
@ -276,8 +274,7 @@ nsBoxObject::GetScreenPosition(nsIntPoint& aPoint)
|
|||
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
if (presContext) {
|
||||
nsIFrame* frame;
|
||||
presShell->GetPrimaryFrameFor(mContent, &frame);
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(mContent);
|
||||
|
||||
if (frame) {
|
||||
nsIntRect rect = frame->GetScreenRect();
|
||||
|
|
|
@ -1284,8 +1284,7 @@ nsListBoxBodyFrame::OnContentInserted(nsPresContext* aPresContext, nsIContent* a
|
|||
// to CreateRows will create all the frames, but OnContentInserted will
|
||||
// still be called again for each content node - so we need to make sure
|
||||
// that the frame for each content node hasn't already been created.
|
||||
nsIFrame* childFrame = nsnull;
|
||||
shell->GetPrimaryFrameFor(aChildContent, &childFrame);
|
||||
nsIFrame* childFrame = shell->GetPrimaryFrameFor(aChildContent);
|
||||
if (childFrame)
|
||||
return;
|
||||
|
||||
|
@ -1300,8 +1299,7 @@ nsListBoxBodyFrame::OnContentInserted(nsPresContext* aPresContext, nsIContent* a
|
|||
mRowsToPrepend = 1;
|
||||
} else if (nextSiblingContent) {
|
||||
// we may be inserting before a frame that is on screen
|
||||
nsIFrame* nextSiblingFrame = nsnull;
|
||||
shell->GetPrimaryFrameFor(nextSiblingContent, &nextSiblingFrame);
|
||||
nsIFrame* nextSiblingFrame = shell->GetPrimaryFrameFor(nextSiblingContent);
|
||||
mLinkupFrame = nextSiblingFrame;
|
||||
}
|
||||
|
||||
|
@ -1351,9 +1349,8 @@ nsListBoxBodyFrame::OnContentRemoved(nsPresContext* aPresContext, nsIFrame* aChi
|
|||
PRUint32 childCount = listBoxContent->GetChildCount();
|
||||
if (childCount > 0) {
|
||||
nsIContent *lastChild = listBoxContent->GetChildAt(childCount - 1);
|
||||
nsIFrame* lastChildFrame = nsnull;
|
||||
aPresContext->PresShell()->GetPrimaryFrameFor(lastChild,
|
||||
&lastChildFrame);
|
||||
nsIFrame* lastChildFrame =
|
||||
aPresContext->PresShell()->GetPrimaryFrameFor(lastChild);
|
||||
|
||||
if (lastChildFrame) {
|
||||
mTopFrame = nsnull;
|
||||
|
|
|
@ -225,7 +225,7 @@ nsListBoxObject::GetListBoxBody()
|
|||
FindBodyContent(frame->GetContent(), getter_AddRefs(content));
|
||||
|
||||
// this frame will be a nsGFXScrollFrame
|
||||
mPresShell->GetPrimaryFrameFor(content, &frame);
|
||||
frame = mPresShell->GetPrimaryFrameFor(content);
|
||||
if (!frame)
|
||||
return nsnull;
|
||||
nsIScrollableFrame* scrollFrame;
|
||||
|
|
|
@ -1625,7 +1625,7 @@ nsMenuFrame::Execute(nsGUIEvent *aEvent)
|
|||
// XXX HACK. Just gracefully exit if the node has been removed, e.g., window.close()
|
||||
// was executed.
|
||||
nsIFrame* primary = nsnull;
|
||||
if (shell) shell->GetPrimaryFrameFor(content, &primary);
|
||||
if (shell) primary = shell->GetPrimaryFrameFor(content);
|
||||
|
||||
// Now properly close them all up.
|
||||
if (content->GetDocument() && // <-- HACK IS HERE. ICK.
|
||||
|
@ -1984,8 +1984,7 @@ nsMenuFrame::SetActiveChild(nsIDOMElement* aChild)
|
|||
|
||||
nsCOMPtr<nsIContent> child(do_QueryInterface(aChild));
|
||||
|
||||
nsIFrame* kid;
|
||||
mPresContext->PresShell()->GetPrimaryFrameFor(child, &kid);
|
||||
nsIFrame* kid = mPresContext->PresShell()->GetPrimaryFrameFor(child);
|
||||
if (!kid)
|
||||
return NS_ERROR_FAILURE;
|
||||
nsIMenuFrame *menuFrame;
|
||||
|
|
|
@ -495,8 +495,7 @@ nsMenuPopupFrame::AdjustClientXYForNestedDocuments ( nsIDOMXULDocument* inPopupD
|
|||
if ( shell ) {
|
||||
// We might be inside a popup widget. If so, we need to use that widget and
|
||||
// not the root view's widget.
|
||||
nsIFrame* targetFrame;
|
||||
shell->GetPrimaryFrameFor(targetAsContent, &targetFrame);
|
||||
nsIFrame* targetFrame = shell->GetPrimaryFrameFor(targetAsContent);
|
||||
nsIView* parentView = nsnull;
|
||||
if (targetFrame) {
|
||||
GetRootViewForPopup(targetFrame, PR_TRUE, &parentView);
|
||||
|
|
|
@ -327,10 +327,9 @@ nsPopupSetFrame::RepositionPopup(nsPopupFrameList* aEntry, nsBoxLayoutState& aSt
|
|||
{
|
||||
// Sync up the view.
|
||||
if (aEntry && aEntry->mElementContent) {
|
||||
nsIFrame* frameToSyncTo = nsnull;
|
||||
nsPresContext* presContext = aState.PresContext();
|
||||
presContext->PresShell()->GetPrimaryFrameFor(aEntry->mElementContent,
|
||||
&frameToSyncTo );
|
||||
nsIFrame* frameToSyncTo = presContext->PresShell()->
|
||||
GetPrimaryFrameFor(aEntry->mElementContent);
|
||||
((nsMenuPopupFrame*)(aEntry->mPopupFrame))->SyncViewWithFrame(presContext,
|
||||
aEntry->mPopupAnchor, aEntry->mPopupAlign, frameToSyncTo, aEntry->mXPos, aEntry->mYPos);
|
||||
}
|
||||
|
@ -366,8 +365,8 @@ nsPopupSetFrame::ShowPopup(nsIContent* aElementContent, nsIContent* aPopupConten
|
|||
entry->mYPos = aYPos;
|
||||
|
||||
// If a frame exists already, go ahead and use it.
|
||||
mPresContext->PresShell()->GetPrimaryFrameFor(aPopupContent,
|
||||
&entry->mPopupFrame);
|
||||
entry->mPopupFrame = mPresContext->PresShell()
|
||||
->GetPrimaryFrameFor(aPopupContent);
|
||||
|
||||
#ifdef DEBUG_PINK
|
||||
printf("X Pos: %d\n", mXPos);
|
||||
|
@ -414,9 +413,8 @@ nsPopupSetFrame::HidePopup(nsIFrame* aPopup)
|
|||
// menupopup, then hiding us should also hide the parent menu
|
||||
// popup.
|
||||
if (entry->mElementContent->Tag() == nsXULAtoms::menupopup) {
|
||||
nsIFrame* popupFrame = nsnull;
|
||||
mPresContext->PresShell()->GetPrimaryFrameFor(entry->mElementContent,
|
||||
&popupFrame);
|
||||
nsIFrame* popupFrame = mPresContext->PresShell()
|
||||
->GetPrimaryFrameFor(entry->mElementContent);
|
||||
if (popupFrame) {
|
||||
nsIMenuParent *menuParent;
|
||||
if (NS_SUCCEEDED(CallQueryInterface(popupFrame, &menuParent))) {
|
||||
|
@ -446,9 +444,8 @@ nsPopupSetFrame::DestroyPopup(nsIFrame* aPopup, PRBool aDestroyEntireChain)
|
|||
// menupopup, then destroying us should also dismiss the parent
|
||||
// menu popup.
|
||||
if (entry->mElementContent->Tag() == nsXULAtoms::menupopup) {
|
||||
nsIFrame* popupFrame = nsnull;
|
||||
mPresContext->PresShell()->GetPrimaryFrameFor(entry->mElementContent,
|
||||
&popupFrame);
|
||||
nsIFrame* popupFrame = mPresContext->PresShell()
|
||||
->GetPrimaryFrameFor(entry->mElementContent);
|
||||
if (popupFrame) {
|
||||
nsIMenuParent *menuParent;
|
||||
if (NS_SUCCEEDED(CallQueryInterface(popupFrame, &menuParent))) {
|
||||
|
|
|
@ -735,9 +735,8 @@ nsTreeBodyFrame::EnsureScrollbar()
|
|||
if (!mScrollbar) {
|
||||
// Try to find it.
|
||||
nsIContent* parContent = GetBaseElement();
|
||||
nsIFrame* treeFrame;
|
||||
|
||||
mPresContext->PresShell()->GetPrimaryFrameFor(parContent, &treeFrame);
|
||||
nsIFrame* treeFrame = mPresContext->PresShell()
|
||||
->GetPrimaryFrameFor(parContent);
|
||||
if (treeFrame)
|
||||
mScrollbar = InitScrollbarFrame(mPresContext, treeFrame, this);
|
||||
}
|
||||
|
|
|
@ -159,7 +159,7 @@ nsTreeBoxObject::GetTreeBody()
|
|||
nsCOMPtr<nsIContent> content;
|
||||
FindBodyElement(frame->GetContent(), getter_AddRefs(content));
|
||||
|
||||
mPresShell->GetPrimaryFrameFor(content, &frame);
|
||||
frame = mPresShell->GetPrimaryFrameFor(content);
|
||||
if (!frame)
|
||||
return nsnull;
|
||||
|
||||
|
|
|
@ -506,8 +506,7 @@ nsTreeColumns::EnsureColumns()
|
|||
if (!shell)
|
||||
return;
|
||||
|
||||
nsIFrame* colsFrame = nsnull;
|
||||
shell->GetPrimaryFrameFor(colsContent, &colsFrame);
|
||||
nsIFrame* colsFrame = shell->GetPrimaryFrameFor(colsContent);
|
||||
if (!colsFrame)
|
||||
return;
|
||||
|
||||
|
|
|
@ -141,8 +141,9 @@ GetScreenOrigin(nsIDOMElement* aElement)
|
|||
float scale;
|
||||
scale = presContext->TwipsToPixels();
|
||||
|
||||
nsIFrame* frame;
|
||||
nsresult rv = presShell->GetPrimaryFrameFor(content, &frame);
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(content);
|
||||
if (!frame)
|
||||
return rect;
|
||||
|
||||
nsIView* view;
|
||||
nsPoint offset;
|
||||
|
|
|
@ -1027,8 +1027,7 @@ nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell,
|
|||
if (!content)
|
||||
return PR_FALSE;
|
||||
|
||||
nsIFrame *frame = nsnull;
|
||||
aPresShell->GetPrimaryFrameFor(content, &frame);
|
||||
nsIFrame *frame = aPresShell->GetPrimaryFrameFor(content);
|
||||
if (!frame)
|
||||
return PR_FALSE; // No frame! Not visible then.
|
||||
|
||||
|
|
|
@ -299,7 +299,7 @@ nsBaseDragService::GetFrameFromNode(nsIDOMNode* inNode, nsIFrame** outFrame,
|
|||
nsIPresShell *presShell = doc->GetShellAt(0);
|
||||
if (presShell) {
|
||||
NS_IF_ADDREF(*outContext = presShell->GetPresContext());
|
||||
presShell->GetPrimaryFrameFor(contentNode, outFrame);
|
||||
*outFrame = presShell->GetPrimaryFrameFor(contentNode);
|
||||
NS_ASSERTION(*outFrame, "Can't get frame for this dom node");
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче