mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-06 00:55:37 +00:00
Merge tracemonkey to mozilla-central.
This commit is contained in:
commit
36a119fabc
@ -368,7 +368,7 @@ nsAccUtils::HasAccessibleChildren(nsIDOMNode *aNode)
|
||||
if (!presShell)
|
||||
return PR_FALSE;
|
||||
|
||||
nsIFrame *frame = presShell->GetPrimaryFrameFor(content);
|
||||
nsIFrame *frame = content->GetPrimaryFrame();
|
||||
if (!frame)
|
||||
return PR_FALSE;
|
||||
|
||||
|
@ -399,12 +399,8 @@ already_AddRefed<nsRootAccessible> nsAccessNode::GetRootAccessible()
|
||||
nsIFrame*
|
||||
nsAccessNode::GetFrame()
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mWeakShell));
|
||||
if (!shell)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
return content ? shell->GetPrimaryFrameFor(content) : nsnull;
|
||||
return content ? content->GetPrimaryFrame() : nsnull;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1410,7 +1410,7 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
|
||||
|
||||
if (!weakFrame.GetFrame() || content != weakFrame.GetFrame()->GetContent()) {
|
||||
// Frame hint not correct, get true frame, we try to optimize away from this
|
||||
weakFrame = aPresShell->GetRealPrimaryFrameFor(content);
|
||||
weakFrame = content->GetPrimaryFrame();
|
||||
if (weakFrame.GetFrame()) {
|
||||
#ifdef DEBUG_A11Y_FRAME_OPTIMIZATION
|
||||
// Frame hint debugging
|
||||
@ -1529,7 +1529,7 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
|
||||
// accessibles
|
||||
nsIContent *tableContent = content;
|
||||
while ((tableContent = tableContent->GetParent()) != nsnull) {
|
||||
nsIFrame *tableFrame = aPresShell->GetPrimaryFrameFor(tableContent);
|
||||
nsIFrame *tableFrame = tableContent->GetPrimaryFrame();
|
||||
if (!tableFrame)
|
||||
continue;
|
||||
|
||||
@ -2137,7 +2137,7 @@ nsAccessibilityService::GetAccessibleForDeckChildren(nsIDOMNode *aNode, nsIAcces
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));
|
||||
|
||||
if (content) {
|
||||
frame = shell->GetPrimaryFrameFor(content);
|
||||
frame = content->GetPrimaryFrame();
|
||||
}
|
||||
|
||||
if (frame && (frame->GetType() == nsAccessibilityAtoms::boxFrame ||
|
||||
|
@ -1248,7 +1248,7 @@ nsAccessible::TakeFocus()
|
||||
if (ancestorContent) {
|
||||
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mWeakShell));
|
||||
if (presShell) {
|
||||
nsIFrame *frame = presShell->GetPrimaryFrameFor(ancestorContent);
|
||||
nsIFrame *frame = ancestorContent->GetPrimaryFrame();
|
||||
if (frame && frame->IsFocusable()) {
|
||||
|
||||
content = ancestorContent;
|
||||
@ -3049,6 +3049,7 @@ nsAccessible::CacheChildren()
|
||||
// Seed the frame hint early while we're still on a container node.
|
||||
// This is better than doing the GetPrimaryFrameFor() later on
|
||||
// a text node, because text nodes aren't in the frame map.
|
||||
// XXXbz is this code still needed?
|
||||
walker.mState.frame = GetFrame();
|
||||
|
||||
walker.GetFirstChild();
|
||||
@ -3204,7 +3205,7 @@ PRBool nsAccessible::CheckVisibilityInParentChain(nsIDocument* aDocument, nsIVie
|
||||
if (!shell) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
nsIFrame* frame = shell->GetPrimaryFrameFor(content);
|
||||
nsIFrame* frame = content->GetPrimaryFrame();
|
||||
while (frame != nsnull && !frame->HasView()) {
|
||||
frame = frame->GetParent();
|
||||
}
|
||||
|
@ -60,6 +60,7 @@ struct WalkState {
|
||||
nsCOMPtr<nsIDOMNodeList> siblingList;
|
||||
nsIContent *parentContent; // For walking normal DOM
|
||||
WalkState *prevState;
|
||||
// XXXbz is |frame| still needed?
|
||||
nsWeakFrame frame; // Helps avoid GetPrimaryFrameFor() calls
|
||||
PRInt32 siblingIndex; // Holds a state flag or an index into the siblingList
|
||||
PRBool isHidden; // Don't enter subtree if hidden
|
||||
|
@ -389,7 +389,7 @@ nsCaretAccessible::GetSelectionControllerForNode(nsIDOMNode *aNode)
|
||||
if (!content)
|
||||
return nsnull;
|
||||
|
||||
nsIFrame *frame = presShell->GetPrimaryFrameFor(content);
|
||||
nsIFrame *frame = content->GetPrimaryFrame();
|
||||
if (!frame)
|
||||
return nsnull;
|
||||
|
||||
|
@ -126,7 +126,7 @@ nsCoreUtils::DispatchClickEvent(nsITreeBoxObject *aTreeBoxObj,
|
||||
tcBoxObj->GetY(&tcY);
|
||||
|
||||
// Dispatch mouse events.
|
||||
nsIFrame* tcFrame = presShell->GetPrimaryFrameFor(tcContent);
|
||||
nsIFrame* tcFrame = tcContent->GetPrimaryFrame();
|
||||
nsIFrame* rootFrame = presShell->GetRootFrame();
|
||||
|
||||
nsPoint offset;
|
||||
@ -152,7 +152,7 @@ nsCoreUtils::DispatchMouseEvent(PRUint32 aEventType,
|
||||
nsIPresShell *aPresShell,
|
||||
nsIContent *aContent)
|
||||
{
|
||||
nsIFrame *frame = aPresShell->GetPrimaryFrameFor(aContent);
|
||||
nsIFrame *frame = aContent->GetPrimaryFrame();
|
||||
if (!frame)
|
||||
return PR_FALSE;
|
||||
|
||||
@ -511,15 +511,11 @@ nsCoreUtils::GetDocShellTreeItemFor(nsIDOMNode *aNode)
|
||||
nsIFrame*
|
||||
nsCoreUtils::GetFrameFor(nsIDOMElement *aElm)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell = GetPresShellFor(aElm);
|
||||
if (!shell)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aElm));
|
||||
if (!content)
|
||||
return nsnull;
|
||||
|
||||
return shell->GetPrimaryFrameFor(content);
|
||||
return content->GetPrimaryFrame();
|
||||
}
|
||||
|
||||
PRBool
|
||||
|
@ -1505,12 +1505,8 @@ nsDocAccessible::FireTextChangeEventForText(nsIContent *aContent,
|
||||
aInfo->mChangeEnd - start; // text has been removed
|
||||
|
||||
if (length > 0) {
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mWeakShell));
|
||||
if (!shell)
|
||||
return;
|
||||
|
||||
PRUint32 renderedStartOffset, renderedEndOffset;
|
||||
nsIFrame* frame = shell->GetPrimaryFrameFor(aContent);
|
||||
nsIFrame* frame = aContent->GetPrimaryFrame();
|
||||
if (!frame)
|
||||
return;
|
||||
|
||||
@ -1722,7 +1718,7 @@ nsDocAccessible::FlushPendingEvents()
|
||||
// such as a:focus { overflow: scroll; }
|
||||
nsCOMPtr<nsIContent> focusContent(do_QueryInterface(domNode));
|
||||
if (focusContent) {
|
||||
nsIFrame *focusFrame = presShell->GetRealPrimaryFrameFor(focusContent);
|
||||
nsIFrame *focusFrame = focusContent->GetPrimaryFrame();
|
||||
nsIAtom *newFrameType =
|
||||
(focusFrame && focusFrame->GetStyleVisibility()->IsVisible()) ?
|
||||
focusFrame->GetType() : nsnull;
|
||||
@ -2102,7 +2098,7 @@ nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
|
||||
if (isHiding) {
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(childNode));
|
||||
if (content) {
|
||||
nsIFrame *frame = presShell->GetPrimaryFrameFor(content);
|
||||
nsIFrame *frame = content->GetPrimaryFrame();
|
||||
if (frame) {
|
||||
nsIFrame *frameParent = frame->GetParent();
|
||||
if (!frameParent || !frameParent->GetStyleVisibility()->IsVisible()) {
|
||||
|
@ -508,7 +508,7 @@ nsRootAccessible::FireAccessibleFocusEvent(nsIAccessible *aAccessible,
|
||||
if (!shell)
|
||||
return PR_FALSE;
|
||||
|
||||
focusFrame = shell->GetRealPrimaryFrameFor(focusContent);
|
||||
focusFrame = focusContent->GetPrimaryFrame();
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(gLastFocusedNode);
|
||||
|
@ -149,7 +149,7 @@ nsTextEquivUtils::AppendTextEquivFromContent(nsIAccessible *aInitiatorAcc,
|
||||
// If the given content is not visible or isn't accessible then go down
|
||||
// through the DOM subtree otherwise go down through accessible subtree and
|
||||
// calculate the flat string.
|
||||
nsIFrame *frame = shell->GetPrimaryFrameFor(aContent);
|
||||
nsIFrame *frame = aContent->GetPrimaryFrame();
|
||||
PRBool isVisible = frame && frame->GetStyleVisibility()->IsVisible();
|
||||
|
||||
nsresult rv;
|
||||
@ -181,12 +181,10 @@ nsTextEquivUtils::AppendTextEquivFromTextContent(nsIContent *aContent,
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(aContent));
|
||||
|
||||
PRBool isHTMLBlock = PR_FALSE;
|
||||
nsCOMPtr<nsIPresShell> shell = nsCoreUtils::GetPresShellFor(DOMNode);
|
||||
NS_ENSURE_STATE(shell);
|
||||
|
||||
nsIContent *parentContent = aContent->GetParent();
|
||||
if (parentContent) {
|
||||
nsIFrame *frame = shell->GetPrimaryFrameFor(parentContent);
|
||||
nsIFrame *frame = parentContent->GetPrimaryFrame();
|
||||
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
|
||||
@ -203,7 +201,7 @@ nsTextEquivUtils::AppendTextEquivFromTextContent(nsIContent *aContent,
|
||||
}
|
||||
|
||||
if (aContent->TextLength() > 0) {
|
||||
nsIFrame *frame = shell->GetPrimaryFrameFor(aContent);
|
||||
nsIFrame *frame = aContent->GetPrimaryFrame();
|
||||
if (frame) {
|
||||
nsresult rv = frame->GetRenderedText(aString);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -116,7 +116,7 @@ nsHTMLAreaAccessible::GetBounds(PRInt32 *x, PRInt32 *y,
|
||||
|
||||
nsRect rect;
|
||||
nsIntRect orgRectPixels;
|
||||
rv = map->GetBoundsForAreaContent(ourContent, presContext, rect);
|
||||
rv = map->GetBoundsForAreaContent(ourContent, rect);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
*x = presContext->AppUnitsToDevPixels(rect.x);
|
||||
|
@ -539,11 +539,11 @@ nsIFrame* nsHTMLSelectOptionAccessible::GetBoundsFrame()
|
||||
PRUint32 state;
|
||||
nsCOMPtr<nsIContent> content = GetSelectState(&state);
|
||||
if (state & nsIAccessibleStates::STATE_COLLAPSED) {
|
||||
nsCOMPtr<nsIPresShell> presShell(GetPresShell());
|
||||
if (!presShell) {
|
||||
return nsnull;
|
||||
if (content) {
|
||||
return content->GetPrimaryFrame();
|
||||
}
|
||||
return presShell->GetPrimaryFrameFor(content);
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
return nsAccessible::GetBoundsFrame();
|
||||
@ -695,7 +695,7 @@ NS_IMETHODIMP nsHTMLSelectOptionAccessible::DoAction(PRUint8 index)
|
||||
if (!testSelectNode || !selectContent || !presShell || !option)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsIFrame *selectFrame = presShell->GetPrimaryFrameFor(selectContent);
|
||||
nsIFrame *selectFrame = selectContent->GetPrimaryFrame();
|
||||
nsIComboboxControlFrame *comboBoxFrame = do_QueryFrame(selectFrame);
|
||||
if (comboBoxFrame) {
|
||||
nsIFrame *listFrame = comboBoxFrame->GetDropDown();
|
||||
@ -727,14 +727,7 @@ nsresult nsHTMLSelectOptionAccessible::GetFocusedOptionNode(nsIDOMNode *aListNod
|
||||
NS_ASSERTION(aListNode, "Called GetFocusedOptionNode without a valid list node");
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aListNode));
|
||||
nsCOMPtr<nsIDocument> document = content->GetDocument();
|
||||
nsIPresShell *shell = nsnull;
|
||||
if (document)
|
||||
shell = document->GetPrimaryShell();
|
||||
if (!shell)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsIFrame *frame = shell->GetPrimaryFrameFor(content);
|
||||
nsIFrame *frame = content->GetPrimaryFrame();
|
||||
if (!frame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
@ -1177,16 +1170,11 @@ void nsHTMLComboboxListAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** aBo
|
||||
mDOMNode->GetFirstChild(getter_AddRefs(child));
|
||||
|
||||
// now get its frame
|
||||
nsCOMPtr<nsIPresShell> shell = GetPresShell();
|
||||
if (!shell) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(child));
|
||||
if (!content) {
|
||||
return;
|
||||
}
|
||||
nsIFrame* frame = shell->GetPrimaryFrameFor(content);
|
||||
nsIFrame* frame = content->GetPrimaryFrame();
|
||||
if (!frame) {
|
||||
*aBoundingFrame = nsnull;
|
||||
return;
|
||||
|
@ -99,7 +99,7 @@ nsHTMLTableCellAccessible::GetStateInternal(PRUint32 *aState,
|
||||
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mDOMNode);
|
||||
nsCOMPtr<nsIPresShell> presShell = do_QueryReferent(mWeakShell);
|
||||
nsIFrame *frame = presShell->GetPrimaryFrameFor(content);
|
||||
nsIFrame *frame = content->GetPrimaryFrame();
|
||||
NS_ASSERTION(frame, "No frame for valid cell accessible!");
|
||||
|
||||
if (frame) {
|
||||
@ -291,11 +291,7 @@ nsHTMLTableCellAccessible::GetCellLayout()
|
||||
{
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell = GetPresShell();
|
||||
if (!shell)
|
||||
return nsnull;
|
||||
|
||||
nsIFrame *frame = shell->GetPrimaryFrameFor(content);
|
||||
nsIFrame *frame = content->GetPrimaryFrame();
|
||||
NS_ASSERTION(frame, "The frame cannot be obtaied for HTML table cell.");
|
||||
if (!frame)
|
||||
return nsnull;
|
||||
@ -1250,9 +1246,7 @@ nsITableLayout*
|
||||
nsHTMLTableAccessible::GetTableLayout()
|
||||
{
|
||||
nsCOMPtr<nsIContent> tableContent(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIPresShell> shell = GetPresShell();
|
||||
|
||||
nsIFrame *frame = shell->GetPrimaryFrameFor(tableContent);
|
||||
nsIFrame *frame = tableContent->GetPrimaryFrame();
|
||||
if (!frame)
|
||||
return nsnull;
|
||||
|
||||
@ -1445,8 +1439,7 @@ nsHTMLTableAccessible::IsProbablyForLayout(PRBool *aIsProbablyForLayout)
|
||||
|
||||
nsCOMPtr<nsIContent> cellContent(do_QueryInterface(cellElement));
|
||||
NS_ENSURE_TRUE(cellContent, NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsIPresShell> shell(GetPresShell());
|
||||
nsIFrame *cellFrame = shell->GetPrimaryFrameFor(cellContent);
|
||||
nsIFrame *cellFrame = cellContent->GetPrimaryFrame();
|
||||
if (!cellFrame) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -592,9 +592,7 @@ nsresult nsHyperTextAccessible::DOMPointToHypertextOffset(nsIDOMNode* aNode, PRI
|
||||
// We want the "skipped" offset into the text (rendered text without the extra whitespace)
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
|
||||
NS_ASSERTION(content, "No nsIContent for dom node");
|
||||
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
||||
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
|
||||
nsIFrame *frame = presShell->GetPrimaryFrameFor(content);
|
||||
nsIFrame *frame = content->GetPrimaryFrame();
|
||||
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
|
||||
nsresult rv = ContentToRenderedOffset(frame, aNodeOffset, &addTextOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -2141,10 +2139,7 @@ nsHyperTextAccessible::GetDOMPointByFrameOffset(nsIFrame *aFrame,
|
||||
nsCOMPtr<nsIContent> content(aFrame->GetContent());
|
||||
NS_ENSURE_STATE(content);
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell(GetPresShell());
|
||||
NS_ENSURE_STATE(shell);
|
||||
|
||||
nsIFrame *primaryFrame = shell->GetPrimaryFrameFor(content);
|
||||
nsIFrame *primaryFrame = content->GetPrimaryFrame();
|
||||
nsresult rv = RenderedToContentOffset(primaryFrame, aOffset, aNodeOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -74,10 +74,7 @@ nsXULSliderAccessible::GetStateInternal(PRUint32 *aState,
|
||||
nsCOMPtr<nsIContent> sliderContent(GetSliderNode());
|
||||
NS_ENSURE_STATE(sliderContent);
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mWeakShell));
|
||||
NS_ENSURE_STATE(shell);
|
||||
|
||||
nsIFrame *frame = shell->GetPrimaryFrameFor(sliderContent);
|
||||
nsIFrame *frame = sliderContent->GetPrimaryFrame();
|
||||
if (frame && frame->IsFocusable())
|
||||
*aState |= nsIAccessibleStates::STATE_FOCUSABLE;
|
||||
|
||||
|
@ -109,9 +109,8 @@ nsXULTabAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
// Check style for -moz-user-focus: normal to see if it's focusable
|
||||
*aState &= ~nsIAccessibleStates::STATE_FOCUSABLE;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mWeakShell));
|
||||
if (presShell && content) {
|
||||
nsIFrame *frame = presShell->GetPrimaryFrameFor(content);
|
||||
if (content) {
|
||||
nsIFrame *frame = content->GetPrimaryFrame();
|
||||
if (frame) {
|
||||
const nsStyleUserInterface* ui = frame->GetStyleUserInterface();
|
||||
if (ui->mUserFocus == NS_STYLE_USER_FOCUS_NORMAL)
|
||||
|
@ -57,6 +57,7 @@ class nsAttrValue;
|
||||
class nsAttrName;
|
||||
class nsTextFragment;
|
||||
class nsIDocShell;
|
||||
class nsIFrame;
|
||||
#ifdef MOZ_SMIL
|
||||
class nsISMILAttr;
|
||||
class nsIDOMCSSStyleDeclaration;
|
||||
@ -70,10 +71,9 @@ enum nsLinkState {
|
||||
};
|
||||
|
||||
// IID for the nsIContent interface
|
||||
// c726e716-a4be-4202-8a5e-32d0525903e8
|
||||
#define NS_ICONTENT_IID \
|
||||
{ 0xc726e716, 0xa4be, 0x4202, \
|
||||
{ 0x8a, 0x5e, 0x32, 0xd0, 0x52, 0x59, 0x03, 0xe8 } }
|
||||
{ 0xe88a767e, 0x1ca1, 0x4855, \
|
||||
{ 0xa7, 0xa4, 0x37, 0x9f, 0x07, 0x89, 0x45, 0xef } }
|
||||
|
||||
/**
|
||||
* A node of content in a document's content model. This interface
|
||||
@ -86,7 +86,8 @@ public:
|
||||
// nsIContent is that it exists with an IID
|
||||
|
||||
nsIContent(nsINodeInfo *aNodeInfo)
|
||||
: nsINode(aNodeInfo)
|
||||
: nsINode(aNodeInfo),
|
||||
mPrimaryFrame(nsnull)
|
||||
{
|
||||
NS_ASSERTION(aNodeInfo,
|
||||
"No nsINodeInfo passed to nsIContent, PREPARE TO CRASH!!!");
|
||||
@ -704,25 +705,6 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Call to let the content node know that it may now have a frame.
|
||||
* The content node may use this to determine what MayHaveFrame
|
||||
* returns.
|
||||
*/
|
||||
virtual void SetMayHaveFrame(PRBool aMayHaveFrame)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns PR_TRUE if there is a chance that the content node has a
|
||||
* frame.
|
||||
* @returns PR_FALSE otherwise.
|
||||
*/
|
||||
virtual PRBool MayHaveFrame() const
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called when the parser begins creating the element's
|
||||
* children, if any are present.
|
||||
@ -870,6 +852,24 @@ public:
|
||||
*/
|
||||
virtual void SaveSubtreeState() = 0;
|
||||
|
||||
/**
|
||||
* Getter and setter for our primary frame pointer. This is the frame that
|
||||
* is most closely associated with the content. A frame is more closely
|
||||
* associated with the content than another frame if the one frame contains
|
||||
* directly or indirectly the other frame (e.g., when a frame is scrolled
|
||||
* there is a scroll frame that contains the frame being scrolled). This
|
||||
* frame is always the first continuation.
|
||||
*
|
||||
* In the case of absolutely positioned elements and floated elements, this
|
||||
* frame is the out of flow frame, not the placeholder.
|
||||
*/
|
||||
nsIFrame* GetPrimaryFrame() const { return mPrimaryFrame; }
|
||||
void SetPrimaryFrame(nsIFrame* aFrame) {
|
||||
NS_PRECONDITION(!aFrame || !mPrimaryFrame,
|
||||
"Losing track of existing primary frame");
|
||||
mPrimaryFrame = aFrame;
|
||||
}
|
||||
|
||||
#ifdef MOZ_SMIL
|
||||
/*
|
||||
* Returns a new nsISMILAttr that allows the caller to animate the given
|
||||
@ -912,6 +912,11 @@ private:
|
||||
*/
|
||||
virtual const nsAttrValue* DoGetClasses() const = 0;
|
||||
|
||||
/**
|
||||
* Pointer to our primary frame. Might be null.
|
||||
*/
|
||||
nsIFrame* mPrimaryFrame;
|
||||
|
||||
public:
|
||||
#ifdef DEBUG
|
||||
/**
|
||||
|
@ -98,45 +98,41 @@ enum {
|
||||
// NOTE: Should only be used on nsIContent nodes
|
||||
NODE_IS_NATIVE_ANONYMOUS_ROOT = 0x00000020U,
|
||||
|
||||
// Whether this node may have a frame
|
||||
// NOTE: Should only be used on nsIContent nodes
|
||||
NODE_MAY_HAVE_FRAME = 0x00000040U,
|
||||
|
||||
// Forces the XBL code to treat this node as if it were
|
||||
// in the document and therefore should get bindings attached.
|
||||
NODE_FORCE_XBL_BINDINGS = 0x00000080U,
|
||||
NODE_FORCE_XBL_BINDINGS = 0x00000040U,
|
||||
|
||||
// Whether a binding manager may have a pointer to this
|
||||
NODE_MAY_BE_IN_BINDING_MNGR = 0x00000100U,
|
||||
NODE_MAY_BE_IN_BINDING_MNGR = 0x00000080U,
|
||||
|
||||
NODE_IS_EDITABLE = 0x00000200U,
|
||||
NODE_IS_EDITABLE = 0x00000100U,
|
||||
|
||||
// Optimizations to quickly check whether element may have ID, class or style
|
||||
// attributes. Not all element implementations may use these!
|
||||
NODE_MAY_HAVE_ID = 0x00000400U,
|
||||
NODE_MAY_HAVE_ID = 0x00000200U,
|
||||
// For all Element nodes, NODE_MAY_HAVE_CLASS is guaranteed to be set if the
|
||||
// node in fact has a class, but may be set even if it doesn't.
|
||||
NODE_MAY_HAVE_CLASS = 0x00000800U,
|
||||
NODE_MAY_HAVE_STYLE = 0x00001000U,
|
||||
NODE_MAY_HAVE_CLASS = 0x00000400U,
|
||||
NODE_MAY_HAVE_STYLE = 0x00000800U,
|
||||
|
||||
NODE_IS_INSERTION_PARENT = 0x00002000U,
|
||||
NODE_IS_INSERTION_PARENT = 0x00001000U,
|
||||
|
||||
// Node has an :empty or :-moz-only-whitespace selector
|
||||
NODE_HAS_EMPTY_SELECTOR = 0x00004000U,
|
||||
NODE_HAS_EMPTY_SELECTOR = 0x00002000U,
|
||||
|
||||
// A child of the node has a selector such that any insertion,
|
||||
// removal, or appending of children requires restyling the parent.
|
||||
NODE_HAS_SLOW_SELECTOR = 0x00008000U,
|
||||
NODE_HAS_SLOW_SELECTOR = 0x00004000U,
|
||||
|
||||
// A child of the node has a :first-child, :-moz-first-node,
|
||||
// :only-child, :last-child or :-moz-last-node selector.
|
||||
NODE_HAS_EDGE_CHILD_SELECTOR = 0x00010000U,
|
||||
NODE_HAS_EDGE_CHILD_SELECTOR = 0x00008000U,
|
||||
|
||||
// A child of the node has a selector such that any insertion or
|
||||
// removal of children requires restyling the parent (but append is
|
||||
// OK).
|
||||
NODE_HAS_SLOW_SELECTOR_NOAPPEND
|
||||
= 0x00020000U,
|
||||
= 0x00010000U,
|
||||
|
||||
NODE_ALL_SELECTOR_FLAGS = NODE_HAS_EMPTY_SELECTOR |
|
||||
NODE_HAS_SLOW_SELECTOR |
|
||||
@ -144,10 +140,10 @@ enum {
|
||||
NODE_HAS_SLOW_SELECTOR_NOAPPEND,
|
||||
|
||||
NODE_MAY_HAVE_CONTENT_EDITABLE_ATTR
|
||||
= 0x00040000U,
|
||||
= 0x00020000U,
|
||||
|
||||
NODE_ATTACH_BINDING_ON_POSTCREATE
|
||||
= 0x00080000U,
|
||||
= 0x00040000U,
|
||||
|
||||
// Four bits for the script-type ID
|
||||
NODE_SCRIPT_TYPE_OFFSET = 20,
|
||||
@ -246,8 +242,8 @@ private:
|
||||
|
||||
// IID for the nsINode interface
|
||||
#define NS_INODE_IID \
|
||||
{ 0xc6485d02, 0x7c8a, 0x42fd, \
|
||||
{ 0x97, 0x15, 0x0f, 0x67, 0xfd, 0x69, 0xd5, 0x3e } }
|
||||
{ 0x7244fd04, 0xa8e9, 0x4839, \
|
||||
{ 0x92, 0x48, 0xb2, 0xe0, 0xd8, 0xd8, 0x85, 0x0d } }
|
||||
|
||||
/**
|
||||
* An internal interface that abstracts some DOMNode-related parts that both
|
||||
@ -733,7 +729,6 @@ public:
|
||||
void SetFlags(PtrBits aFlagsToSet)
|
||||
{
|
||||
NS_ASSERTION(!(aFlagsToSet & (NODE_IS_ANONYMOUS |
|
||||
NODE_MAY_HAVE_FRAME |
|
||||
NODE_IS_NATIVE_ANONYMOUS_ROOT |
|
||||
NODE_IS_IN_ANONYMOUS_SUBTREE |
|
||||
NODE_ATTACH_BINDING_ON_POSTCREATE)) ||
|
||||
|
@ -64,7 +64,6 @@ public:
|
||||
// Empty interface
|
||||
|
||||
// nsIContent
|
||||
virtual PRBool MayHaveFrame() const;
|
||||
virtual PRBool IsNodeOfType(PRUint32 aFlags) const;
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -120,13 +119,6 @@ NS_IMPL_ADDREF_INHERITED(nsCommentNode, nsGenericDOMDataNode)
|
||||
NS_IMPL_RELEASE_INHERITED(nsCommentNode, nsGenericDOMDataNode)
|
||||
|
||||
|
||||
// virtual
|
||||
PRBool
|
||||
nsCommentNode::MayHaveFrame() const
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsCommentNode::IsNodeOfType(PRUint32 aFlags) const
|
||||
{
|
||||
|
@ -747,8 +747,8 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
||||
FirePageHideEvent(ourTreeItem, ourChromeEventHandler);
|
||||
FirePageHideEvent(otherTreeItem, otherChromeEventHandler);
|
||||
|
||||
nsIFrame* ourFrame = ourShell->GetPrimaryFrameFor(ourContent);
|
||||
nsIFrame* otherFrame = otherShell->GetPrimaryFrameFor(otherContent);
|
||||
nsIFrame* ourFrame = ourContent->GetPrimaryFrame();
|
||||
nsIFrame* otherFrame = otherContent->GetPrimaryFrame();
|
||||
if (!ourFrame || !otherFrame) {
|
||||
mInSwap = aOther->mInSwap = PR_FALSE;
|
||||
FirePageShowEvent(ourTreeItem, ourChromeEventHandler, PR_TRUE);
|
||||
@ -826,8 +826,8 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
||||
}
|
||||
|
||||
// We shouldn't have changed frames, but be really careful about it
|
||||
if (ourFrame == ourShell->GetPrimaryFrameFor(ourContent) &&
|
||||
otherFrame == otherShell->GetPrimaryFrameFor(otherContent)) {
|
||||
if (ourFrame == ourContent->GetPrimaryFrame() &&
|
||||
otherFrame == otherContent->GetPrimaryFrame()) {
|
||||
ourFrameFrame->EndSwapDocShells(otherFrame);
|
||||
}
|
||||
|
||||
|
@ -767,14 +767,6 @@ nsGenericDOMDataNode::RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMut
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// virtual
|
||||
PRBool
|
||||
nsGenericDOMDataNode::MayHaveFrame() const
|
||||
{
|
||||
nsIContent* parent = GetParent();
|
||||
return parent && parent->MayHaveFrame();
|
||||
}
|
||||
|
||||
nsIContent *
|
||||
nsGenericDOMDataNode::GetBindingParent() const
|
||||
{
|
||||
|
@ -255,8 +255,6 @@ public:
|
||||
virtual already_AddRefed<nsIURI> GetBaseURI() const;
|
||||
virtual PRBool IsLink(nsIURI** aURI) const;
|
||||
|
||||
virtual PRBool MayHaveFrame() const;
|
||||
|
||||
virtual nsIAtom* GetID() const;
|
||||
virtual const nsAttrValue* DoGetClasses() const;
|
||||
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
|
||||
|
@ -396,8 +396,9 @@ nsINode::GetSelectionRootContent(nsIPresShell* aPresShell)
|
||||
if (!IsNodeOfType(eCONTENT))
|
||||
return nsnull;
|
||||
|
||||
nsIFrame* frame =
|
||||
aPresShell->GetPrimaryFrameFor(static_cast<nsIContent*>(this));
|
||||
NS_ASSERTION(GetCurrentDoc() == aPresShell->GetDocument(),
|
||||
"Wrong document somewhere");
|
||||
nsIFrame* frame = static_cast<nsIContent*>(this)->GetPrimaryFrame();
|
||||
if (frame && frame->GetStateBits() & NS_FRAME_INDEPENDENT_SELECTION) {
|
||||
// This node should be a descendant of input/textarea editor.
|
||||
nsIContent* content = GetTextEditorRootContent();
|
||||
@ -3203,24 +3204,6 @@ nsGenericElement::IsNodeOfType(PRUint32 aFlags) const
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// virtual
|
||||
void
|
||||
nsGenericElement::SetMayHaveFrame(PRBool aMayHaveFrame)
|
||||
{
|
||||
if (aMayHaveFrame) {
|
||||
SetFlags(NODE_MAY_HAVE_FRAME);
|
||||
} else {
|
||||
UnsetFlags(NODE_MAY_HAVE_FRAME);
|
||||
}
|
||||
}
|
||||
|
||||
// virtual
|
||||
PRBool
|
||||
nsGenericElement::MayHaveFrame() const
|
||||
{
|
||||
return HasFlag(NODE_MAY_HAVE_FRAME);
|
||||
}
|
||||
|
||||
PRUint32
|
||||
nsGenericElement::GetScriptTypeID() const
|
||||
{
|
||||
@ -3488,17 +3471,6 @@ nsGenericElement::DispatchClickEvent(nsPresContext* aPresContext,
|
||||
return DispatchEvent(aPresContext, &event, aTarget, aFullDispatch, aStatus);
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
nsGenericElement::GetPrimaryFrame()
|
||||
{
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
if (!doc) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
return GetPrimaryFrameFor(this, doc);
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
nsGenericElement::GetPrimaryFrame(mozFlushType aType)
|
||||
{
|
||||
@ -3511,21 +3483,7 @@ nsGenericElement::GetPrimaryFrame(mozFlushType aType)
|
||||
// information
|
||||
doc->FlushPendingNotifications(aType);
|
||||
|
||||
return GetPrimaryFrameFor(this, doc);
|
||||
}
|
||||
|
||||
/* static */
|
||||
nsIFrame*
|
||||
nsGenericElement::GetPrimaryFrameFor(nsIContent* aContent,
|
||||
nsIDocument* aDocument)
|
||||
{
|
||||
// Get presentation shell 0
|
||||
nsIPresShell *presShell = aDocument->GetPrimaryShell();
|
||||
if (!presShell) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
return presShell->GetPrimaryFrameFor(aContent);
|
||||
return GetPrimaryFrame();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -422,8 +422,6 @@ public:
|
||||
virtual PRBool IsNodeOfType(PRUint32 aFlags) const;
|
||||
virtual already_AddRefed<nsIURI> GetBaseURI() const;
|
||||
virtual PRBool IsLink(nsIURI** aURI) const;
|
||||
virtual void SetMayHaveFrame(PRBool aMayHaveFrame);
|
||||
virtual PRBool MayHaveFrame() const;
|
||||
|
||||
virtual PRUint32 GetScriptTypeID() const;
|
||||
NS_IMETHOD SetScriptTypeID(PRUint32 aLang);
|
||||
@ -705,32 +703,15 @@ public:
|
||||
nsEventStatus* aStatus);
|
||||
|
||||
/**
|
||||
* Get the primary frame for this content without flushing (see
|
||||
* GetPrimaryFrameFor)
|
||||
*
|
||||
* @return the primary frame
|
||||
*/
|
||||
nsIFrame* GetPrimaryFrame();
|
||||
|
||||
/**
|
||||
* Get the primary frame for this content with flushing (see
|
||||
* GetPrimaryFrameFor).
|
||||
* Get the primary frame for this content with flushing
|
||||
*
|
||||
* @param aType the kind of flush to do, typically Flush_Frames or
|
||||
* Flush_Layout
|
||||
* @return the primary frame
|
||||
*/
|
||||
nsIFrame* GetPrimaryFrame(mozFlushType aType);
|
||||
|
||||
/**
|
||||
* Get the primary frame for a piece of content without flushing.
|
||||
*
|
||||
* @param aContent the content to get the primary frame for
|
||||
* @param aDocument the document for this content
|
||||
* @return the primary frame
|
||||
*/
|
||||
static nsIFrame* GetPrimaryFrameFor(nsIContent* aContent,
|
||||
nsIDocument* aDocument);
|
||||
// Work around silly C++ name hiding stuff
|
||||
nsIFrame* GetPrimaryFrame() const { return nsIContent::GetPrimaryFrame(); }
|
||||
|
||||
/**
|
||||
* Struct that stores info on an attribute. The name and value must
|
||||
|
@ -1665,17 +1665,7 @@ nsObjectLoadingContent::GetExistingFrame(FlushType aFlushType)
|
||||
|
||||
nsIFrame* frame;
|
||||
do {
|
||||
nsIDocument* doc = thisContent->GetCurrentDoc();
|
||||
if (!doc) {
|
||||
return nsnull; // No current doc -> no frame
|
||||
}
|
||||
|
||||
nsIPresShell* shell = doc->GetPrimaryShell();
|
||||
if (!shell) {
|
||||
return nsnull; // No presentation -> no frame
|
||||
}
|
||||
|
||||
frame = shell->GetPrimaryFrameFor(thisContent);
|
||||
frame = thisContent->GetPrimaryFrame();
|
||||
if (!frame) {
|
||||
return nsnull;
|
||||
}
|
||||
@ -1686,6 +1676,8 @@ nsObjectLoadingContent::GetExistingFrame(FlushType aFlushType)
|
||||
|
||||
// OK, let's flush out and try again. Note that we want to reget
|
||||
// the document, etc, since flushing might run script.
|
||||
nsIDocument* doc = thisContent->GetCurrentDoc();
|
||||
NS_ASSERTION(doc, "Frame but no document?");
|
||||
mozFlushType flushType =
|
||||
aFlushType == eFlushLayout ? Flush_Layout : Flush_ContentAndNotify;
|
||||
doc->FlushPendingNotifications(flushType);
|
||||
|
@ -2061,10 +2061,10 @@ static void ExtractRectFromOffset(nsIFrame* aFrame,
|
||||
}
|
||||
}
|
||||
|
||||
static nsresult GetPartialTextRect(nsLayoutUtils::RectCallback* aCallback, nsIPresShell* aPresShell,
|
||||
static nsresult GetPartialTextRect(nsLayoutUtils::RectCallback* aCallback,
|
||||
nsIContent* aContent, PRInt32 aStartOffset, PRInt32 aEndOffset)
|
||||
{
|
||||
nsIFrame* frame = aPresShell->GetPrimaryFrameFor(aContent);
|
||||
nsIFrame* frame = aContent->GetPrimaryFrame();
|
||||
if (frame && frame->GetType() == nsGkAtoms::textFrame) {
|
||||
nsTextFrame* textFrame = static_cast<nsTextFrame*>(frame);
|
||||
nsIFrame* relativeTo = nsLayoutUtils::GetContainingBlockForClientRect(textFrame);
|
||||
@ -2090,30 +2090,24 @@ static nsresult GetPartialTextRect(nsLayoutUtils::RectCallback* aCallback, nsIPr
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsIPresShell* GetPresShell(nsINode* aNode, PRBool aFlush)
|
||||
{
|
||||
nsCOMPtr<nsIDocument> document = aNode->GetCurrentDoc();
|
||||
if (!document)
|
||||
return nsnull;
|
||||
|
||||
if (aFlush) {
|
||||
document->FlushPendingNotifications(Flush_Layout);
|
||||
}
|
||||
|
||||
return document->GetPrimaryShell();
|
||||
}
|
||||
|
||||
static void CollectClientRects(nsLayoutUtils::RectCallback* aCollector,
|
||||
nsRange* aRange,
|
||||
nsINode* aStartParent, PRInt32 aStartOffset,
|
||||
nsINode* aEndParent, PRInt32 aEndOffset)
|
||||
{
|
||||
// Hold strong pointers across the flush
|
||||
nsCOMPtr<nsIDOMNode> startContainer = do_QueryInterface(aStartParent);
|
||||
nsCOMPtr<nsIDOMNode> endContainer = do_QueryInterface(aEndParent);
|
||||
|
||||
nsIPresShell* presShell = GetPresShell(aStartParent, PR_TRUE);
|
||||
if (!presShell) {
|
||||
//not in the document
|
||||
// Flush out layout so our frames are up to date.
|
||||
if (!aStartParent->IsInDoc()) {
|
||||
return;
|
||||
}
|
||||
|
||||
aStartParent->GetCurrentDoc()->FlushPendingNotifications(Flush_Layout);
|
||||
|
||||
// Recheck whether we're still in the document
|
||||
if (!aStartParent->IsInDoc()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2126,7 +2120,7 @@ static void CollectClientRects(nsLayoutUtils::RectCallback* aCollector,
|
||||
// the range is collapsed, only continue if the cursor is in a text node
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aStartParent);
|
||||
if (content->IsNodeOfType(nsINode::eTEXT)) {
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(content);
|
||||
nsIFrame* frame = content->GetPrimaryFrame();
|
||||
if (frame && frame->GetType() == nsGkAtoms::textFrame) {
|
||||
nsTextFrame* textFrame = static_cast<nsTextFrame*>(frame);
|
||||
PRInt32 outOffset;
|
||||
@ -2154,17 +2148,15 @@ static void CollectClientRects(nsLayoutUtils::RectCallback* aCollector,
|
||||
if (node == startContainer) {
|
||||
PRInt32 offset = startContainer == endContainer ?
|
||||
aEndOffset : content->GetText()->GetLength();
|
||||
GetPartialTextRect(aCollector, presShell, content,
|
||||
aStartOffset, offset);
|
||||
GetPartialTextRect(aCollector, content, aStartOffset, offset);
|
||||
continue;
|
||||
} else if (node == endContainer) {
|
||||
GetPartialTextRect(aCollector, presShell, content,
|
||||
0, aEndOffset);
|
||||
GetPartialTextRect(aCollector, content, 0, aEndOffset);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(content);
|
||||
nsIFrame* frame = content->GetPrimaryFrame();
|
||||
if (frame) {
|
||||
nsLayoutUtils::GetAllInFlowRects(frame,
|
||||
nsLayoutUtils::GetContainingBlockForClientRect(frame), aCollector);
|
||||
@ -2182,10 +2174,6 @@ nsRange::GetBoundingClientRect(nsIDOMClientRect** aResult)
|
||||
|
||||
NS_ADDREF(*aResult = rect);
|
||||
|
||||
nsIPresShell* presShell = GetPresShell(mStartParent, PR_FALSE);
|
||||
if (!presShell)
|
||||
return NS_OK;
|
||||
|
||||
nsLayoutUtils::RectAccumulator accumulator;
|
||||
|
||||
CollectClientRects(&accumulator, this, mStartParent, mStartOffset,
|
||||
@ -2206,12 +2194,6 @@ nsRange::GetClientRects(nsIDOMClientRectList** aResult)
|
||||
if (!rectList)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsIPresShell* presShell = GetPresShell(mStartParent, PR_FALSE);
|
||||
if (!presShell) {
|
||||
rectList.forget(aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsLayoutUtils::RectListBuilder builder(rectList);
|
||||
|
||||
CollectClientRects(&builder, this, mStartParent, mStartOffset,
|
||||
|
@ -494,8 +494,7 @@ static nsINode* AdjustTextRectNode(nsINode* aNode,
|
||||
|
||||
// Similar to nsFrameSelection::GetFrameForNodeOffset,
|
||||
// but this is more flexible for OnQueryTextRect to use
|
||||
static nsresult GetFrameForTextRect(nsIPresShell* aPresShell,
|
||||
nsINode* aNode,
|
||||
static nsresult GetFrameForTextRect(nsINode* aNode,
|
||||
PRInt32 aOffset,
|
||||
PRBool aHint,
|
||||
nsIFrame** aReturnFrame)
|
||||
@ -503,7 +502,7 @@ static nsresult GetFrameForTextRect(nsIPresShell* aPresShell,
|
||||
NS_ENSURE_TRUE(aNode && aNode->IsNodeOfType(nsINode::eCONTENT),
|
||||
NS_ERROR_UNEXPECTED);
|
||||
nsIContent* content = static_cast<nsIContent*>(aNode);
|
||||
nsIFrame* frame = aPresShell->GetPrimaryFrameFor(content);
|
||||
nsIFrame* frame = content->GetPrimaryFrame();
|
||||
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
|
||||
PRInt32 childOffset = 0;
|
||||
return frame->GetChildFrameContainingOffset(aOffset, aHint, &childOffset,
|
||||
@ -539,8 +538,7 @@ nsContentEventHandler::OnQueryTextRect(nsQueryContentEvent* aEvent)
|
||||
node = AdjustTextRectNode(range->GetStartParent(), offset);
|
||||
}
|
||||
nsIFrame* firstFrame = nsnull;
|
||||
rv = GetFrameForTextRect(mPresShell, node, offset,
|
||||
PR_TRUE, &firstFrame);
|
||||
rv = GetFrameForTextRect(node, offset, PR_TRUE, &firstFrame);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// get the starting frame rect
|
||||
@ -558,8 +556,7 @@ nsContentEventHandler::OnQueryTextRect(nsQueryContentEvent* aEvent)
|
||||
offset = range->EndOffset();
|
||||
node = AdjustTextRectNode(range->GetEndParent(), offset);
|
||||
nsIFrame* lastFrame = nsnull;
|
||||
rv = GetFrameForTextRect(mPresShell, node, offset,
|
||||
range->Collapsed(), &lastFrame);
|
||||
rv = GetFrameForTextRect(node, offset, range->Collapsed(), &lastFrame);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// iterate over all covered frames
|
||||
@ -571,7 +568,7 @@ nsContentEventHandler::OnQueryTextRect(nsQueryContentEvent* aEvent)
|
||||
node = iter->GetCurrentNode();
|
||||
if (!node || !node->IsNodeOfType(nsINode::eCONTENT))
|
||||
continue;
|
||||
frame = mPresShell->GetPrimaryFrameFor(static_cast<nsIContent*>(node));
|
||||
frame = static_cast<nsIContent*>(node)->GetPrimaryFrame();
|
||||
} while (!frame && !iter->IsDone());
|
||||
if (!frame) {
|
||||
// this can happen when the end offset of the range is 0.
|
||||
@ -610,7 +607,7 @@ nsContentEventHandler::OnQueryEditorRect(nsQueryContentEvent* aEvent)
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsIFrame* frame = mPresShell->GetPrimaryFrameFor(mRootContent);
|
||||
nsIFrame* frame = mRootContent->GetPrimaryFrame();
|
||||
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
|
||||
|
||||
// get rect for first frame
|
||||
|
@ -1444,12 +1444,12 @@ nsEventStateManager::ExecuteAccessKey(nsTArray<PRUint32>& aAccessCharCodes,
|
||||
AppendUCS4ToUTF16(ch, accessKey);
|
||||
for (count = 1; count <= length; ++count) {
|
||||
content = mAccessKeys[(start + count) % length];
|
||||
frame = mPresContext->PresShell()->GetPrimaryFrameFor(content);
|
||||
frame = content->GetPrimaryFrame();
|
||||
if (IsAccessKeyTarget(content, frame, accessKey)) {
|
||||
PRBool shouldActivate = sKeyCausesActivation;
|
||||
while (shouldActivate && ++count <= length) {
|
||||
nsIContent *oc = mAccessKeys[(start + count) % length];
|
||||
nsIFrame *of = mPresContext->PresShell()->GetPrimaryFrameFor(oc);
|
||||
nsIFrame *of = oc->GetPrimaryFrame();
|
||||
if (IsAccessKeyTarget(oc, of, accessKey))
|
||||
shouldActivate = PR_FALSE;
|
||||
}
|
||||
@ -1683,93 +1683,88 @@ nsEventStateManager::FireContextClick()
|
||||
// the same. (Note: saari and I have decided that we don't have to reset |mCurrentTarget|
|
||||
// when we're through because no one else is doing anything more with this
|
||||
// event and it will get reset on the very next event to the correct frame).
|
||||
mCurrentTarget = nsnull;
|
||||
nsIPresShell *shell = mPresContext->GetPresShell();
|
||||
if ( shell ) {
|
||||
mCurrentTarget = shell->GetPrimaryFrameFor(mGestureDownFrameOwner);
|
||||
mCurrentTarget = mPresContext->GetPrimaryFrameFor(mGestureDownContent);
|
||||
if (mCurrentTarget) {
|
||||
NS_ASSERTION(mPresContext == mCurrentTarget->PresContext(),
|
||||
"a prescontext returned a primary frame that didn't belong to it?");
|
||||
|
||||
if ( mCurrentTarget ) {
|
||||
NS_ASSERTION(mPresContext == mCurrentTarget->PresContext(),
|
||||
"a prescontext returned a primary frame that didn't belong to it?");
|
||||
// before dispatching, check that we're not on something that
|
||||
// doesn't get a context menu
|
||||
nsIAtom *tag = mGestureDownContent->Tag();
|
||||
PRBool allowedToDispatch = PR_TRUE;
|
||||
|
||||
// before dispatching, check that we're not on something that
|
||||
// doesn't get a context menu
|
||||
nsIAtom *tag = mGestureDownContent->Tag();
|
||||
PRBool allowedToDispatch = PR_TRUE;
|
||||
|
||||
if (mGestureDownContent->IsXUL()) {
|
||||
if (tag == nsGkAtoms::scrollbar ||
|
||||
tag == nsGkAtoms::scrollbarbutton ||
|
||||
tag == nsGkAtoms::button)
|
||||
if (mGestureDownContent->IsXUL()) {
|
||||
if (tag == nsGkAtoms::scrollbar ||
|
||||
tag == nsGkAtoms::scrollbarbutton ||
|
||||
tag == nsGkAtoms::button)
|
||||
allowedToDispatch = PR_FALSE;
|
||||
else if (tag == nsGkAtoms::toolbarbutton) {
|
||||
// a <toolbarbutton> that has the container attribute set
|
||||
// will already have its own dropdown.
|
||||
if (nsContentUtils::HasNonEmptyAttr(mGestureDownContent,
|
||||
kNameSpaceID_None, nsGkAtoms::container)) {
|
||||
allowedToDispatch = PR_FALSE;
|
||||
else if (tag == nsGkAtoms::toolbarbutton) {
|
||||
// a <toolbarbutton> that has the container attribute set
|
||||
// will already have its own dropdown.
|
||||
if (nsContentUtils::HasNonEmptyAttr(mGestureDownContent,
|
||||
kNameSpaceID_None, nsGkAtoms::container)) {
|
||||
allowedToDispatch = PR_FALSE;
|
||||
} else {
|
||||
// If the toolbar button has an open menu, don't attempt to open
|
||||
} else {
|
||||
// If the toolbar button has an open menu, don't attempt to open
|
||||
// a second menu
|
||||
if (mGestureDownContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::open,
|
||||
nsGkAtoms::_true, eCaseMatters)) {
|
||||
allowedToDispatch = PR_FALSE;
|
||||
}
|
||||
if (mGestureDownContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::open,
|
||||
nsGkAtoms::_true, eCaseMatters)) {
|
||||
allowedToDispatch = PR_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (mGestureDownContent->IsHTML()) {
|
||||
nsCOMPtr<nsIFormControl> formCtrl(do_QueryInterface(mGestureDownContent));
|
||||
}
|
||||
else if (mGestureDownContent->IsHTML()) {
|
||||
nsCOMPtr<nsIFormControl> formCtrl(do_QueryInterface(mGestureDownContent));
|
||||
|
||||
if (formCtrl) {
|
||||
// of all form controls, only ones dealing with text are
|
||||
// allowed to have context menus
|
||||
PRInt32 type = formCtrl->GetType();
|
||||
if (formCtrl) {
|
||||
// of all form controls, only ones dealing with text are
|
||||
// allowed to have context menus
|
||||
PRInt32 type = formCtrl->GetType();
|
||||
|
||||
allowedToDispatch = (type == NS_FORM_INPUT_TEXT ||
|
||||
type == NS_FORM_INPUT_PASSWORD ||
|
||||
type == NS_FORM_INPUT_FILE ||
|
||||
type == NS_FORM_TEXTAREA);
|
||||
}
|
||||
else if (tag == nsGkAtoms::applet ||
|
||||
tag == nsGkAtoms::embed ||
|
||||
tag == nsGkAtoms::object) {
|
||||
allowedToDispatch = PR_FALSE;
|
||||
allowedToDispatch = (type == NS_FORM_INPUT_TEXT ||
|
||||
type == NS_FORM_INPUT_PASSWORD ||
|
||||
type == NS_FORM_INPUT_FILE ||
|
||||
type == NS_FORM_TEXTAREA);
|
||||
}
|
||||
else if (tag == nsGkAtoms::applet ||
|
||||
tag == nsGkAtoms::embed ||
|
||||
tag == nsGkAtoms::object) {
|
||||
allowedToDispatch = PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (allowedToDispatch) {
|
||||
// make sure the widget sticks around
|
||||
nsCOMPtr<nsIWidget> targetWidget(mCurrentTarget->GetWindow());
|
||||
// init the event while mCurrentTarget is still good
|
||||
nsMouseEvent event(PR_TRUE, NS_CONTEXTMENU,
|
||||
targetWidget,
|
||||
nsMouseEvent::eReal);
|
||||
event.clickCount = 1;
|
||||
FillInEventFromGestureDown(&event);
|
||||
|
||||
// stop selection tracking, we're in control now
|
||||
if (mCurrentTarget)
|
||||
{
|
||||
nsCOMPtr<nsFrameSelection> frameSel =
|
||||
mCurrentTarget->GetFrameSelection();
|
||||
|
||||
if (frameSel && frameSel->GetMouseDownState()) {
|
||||
// note that this can cause selection changed events to fire if we're in
|
||||
// a text field, which will null out mCurrentTarget
|
||||
frameSel->SetMouseDownState(PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
if (allowedToDispatch) {
|
||||
// make sure the widget sticks around
|
||||
nsCOMPtr<nsIWidget> targetWidget(mCurrentTarget->GetWindow());
|
||||
// init the event while mCurrentTarget is still good
|
||||
nsMouseEvent event(PR_TRUE, NS_CONTEXTMENU,
|
||||
targetWidget,
|
||||
nsMouseEvent::eReal);
|
||||
event.clickCount = 1;
|
||||
FillInEventFromGestureDown(&event);
|
||||
|
||||
// stop selection tracking, we're in control now
|
||||
if (mCurrentTarget)
|
||||
{
|
||||
nsCOMPtr<nsFrameSelection> frameSel =
|
||||
mCurrentTarget->GetFrameSelection();
|
||||
|
||||
if (frameSel && frameSel->GetMouseDownState()) {
|
||||
// note that this can cause selection changed events to fire if we're in
|
||||
// a text field, which will null out mCurrentTarget
|
||||
frameSel->SetMouseDownState(PR_FALSE);
|
||||
}
|
||||
}
|
||||
// dispatch to DOM
|
||||
nsEventDispatcher::Dispatch(mGestureDownContent, mPresContext, &event,
|
||||
nsnull, &status);
|
||||
|
||||
// dispatch to DOM
|
||||
nsEventDispatcher::Dispatch(mGestureDownContent, mPresContext, &event,
|
||||
nsnull, &status);
|
||||
|
||||
// We don't need to dispatch to frame handling because no frames
|
||||
// watch NS_CONTEXTMENU except for nsMenuFrame and that's only for
|
||||
// dismissal. That's just as well since we don't really know
|
||||
// which frame to send it to.
|
||||
}
|
||||
// We don't need to dispatch to frame handling because no frames
|
||||
// watch NS_CONTEXTMENU except for nsMenuFrame and that's only for
|
||||
// dismissal. That's just as well since we don't really know
|
||||
// which frame to send it to.
|
||||
}
|
||||
}
|
||||
|
||||
@ -1874,7 +1869,7 @@ nsEventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
|
||||
{
|
||||
NS_ASSERTION(aPresContext, "This shouldn't happen.");
|
||||
if ( IsTrackingDragGesture() ) {
|
||||
mCurrentTarget = aPresContext->GetPresShell()->GetPrimaryFrameFor(mGestureDownFrameOwner);
|
||||
mCurrentTarget = mGestureDownFrameOwner->GetPrimaryFrame();
|
||||
|
||||
if (!mCurrentTarget) {
|
||||
StopTrackingDragGesture();
|
||||
@ -2216,16 +2211,9 @@ nsEventStateManager::DoDefaultDragStart(nsPresContext* aPresContext,
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(dragTarget);
|
||||
if (content->NodeInfo()->Equals(nsGkAtoms::treechildren,
|
||||
kNameSpaceID_XUL)) {
|
||||
nsIDocument* doc = content->GetCurrentDoc();
|
||||
if (doc) {
|
||||
nsIPresShell* presShell = doc->GetPrimaryShell();
|
||||
if (presShell) {
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(content);
|
||||
if (frame) {
|
||||
nsTreeBodyFrame* treeBody = do_QueryFrame(frame);
|
||||
treeBody->GetSelectionRegion(getter_AddRefs(region));
|
||||
}
|
||||
}
|
||||
nsTreeBodyFrame* treeBody = do_QueryFrame(content->GetPrimaryFrame());
|
||||
if (treeBody) {
|
||||
treeBody->GetSelectionRegion(getter_AddRefs(region));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2788,7 +2776,7 @@ nsEventStateManager::GetParentScrollingView(nsInputEvent *aEvent,
|
||||
because they are not used by DoScrollText().
|
||||
*/
|
||||
|
||||
nsIFrame* frameFrame = pPresShell->GetPrimaryFrameFor(frameContent);
|
||||
nsIFrame* frameFrame = frameContent->GetPrimaryFrame();
|
||||
if (!frameFrame) return NS_ERROR_FAILURE;
|
||||
|
||||
NS_IF_ADDREF(presCtxOuter = pPresShell->GetPresContext());
|
||||
@ -3577,14 +3565,11 @@ public:
|
||||
virtual void HandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
{
|
||||
if (aVisitor.mPresContext) {
|
||||
nsIPresShell* shell = aVisitor.mPresContext->GetPresShell();
|
||||
if (shell) {
|
||||
nsIFrame* frame = shell->GetPrimaryFrameFor(mTarget);
|
||||
if (frame) {
|
||||
frame->HandleEvent(aVisitor.mPresContext,
|
||||
(nsGUIEvent*) aVisitor.mEvent,
|
||||
&aVisitor.mEventStatus);
|
||||
}
|
||||
nsIFrame* frame = aVisitor.mPresContext->GetPrimaryFrameFor(mTarget);
|
||||
if (frame) {
|
||||
frame->HandleEvent(aVisitor.mPresContext,
|
||||
(nsGUIEvent*) aVisitor.mEvent,
|
||||
&aVisitor.mEventStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3616,12 +3601,11 @@ nsEventStateManager::DispatchMouseEvent(nsGUIEvent* aEvent, PRUint32 aMessage,
|
||||
nsEventDispatcher::Dispatch(aTargetContent, mPresContext, &event, nsnull,
|
||||
&status, &callback);
|
||||
|
||||
nsIPresShell *shell = mPresContext ? mPresContext->GetPresShell() : nsnull;
|
||||
if (shell) {
|
||||
// Although the primary frame was checked in event callback,
|
||||
// it may not be the same object after event dispatching and handling.
|
||||
// So we need to refetch it.
|
||||
targetFrame = shell->GetPrimaryFrameFor(aTargetContent);
|
||||
// Although the primary frame was checked in event callback,
|
||||
// it may not be the same object after event dispatching and handling.
|
||||
// So we need to refetch it.
|
||||
if (mPresContext) {
|
||||
targetFrame = mPresContext->GetPrimaryFrameFor(aTargetContent);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4059,7 +4043,7 @@ nsEventStateManager::GetEventTarget(nsIFrame **aFrame)
|
||||
}
|
||||
|
||||
if (mCurrentTargetContent) {
|
||||
mCurrentTarget = shell->GetPrimaryFrameFor(mCurrentTargetContent);
|
||||
mCurrentTarget = mPresContext->GetPrimaryFrameFor(mCurrentTargetContent);
|
||||
if (mCurrentTarget) {
|
||||
*aFrame = mCurrentTarget;
|
||||
return NS_OK;
|
||||
@ -4232,8 +4216,10 @@ nsEventStateManager::SetContentState(nsIContent *aContent, PRInt32 aState)
|
||||
if (!mPresContext || mPresContext->IsDynamic()) {
|
||||
newHover = aContent;
|
||||
} else {
|
||||
nsIFrame *frame = aContent ?
|
||||
mPresContext->PresShell()->GetPrimaryFrameFor(aContent) : nsnull;
|
||||
NS_ASSERTION(!aContent ||
|
||||
aContent->GetCurrentDoc() == mPresContext->PresShell()->GetDocument(),
|
||||
"Unexpected document");
|
||||
nsIFrame *frame = aContent ? aContent->GetPrimaryFrame() : nsnull;
|
||||
if (frame && nsLayoutUtils::IsViewportScrollbarFrame(frame)) {
|
||||
// The scrollbars of viewport should not ignore the hover state.
|
||||
// Because they are *not* the content of the web page.
|
||||
|
@ -285,8 +285,7 @@ nsTextStateManager::Init(nsIWidget* aWidget,
|
||||
// get selection and root content
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
if (aNode->IsNodeOfType(nsINode::eCONTENT)) {
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(
|
||||
static_cast<nsIContent*>(aNode));
|
||||
nsIFrame* frame = static_cast<nsIContent*>(aNode)->GetPrimaryFrame();
|
||||
NS_ENSURE_TRUE(frame, NS_ERROR_UNEXPECTED);
|
||||
|
||||
frame->GetSelectionController(aPresContext,
|
||||
|
@ -1245,17 +1245,14 @@ nsGenericHTMLElement::GetAttributeMappingFunction() const
|
||||
return &MapCommonAttributesInto;
|
||||
}
|
||||
|
||||
// static
|
||||
nsIFormControlFrame*
|
||||
nsGenericHTMLElement::GetFormControlFrameFor(nsIContent* aContent,
|
||||
nsIDocument* aDocument,
|
||||
PRBool aFlushContent)
|
||||
nsGenericHTMLElement::GetFormControlFrame(PRBool aFlushFrames)
|
||||
{
|
||||
if (aFlushContent) {
|
||||
if (aFlushFrames && IsInDoc()) {
|
||||
// Cause a flush of the frames, so we get up-to-date frame information
|
||||
aDocument->FlushPendingNotifications(Flush_Frames);
|
||||
GetCurrentDoc()->FlushPendingNotifications(Flush_Frames);
|
||||
}
|
||||
nsIFrame* frame = GetPrimaryFrameFor(aContent, aDocument);
|
||||
nsIFrame* frame = GetPrimaryFrame();
|
||||
if (frame) {
|
||||
nsIFormControlFrame* form_frame = do_QueryFrame(frame);
|
||||
if (form_frame) {
|
||||
|
@ -232,21 +232,13 @@ public:
|
||||
void GetBaseTarget(nsAString& aBaseTarget) const;
|
||||
|
||||
/**
|
||||
* Get the primary form control frame for this content (see
|
||||
* GetFormControlFrameFor)
|
||||
* Get the primary form control frame for this element. Same as
|
||||
* GetPrimaryFrame(), except it QI's to nsIFormControlFrame.
|
||||
*
|
||||
* @param aFlushContent whether to flush the content sink
|
||||
* @return the primary form control frame (or null)
|
||||
* @param aFlush whether to flush out frames so that they're up to date.
|
||||
* @return the primary frame as nsIFormControlFrame
|
||||
*/
|
||||
nsIFormControlFrame* GetFormControlFrame(PRBool aFlushContent)
|
||||
{
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
if (!doc) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
return GetFormControlFrameFor(this, doc, aFlushContent);
|
||||
}
|
||||
nsIFormControlFrame* GetFormControlFrame(PRBool aFlushFrames);
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
@ -444,19 +436,6 @@ public:
|
||||
*/
|
||||
static void MapScrollingAttributeInto(const nsMappedAttributes* aAttributes,
|
||||
nsRuleData* aData);
|
||||
/**
|
||||
* Get the primary form control frame for a piece of content. Same as
|
||||
* GetPrimaryFrameFor, except it QI's to nsIFormControlFrame.
|
||||
*
|
||||
* @param aContent the content to get the primary frame for
|
||||
* @param aDocument the document for this content
|
||||
* @param aFlushContent whether to flush the content sink, which creates
|
||||
* frames for content that do not already have it. EXPENSIVE.
|
||||
* @return the primary frame as nsIFormControlFrame
|
||||
*/
|
||||
static nsIFormControlFrame* GetFormControlFrameFor(nsIContent* aContent,
|
||||
nsIDocument* aDocument,
|
||||
PRBool aFlushContent);
|
||||
/**
|
||||
* Get the presentation state for a piece of content, or create it if it does
|
||||
* not exist. Generally used by SaveState().
|
||||
|
@ -521,14 +521,9 @@ nsHTMLCanvasElement::SetWriteOnly()
|
||||
NS_IMETHODIMP
|
||||
nsHTMLCanvasElement::InvalidateFrame()
|
||||
{
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
if (!doc) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// We don't need to flush anything here; if there's no frame or if
|
||||
// we plan to reframe we don't need to invalidate it anyway.
|
||||
nsIFrame *frame = GetPrimaryFrameFor(this, doc);
|
||||
nsIFrame *frame = GetPrimaryFrame();
|
||||
if (frame) {
|
||||
nsRect r = frame->GetRect();
|
||||
r.x = r.y = 0;
|
||||
@ -541,14 +536,9 @@ nsHTMLCanvasElement::InvalidateFrame()
|
||||
NS_IMETHODIMP
|
||||
nsHTMLCanvasElement::InvalidateFrameSubrect(const gfxRect& damageRect)
|
||||
{
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
if (!doc) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// We don't need to flush anything here; if there's no frame or if
|
||||
// we plan to reframe we don't need to invalidate it anyway.
|
||||
nsIFrame *frame = GetPrimaryFrameFor(this, doc);
|
||||
nsIFrame *frame = GetPrimaryFrame();
|
||||
if (frame) {
|
||||
// Frame might be dirty, but we don't care about that; if the geometry
|
||||
// changes the right invalidates will happen anyway. Don't assert on our
|
||||
|
@ -952,15 +952,11 @@ void nsHTMLMediaElement::SetPlayedOrSeeked(PRBool aValue)
|
||||
mHasPlayedOrSeeked = aValue;
|
||||
|
||||
// Force a reflow so that the poster frame hides or shows immediately.
|
||||
nsIDocument *doc = GetDocument();
|
||||
if (!doc) return;
|
||||
nsIPresShell *presShell = doc->GetPrimaryShell();
|
||||
if (!presShell) return;
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(this);
|
||||
nsIFrame* frame = GetPrimaryFrame();
|
||||
if (!frame) return;
|
||||
presShell->FrameNeedsReflow(frame,
|
||||
nsIPresShell::eTreeChange,
|
||||
NS_FRAME_IS_DIRTY);
|
||||
frame->PresContext()->PresShell()->FrameNeedsReflow(frame,
|
||||
nsIPresShell::eTreeChange,
|
||||
NS_FRAME_IS_DIRTY);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLMediaElement::Play()
|
||||
@ -2027,9 +2023,7 @@ nsHTMLMediaElement::CopyInnerTo(nsGenericElement* aDest) const
|
||||
dest->mPrintSurface = mPrintSurface;
|
||||
dest->mMediaSize = mMediaSize;
|
||||
} else {
|
||||
nsIFrame* frame =
|
||||
GetPrimaryFrameFor(const_cast<nsHTMLMediaElement*>(this),
|
||||
GetOwnerDoc());
|
||||
nsIFrame* frame = GetPrimaryFrame();
|
||||
nsCOMPtr<nsIDOMElement> elem;
|
||||
if (frame && frame->GetType() == nsGkAtoms::HTMLVideoFrame &&
|
||||
static_cast<nsVideoFrame*>(frame)->ShouldDisplayPoster()) {
|
||||
|
@ -2321,11 +2321,6 @@ nsHTMLDocument::GetBodySize(PRInt32* aWidth,
|
||||
|
||||
FlushPendingNotifications(Flush_Layout);
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
|
||||
|
||||
if (!shell)
|
||||
return NS_OK;
|
||||
|
||||
// Find the <body> element: this is what we'll want to use for the
|
||||
// document's width and height values.
|
||||
nsIContent* body = GetBodyContent();
|
||||
@ -2334,7 +2329,7 @@ nsHTMLDocument::GetBodySize(PRInt32* aWidth,
|
||||
}
|
||||
|
||||
// Now grab its frame
|
||||
nsIFrame* frame = shell->GetPrimaryFrameFor(body);
|
||||
nsIFrame* frame = body->GetPrimaryFrame();
|
||||
if (!frame)
|
||||
return NS_OK;
|
||||
|
||||
|
@ -138,7 +138,7 @@ nsPluginStreamListener::SetupPlugin()
|
||||
// nsObjectFrame does that at the end of reflow.
|
||||
shell->FlushPendingNotifications(Flush_Layout);
|
||||
|
||||
nsIFrame* frame = shell->GetPrimaryFrameFor(embed);
|
||||
nsIFrame* frame = embed->GetPrimaryFrame();
|
||||
if (!frame) {
|
||||
mPluginDoc->AllowNormalInstantiation();
|
||||
return NS_OK;
|
||||
@ -341,15 +341,8 @@ nsPluginDocument::Print()
|
||||
{
|
||||
NS_ENSURE_TRUE(mPluginContent, NS_ERROR_FAILURE);
|
||||
|
||||
nsIPresShell *shell = GetPrimaryShell();
|
||||
if (!shell) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIFrame* frame = shell->GetPrimaryFrameFor(mPluginContent);
|
||||
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
|
||||
|
||||
nsIObjectFrame* objectFrame = do_QueryFrame(frame);
|
||||
nsIObjectFrame* objectFrame =
|
||||
do_QueryFrame(mPluginContent->GetPrimaryFrame());
|
||||
if (objectFrame) {
|
||||
nsCOMPtr<nsIPluginInstance> pi;
|
||||
objectFrame->GetPluginInstance(*getter_AddRefs(pi));
|
||||
|
@ -1091,26 +1091,18 @@ nsSVGSVGElement::WillBeOutermostSVG(nsIContent* aParent,
|
||||
void
|
||||
nsSVGSVGElement::InvalidateTransformNotifyFrame()
|
||||
{
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
if (!doc) return;
|
||||
nsIPresShell* presShell = doc->GetPrimaryShell();
|
||||
if (!presShell) return;
|
||||
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(this);
|
||||
if (frame) {
|
||||
nsISVGSVGFrame* svgframe = do_QueryFrame(frame);
|
||||
if (svgframe) {
|
||||
svgframe->NotifyViewportChange();
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else {
|
||||
// XXX we get here during nsSVGOuterSVGFrame::Init() since that
|
||||
// function is called before the presshell association between us
|
||||
// and our frame is established.
|
||||
NS_WARNING("wrong frame type");
|
||||
}
|
||||
#endif
|
||||
nsISVGSVGFrame* svgframe = do_QueryFrame(GetPrimaryFrame());
|
||||
if (svgframe) {
|
||||
svgframe->NotifyViewportChange();
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else {
|
||||
// XXX we get here during nsSVGOuterSVGFrame::Init() since that
|
||||
// function is called before the presshell association between us
|
||||
// and our frame is established.
|
||||
NS_WARNING("wrong frame type");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -265,7 +265,7 @@ nsXBLResourceLoader::NotifyBoundElements()
|
||||
// will happen.
|
||||
nsIPresShell *shell = doc->GetPrimaryShell();
|
||||
if (shell) {
|
||||
nsIFrame* childFrame = shell->GetPrimaryFrameFor(content);
|
||||
nsIFrame* childFrame = content->GetPrimaryFrame();
|
||||
if (!childFrame) {
|
||||
// Check to see if it's in the undisplayed content map.
|
||||
nsStyleContext* sc =
|
||||
|
@ -215,7 +215,7 @@ public:
|
||||
// will happen.
|
||||
nsIPresShell *shell = doc->GetPrimaryShell();
|
||||
if (shell) {
|
||||
nsIFrame* childFrame = shell->GetPrimaryFrameFor(mBoundElement);
|
||||
nsIFrame* childFrame = mBoundElement->GetPrimaryFrame();
|
||||
if (!childFrame) {
|
||||
// Check to see if it's in the undisplayed content map.
|
||||
nsStyleContext* sc =
|
||||
|
@ -140,13 +140,6 @@ nsXMLProcessingInstruction::IsNodeOfType(PRUint32 aFlags) const
|
||||
return !(aFlags & ~(eCONTENT | ePROCESSING_INSTRUCTION | eDATA_NODE));
|
||||
}
|
||||
|
||||
// virtual
|
||||
PRBool
|
||||
nsXMLProcessingInstruction::MayHaveFrame() const
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXMLProcessingInstruction::GetNodeName(nsAString& aNodeName)
|
||||
{
|
||||
|
@ -65,7 +65,6 @@ public:
|
||||
|
||||
// nsIContent
|
||||
virtual PRBool IsNodeOfType(PRUint32 aFlags) const;
|
||||
virtual PRBool MayHaveFrame() const;
|
||||
|
||||
#ifdef DEBUG
|
||||
virtual void List(FILE* out, PRInt32 aIndent) const;
|
||||
|
@ -632,15 +632,7 @@ nsXULElement::PerformAccesskey(PRBool aKeyCausesActivation,
|
||||
return;
|
||||
}
|
||||
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
if (!doc)
|
||||
return;
|
||||
|
||||
nsIPresShell *shell = doc->GetPrimaryShell();
|
||||
if (!shell)
|
||||
return;
|
||||
|
||||
nsIFrame* frame = shell->GetPrimaryFrameFor(content);
|
||||
nsIFrame* frame = content->GetPrimaryFrame();
|
||||
if (!frame)
|
||||
return;
|
||||
|
||||
@ -2385,8 +2377,7 @@ nsXULElement::HideWindowChrome(PRBool aShouldHide)
|
||||
nsIPresShell *shell = doc->GetPrimaryShell();
|
||||
|
||||
if (shell) {
|
||||
nsIContent* content = static_cast<nsIContent*>(this);
|
||||
nsIFrame* frame = shell->GetPrimaryFrameFor(content);
|
||||
nsIFrame* frame = GetPrimaryFrame();
|
||||
|
||||
nsPresContext *presContext = shell->GetPresContext();
|
||||
|
||||
|
@ -274,10 +274,11 @@ nsXULPopupListener::FireFocusOnTargetContent(nsIDOMNode* aTargetNode)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// strong reference to keep this from going away between events
|
||||
// XXXbz between what events? We don't use this local at all!
|
||||
nsCOMPtr<nsPresContext> context = shell->GetPresContext();
|
||||
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aTargetNode);
|
||||
nsIFrame* targetFrame = shell->GetPrimaryFrameFor(content);
|
||||
nsIFrame* targetFrame = content->GetPrimaryFrame();
|
||||
if (!targetFrame) return NS_ERROR_FAILURE;
|
||||
|
||||
const nsStyleUserInterface* ui = targetFrame->GetStyleUserInterface();
|
||||
@ -451,9 +452,7 @@ nsXULPopupListener::LaunchPopup(nsIDOMEvent* aEvent, nsIContent* aTargetContent)
|
||||
nsCOMPtr<nsIContent> popup = do_QueryInterface(popupElement);
|
||||
nsIContent* parent = popup->GetParent();
|
||||
if (parent) {
|
||||
nsIDocument* doc = parent->GetCurrentDoc();
|
||||
nsIPresShell* presShell = doc ? doc->GetPrimaryShell() : nsnull;
|
||||
nsIFrame* frame = presShell ? presShell->GetPrimaryFrameFor(parent) : nsnull;
|
||||
nsIFrame* frame = parent->GetPrimaryFrame();
|
||||
if (frame && frame->GetType() == nsGkAtoms::menuFrame)
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -4497,7 +4497,7 @@ nsDocShell::GetVisibility(PRBool * aVisibility)
|
||||
pPresShell->GetDocument()->FindContentForSubDocument(presShell->GetDocument());
|
||||
NS_ASSERTION(shellContent, "subshell not in the map");
|
||||
|
||||
nsIFrame* frame = pPresShell->GetPrimaryFrameFor(shellContent);
|
||||
nsIFrame* frame = shellContent->GetPrimaryFrame();
|
||||
PRBool isDocShellOffScreen = PR_FALSE;
|
||||
docShell->GetIsOffScreenBrowser(&isDocShellOffScreen);
|
||||
if (frame && !frame->AreAncestorViewsVisible() && !isDocShellOffScreen)
|
||||
|
@ -7740,10 +7740,7 @@ GetBindingURL(nsIContent *aContent, nsIDocument *aDocument,
|
||||
// otherwise, don't do anything else here unless we're dealing with
|
||||
// XUL.
|
||||
nsIPresShell *shell = aDocument->GetPrimaryShell();
|
||||
nsIFrame *frame;
|
||||
if (!shell ||
|
||||
(frame = shell->GetPrimaryFrameFor(aContent)) ||
|
||||
!aContent->IsXUL()) {
|
||||
if (!shell || aContent->GetPrimaryFrame() || !aContent->IsXUL()) {
|
||||
*aResult = nsnull;
|
||||
|
||||
return PR_TRUE;
|
||||
|
@ -474,7 +474,7 @@ nsDOMWindowUtils::GetWidgetForElement(nsIDOMElement* aElement)
|
||||
nsIPresShell* presShell = doc ? doc->GetPrimaryShell() : nsnull;
|
||||
|
||||
if (presShell) {
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(content);
|
||||
nsIFrame* frame = content->GetPrimaryFrame();
|
||||
if (!frame) {
|
||||
frame = presShell->GetRootFrame();
|
||||
}
|
||||
|
@ -1306,13 +1306,13 @@ nsFocusManager::CheckIfFocusable(nsIContent* aContent, PRUint32 aFlags)
|
||||
if (presContext && presContext->Type() == nsPresContext::eContext_PrintPreview)
|
||||
return nsnull;
|
||||
|
||||
nsIFrame* frame = shell->GetPrimaryFrameFor(aContent);
|
||||
nsIFrame* frame = aContent->GetPrimaryFrame();
|
||||
if (!frame)
|
||||
return nsnull;
|
||||
|
||||
if (aContent->Tag() == nsGkAtoms::area && aContent->IsHTML()) {
|
||||
// HTML areas do not have their own frame, and the img frame we get from
|
||||
// GetPrimaryFrameFor() is not relevant as to whether it is focusable or
|
||||
// GetPrimaryFrame() is not relevant as to whether it is focusable or
|
||||
// not, so we have to do all the relevant checks manually for them.
|
||||
return frame->AreAncestorViewsVisible() &&
|
||||
frame->GetStyleVisibility()->IsVisible() &&
|
||||
@ -1409,7 +1409,7 @@ nsFocusManager::Blur(nsPIDOMWindow* aWindowToClear,
|
||||
// But don't do this if we are blurring due to the window being lowered,
|
||||
// otherwise, the parent window can get raised again.
|
||||
if (mActiveWindow) {
|
||||
nsIFrame* contentFrame = presShell->GetPrimaryFrameFor(content);
|
||||
nsIFrame* contentFrame = content->GetPrimaryFrame();
|
||||
nsIObjectFrame* objectFrame = do_QueryFrame(contentFrame);
|
||||
if (objectFrame) {
|
||||
// note that the presshell's widget is being retrieved here, not the one
|
||||
@ -1602,13 +1602,17 @@ nsFocusManager::Focus(nsPIDOMWindow* aWindow,
|
||||
nsPresContext* presContext = presShell->GetPresContext();
|
||||
presContext->EventStateManager()->SetContentState(aContent, NS_EVENT_STATE_FOCUS);
|
||||
|
||||
// if this is an object/plug-in, focus the plugin's widget
|
||||
nsIFrame* contentFrame = presShell->GetPrimaryFrameFor(aContent);
|
||||
nsIObjectFrame* objectFrame = do_QueryFrame(contentFrame);
|
||||
if (objectFrame) {
|
||||
nsIWidget* widget = objectFrame->GetWidget();
|
||||
if (widget)
|
||||
widget->SetFocus(PR_FALSE);
|
||||
// if this is an object/plug-in, focus the plugin's widget. Note that we might
|
||||
// no longer be in the same document, due to the events we fired above when
|
||||
// aIsNewDocument.
|
||||
if (presShell->GetDocument() == aContent->GetDocument()) {
|
||||
nsIFrame* contentFrame = aContent->GetPrimaryFrame();
|
||||
nsIObjectFrame* objectFrame = do_QueryFrame(contentFrame);
|
||||
if (objectFrame) {
|
||||
nsIWidget* widget = objectFrame->GetWidget();
|
||||
if (widget)
|
||||
widget->SetFocus(PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
nsIMEStateManager::OnChangeFocus(presContext, aContent);
|
||||
@ -1906,7 +1910,9 @@ nsFocusManager::SetCaretVisible(nsIPresShell* aPresShell,
|
||||
|
||||
nsCOMPtr<nsFrameSelection> frameSelection;
|
||||
if (aContent) {
|
||||
nsIFrame *focusFrame = aPresShell->GetPrimaryFrameFor(aContent);
|
||||
NS_ASSERTION(aContent->GetDocument() == aPresShell->GetDocument(),
|
||||
"Wrong document?");
|
||||
nsIFrame *focusFrame = aContent->GetPrimaryFrame();
|
||||
if (focusFrame)
|
||||
frameSelection = focusFrame->GetFrameSelection();
|
||||
}
|
||||
@ -2001,7 +2007,7 @@ nsFocusManager::GetSelectionLocation(nsIDocument* aDocument,
|
||||
|
||||
nsIFrame *startFrame = nsnull;
|
||||
if (startContent) {
|
||||
startFrame = aPresShell->GetPrimaryFrameFor(startContent);
|
||||
startFrame = startContent->GetPrimaryFrame();
|
||||
if (isCollapsed) {
|
||||
// Next check to see if our caret is at the very end of a node
|
||||
// If so, the caret is actually sitting in front of the next
|
||||
@ -2152,7 +2158,7 @@ nsFocusManager::DetermineElementToMoveFocus(nsPIDOMWindow* aWindow,
|
||||
|
||||
PRInt32 tabIndex = forward ? 1 : 0;
|
||||
if (startContent) {
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(startContent);
|
||||
nsIFrame* frame = startContent->GetPrimaryFrame();
|
||||
if (startContent->Tag() == nsGkAtoms::area &&
|
||||
startContent->IsHTML())
|
||||
startContent->IsFocusable(&tabIndex);
|
||||
@ -2333,7 +2339,7 @@ nsFocusManager::DetermineElementToMoveFocus(nsPIDOMWindow* aWindow,
|
||||
rootContent = doc->GetRootContent();
|
||||
startContent = do_QueryInterface(piWindow->GetFrameElementInternal());
|
||||
if (startContent) {
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(startContent);
|
||||
nsIFrame* frame = startContent->GetPrimaryFrame();
|
||||
if (!frame)
|
||||
return NS_OK;
|
||||
|
||||
@ -2415,7 +2421,7 @@ nsFocusManager::GetNextTabbableContent(nsIPresShell* aPresShell,
|
||||
PRBool getNextFrame = PR_TRUE;
|
||||
nsCOMPtr<nsIContent> iterStartContent = aStartContent;
|
||||
while (1) {
|
||||
nsIFrame* startFrame = aPresShell->GetPrimaryFrameFor(iterStartContent);
|
||||
nsIFrame* startFrame = iterStartContent->GetPrimaryFrame();
|
||||
// if there is no frame, look for another content node that has a frame
|
||||
if (!startFrame) {
|
||||
// if the root content doesn't have a frame, just return
|
||||
@ -2730,7 +2736,7 @@ nsFocusManager::GetRootForFocus(nsPIDOMWindow* aWindow,
|
||||
if (rootContent) {
|
||||
if (aCheckVisibility) {
|
||||
nsIPresShell* presShell = aDocument->GetPrimaryShell();
|
||||
if (!presShell || !presShell->GetPrimaryFrameFor(rootContent))
|
||||
if (!presShell || !rootContent->GetPrimaryFrame())
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
@ -2928,7 +2934,7 @@ nsFocusManager::GetFocusInSelection(nsPIDOMWindow* aWindow,
|
||||
|
||||
// Method #1: Keep going up while we look - an ancestor might be focusable
|
||||
// We could end the loop earlier, such as when we're no longer
|
||||
// in the same frame, by comparing getPrimaryFrameFor(selectionContent)
|
||||
// in the same frame, by comparing selectionContent->GetPrimaryFrame()
|
||||
// with a variable holding the starting selectionContent
|
||||
while (testContent) {
|
||||
// Keep testing while selectionContent is equal to something,
|
||||
|
@ -7019,7 +7019,7 @@ nsGlobalWindow::UpdateCanvasFocus(PRBool aFocusChanged, nsIContent* aNewContent)
|
||||
if (rootContent) {
|
||||
if ((mHasFocus || aFocusChanged) &&
|
||||
(mFocusedNode == rootContent || aNewContent == rootContent)) {
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(rootContent);
|
||||
nsIFrame* frame = rootContent->GetPrimaryFrame();
|
||||
if (frame) {
|
||||
frame = frame->GetParent();
|
||||
nsCanvasFrame* canvasFrame = do_QueryFrame(frame);
|
||||
@ -9147,11 +9147,7 @@ nsGlobalChromeWindow::NotifyDefaultButtonLoaded(nsIDOMElement* aDefaultButton)
|
||||
// Get the button rect in screen coordinates.
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aDefaultButton));
|
||||
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
|
||||
nsIDocument *doc = content->GetCurrentDoc();
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
|
||||
nsIPresShell *shell = doc->GetPrimaryShell();
|
||||
NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE);
|
||||
nsIFrame *frame = shell->GetPrimaryFrameFor(content);
|
||||
nsIFrame *frame = content->GetPrimaryFrame();
|
||||
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
|
||||
nsIntRect buttonRect = frame->GetScreenRect();
|
||||
|
||||
|
@ -2120,9 +2120,9 @@ nsEditor::GetPhonetic(nsAString& aPhonetic)
|
||||
|
||||
|
||||
static nsresult
|
||||
GetEditorContentWindow(nsIPresShell *aPresShell, nsIDOMElement *aRoot, nsIWidget **aResult)
|
||||
GetEditorContentWindow(nsIDOMElement *aRoot, nsIWidget **aResult)
|
||||
{
|
||||
if (!aPresShell || !aRoot || !aResult)
|
||||
if (!aRoot || !aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aResult = 0;
|
||||
@ -2133,7 +2133,7 @@ GetEditorContentWindow(nsIPresShell *aPresShell, nsIDOMElement *aRoot, nsIWidget
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Not ref counted
|
||||
nsIFrame *frame = aPresShell->GetPrimaryFrameFor(content);
|
||||
nsIFrame *frame = content->GetPrimaryFrame();
|
||||
|
||||
if (!frame)
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -2152,17 +2152,9 @@ nsEditor::GetWidget(nsIWidget **aWidget)
|
||||
if (!aWidget)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*aWidget = nsnull;
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
nsresult res = GetPresShell(getter_AddRefs(shell));
|
||||
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
|
||||
if (!shell)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
res = GetEditorContentWindow(shell, GetRoot(), getter_AddRefs(widget));
|
||||
nsresult res = GetEditorContentWindow(GetRoot(), getter_AddRefs(widget));
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
if (!widget)
|
||||
@ -2222,14 +2214,10 @@ nsEditor::GetPreferredIMEState(PRUint32 *aState)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
rv = GetPresShell(getter_AddRefs(presShell));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(GetRoot());
|
||||
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
|
||||
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(content);
|
||||
nsIFrame* frame = content->GetPrimaryFrame();
|
||||
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
|
||||
|
||||
switch (frame->GetStyleUIReset()->mIMEMode) {
|
||||
@ -3807,9 +3795,6 @@ PRBool
|
||||
nsEditor::IsEditable(nsIDOMNode *aNode)
|
||||
{
|
||||
if (!aNode) return PR_FALSE;
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
GetPresShell(getter_AddRefs(shell));
|
||||
if (!shell) return PR_FALSE;
|
||||
|
||||
if (IsMozEditorBogusNode(aNode) || !IsModifiableNode(aNode)) return PR_FALSE;
|
||||
|
||||
@ -3818,7 +3803,7 @@ nsEditor::IsEditable(nsIDOMNode *aNode)
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
|
||||
if (content)
|
||||
{
|
||||
nsIFrame *resultFrame = shell->GetPrimaryFrameFor(content);
|
||||
nsIFrame *resultFrame = content->GetPrimaryFrame();
|
||||
if (!resultFrame) // if it has no frame, it is not editable
|
||||
return PR_FALSE;
|
||||
NS_ASSERTION(content->IsNodeOfType(nsINode::eTEXT) ||
|
||||
@ -4156,7 +4141,7 @@ nsEditor::IsPreformatted(nsIDOMNode *aNode, PRBool *aResult)
|
||||
nsCOMPtr<nsIPresShell> ps = do_QueryReferent(mPresShellWeak);
|
||||
if (!ps) return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
nsIFrame *frame = ps->GetPrimaryFrameFor(content);
|
||||
nsIFrame *frame = content->GetPrimaryFrame();
|
||||
|
||||
NS_ASSERTION(frame, "no frame, see bug #188946");
|
||||
if (!frame)
|
||||
@ -5307,12 +5292,7 @@ nsEditor::SwitchTextDirection()
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
rv = GetPresShell(getter_AddRefs(presShell));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsIFrame *frame = presShell->GetPrimaryFrameFor(content);
|
||||
nsIFrame *frame = content->GetPrimaryFrame();
|
||||
if (!frame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -5521,7 +5521,7 @@ nsHTMLEditor::GetElementOrigin(nsIDOMElement * aElement, PRInt32 & aX, PRInt32 &
|
||||
if (!ps) return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
|
||||
nsIFrame *frame = ps->GetPrimaryFrameFor(content);
|
||||
nsIFrame *frame = content->GetPrimaryFrame();
|
||||
|
||||
nsIFrame *container = ps->GetAbsoluteContainingBlock(frame);
|
||||
if (!frame) return NS_OK;
|
||||
|
@ -2650,7 +2650,7 @@ nsHTMLEditor::GetCellIndexes(nsIDOMElement *aCell,
|
||||
nsCOMPtr<nsIContent> nodeAsContent( do_QueryInterface(aCell) );
|
||||
if (!nodeAsContent) return NS_ERROR_FAILURE;
|
||||
// frames are not ref counted, so don't use an nsCOMPtr
|
||||
nsIFrame *layoutObject = ps->GetPrimaryFrameFor(nodeAsContent);
|
||||
nsIFrame *layoutObject = nodeAsContent->GetPrimaryFrame();
|
||||
if (!layoutObject) return NS_ERROR_FAILURE;
|
||||
|
||||
nsITableCellLayout *cellLayoutObject = do_QueryFrame(layoutObject);
|
||||
@ -2670,7 +2670,7 @@ nsHTMLEditor::GetTableLayoutObject(nsIDOMElement* aTable, nsITableLayout **table
|
||||
nsCOMPtr<nsIContent> nodeAsContent( do_QueryInterface(aTable) );
|
||||
if (!nodeAsContent) return NS_ERROR_FAILURE;
|
||||
// frames are not ref counted, so don't use an nsCOMPtr
|
||||
nsIFrame *layoutObject = ps->GetPrimaryFrameFor(nodeAsContent);
|
||||
nsIFrame *layoutObject = nodeAsContent->GetPrimaryFrame();
|
||||
if (!layoutObject) return NS_ERROR_FAILURE;
|
||||
|
||||
*tableLayoutObject = do_QueryFrame(layoutObject);
|
||||
|
@ -165,9 +165,10 @@ EmbedContextMenuInfo::GetFormControlType(nsIDOMEvent* aEvent)
|
||||
if (!presShell)
|
||||
return NS_OK;
|
||||
nsCOMPtr<nsIContent> tgContent = do_QueryInterface(mEventTarget);
|
||||
nsIFrame* frame = nsnull;
|
||||
nsIFrame* frame = nsnull;
|
||||
#if defined(FIXED_BUG347731) || !defined(MOZ_ENABLE_LIBXUL)
|
||||
frame = presShell->GetPrimaryFrameFor(tgContent);
|
||||
frame = tgContent->GetDocument() == presShell->GetDocument() ?
|
||||
tgContent->GetPrimaryFrame() : nsnull;
|
||||
if (frame)
|
||||
mFormRect = frame->GetScreenRectExternal();
|
||||
#endif
|
||||
@ -595,8 +596,8 @@ EmbedContextMenuInfo::UpdateContextData(nsIDOMEvent *aDOMEvent)
|
||||
#if defined(FIXED_BUG347731) || !defined(MOZ_ENABLE_LIBXUL)
|
||||
if (mEmbedCtxType & GTK_MOZ_EMBED_CTX_RICHEDIT)
|
||||
frame = presShell->GetRootFrame();
|
||||
else {
|
||||
frame = presShell->GetPrimaryFrameFor(tgContent);
|
||||
else if (tgContent->GetDocument() == presShell->GetDocument()) {
|
||||
frame = tgContent->GetPrimaryFrame();
|
||||
}
|
||||
if (frame) {
|
||||
mFormRect = frame->GetScreenRectExternal();
|
||||
|
@ -376,16 +376,7 @@ nsFindContentIterator::SetupInnerIterator(nsIContent* aContent)
|
||||
}
|
||||
NS_ASSERTION(!aContent->IsRootOfNativeAnonymousSubtree(), "invalid call");
|
||||
|
||||
nsIDocument* doc = aContent->GetDocument();
|
||||
nsIPresShell* shell = doc ? doc->GetPrimaryShell() : nsnull;
|
||||
if (!shell)
|
||||
return;
|
||||
|
||||
nsIFrame* frame = shell->GetPrimaryFrameFor(aContent);
|
||||
if (!frame)
|
||||
return;
|
||||
|
||||
nsITextControlFrame* tcFrame = do_QueryFrame(frame);
|
||||
nsITextControlFrame* tcFrame = do_QueryFrame(aContent->GetPrimaryFrame());
|
||||
if (!tcFrame)
|
||||
return;
|
||||
|
||||
@ -827,15 +818,7 @@ PRBool nsFind::IsVisibleNode(nsIDOMNode *aDOMNode)
|
||||
if (!content)
|
||||
return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = content->GetDocument();
|
||||
if (!doc)
|
||||
return PR_FALSE;
|
||||
|
||||
nsIPresShell *presShell = doc->GetPrimaryShell();
|
||||
if (!presShell)
|
||||
return PR_FALSE;
|
||||
|
||||
nsIFrame *frame = presShell->GetPrimaryFrameFor(content);
|
||||
nsIFrame *frame = content->GetPrimaryFrame();
|
||||
if (!frame) {
|
||||
// No frame! Not visible then.
|
||||
return PR_FALSE;
|
||||
|
@ -400,7 +400,7 @@ void nsWebBrowserFind::SetSelectionAndScroll(nsIDOMWindow* aWindow,
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
aRange->GetStartContainer(getter_AddRefs(node));
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(content);
|
||||
nsIFrame* frame = content->GetPrimaryFrame();
|
||||
if (!frame)
|
||||
return;
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
@ -412,7 +412,7 @@ void nsWebBrowserFind::SetSelectionAndScroll(nsIDOMWindow* aWindow,
|
||||
nsITextControlFrame *tcFrame = nsnull;
|
||||
for ( ; content; content = content->GetParent()) {
|
||||
if (!IsInNativeAnonymousSubtree(content)) {
|
||||
nsIFrame* f = presShell->GetPrimaryFrameFor(content);
|
||||
nsIFrame* f = content->GetPrimaryFrame();
|
||||
if (!f)
|
||||
return;
|
||||
tcFrame = do_QueryFrame(f);
|
||||
@ -847,7 +847,7 @@ nsWebBrowserFind::GetFrameSelection(nsIDOMWindow* aWindow,
|
||||
fm->GetFocusedElement(getter_AddRefs(focusedElement));
|
||||
nsCOMPtr<nsIContent> focusedContent(do_QueryInterface(focusedElement));
|
||||
if (focusedContent) {
|
||||
frame = presShell->GetPrimaryFrameFor(focusedContent);
|
||||
frame = focusedContent->GetPrimaryFrame();
|
||||
if (frame && frame->PresContext() != presContext)
|
||||
frame = nsnull;
|
||||
}
|
||||
|
@ -239,7 +239,6 @@ nsIXBLService * nsCSSFrameConstructor::gXBLService = nsnull;
|
||||
static PRBool gNoisyContentUpdates = PR_FALSE;
|
||||
static PRBool gReallyNoisyContentUpdates = PR_FALSE;
|
||||
static PRBool gNoisyInlineConstruction = PR_FALSE;
|
||||
static PRBool gVerifyFastFindFrame = PR_FALSE;
|
||||
|
||||
struct FrameCtorDebugFlags {
|
||||
const char* name;
|
||||
@ -249,8 +248,7 @@ struct FrameCtorDebugFlags {
|
||||
static FrameCtorDebugFlags gFlags[] = {
|
||||
{ "content-updates", &gNoisyContentUpdates },
|
||||
{ "really-noisy-content-updates", &gReallyNoisyContentUpdates },
|
||||
{ "noisy-inline", &gNoisyInlineConstruction },
|
||||
{ "fast-find-frame", &gVerifyFastFindFrame }
|
||||
{ "noisy-inline", &gNoisyInlineConstruction }
|
||||
};
|
||||
|
||||
#define NUM_DEBUG_FLAGS (sizeof(gFlags) / sizeof(gFlags[0]))
|
||||
@ -2489,7 +2487,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIContent* aDocEle
|
||||
}
|
||||
|
||||
// set the primary frame
|
||||
state.mFrameManager->SetPrimaryFrameFor(aDocElement, contentFrame);
|
||||
aDocElement->SetPrimaryFrame(contentFrame);
|
||||
|
||||
NS_ASSERTION(processChildren ? !mRootElementFrame :
|
||||
mRootElementFrame == contentFrame,
|
||||
@ -3433,9 +3431,8 @@ nsCSSFrameConstructor::ConstructTextFrame(const FrameConstructionData* aData,
|
||||
// Add the newly constructed frame to the flow
|
||||
aFrameItems.AddChild(newFrame);
|
||||
|
||||
// Text frames don't go in the content->frame hash table, because
|
||||
// they're anonymous. This keeps the hash table smaller
|
||||
|
||||
aContent->SetPrimaryFrame(newFrame);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -3550,8 +3547,7 @@ nsCSSFrameConstructor::FindHTMLData(nsIContent* aContent,
|
||||
SIMPLE_TAG_CHAIN(mozgeneratedcontentimage,
|
||||
nsCSSFrameConstructor::FindImgData),
|
||||
{ &nsGkAtoms::br,
|
||||
FCDATA_DECL(FCDATA_SKIP_FRAMEMAP | FCDATA_IS_LINE_PARTICIPANT |
|
||||
FCDATA_IS_LINE_BREAK,
|
||||
FCDATA_DECL(FCDATA_IS_LINE_PARTICIPANT | FCDATA_IS_LINE_BREAK,
|
||||
NS_NewBRFrame) },
|
||||
SIMPLE_TAG_CREATE(wbr, NS_NewWBRFrame),
|
||||
SIMPLE_TAG_CHAIN(input, nsCSSFrameConstructor::FindInputData),
|
||||
@ -3747,9 +3743,8 @@ nsCSSFrameConstructor::ConstructFrameFromItemInternal(FrameConstructionItem& aIt
|
||||
display->IsScrollableOverflow()) {
|
||||
BuildScrollFrame(aState, content, styleContext, newFrame,
|
||||
geometricParent, frameToAddToList);
|
||||
// No need to add to frame map later, since BuildScrollFrame did it
|
||||
// already
|
||||
bits |= FCDATA_SKIP_FRAMEMAP;
|
||||
// No need to set the primary frame, since BuildScrollFrame did it already
|
||||
bits |= FCDATA_SKIP_FRAMESET;
|
||||
} else {
|
||||
rv = InitAndRestoreFrame(aState, content, geometricParent, nsnull,
|
||||
newFrame);
|
||||
@ -3855,8 +3850,8 @@ nsCSSFrameConstructor::ConstructFrameFromItemInternal(FrameConstructionItem& aIt
|
||||
((bits & FCDATA_IS_LINE_PARTICIPANT) != 0),
|
||||
"Incorrectly set FCDATA_IS_LINE_PARTICIPANT bits");
|
||||
|
||||
if (!(bits & FCDATA_SKIP_FRAMEMAP)) {
|
||||
aState.mFrameManager->SetPrimaryFrameFor(aItem.mContent, newFrame);
|
||||
if (!(bits & FCDATA_SKIP_FRAMESET)) {
|
||||
aItem.mContent->SetPrimaryFrame(newFrame);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -4334,7 +4329,7 @@ nsCSSFrameConstructor::BuildScrollFrame(nsFrameConstructorState& aState,
|
||||
FinishBuildingScrollFrame(aNewFrame, aScrolledFrame);
|
||||
|
||||
// now set the primary frame to the ScrollFrame
|
||||
aState.mFrameManager->SetPrimaryFrameFor( aContent, aNewFrame );
|
||||
aContent->SetPrimaryFrame(aNewFrame);
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
@ -4394,56 +4389,50 @@ nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay* aDisplay,
|
||||
// find them if we need to.
|
||||
// XXXbz the "quickly" part is a bald-faced lie!
|
||||
{ NS_STYLE_DISPLAY_INLINE,
|
||||
FULL_CTOR_FCDATA(FCDATA_SKIP_FRAMEMAP | FCDATA_IS_INLINE |
|
||||
FCDATA_IS_LINE_PARTICIPANT,
|
||||
FULL_CTOR_FCDATA(FCDATA_IS_INLINE | FCDATA_IS_LINE_PARTICIPANT,
|
||||
&nsCSSFrameConstructor::ConstructInline) },
|
||||
{ NS_STYLE_DISPLAY_MARKER,
|
||||
FULL_CTOR_FCDATA(FCDATA_SKIP_FRAMEMAP | FCDATA_IS_INLINE |
|
||||
FCDATA_IS_LINE_PARTICIPANT,
|
||||
FULL_CTOR_FCDATA(FCDATA_IS_INLINE | FCDATA_IS_LINE_PARTICIPANT,
|
||||
&nsCSSFrameConstructor::ConstructInline) },
|
||||
{ NS_STYLE_DISPLAY_TABLE,
|
||||
FULL_CTOR_FCDATA(0, &nsCSSFrameConstructor::ConstructTable) },
|
||||
{ NS_STYLE_DISPLAY_INLINE_TABLE,
|
||||
FULL_CTOR_FCDATA(0, &nsCSSFrameConstructor::ConstructTable) },
|
||||
{ NS_STYLE_DISPLAY_TABLE_CAPTION,
|
||||
FCDATA_DECL(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMEMAP |
|
||||
FCDATA_ALLOW_BLOCK_STYLES | FCDATA_DISALLOW_OUT_OF_FLOW |
|
||||
FCDATA_SKIP_ABSPOS_PUSH |
|
||||
FCDATA_DECL(FCDATA_IS_TABLE_PART | FCDATA_ALLOW_BLOCK_STYLES |
|
||||
FCDATA_DISALLOW_OUT_OF_FLOW | FCDATA_SKIP_ABSPOS_PUSH |
|
||||
FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeTable),
|
||||
NS_NewTableCaptionFrame) },
|
||||
{ NS_STYLE_DISPLAY_TABLE_ROW_GROUP,
|
||||
FCDATA_DECL(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMEMAP |
|
||||
FCDATA_DISALLOW_OUT_OF_FLOW | FCDATA_MAY_NEED_SCROLLFRAME |
|
||||
FCDATA_SKIP_ABSPOS_PUSH |
|
||||
FCDATA_DECL(FCDATA_IS_TABLE_PART | FCDATA_DISALLOW_OUT_OF_FLOW |
|
||||
FCDATA_MAY_NEED_SCROLLFRAME | FCDATA_SKIP_ABSPOS_PUSH |
|
||||
FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeTable),
|
||||
NS_NewTableRowGroupFrame) },
|
||||
{ NS_STYLE_DISPLAY_TABLE_HEADER_GROUP,
|
||||
FCDATA_DECL(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMEMAP |
|
||||
FCDATA_DISALLOW_OUT_OF_FLOW | FCDATA_MAY_NEED_SCROLLFRAME |
|
||||
FCDATA_SKIP_ABSPOS_PUSH |
|
||||
FCDATA_DECL(FCDATA_IS_TABLE_PART | FCDATA_DISALLOW_OUT_OF_FLOW |
|
||||
FCDATA_MAY_NEED_SCROLLFRAME | FCDATA_SKIP_ABSPOS_PUSH |
|
||||
FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeTable),
|
||||
NS_NewTableRowGroupFrame) },
|
||||
{ NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP,
|
||||
FCDATA_DECL(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMEMAP |
|
||||
FCDATA_DISALLOW_OUT_OF_FLOW | FCDATA_MAY_NEED_SCROLLFRAME |
|
||||
FCDATA_SKIP_ABSPOS_PUSH |
|
||||
FCDATA_DECL(FCDATA_IS_TABLE_PART | FCDATA_DISALLOW_OUT_OF_FLOW |
|
||||
FCDATA_MAY_NEED_SCROLLFRAME | FCDATA_SKIP_ABSPOS_PUSH |
|
||||
FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeTable),
|
||||
NS_NewTableRowGroupFrame) },
|
||||
{ NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP,
|
||||
FCDATA_DECL(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMEMAP |
|
||||
FCDATA_DISALLOW_OUT_OF_FLOW | FCDATA_SKIP_ABSPOS_PUSH |
|
||||
FCDATA_DECL(FCDATA_IS_TABLE_PART | FCDATA_DISALLOW_OUT_OF_FLOW |
|
||||
FCDATA_SKIP_ABSPOS_PUSH |
|
||||
FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeTable),
|
||||
NS_NewTableColGroupFrame) },
|
||||
{ NS_STYLE_DISPLAY_TABLE_COLUMN,
|
||||
FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMEMAP |
|
||||
FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART |
|
||||
FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeColGroup),
|
||||
&nsCSSFrameConstructor::ConstructTableCol) },
|
||||
{ NS_STYLE_DISPLAY_TABLE_ROW,
|
||||
FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMEMAP |
|
||||
FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART |
|
||||
FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRowGroup),
|
||||
&nsCSSFrameConstructor::ConstructTableRow) },
|
||||
{ NS_STYLE_DISPLAY_TABLE_CELL,
|
||||
FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMEMAP |
|
||||
FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART |
|
||||
FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRow),
|
||||
&nsCSSFrameConstructor::ConstructTableCell) }
|
||||
};
|
||||
@ -4644,8 +4633,7 @@ nsCSSFrameConstructor::FlushAccumulatedBlock(nsFrameConstructorState& aState,
|
||||
{ &nsGkAtoms::_tag, \
|
||||
FCDATA_DECL(FCDATA_DISALLOW_OUT_OF_FLOW | \
|
||||
FCDATA_FORCE_NULL_ABSPOS_CONTAINER | \
|
||||
FCDATA_WRAP_KIDS_IN_BLOCKS | \
|
||||
FCDATA_SKIP_FRAMEMAP, _func) }
|
||||
FCDATA_WRAP_KIDS_IN_BLOCKS, _func) }
|
||||
|
||||
/* static */
|
||||
const nsCSSFrameConstructor::FrameConstructionData*
|
||||
@ -4663,17 +4651,14 @@ nsCSSFrameConstructor::FindMathMLData(nsIContent* aContent,
|
||||
if (aStyleContext->GetStyleDisplay()->mDisplay == NS_STYLE_DISPLAY_BLOCK) {
|
||||
static const FrameConstructionData sBlockMathData =
|
||||
FCDATA_DECL(FCDATA_FORCE_NULL_ABSPOS_CONTAINER |
|
||||
FCDATA_WRAP_KIDS_IN_BLOCKS |
|
||||
FCDATA_SKIP_FRAMEMAP,
|
||||
FCDATA_WRAP_KIDS_IN_BLOCKS,
|
||||
NS_CreateNewMathMLmathBlockFrame);
|
||||
return &sBlockMathData;
|
||||
}
|
||||
|
||||
static const FrameConstructionData sInlineMathData =
|
||||
FCDATA_DECL(FCDATA_FORCE_NULL_ABSPOS_CONTAINER |
|
||||
FCDATA_WRAP_KIDS_IN_BLOCKS |
|
||||
FCDATA_SKIP_FRAMEMAP |
|
||||
FCDATA_IS_LINE_PARTICIPANT,
|
||||
FCDATA_WRAP_KIDS_IN_BLOCKS,
|
||||
NS_NewMathMLmathInlineFrame);
|
||||
return &sInlineMathData;
|
||||
}
|
||||
@ -4718,7 +4703,7 @@ nsCSSFrameConstructor::FindMathMLData(nsIContent* aContent,
|
||||
// should be in-flow.
|
||||
#define SIMPLE_SVG_FCDATA(_func) \
|
||||
FCDATA_DECL(FCDATA_DISALLOW_OUT_OF_FLOW | \
|
||||
FCDATA_SKIP_ABSPOS_PUSH | FCDATA_SKIP_FRAMEMAP | \
|
||||
FCDATA_SKIP_ABSPOS_PUSH | \
|
||||
FCDATA_DISALLOW_GENERATED_CONTENT, _func)
|
||||
#define SIMPLE_SVG_CREATE(_tag, _func) \
|
||||
{ &nsGkAtoms::_tag, SIMPLE_SVG_FCDATA(_func) }
|
||||
@ -4770,8 +4755,6 @@ nsCSSFrameConstructor::FindSVGData(nsIContent* aContent,
|
||||
//
|
||||
// Style mutation can't change this situation, so don't bother
|
||||
// adding to the undisplayed content map.
|
||||
// XXXbz except of course that this makes GetPrimaryFrameFor for this stuff
|
||||
// that much slower.
|
||||
//
|
||||
// We don't currently handle any UI for desc/title
|
||||
return &sSuppressData;
|
||||
@ -4801,7 +4784,7 @@ nsCSSFrameConstructor::FindSVGData(nsIContent* aContent,
|
||||
|
||||
static const FrameConstructionData sOuterSVGData =
|
||||
FCDATA_DECL(FCDATA_FORCE_VIEW | FCDATA_SKIP_ABSPOS_PUSH |
|
||||
FCDATA_SKIP_FRAMEMAP | FCDATA_DISALLOW_GENERATED_CONTENT,
|
||||
FCDATA_DISALLOW_GENERATED_CONTENT,
|
||||
NS_NewSVGOuterSVGFrame);
|
||||
return &sOuterSVGData;
|
||||
}
|
||||
@ -4980,7 +4963,7 @@ nsCSSFrameConstructor::AddPageBreakItem(nsIContent* aContent,
|
||||
NS_STYLE_DISPLAY_BLOCK, "Unexpected display");
|
||||
|
||||
static const FrameConstructionData sPageBreakData =
|
||||
FCDATA_DECL(FCDATA_SKIP_FRAMEMAP, NS_NewPageBreakFrame);
|
||||
FCDATA_DECL(FCDATA_SKIP_FRAMESET, NS_NewPageBreakFrame);
|
||||
|
||||
// Lie about the tag and namespace so we don't trigger anything
|
||||
// interesting during frame construction.
|
||||
@ -5467,7 +5450,7 @@ nsIFrame*
|
||||
nsCSSFrameConstructor::GetFrameFor(nsIContent* aContent)
|
||||
{
|
||||
// Get the primary frame associated with the content
|
||||
nsIFrame* frame = mPresShell->GetPrimaryFrameFor(aContent);
|
||||
nsIFrame* frame = aContent->GetPrimaryFrame();
|
||||
|
||||
if (!frame)
|
||||
return nsnull;
|
||||
@ -5844,14 +5827,14 @@ nsCSSFrameConstructor::FindFrameForContentSibling(nsIContent* aContent,
|
||||
PRUint8& aTargetContentDisplay,
|
||||
PRBool aPrevSibling)
|
||||
{
|
||||
nsIFrame* sibling = mPresShell->GetPrimaryFrameFor(aContent);
|
||||
nsIFrame* sibling = aContent->GetPrimaryFrame();
|
||||
if (!sibling || sibling->GetContent() != aContent) {
|
||||
// XXX the GetContent() != aContent check is needed due to bug 135040.
|
||||
// Remove it once that's fixed.
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
// If the frame is out-of-flow, GPFF() will have returned the
|
||||
// If the frame is out-of-flow, GetPrimaryFrame() will have returned the
|
||||
// out-of-flow frame; we want the placeholder.
|
||||
if (sibling->GetStateBits() & NS_FRAME_OUT_OF_FLOW) {
|
||||
nsIFrame* placeholderFrame;
|
||||
@ -6092,7 +6075,7 @@ nsCSSFrameConstructor::AddTextItemIfNeeded(nsFrameConstructorState& aState,
|
||||
// NS_CREATE_FRAME_IF_NON_WHITESPACE flag)
|
||||
return;
|
||||
}
|
||||
NS_ASSERTION(!mPresShell->GetPrimaryFrameFor(content),
|
||||
NS_ASSERTION(!content->GetPrimaryFrame(),
|
||||
"Text node has a frame and NS_CREATE_FRAME_IF_NON_WHITESPACE");
|
||||
AddFrameConstructionItems(aState, content, aContentIndex, aParentFrame, aItems);
|
||||
}
|
||||
@ -6112,7 +6095,7 @@ nsCSSFrameConstructor::ReframeTextIfNeeded(nsIContent* aParentContent,
|
||||
// NS_CREATE_FRAME_IF_NON_WHITESPACE flag)
|
||||
return;
|
||||
}
|
||||
NS_ASSERTION(!mPresShell->GetPrimaryFrameFor(content),
|
||||
NS_ASSERTION(!content->GetPrimaryFrame(),
|
||||
"Text node has a frame and NS_CREATE_FRAME_IF_NON_WHITESPACE");
|
||||
ContentInserted(aParentContent, content, aContentIndex, nsnull);
|
||||
}
|
||||
@ -6207,7 +6190,7 @@ nsCSSFrameConstructor::ContentAppended(nsIContent* aContainer,
|
||||
PRUint32 containerCount = aContainer->GetChildCount();
|
||||
for (PRUint32 i = aNewIndexInContainer; i < containerCount; i++) {
|
||||
nsIContent* content = aContainer->GetChildAt(i);
|
||||
if ((mPresShell->GetPrimaryFrameFor(content) ||
|
||||
if ((content->GetPrimaryFrame() ||
|
||||
mPresShell->FrameManager()->GetUndisplayedContent(content))
|
||||
#ifdef MOZ_XUL
|
||||
// Except listboxes suck, so do NOT skip anything here if
|
||||
@ -6903,8 +6886,7 @@ nsCSSFrameConstructor::ContentRemoved(nsIContent* aContainer,
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// Find the child frame that maps the content
|
||||
nsIFrame* childFrame =
|
||||
frameManager->GetPrimaryFrameFor(aChild, aIndexInContainer);
|
||||
nsIFrame* childFrame = aChild->GetPrimaryFrame();
|
||||
|
||||
if (!childFrame || childFrame->GetContent() != aChild) {
|
||||
// XXXbz the GetContent() != aChild check is needed due to bug 135040.
|
||||
@ -7023,7 +7005,7 @@ nsCSSFrameConstructor::ContentRemoved(nsIContent* aContainer,
|
||||
containingBlock);
|
||||
|
||||
// Recover childFrame and parentFrame
|
||||
childFrame = mPresShell->GetPrimaryFrameFor(aChild);
|
||||
childFrame = aChild->GetPrimaryFrame();
|
||||
if (!childFrame || childFrame->GetContent() != aChild) {
|
||||
// XXXbz the GetContent() != aChild check is needed due to bug 135040.
|
||||
// Remove it once that's fixed.
|
||||
@ -7377,7 +7359,7 @@ nsCSSFrameConstructor::CharacterDataChanged(nsIContent* aContent,
|
||||
(aContent->HasFlag(NS_REFRAME_IF_WHITESPACE) &&
|
||||
aContent->TextIsOnlyWhitespace())) {
|
||||
#ifdef DEBUG
|
||||
nsIFrame* frame = mPresShell->GetPrimaryFrameFor(aContent);
|
||||
nsIFrame* frame = aContent->GetPrimaryFrame();
|
||||
NS_ASSERTION(!frame || !frame->IsGeneratedContentFrame(),
|
||||
"Bit should never be set on generated content");
|
||||
#endif
|
||||
@ -7388,7 +7370,7 @@ nsCSSFrameConstructor::CharacterDataChanged(nsIContent* aContent,
|
||||
}
|
||||
|
||||
// Find the child frame
|
||||
nsIFrame* frame = mPresShell->GetPrimaryFrameFor(aContent);
|
||||
nsIFrame* frame = aContent->GetPrimaryFrame();
|
||||
|
||||
// Notify the first frame that maps the content. It will generate a reflow
|
||||
// command
|
||||
@ -7422,7 +7404,7 @@ nsCSSFrameConstructor::CharacterDataChanged(nsIContent* aContent,
|
||||
mPresShell->FrameManager(), block);
|
||||
// Reget |frame|, since we might have killed it.
|
||||
// Do we really need to call CharacterDataChanged in this case, though?
|
||||
frame = mPresShell->GetPrimaryFrameFor(aContent);
|
||||
frame = aContent->GetPrimaryFrame();
|
||||
NS_ASSERTION(frame, "Should have frame here!");
|
||||
}
|
||||
}
|
||||
@ -7486,8 +7468,8 @@ nsCSSFrameConstructor::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
|
||||
"Reflow hint bits set without actually asking for a reflow");
|
||||
|
||||
if (frame && frame->GetContent() != content) {
|
||||
// XXXbz this is due to image maps messing with the primary frame map.
|
||||
// See bug 135040. Remove this block once that's fixed.
|
||||
// XXXbz this is due to image maps messing with the primary frame of
|
||||
// <area>s. See bug 135040. Remove this block once that's fixed.
|
||||
frame = nsnull;
|
||||
if (!(hint & nsChangeHint_ReconstructFrame)) {
|
||||
continue;
|
||||
@ -7554,7 +7536,7 @@ nsCSSFrameConstructor::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
|
||||
#ifdef DEBUG
|
||||
// reget frame from content since it may have been regenerated...
|
||||
if (changeData->mContent) {
|
||||
nsIFrame* frame = mPresShell->GetPrimaryFrameFor(changeData->mContent);
|
||||
nsIFrame* frame = changeData->mContent->GetPrimaryFrame();
|
||||
if (frame) {
|
||||
mPresShell->FrameManager()->DebugVerifyStyleTree(frame);
|
||||
}
|
||||
@ -7573,11 +7555,11 @@ nsCSSFrameConstructor::RestyleElement(nsIContent *aContent,
|
||||
nsIFrame *aPrimaryFrame,
|
||||
nsChangeHint aMinHint)
|
||||
{
|
||||
NS_ASSERTION(aPrimaryFrame == mPresShell->GetPrimaryFrameFor(aContent),
|
||||
NS_ASSERTION(aPrimaryFrame == aContent->GetPrimaryFrame(),
|
||||
"frame/content mismatch");
|
||||
if (aPrimaryFrame && aPrimaryFrame->GetContent() != aContent) {
|
||||
// XXXbz this is due to image maps messing with the primary frame mapping.
|
||||
// See bug 135040. We can remove this block once that's fixed.
|
||||
// XXXbz this is due to image maps messing with the primary frame pointer
|
||||
// of <area>s. See bug 135040. We can remove this block once that's fixed.
|
||||
aPrimaryFrame = nsnull;
|
||||
}
|
||||
NS_ASSERTION(!aPrimaryFrame || aPrimaryFrame->GetContent() == aContent,
|
||||
@ -7610,7 +7592,7 @@ nsCSSFrameConstructor::RestyleLaterSiblings(nsIContent *aContent)
|
||||
if (!child->IsNodeOfType(nsINode::eELEMENT))
|
||||
continue;
|
||||
|
||||
nsIFrame* primaryFrame = mPresShell->GetPrimaryFrameFor(child);
|
||||
nsIFrame* primaryFrame = child->GetPrimaryFrame();
|
||||
RestyleElement(child, primaryFrame, NS_STYLE_HINT_NONE);
|
||||
}
|
||||
}
|
||||
@ -7641,7 +7623,7 @@ nsCSSFrameConstructor::DoContentStateChanged(nsIContent* aContent,
|
||||
// based on content states, so if we already don't have a frame we don't
|
||||
// need to force a reframe -- if it's needed, the HasStateDependentStyle
|
||||
// call will handle things.
|
||||
nsIFrame* primaryFrame = mPresShell->GetPrimaryFrameFor(aContent);
|
||||
nsIFrame* primaryFrame = aContent->GetPrimaryFrame();
|
||||
if (primaryFrame) {
|
||||
// If it's generated content, ignore LOADING/etc state changes on it.
|
||||
if (!primaryFrame->IsGeneratedContentFrame() &&
|
||||
@ -7701,7 +7683,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);
|
||||
nsIFrame* primaryFrame = aContent->GetPrimaryFrame();
|
||||
|
||||
#if 0
|
||||
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
|
||||
@ -8290,251 +8272,6 @@ nsCSSFrameConstructor::ReplicateFixedFrames(nsPageContentFrame* aParentFrame)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static PRBool
|
||||
IsBindingAncestor(nsIContent* aContent, nsIContent* aBindingRoot)
|
||||
{
|
||||
while (PR_TRUE) {
|
||||
// Native-anonymous content doesn't contain insertion points, so
|
||||
// we don't need to search through it.
|
||||
if (aContent->IsRootOfNativeAnonymousSubtree())
|
||||
return PR_FALSE;
|
||||
nsIContent* bindingParent = aContent->GetBindingParent();
|
||||
if (!bindingParent)
|
||||
return PR_FALSE;
|
||||
if (bindingParent == aBindingRoot)
|
||||
return PR_TRUE;
|
||||
aContent = bindingParent;
|
||||
}
|
||||
}
|
||||
|
||||
// Helper function that searches the immediate child frames
|
||||
// (and their children if the frames are "special")
|
||||
// for a frame that maps the specified content object
|
||||
nsIFrame*
|
||||
nsCSSFrameConstructor::FindFrameWithContent(nsFrameManager* aFrameManager,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIContent* aParentContent,
|
||||
nsIContent* aContent,
|
||||
nsFindFrameHint* aHint)
|
||||
{
|
||||
NS_PRECONDITION(aParentFrame, "Must have a frame");
|
||||
|
||||
#ifdef NOISY_FINDFRAME
|
||||
FFWC_totalCount++;
|
||||
printf("looking for content=%p, given aParentFrame %p parentContent %p, hint is %s\n",
|
||||
aContent, aParentFrame, aParentContent, aHint ? "set" : "NULL");
|
||||
#endif
|
||||
|
||||
// Search for the frame in each child list that aParentFrame supports.
|
||||
nsIAtom* listName = nsnull;
|
||||
PRInt32 listIndex = 0;
|
||||
PRBool searchAgain;
|
||||
|
||||
do {
|
||||
#ifdef NOISY_FINDFRAME
|
||||
FFWC_doLoop++;
|
||||
#endif
|
||||
nsIFrame* kidFrame = nsnull;
|
||||
|
||||
searchAgain = PR_FALSE;
|
||||
|
||||
// if we were given an hint, try to use it here to find a good
|
||||
// previous frame to start our search (|kidFrame|).
|
||||
if (aHint) {
|
||||
#ifdef NOISY_FINDFRAME
|
||||
printf(" hint frame is %p\n", aHint->mPrimaryFrameForPrevSibling);
|
||||
#endif
|
||||
// start with the primary frame for aContent's previous sibling
|
||||
kidFrame = aHint->mPrimaryFrameForPrevSibling;
|
||||
// But if it's out of flow, start from its placeholder.
|
||||
if (kidFrame && (kidFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
|
||||
kidFrame = aFrameManager->GetPlaceholderFrameFor(kidFrame);
|
||||
}
|
||||
|
||||
if (kidFrame) {
|
||||
// then use the next sibling frame as our starting point
|
||||
if (kidFrame->GetNextSibling()) {
|
||||
kidFrame = kidFrame->GetNextSibling();
|
||||
}
|
||||
else {
|
||||
// The hint frame had no next sibling. Try the next-in-flow or
|
||||
// special sibling of the parent of the hint frame (or its
|
||||
// associated placeholder).
|
||||
nsIFrame *parentFrame = kidFrame->GetParent();
|
||||
kidFrame = nsnull;
|
||||
if (parentFrame) {
|
||||
parentFrame = nsLayoutUtils::GetNextContinuationOrSpecialSibling(parentFrame);
|
||||
}
|
||||
if (parentFrame) {
|
||||
// Found it, continue the search with its first child.
|
||||
kidFrame = parentFrame->GetFirstChild(listName);
|
||||
// Leave |aParentFrame| as-is, since the only time we'll
|
||||
// reuse it is if the hint fails.
|
||||
}
|
||||
}
|
||||
#ifdef NOISY_FINDFRAME
|
||||
printf(" hint gives us kidFrame=%p with parent frame %p content %p\n",
|
||||
kidFrame, aParentFrame, aParentContent);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (!kidFrame) { // we didn't have enough info to prune, start searching from the beginning
|
||||
kidFrame = aParentFrame->GetFirstChild(listName);
|
||||
}
|
||||
while (kidFrame) {
|
||||
// See if the child frame points to the content object we're
|
||||
// looking for
|
||||
nsIContent* kidContent = kidFrame->GetContent();
|
||||
if (kidContent == aContent) {
|
||||
// We found a match. Return the out-of-flow if it's a placeholder.
|
||||
return nsPlaceholderFrame::GetRealFrameFor(kidFrame);
|
||||
}
|
||||
|
||||
// only do this if there is content
|
||||
if (kidContent) {
|
||||
// We search the immediate children only, but if the child frame has
|
||||
// the same content pointer as its parent then we need to search its
|
||||
// child frames, too.
|
||||
// We also need to search if the child content is anonymous and scoped
|
||||
// to the parent content.
|
||||
// XXXldb What makes us continue the search once we're inside
|
||||
// the anonymous subtree?
|
||||
if (aParentContent == kidContent ||
|
||||
(aParentContent && IsBindingAncestor(kidContent, aParentContent))) {
|
||||
#ifdef NOISY_FINDFRAME
|
||||
FFWC_recursions++;
|
||||
printf(" recursing with new parent set to kidframe=%p, parentContent=%p\n",
|
||||
kidFrame, aParentContent);
|
||||
#endif
|
||||
nsIFrame* matchingFrame =
|
||||
FindFrameWithContent(aFrameManager,
|
||||
nsPlaceholderFrame::GetRealFrameFor(kidFrame),
|
||||
aParentContent, aContent, nsnull);
|
||||
|
||||
if (matchingFrame) {
|
||||
return matchingFrame;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
kidFrame = kidFrame->GetNextSibling();
|
||||
|
||||
#ifdef NOISY_FINDFRAME
|
||||
if (kidFrame) {
|
||||
FFWC_doSibling++;
|
||||
printf(" searching sibling frame %p\n", kidFrame);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (aHint) {
|
||||
// If we get here, and we had a hint, then we didn't find a frame.
|
||||
// The hint may have been a frame whose location in the frame tree
|
||||
// doesn't match the location of its corresponding element in the
|
||||
// DOM tree, e.g. a floated or absolutely positioned frame, or e.g.
|
||||
// a <col> frame, in which case we'd be off in the weeds looking
|
||||
// through something other than the primary frame list.
|
||||
// Reboot the search from scratch, without the hint, but using the
|
||||
// null child list again.
|
||||
aHint = nsnull;
|
||||
searchAgain = PR_TRUE;
|
||||
}
|
||||
else {
|
||||
do {
|
||||
listName = aParentFrame->GetAdditionalChildListName(listIndex++);
|
||||
} while (IsOutOfFlowList(listName));
|
||||
}
|
||||
} while (listName || searchAgain);
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
// Request to find the primary frame associated with a given content object.
|
||||
// This is typically called by the pres shell when there is no mapping in
|
||||
// the pres shell hash table
|
||||
nsresult
|
||||
nsCSSFrameConstructor::FindPrimaryFrameFor(nsFrameManager* aFrameManager,
|
||||
nsIContent* aContent,
|
||||
nsIFrame** aFrame,
|
||||
nsFindFrameHint* aHint)
|
||||
{
|
||||
NS_ASSERTION(aFrameManager && aContent && aFrame, "bad arg");
|
||||
|
||||
*aFrame = nsnull; // initialize OUT parameter
|
||||
|
||||
// We want to be able to quickly map from a content object to its frame,
|
||||
// but we also want to keep the hash table small. Therefore, many frames
|
||||
// are not added to the hash table when they're first created:
|
||||
// - text frames
|
||||
// - inline frames (often things like FONT and B)
|
||||
// - BR frames
|
||||
// - internal table frames (row-group, row, cell, col-group, col)
|
||||
//
|
||||
// That means we need to need to search for the frame
|
||||
nsIFrame* parentFrame; // this pointer is used to iterate across all frames that map to parentContent
|
||||
|
||||
// Get the frame that corresponds to the parent content object.
|
||||
// Note that this may recurse indirectly, because the pres shell will
|
||||
// call us back if there is no mapping in the hash table
|
||||
nsCOMPtr<nsIContent> parentContent = aContent->GetParent(); // Get this once
|
||||
if (parentContent) {
|
||||
parentFrame = aFrameManager->GetPrimaryFrameFor(parentContent, -1);
|
||||
while (parentFrame) {
|
||||
// Search the child frames for a match
|
||||
*aFrame = FindFrameWithContent(aFrameManager, parentFrame,
|
||||
parentContent, aContent, aHint);
|
||||
#ifdef NOISY_FINDFRAME
|
||||
printf("FindFrameWithContent returned %p\n", *aFrame);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
// if we're given a hint and we were told to verify, then compare the resulting frame with
|
||||
// the frame we get by calling FindFrameWithContent *without* the hint.
|
||||
// Assert if they do not match
|
||||
// Note that this makes finding frames *slower* than it was before the fix.
|
||||
if (gVerifyFastFindFrame && aHint) {
|
||||
#ifdef NOISY_FINDFRAME
|
||||
printf("VERIFYING...\n");
|
||||
#endif
|
||||
nsIFrame *verifyTestFrame =
|
||||
FindFrameWithContent(aFrameManager, parentFrame,
|
||||
parentContent, aContent, nsnull);
|
||||
#ifdef NOISY_FINDFRAME
|
||||
printf("VERIFY returned %p\n", verifyTestFrame);
|
||||
#endif
|
||||
NS_ASSERTION(verifyTestFrame == *aFrame, "hint shortcut found wrong frame");
|
||||
}
|
||||
#endif
|
||||
// If we found a match, then add a mapping to the hash table so
|
||||
// next time this will be quick
|
||||
if (*aFrame) {
|
||||
aFrameManager->SetPrimaryFrameFor(aContent, *aFrame);
|
||||
break;
|
||||
}
|
||||
|
||||
// We didn't find a matching frame. If parentFrame has a next-in-flow
|
||||
// or special sibling, then continue looking there.
|
||||
parentFrame = nsLayoutUtils::GetNextContinuationOrSpecialSibling(parentFrame);
|
||||
#ifdef NOISY_FINDFRAME
|
||||
if (parentFrame) {
|
||||
FFWC_nextInFlows++;
|
||||
printf(" searching NIF frame %p\n", parentFrame);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NOISY_FINDFRAME
|
||||
printf("%10s %10s %10s %10s %10s\n",
|
||||
"total", "doLoop", "doSibling", "recur", "nextIF");
|
||||
printf("%10d %10d %10d %10d %10d\n",
|
||||
FFWC_totalCount, FFWC_doLoop, FFWC_doSibling, FFWC_recursions,
|
||||
FFWC_nextInFlows);
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsCSSFrameConstructor::GetInsertionPoint(nsIFrame* aParentFrame,
|
||||
nsIContent* aChildContent,
|
||||
@ -8577,7 +8314,7 @@ nsCSSFrameConstructor::GetInsertionPoint(nsIFrame* aParentFrame,
|
||||
}
|
||||
|
||||
if (insertionElement) {
|
||||
nsIFrame* insertionPoint = mPresShell->GetPrimaryFrameFor(insertionElement);
|
||||
nsIFrame* insertionPoint = insertionElement->GetPrimaryFrame();
|
||||
if (insertionPoint) {
|
||||
// Use the content insertion frame of the insertion point.
|
||||
insertionPoint = insertionPoint->GetContentInsertionFrame();
|
||||
@ -8609,7 +8346,7 @@ nsresult
|
||||
nsCSSFrameConstructor::CaptureStateForFramesOf(nsIContent* aContent,
|
||||
nsILayoutHistoryState* aHistoryState)
|
||||
{
|
||||
nsIFrame* frame = mPresShell->GetPrimaryFrameFor(aContent);
|
||||
nsIFrame* frame = aContent->GetPrimaryFrame();
|
||||
if (frame == mRootElementFrame) {
|
||||
frame = mFixedContainingBlock;
|
||||
}
|
||||
@ -8680,7 +8417,7 @@ nsCSSFrameConstructor::MaybeRecreateContainerForFrameRemoval(nsIFrame* aFrame,
|
||||
NS_PRECONDITION(aFrame->GetParent(), "Frame shouldn't be root");
|
||||
NS_PRECONDITION(aResult, "Null out param?");
|
||||
NS_PRECONDITION(aFrame == aFrame->GetFirstContinuation(),
|
||||
"aFrame not the result of GetPrimaryFrameFor()?");
|
||||
"aFrame not the result of GetPrimaryFrame()?");
|
||||
|
||||
if (IsFrameSpecial(aFrame)) {
|
||||
// The removal functions can't handle removal of an {ib} split directly; we
|
||||
@ -8806,13 +8543,13 @@ nsCSSFrameConstructor::RecreateFramesForContent(nsIContent* aContent,
|
||||
// below!). We'd really like to optimize away one of those
|
||||
// containing block reframes, hence the code here.
|
||||
|
||||
nsIFrame* frame = mPresShell->GetPrimaryFrameFor(aContent);
|
||||
nsIFrame* frame = aContent->GetPrimaryFrame();
|
||||
if (frame && frame->IsFrameOfType(nsIFrame::eMathML)) {
|
||||
// Reframe the topmost MathML element to prevent exponential blowup
|
||||
// (see bug 397518)
|
||||
while (PR_TRUE) {
|
||||
nsIContent* parentContent = aContent->GetParent();
|
||||
nsIFrame* parentContentFrame = mPresShell->GetPrimaryFrameFor(parentContent);
|
||||
nsIFrame* parentContentFrame = parentContent->GetPrimaryFrame();
|
||||
if (!parentContentFrame || !parentContentFrame->IsFrameOfType(nsIFrame::eMathML))
|
||||
break;
|
||||
aContent = parentContent;
|
||||
@ -8870,7 +8607,7 @@ nsCSSFrameConstructor::RecreateFramesForContent(nsIContent* aContent,
|
||||
if (mPresShell->IsAccessibilityActive()) {
|
||||
PRUint32 changeType;
|
||||
if (frame) {
|
||||
nsIFrame *newFrame = mPresShell->GetPrimaryFrameFor(aContent);
|
||||
nsIFrame *newFrame = aContent->GetPrimaryFrame();
|
||||
changeType = newFrame ? nsIAccessibilityService::FRAME_SIGNIFICANT_CHANGE :
|
||||
nsIAccessibilityService::FRAME_HIDE;
|
||||
}
|
||||
@ -8980,21 +8717,21 @@ nsCSSFrameConstructor::ShouldHaveSpecialBlockStyle(nsIContent* aContent,
|
||||
const nsCSSFrameConstructor::PseudoParentData
|
||||
nsCSSFrameConstructor::sPseudoParentData[eParentTypeCount] = {
|
||||
{ // Cell
|
||||
FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMEMAP |
|
||||
FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMESET |
|
||||
FCDATA_USE_CHILD_ITEMS |
|
||||
FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRow),
|
||||
&nsCSSFrameConstructor::ConstructTableCell),
|
||||
&nsCSSAnonBoxes::tableCell
|
||||
},
|
||||
{ // Row
|
||||
FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMEMAP |
|
||||
FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMESET |
|
||||
FCDATA_USE_CHILD_ITEMS |
|
||||
FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRowGroup),
|
||||
&nsCSSFrameConstructor::ConstructTableRow),
|
||||
&nsCSSAnonBoxes::tableRow
|
||||
},
|
||||
{ // Row group
|
||||
FCDATA_DECL(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMEMAP |
|
||||
FCDATA_DECL(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMESET |
|
||||
FCDATA_DISALLOW_OUT_OF_FLOW | FCDATA_USE_CHILD_ITEMS |
|
||||
FCDATA_SKIP_ABSPOS_PUSH |
|
||||
FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeTable),
|
||||
@ -9002,7 +8739,7 @@ nsCSSFrameConstructor::sPseudoParentData[eParentTypeCount] = {
|
||||
&nsCSSAnonBoxes::tableRowGroup
|
||||
},
|
||||
{ // Column group
|
||||
FCDATA_DECL(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMEMAP |
|
||||
FCDATA_DECL(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMESET |
|
||||
FCDATA_DISALLOW_OUT_OF_FLOW | FCDATA_USE_CHILD_ITEMS |
|
||||
FCDATA_SKIP_ABSPOS_PUSH |
|
||||
FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeTable),
|
||||
@ -9010,7 +8747,7 @@ nsCSSFrameConstructor::sPseudoParentData[eParentTypeCount] = {
|
||||
&nsCSSAnonBoxes::tableColGroup
|
||||
},
|
||||
{ // Table
|
||||
FULL_CTOR_FCDATA(FCDATA_SKIP_FRAMEMAP | FCDATA_USE_CHILD_ITEMS,
|
||||
FULL_CTOR_FCDATA(FCDATA_SKIP_FRAMESET | FCDATA_USE_CHILD_ITEMS,
|
||||
&nsCSSFrameConstructor::ConstructTable),
|
||||
&nsCSSAnonBoxes::table
|
||||
}
|
||||
@ -9907,6 +9644,7 @@ nsCSSFrameConstructor::CreateLetterFrame(nsIFrame* aBlockFrame,
|
||||
aBlockFrame->AddStateBits(NS_BLOCK_HAS_FIRST_LETTER_CHILD);
|
||||
}
|
||||
}
|
||||
aTextContent->SetPrimaryFrame(textFrame);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -10084,6 +9822,7 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
|
||||
return NS_ERROR_OUT_OF_MEMORY;;
|
||||
}
|
||||
newTextFrame->Init(textContent, parentFrame, nsnull);
|
||||
textContent->SetPrimaryFrame(newTextFrame);
|
||||
|
||||
// Destroy the old text frame's continuations (the old text frame
|
||||
// will be destroyed when its letter frame is destroyed).
|
||||
@ -10146,6 +9885,7 @@ nsCSSFrameConstructor::RemoveFirstLetterFrames(nsPresContext* aPresContext,
|
||||
}
|
||||
textFrame = NS_NewTextFrame(aPresShell, newSC);
|
||||
textFrame->Init(textContent, aFrame, nsnull);
|
||||
textContent->SetPrimaryFrame(textFrame);
|
||||
|
||||
// Next rip out the kid and replace it with the text frame
|
||||
aFrameManager->RemoveFrame(nsnull, kid);
|
||||
@ -11261,7 +11001,7 @@ nsCSSFrameConstructor::ProcessOneRestyle(nsIContent* aContent,
|
||||
return;
|
||||
}
|
||||
|
||||
nsIFrame* primaryFrame = mPresShell->GetPrimaryFrameFor(aContent);
|
||||
nsIFrame* primaryFrame = aContent->GetPrimaryFrame();
|
||||
if (aRestyleHint & eReStyle_Self) {
|
||||
RestyleElement(aContent, primaryFrame, aChangeHint);
|
||||
} else if (aChangeHint &&
|
||||
@ -11491,7 +11231,8 @@ nsCSSFrameConstructor::LazyGenerateChildrenEvent::Run()
|
||||
mPresShell->GetDocument()->FlushPendingNotifications(Flush_Layout);
|
||||
|
||||
// this is hard-coded to handle only menu popup frames
|
||||
nsIFrame* frame = mPresShell->GetPrimaryFrameFor(mContent);
|
||||
nsIFrame* frame = mPresShell->GetPresContext() ?
|
||||
mPresShell->GetPresContext()->GetPrimaryFrameFor(mContent) : nsnull;
|
||||
if (frame && frame->GetType() == nsGkAtoms::menuPopupFrame) {
|
||||
nsWeakFrame weakFrame(frame);
|
||||
#ifdef MOZ_XUL
|
||||
|
@ -72,12 +72,6 @@ class nsICSSAnonBoxPseudo;
|
||||
class nsPageContentFrame;
|
||||
struct PendingBinding;
|
||||
|
||||
struct nsFindFrameHint
|
||||
{
|
||||
nsIFrame *mPrimaryFrameForPrevSibling; // weak ref to the primary frame for the content for which we need a frame
|
||||
nsFindFrameHint() : mPrimaryFrameForPrevSibling(nsnull) { }
|
||||
};
|
||||
|
||||
typedef void (nsLazyFrameConstructionCallback)
|
||||
(nsIContent* aContent, nsIFrame* aFrame, void* aArg);
|
||||
|
||||
@ -286,14 +280,6 @@ public:
|
||||
// Copy over fixed frames from aParentFrame's prev-in-flow
|
||||
nsresult ReplicateFixedFrames(nsPageContentFrame* aParentFrame);
|
||||
|
||||
// Request to find the primary frame associated with a given content object.
|
||||
// This is typically called by the pres shell when there is no mapping in
|
||||
// the pres shell hash table
|
||||
nsresult FindPrimaryFrameFor(nsFrameManager* aFrameManager,
|
||||
nsIContent* aContent,
|
||||
nsIFrame** aFrame,
|
||||
nsFindFrameHint* aHint);
|
||||
|
||||
// Get the XBL insertion point for a child
|
||||
nsresult GetInsertionPoint(nsIFrame* aParentFrame,
|
||||
nsIContent* aChildContent,
|
||||
@ -337,6 +323,7 @@ private:
|
||||
PRInt32 aStateMask);
|
||||
|
||||
/* aMinHint is the minimal change that should be made to the element */
|
||||
// XXXbz do we really need the aPrimaryFrame argument here?
|
||||
void RestyleElement(nsIContent* aContent,
|
||||
nsIFrame* aPrimaryFrame,
|
||||
nsChangeHint aMinHint);
|
||||
@ -551,7 +538,7 @@ private:
|
||||
not the thing that ends up in aFrameItems? If not, would it be safe to do
|
||||
the add into the frame construction state after processing kids? Look
|
||||
into this as a followup!), process children as needed, etc. It is NOT
|
||||
expected to deal with the primary frame map.
|
||||
expected to deal with setting the frame on the content.
|
||||
|
||||
@param aState the frame construction state to use.
|
||||
@param aItem the frame construction item to use
|
||||
@ -561,7 +548,7 @@ private:
|
||||
@param aFrameItems the frame list to add the new frame (or its
|
||||
placeholder) to.
|
||||
@param aFrame out param handing out the frame that was constructed. This
|
||||
frame is what the caller will add to the primary frame map.
|
||||
frame is what the caller will set as the frame on the content.
|
||||
*/
|
||||
typedef nsresult
|
||||
(nsCSSFrameConstructor::* FrameFullConstructor)(nsFrameConstructorState& aState,
|
||||
@ -573,11 +560,11 @@ private:
|
||||
|
||||
/* Bits that modify the way a FrameConstructionData is handled */
|
||||
|
||||
/* If the FCDATA_SKIP_FRAMEMAP bit is set, then the frame created should not
|
||||
be added to the primary frame map. This flag might get ignored when used
|
||||
with FCDATA_MAY_NEED_SCROLLFRAME, since scrollframe construction will add
|
||||
to the frame map. */
|
||||
#define FCDATA_SKIP_FRAMEMAP 0x1
|
||||
/* If the FCDATA_SKIP_FRAMESET bit is set, then the frame created should not
|
||||
be set as the primary frame on the content node. This should only be used
|
||||
in very rare cases when we create more than one frame for a given content
|
||||
node. */
|
||||
#define FCDATA_SKIP_FRAMESET 0x1
|
||||
/* If the FCDATA_FUNC_IS_DATA_GETTER bit is set, then the mFunc of the
|
||||
FrameConstructionData is a getter function that can be used to get the
|
||||
actual FrameConstructionData to use. */
|
||||
@ -1129,8 +1116,8 @@ private:
|
||||
FindObjectData(nsIContent* aContent, nsStyleContext* aStyleContext);
|
||||
|
||||
/* Construct a frame from the given FrameConstructionItem. This function
|
||||
will handle adding the frame to frame lists, processing children, adding
|
||||
it to the primary frame map, and so forth.
|
||||
will handle adding the frame to frame lists, processing children, setting
|
||||
the frame as the primary frame for the item's content, and so forth.
|
||||
|
||||
@param aItem the FrameConstructionItem to use.
|
||||
@param aState the frame construction state to use.
|
||||
@ -1393,10 +1380,11 @@ private:
|
||||
// containing block (either of aFrame or of its parent) due to {ib} splits or
|
||||
// table pseudo-frames, recreate the relevant frame subtree. The return value
|
||||
// indicates whether this happened. If this method returns true, *aResult is
|
||||
// the return value of ReframeContainingBlock or RecreateFramesForContent.
|
||||
// If this method returns false, the value of *aResult is not affected.
|
||||
// aFrame and aResult must not be null. aFrame must be the result of a
|
||||
// GetPrimaryFrameFor() call (which means its parent is also not null).
|
||||
// the return value of ReframeContainingBlock or RecreateFramesForContent. If
|
||||
// this method returns false, the value of *aResult is not affected. aFrame
|
||||
// and aResult must not be null. aFrame must be the result of a
|
||||
// GetPrimaryFrame() call on a content node (which means its parent is also
|
||||
// not null).
|
||||
PRBool MaybeRecreateContainerForFrameRemoval(nsIFrame* aFrame,
|
||||
nsresult* aResult);
|
||||
|
||||
@ -1526,21 +1514,6 @@ private:
|
||||
|
||||
nsresult StyleChangeReflow(nsIFrame* aFrame, nsChangeHint aHint);
|
||||
|
||||
/** Helper function that searches the immediate child frames
|
||||
* (and their children if the frames are "special")
|
||||
* for a frame that maps the specified content object
|
||||
*
|
||||
* @param aParentFrame the primary frame for aParentContent
|
||||
* @param aContent the content node for which we seek a frame
|
||||
* @param aParentContent the parent for aContent
|
||||
* @param aHint an optional hint used to make the search for aFrame faster
|
||||
*/
|
||||
nsIFrame* FindFrameWithContent(nsFrameManager* aFrameManager,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIContent* aParentContent,
|
||||
nsIContent* aContent,
|
||||
nsFindFrameHint* aHint);
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
// Methods support :first-letter style
|
||||
|
@ -987,8 +987,7 @@ nsCSSRendering::FindBackgroundStyleFrame(nsIFrame* aForFrame)
|
||||
// and thus |InitialReflow| on the pres shell. See bug 119351
|
||||
// for the ugly details.
|
||||
if (bodyContent) {
|
||||
nsIFrame *bodyFrame = aForFrame->PresContext()->GetPresShell()->
|
||||
GetPrimaryFrameFor(bodyContent);
|
||||
nsIFrame *bodyFrame = bodyContent->GetPrimaryFrame();
|
||||
if (bodyFrame) {
|
||||
return nsLayoutUtils::GetStyleFrame(bodyFrame);
|
||||
}
|
||||
|
@ -150,41 +150,6 @@ static PLDHashTableOps PlaceholderMapOps = {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
struct PrimaryFrameMapEntry : public PLDHashEntryHdr {
|
||||
// key (the content node) can almost always be obtained through the
|
||||
// frame. If it weren't for the way image maps (mis)used the primary
|
||||
// frame map, we'd be able to have a 2 word entry instead of a 3 word
|
||||
// entry.
|
||||
nsIContent *content;
|
||||
nsIFrame *frame;
|
||||
};
|
||||
|
||||
// These ops should be used if/when we switch back to a 2-word entry.
|
||||
// See comment in |PrimaryFrameMapEntry| above.
|
||||
#if 0
|
||||
static PRBool
|
||||
PrimaryFrameMapMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr,
|
||||
const void *key)
|
||||
{
|
||||
const PrimaryFrameMapEntry *entry =
|
||||
static_cast<const PrimaryFrameMapEntry*>(hdr);
|
||||
return entry->frame->GetContent() == key;
|
||||
}
|
||||
|
||||
static PLDHashTableOps PrimaryFrameMapOps = {
|
||||
PL_DHashAllocTable,
|
||||
PL_DHashFreeTable,
|
||||
PL_DHashVoidPtrKeyStub,
|
||||
PrimaryFrameMapMatchEntry,
|
||||
PL_DHashMoveEntryStub,
|
||||
PL_DHashClearEntryStub,
|
||||
PL_DHashFinalizeStub,
|
||||
NULL
|
||||
};
|
||||
#endif /* 0 */
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// XXXldb This seems too complicated for what I think it's doing, and it
|
||||
// should also be using pldhash rather than plhash to use less memory.
|
||||
|
||||
@ -282,8 +247,6 @@ nsFrameManager::Destroy()
|
||||
// Destroy the frame hierarchy.
|
||||
mPresShell->SetIgnoreFrameDestruction(PR_TRUE);
|
||||
|
||||
mIsDestroying = PR_TRUE; // This flag prevents GetPrimaryFrameFor from returning pointers to destroyed frames
|
||||
|
||||
// Unregister all placeholders before tearing down the frame tree
|
||||
nsFrameManager::ClearPlaceholderFrameMap();
|
||||
|
||||
@ -292,7 +255,6 @@ nsFrameManager::Destroy()
|
||||
mRootFrame = nsnull;
|
||||
}
|
||||
|
||||
nsFrameManager::ClearPrimaryFrameMap();
|
||||
delete mUndisplayedMap;
|
||||
mUndisplayedMap = nsnull;
|
||||
|
||||
@ -326,159 +288,12 @@ nsFrameManager::GetCanvasFrame()
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// Primary frame functions
|
||||
nsIFrame*
|
||||
nsFrameManager::GetPrimaryFrameFor(nsIContent* aContent,
|
||||
PRInt32 aIndexHint)
|
||||
{
|
||||
NS_ASSERTION(!mIsDestroyingFrames,
|
||||
"GetPrimaryFrameFor() called while frames are being destroyed!");
|
||||
NS_ENSURE_TRUE(aContent, nsnull);
|
||||
|
||||
if (mIsDestroying) {
|
||||
NS_ERROR("GetPrimaryFrameFor() called while nsFrameManager is being destroyed!");
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
if (!aContent->MayHaveFrame()) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
if (mPrimaryFrameMap.ops) {
|
||||
PrimaryFrameMapEntry *entry = static_cast<PrimaryFrameMapEntry*>
|
||||
(PL_DHashTableOperate(&mPrimaryFrameMap, aContent, PL_DHASH_LOOKUP));
|
||||
if (PL_DHASH_ENTRY_IS_BUSY(entry)) {
|
||||
return entry->frame;
|
||||
}
|
||||
|
||||
// XXX: todo: Add a lookup into the undisplay map to skip searches
|
||||
// if we already know the content has no frame.
|
||||
// nsCSSFrameConstructor calls SetUndisplayedContent() for every
|
||||
// content node that has display: none.
|
||||
// Today, the undisplay map doesn't quite support what we need.
|
||||
// We need to see if we can add a method to make a search for 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.
|
||||
// XXX with the nsIContent::MayHaveFrame bit, is that really necessary now?
|
||||
|
||||
// Give the frame construction code the opportunity to return the
|
||||
// frame that maps the content object
|
||||
|
||||
// if the prev sibling of aContent has a cached primary frame,
|
||||
// pass that data in to the style set to speed things up
|
||||
// if any methods in here fail, don't report that failure
|
||||
// we're just trying to enhance performance here, not test for correctness
|
||||
nsFindFrameHint hint;
|
||||
nsIContent* parent = aContent->GetParent();
|
||||
if (parent)
|
||||
{
|
||||
PRInt32 index = aIndexHint >= 0 ? aIndexHint : parent->IndexOf(aContent);
|
||||
if (index > 0) // no use looking if it's the first child
|
||||
{
|
||||
nsIContent *prevSibling;
|
||||
do {
|
||||
prevSibling = parent->GetChildAt(--index);
|
||||
} while (index &&
|
||||
(prevSibling->IsNodeOfType(nsINode::eTEXT) ||
|
||||
prevSibling->IsNodeOfType(nsINode::eCOMMENT) ||
|
||||
prevSibling->IsNodeOfType(nsINode::ePROCESSING_INSTRUCTION)));
|
||||
if (prevSibling) {
|
||||
entry = static_cast<PrimaryFrameMapEntry*>
|
||||
(PL_DHashTableOperate(&mPrimaryFrameMap, prevSibling,
|
||||
PL_DHASH_LOOKUP));
|
||||
// XXXbz the GetContent() == prevSibling check is needed due to bug
|
||||
// 135040. Remove it once that's fixed.
|
||||
if (PL_DHASH_ENTRY_IS_BUSY(entry) && entry->frame &&
|
||||
entry->frame->GetContent() == prevSibling)
|
||||
hint.mPrimaryFrameForPrevSibling = entry->frame;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// walk the frame tree to find the frame that maps aContent.
|
||||
// Use the hint if we have it.
|
||||
nsIFrame *result;
|
||||
|
||||
mPresShell->FrameConstructor()->
|
||||
FindPrimaryFrameFor(this, aContent, &result,
|
||||
hint.mPrimaryFrameForPrevSibling ? &hint : nsnull);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFrameManager::SetPrimaryFrameFor(nsIContent* aContent,
|
||||
nsIFrame* aPrimaryFrame)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aContent);
|
||||
NS_ASSERTION(aPrimaryFrame && aPrimaryFrame->GetParent(),
|
||||
"BOGUS!");
|
||||
#ifdef DEBUG
|
||||
{
|
||||
nsIFrame *docElementCB =
|
||||
mPresShell->FrameConstructor()->GetDocElementContainingBlock();
|
||||
NS_ASSERTION(aPrimaryFrame != docElementCB &&
|
||||
!nsLayoutUtils::IsProperAncestorFrame(aPrimaryFrame,
|
||||
docElementCB),
|
||||
"too high in the frame tree to be a primary frame");
|
||||
}
|
||||
#endif
|
||||
|
||||
// This code should be used if/when we switch back to a 2-word entry
|
||||
// in the primary frame map.
|
||||
#if 0
|
||||
NS_PRECONDITION(aPrimaryFrame->GetContent() == aContent, "wrong content");
|
||||
#endif
|
||||
|
||||
// Create a new hashtable if necessary
|
||||
if (!mPrimaryFrameMap.ops) {
|
||||
if (!PL_DHashTableInit(&mPrimaryFrameMap, PL_DHashGetStubOps(), nsnull,
|
||||
sizeof(PrimaryFrameMapEntry), 16)) {
|
||||
mPrimaryFrameMap.ops = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
// Add a mapping to the hash table
|
||||
PrimaryFrameMapEntry *entry = static_cast<PrimaryFrameMapEntry*>
|
||||
(PL_DHashTableOperate(&mPrimaryFrameMap, aContent, PL_DHASH_ADD));
|
||||
#ifdef DEBUG_dbaron
|
||||
if (entry->frame) {
|
||||
NS_WARNING("already have primary frame for content");
|
||||
}
|
||||
#endif
|
||||
entry->frame = aPrimaryFrame;
|
||||
entry->content = aContent;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsFrameManager::RemoveAsPrimaryFrame(nsIContent* aContent,
|
||||
nsIFrame* aPrimaryFrame)
|
||||
{
|
||||
NS_PRECONDITION(aPrimaryFrame, "Must have a frame");
|
||||
if (aContent && mPrimaryFrameMap.ops) {
|
||||
PrimaryFrameMapEntry *entry = static_cast<PrimaryFrameMapEntry*>
|
||||
(PL_DHashTableOperate(&mPrimaryFrameMap, aContent, PL_DHASH_LOOKUP));
|
||||
if (PL_DHASH_ENTRY_IS_BUSY(entry) && entry->frame == aPrimaryFrame) {
|
||||
// Don't use PL_DHashTableRawRemove, since we want the table to
|
||||
// shrink as needed.
|
||||
PL_DHashTableOperate(&mPrimaryFrameMap, aContent, PL_DHASH_REMOVE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsFrameManager::ClearPrimaryFrameMap()
|
||||
{
|
||||
if (mPrimaryFrameMap.ops) {
|
||||
PL_DHashTableFinish(&mPrimaryFrameMap);
|
||||
mPrimaryFrameMap.ops = nsnull;
|
||||
if (aContent->GetPrimaryFrame() == aPrimaryFrame) {
|
||||
aContent->SetPrimaryFrame(nsnull);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,20 +110,10 @@ public:
|
||||
NS_HIDDEN_(nsIFrame*) GetCanvasFrame();
|
||||
|
||||
// Primary frame functions
|
||||
// If aIndexHint it not -1, it will be used as when determining a frame hint
|
||||
// instead of calling IndexOf(aContent).
|
||||
NS_HIDDEN_(nsIFrame*) GetPrimaryFrameFor(nsIContent* aContent,
|
||||
PRInt32 aIndexHint);
|
||||
// aPrimaryFrame must not be null. If you're trying to remove a primary frame
|
||||
// mapping, use RemoveAsPrimaryFrame.
|
||||
NS_HIDDEN_(nsresult) SetPrimaryFrameFor(nsIContent* aContent,
|
||||
nsIFrame* aPrimaryFrame);
|
||||
// If aPrimaryFrame is the current primary frame for aContent, remove the
|
||||
// relevant hashtable entry. If the current primary frame for aContent is
|
||||
// null, this does nothing. aPrimaryFrame must not be null.
|
||||
// If aPrimaryFrame is the current primary frame for aContent, set its
|
||||
// primary frame to null. aPrimaryFrame must not be null.
|
||||
NS_HIDDEN_(void) RemoveAsPrimaryFrame(nsIContent* aContent,
|
||||
nsIFrame* aPrimaryFrame);
|
||||
NS_HIDDEN_(void) ClearPrimaryFrameMap();
|
||||
|
||||
// Placeholder frame functions
|
||||
NS_HIDDEN_(nsPlaceholderFrame*) GetPlaceholderFrameFor(nsIFrame* aFrame);
|
||||
|
@ -78,10 +78,8 @@ protected:
|
||||
// the pres shell owns the style set
|
||||
nsStyleSet* mStyleSet;
|
||||
nsIFrame* mRootFrame;
|
||||
PLDHashTable mPrimaryFrameMap;
|
||||
PLDHashTable mPlaceholderMap;
|
||||
UndisplayedMap* mUndisplayedMap;
|
||||
PRPackedBool mIsDestroying; // The frame manager is being destroyed.
|
||||
PRPackedBool mIsDestroyingFrames; // The frame manager is destroying some frame(s).
|
||||
};
|
||||
|
||||
|
@ -45,15 +45,14 @@ class nsIContent;
|
||||
struct nsRect;
|
||||
|
||||
#define NS_IIMAGEMAP_IID \
|
||||
{ 0x36a48085, 0xc213, 0x4464, { 0xab, 0x60, 0x41, 0x2e, 0xc8, 0xe8, 0xb1, 0xfe } }
|
||||
|
||||
{ 0x2fca3d7e, 0x5b1f, 0x4ecf, \
|
||||
{ 0xb5, 0x7a, 0x84, 0x24, 0x97, 0x81, 0x2e, 0x62 } }
|
||||
|
||||
class nsIImageMap : public nsISupports {
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IIMAGEMAP_IID)
|
||||
|
||||
NS_IMETHOD GetBoundsForAreaContent(nsIContent *aContent,
|
||||
nsPresContext* aPresContext,
|
||||
nsRect& aBounds) = 0;
|
||||
};
|
||||
|
||||
|
@ -122,10 +122,10 @@ typedef struct CapturingContentInfo {
|
||||
mAllowed(PR_FALSE), mRetargetToElement(PR_FALSE), mContent(nsnull) { }
|
||||
} CapturingContentInfo;
|
||||
|
||||
// 4e8724b5-14f9-4bb0-b5a0-24041d653c9f
|
||||
#define NS_IPRESSHELL_IID \
|
||||
{ 0x4e8724b5, 0x14f9, 0x4bb0, \
|
||||
{ 0xb5, 0xa0, 0x24, 0x04, 0x1d, 0x65, 0x3c, 0x9f } }
|
||||
// 06AA90C2-5234-4F1C-81D7-773B5E4CBB8B
|
||||
#define NS_IPRESSHELL_IID \
|
||||
{ 0x06aa90c2, 0x5234, 0x4f1c, \
|
||||
{ 0x81, 0xd7, 0x77, 0x3b, 0x5e, 0x4c, 0xbb, 0x8b } }
|
||||
|
||||
// Constants for ScrollContentIntoView() function
|
||||
#define NS_PRESSHELL_SCROLL_TOP 0
|
||||
@ -222,7 +222,7 @@ public:
|
||||
virtual void PopStackMemory() = 0;
|
||||
virtual void* AllocateStackMemory(size_t aSize) = 0;
|
||||
|
||||
nsIDocument* GetDocument() { return mDocument; }
|
||||
nsIDocument* GetDocument() const { return mDocument; }
|
||||
|
||||
nsPresContext* GetPresContext() { return mPresContext; }
|
||||
|
||||
@ -357,21 +357,6 @@ public:
|
||||
*/
|
||||
NS_IMETHOD GetPageSequenceFrame(nsIPageSequenceFrame** aResult) const = 0;
|
||||
|
||||
/**
|
||||
* Gets the primary frame associated with the content object. This is a
|
||||
* helper function that just forwards the request to the frame manager.
|
||||
*
|
||||
* The primary frame is the frame that is most closely associated with the
|
||||
* content. A frame is more closely associated with the content that another
|
||||
* frame if the one frame contains directly or indirectly the other frame (e.g.,
|
||||
* when a frame is scrolled there is a scroll frame that contains the frame
|
||||
* being scrolled). The primary frame is always the first-in-flow.
|
||||
*
|
||||
* In the case of absolutely positioned elements and floated elements,
|
||||
* the primary frame is the placeholder frame.
|
||||
*/
|
||||
virtual NS_HIDDEN_(nsIFrame*) GetPrimaryFrameFor(nsIContent* aContent) const = 0;
|
||||
|
||||
/**
|
||||
* Gets the real primary frame associated with the content object.
|
||||
*
|
||||
|
@ -72,6 +72,7 @@
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "nsIContent.h"
|
||||
|
||||
class nsImageLoader;
|
||||
#ifdef IBMBIDI
|
||||
@ -82,7 +83,6 @@ struct nsRect;
|
||||
|
||||
class imgIRequest;
|
||||
|
||||
class nsIContent;
|
||||
class nsIFontMetrics;
|
||||
class nsIFrame;
|
||||
class nsFrameManager;
|
||||
@ -904,6 +904,22 @@ public:
|
||||
*/
|
||||
void SMILOverrideStyleChanged(nsIContent* aContent);
|
||||
#endif // MOZ_SMIL
|
||||
|
||||
/**
|
||||
* If we have a presshell, and if the given content's current
|
||||
* document is the same as our presshell's document, return the
|
||||
* content's primary frame. Otherwise, return null. Only use this
|
||||
* if you care about which presshell the primary frame is in.
|
||||
*/
|
||||
nsIFrame* GetPrimaryFrameFor(nsIContent* aContent) {
|
||||
NS_PRECONDITION(aContent, "Don't do that");
|
||||
if (GetPresShell() &&
|
||||
GetPresShell()->GetDocument() == aContent->GetCurrentDoc()) {
|
||||
return aContent->GetPrimaryFrame();
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
protected:
|
||||
friend class nsRunnableMethod<nsPresContext>;
|
||||
NS_HIDDEN_(void) ThemeChangedInternal();
|
||||
|
@ -687,7 +687,6 @@ public:
|
||||
NS_IMETHOD ResizeReflow(nscoord aWidth, nscoord aHeight);
|
||||
NS_IMETHOD StyleChangeReflow();
|
||||
NS_IMETHOD GetPageSequenceFrame(nsIPageSequenceFrame** aResult) const;
|
||||
virtual NS_HIDDEN_(nsIFrame*) GetPrimaryFrameFor(nsIContent* aContent) const;
|
||||
virtual NS_HIDDEN_(nsIFrame*) GetRealPrimaryFrameFor(nsIContent* aContent) const;
|
||||
|
||||
NS_IMETHOD GetPlaceholderFrameFor(nsIFrame* aFrame,
|
||||
@ -3078,7 +3077,7 @@ PresShell::CheckVisibility(nsIDOMNode *node, PRInt16 startOffset, PRInt16 EndOff
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
|
||||
if (!content)
|
||||
return NS_ERROR_FAILURE;
|
||||
nsIFrame *frame = GetPrimaryFrameFor(content);
|
||||
nsIFrame *frame = content->GetPrimaryFrame();
|
||||
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
|
||||
@ -3446,7 +3445,7 @@ PresShell::GetViewToScroll(nsLayoutUtils::Direction aDirection)
|
||||
}
|
||||
}
|
||||
if (focusedContent) {
|
||||
nsIFrame* startFrame = GetPrimaryFrameFor(focusedContent);
|
||||
nsIFrame* startFrame = focusedContent->GetPrimaryFrame();
|
||||
if (startFrame) {
|
||||
nsIScrollableViewProvider* svp = do_QueryFrame(startFrame);
|
||||
// If this very frame provides a scroll view, start there instead of frame's
|
||||
@ -4127,7 +4126,7 @@ PresShell::DoScrollContentIntoView(nsIContent* aContent,
|
||||
PRIntn aVPercent,
|
||||
PRIntn aHPercent)
|
||||
{
|
||||
nsIFrame* frame = GetPrimaryFrameFor(aContent);
|
||||
nsIFrame* frame = aContent->GetPrimaryFrame();
|
||||
if (!frame) {
|
||||
mContentToScrollTo = nsnull;
|
||||
return;
|
||||
@ -4281,7 +4280,7 @@ PresShell::GetSelectionForCopy(nsISelection** outSelection)
|
||||
nsCOMPtr<nsIDOMNSHTMLTextAreaElement> htmlTextAreaElement(do_QueryInterface(content));
|
||||
if (htmlInputElement || htmlTextAreaElement)
|
||||
{
|
||||
nsIFrame *htmlInputFrame = GetPrimaryFrameFor(content);
|
||||
nsIFrame *htmlInputFrame = content->GetPrimaryFrame();
|
||||
if (!htmlInputFrame) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
@ -4386,7 +4385,7 @@ PresShell::ClearMouseCapture(nsIView* aView)
|
||||
if (shell->FrameManager()->IsDestroyingFrames())
|
||||
return;
|
||||
|
||||
frame = shell->GetPrimaryFrameFor(gCaptureInfo.mContent);
|
||||
frame = gCaptureInfo.mContent->GetPrimaryFrame();
|
||||
}
|
||||
}
|
||||
|
||||
@ -5143,16 +5142,13 @@ PresShell::StyleRuleRemoved(nsIDocument *aDocument,
|
||||
mStylesHaveChanged = PR_TRUE;
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
PresShell::GetPrimaryFrameFor(nsIContent* aContent) const
|
||||
{
|
||||
return FrameManager()->GetPrimaryFrameFor(aContent, -1);
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
PresShell::GetRealPrimaryFrameFor(nsIContent* aContent) const
|
||||
{
|
||||
nsIFrame *primaryFrame = FrameManager()->GetPrimaryFrameFor(aContent, -1);
|
||||
if (aContent->GetDocument() != GetDocument()) {
|
||||
return nsnull;
|
||||
}
|
||||
nsIFrame *primaryFrame = aContent->GetPrimaryFrame();
|
||||
if (!primaryFrame)
|
||||
return nsnull;
|
||||
return nsPlaceholderFrame::GetRealFrameFor(primaryFrame);
|
||||
@ -5458,7 +5454,7 @@ PresShell::CreateRangePaintInfo(nsIDOMRange* aRange,
|
||||
return nsnull;
|
||||
|
||||
nsIContent* ancestorContent = static_cast<nsIContent*>(ancestor);
|
||||
ancestorFrame = GetPrimaryFrameFor(ancestorContent);
|
||||
ancestorFrame = ancestorContent->GetPrimaryFrame();
|
||||
|
||||
// use the nearest ancestor frame that includes all continuations as the
|
||||
// root for building the display list
|
||||
@ -5833,7 +5829,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()) {
|
||||
mCurrentEventFrame = GetPrimaryFrameFor(mCurrentEventContent);
|
||||
mCurrentEventFrame = mCurrentEventContent->GetPrimaryFrame();
|
||||
}
|
||||
}
|
||||
|
||||
@ -6152,7 +6148,11 @@ PresShell::HandleEvent(nsIView *aView,
|
||||
if (capturingContent) {
|
||||
captureRetarget = gCaptureInfo.mRetargetToElement;
|
||||
if (!captureRetarget) {
|
||||
nsIFrame* captureFrame = GetPrimaryFrameFor(capturingContent);
|
||||
// A check was already done above to ensure that capturingContent is
|
||||
// in this presshell, so GetPrimaryFrame can just be called directly.
|
||||
NS_ASSERTION(capturingContent->GetCurrentDoc() == GetDocument(),
|
||||
"Unexpected document");
|
||||
nsIFrame* captureFrame = capturingContent->GetPrimaryFrame();
|
||||
if (captureFrame) {
|
||||
if (capturingContent->Tag() == nsGkAtoms::select &&
|
||||
capturingContent->IsHTML()) {
|
||||
@ -6202,8 +6202,10 @@ PresShell::HandleEvent(nsIView *aView,
|
||||
!nsContentUtils::ContentIsCrossDocDescendantOf(targetFrame->GetContent(),
|
||||
capturingContent))) {
|
||||
// A check was already done above to ensure that capturingContent is
|
||||
// in this presshell, so GetPrimaryFrameFor can just be called directly.
|
||||
nsIFrame* capturingFrame = GetPrimaryFrameFor(capturingContent);
|
||||
// in this presshell, so GetPrimaryFrame can just be called directly.
|
||||
NS_ASSERTION(capturingContent->GetCurrentDoc() == GetDocument(),
|
||||
"Unexpected document");
|
||||
nsIFrame* capturingFrame = capturingContent->GetPrimaryFrame();
|
||||
if (capturingFrame) {
|
||||
targetFrame = capturingFrame;
|
||||
aView = targetFrame->GetClosestView();
|
||||
@ -6733,7 +6735,7 @@ PresShell::PrepareToUseCaretPosition(nsIWidget* aEventWidget, nsIntPoint& aTarge
|
||||
rv = ScrollContentIntoView(content, NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,
|
||||
NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE);
|
||||
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
||||
frame = GetPrimaryFrameFor(content);
|
||||
frame = content->GetPrimaryFrame();
|
||||
NS_WARN_IF_FALSE(frame, "No frame for focused content?");
|
||||
}
|
||||
|
||||
@ -6836,7 +6838,7 @@ PresShell::GetCurrentItemAndPositionForElement(nsIDOMElement *aCurrentEl,
|
||||
col->GetElement(getter_AddRefs(colElement));
|
||||
nsCOMPtr<nsIContent> colContent(do_QueryInterface(colElement));
|
||||
if (colContent) {
|
||||
nsIFrame* frame = GetPrimaryFrameFor(colContent);
|
||||
nsIFrame* frame = colContent->GetPrimaryFrame();
|
||||
if (frame) {
|
||||
extraTreeY = frame->GetSize().height;
|
||||
}
|
||||
@ -6866,7 +6868,7 @@ PresShell::GetCurrentItemAndPositionForElement(nsIDOMElement *aCurrentEl,
|
||||
focusedContent = do_QueryInterface(item);
|
||||
#endif
|
||||
|
||||
nsIFrame *frame = GetPrimaryFrameFor(focusedContent);
|
||||
nsIFrame *frame = focusedContent->GetPrimaryFrame();
|
||||
if (frame) {
|
||||
nsPoint frameOrigin(0, 0);
|
||||
|
||||
@ -6978,10 +6980,9 @@ PresShell::RemoveOverrideStyleSheet(nsIStyleSheet *aSheet)
|
||||
}
|
||||
|
||||
static void
|
||||
FreezeElement(nsIContent *aContent, void *aShell)
|
||||
FreezeElement(nsIContent *aContent, void * /* unused */)
|
||||
{
|
||||
nsIPresShell* shell = static_cast<nsIPresShell*>(aShell);
|
||||
nsIFrame *frame = shell->FrameManager()->GetPrimaryFrameFor(aContent, -1);
|
||||
nsIFrame *frame = aContent->GetPrimaryFrame();
|
||||
nsIObjectFrame *objectFrame = do_QueryFrame(frame);
|
||||
if (objectFrame) {
|
||||
objectFrame->StopPlugin();
|
||||
@ -7003,7 +7004,7 @@ PresShell::Freeze()
|
||||
{
|
||||
MaybeReleaseCapturingContent();
|
||||
|
||||
mDocument->EnumerateFreezableElements(FreezeElement, this);
|
||||
mDocument->EnumerateFreezableElements(FreezeElement, nsnull);
|
||||
|
||||
if (mCaret)
|
||||
mCaret->SetCaretVisible(PR_FALSE);
|
||||
|
@ -146,10 +146,9 @@ nsIsIndexFrame::UpdatePromptLabel(PRBool aNotify)
|
||||
nsresult
|
||||
nsIsIndexFrame::GetInputFrame(nsIFormControlFrame** oFrame)
|
||||
{
|
||||
nsIPresShell *presShell = PresContext()->GetPresShell();
|
||||
if (!mInputContent) NS_WARNING("null content - cannot restore state");
|
||||
if (presShell && mInputContent) {
|
||||
nsIFrame *frame = presShell->GetPrimaryFrameFor(mInputContent);
|
||||
if (mInputContent) {
|
||||
nsIFrame *frame = mInputContent->GetPrimaryFrame();
|
||||
if (frame) {
|
||||
*oFrame = do_QueryFrame(frame);
|
||||
return *oFrame ? NS_OK : NS_NOINTERFACE;
|
||||
|
@ -279,9 +279,6 @@ void nsListControlFrame::PaintFocus(nsIRenderingContext& aRC, nsPoint aPt)
|
||||
nsPresContext* presContext = PresContext();
|
||||
if (!GetScrollableView()) return;
|
||||
|
||||
nsIPresShell *presShell = presContext->GetPresShell();
|
||||
if (!presShell) return;
|
||||
|
||||
nsIFrame* containerFrame = GetOptionsContainer();
|
||||
if (!containerFrame) return;
|
||||
|
||||
@ -301,7 +298,7 @@ void nsListControlFrame::PaintFocus(nsIRenderingContext& aRC, nsPoint aPt)
|
||||
focusedContent = GetOptionContent(focusedIndex);
|
||||
// otherwise we find the focusedContent's frame and scroll to it
|
||||
if (focusedContent) {
|
||||
childframe = presShell->GetPrimaryFrameFor(focusedContent);
|
||||
childframe = focusedContent->GetPrimaryFrame();
|
||||
}
|
||||
} else {
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> selectHTMLElement(do_QueryInterface(mContent));
|
||||
@ -337,7 +334,7 @@ void nsListControlFrame::PaintFocus(nsIRenderingContext& aRC, nsPoint aPt)
|
||||
// if we found a node use it, if not get the first child (this is for empty selects)
|
||||
if (node) {
|
||||
focusedContent = do_QueryInterface(node);
|
||||
childframe = presShell->GetPrimaryFrameFor(focusedContent);
|
||||
childframe = focusedContent->GetPrimaryFrame();
|
||||
}
|
||||
if (!childframe) {
|
||||
// Failing all else, try the first thing we have, but only if
|
||||
@ -476,8 +473,7 @@ GetNumberOfOptionsRecursive(nsIContent* aContent)
|
||||
}
|
||||
|
||||
static nscoord
|
||||
GetOptGroupLabelsHeight(nsPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
GetOptGroupLabelsHeight(nsIContent* aContent,
|
||||
nscoord aRowHeight)
|
||||
{
|
||||
nscoord height = 0;
|
||||
@ -487,7 +483,7 @@ GetOptGroupLabelsHeight(nsPresContext* aPresContext,
|
||||
if (::IsOptGroup(child)) {
|
||||
PRUint32 numOptions = ::GetNumberOfOptionsRecursive(child);
|
||||
nscoord optionsHeight = aRowHeight * numOptions;
|
||||
nsIFrame* frame = aPresContext->GetPresShell()->GetPrimaryFrameFor(child);
|
||||
nsIFrame* frame = child->GetPrimaryFrame();
|
||||
nscoord totalHeight = frame ? frame->GetSize().height : 0;
|
||||
height += NS_MAX(0, totalHeight - optionsHeight);
|
||||
}
|
||||
@ -1933,8 +1929,7 @@ nsListControlFrame::CalcIntrinsicHeight(nscoord aHeightOfARow,
|
||||
// When SIZE=0 or unspecified we constrain the height to
|
||||
// [2..kMaxDropDownRows] rows. We add in the height of optgroup labels
|
||||
// (within the constraint above), bug 300474.
|
||||
nscoord labelHeight =
|
||||
::GetOptGroupLabelsHeight(PresContext(), mContent, aHeightOfARow);
|
||||
nscoord labelHeight = ::GetOptGroupLabelsHeight(mContent, aHeightOfARow);
|
||||
|
||||
if (GetMultiple()) {
|
||||
if (aNumberOfOptions < 2) {
|
||||
@ -2136,7 +2131,6 @@ nsListControlFrame::GetIndexFromDOMEvent(nsIDOMEvent* aMouseEvent,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIPresShell *presShell = PresContext()->PresShell();
|
||||
PRInt32 numOptions = GetNumberOfOptions();
|
||||
if (numOptions < 1)
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -2147,7 +2141,7 @@ 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 = presShell->GetPrimaryFrameFor(firstOption);
|
||||
nsIFrame* optionFrame = firstOption->GetPrimaryFrame();
|
||||
if (optionFrame) {
|
||||
nsPoint ptInOptionFrame = pt - optionFrame->GetOffsetTo(this);
|
||||
if (ptInOptionFrame.y < 0 && ptInOptionFrame.x >= 0 &&
|
||||
@ -2161,7 +2155,7 @@ 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");
|
||||
optionFrame = presShell->GetPrimaryFrameFor(lastOption);
|
||||
optionFrame = lastOption->GetPrimaryFrame();
|
||||
if (optionFrame) {
|
||||
nsPoint ptInOptionFrame = pt - optionFrame->GetOffsetTo(this);
|
||||
if (ptInOptionFrame.y >= optionFrame->GetSize().height && ptInOptionFrame.x >= 0 &&
|
||||
@ -2327,10 +2321,9 @@ nsListControlFrame::ScrollToFrame(nsIContent* aOptElement)
|
||||
}
|
||||
|
||||
// otherwise we find the content's frame and scroll to it
|
||||
nsIPresShell *presShell = PresContext()->PresShell();
|
||||
nsIFrame * childframe;
|
||||
if (aOptElement) {
|
||||
childframe = presShell->GetPrimaryFrameFor(aOptElement);
|
||||
childframe = aOptElement->GetPrimaryFrame();
|
||||
} else {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -2363,7 +2356,7 @@ nsListControlFrame::ScrollToFrame(nsIContent* aOptElement)
|
||||
nsCOMPtr<nsIDOMHTMLOptGroupElement> optGroup(do_QueryInterface(parentContent));
|
||||
nsRect optRect(0,0,0,0);
|
||||
if (optGroup) {
|
||||
nsIFrame * optFrame = presShell->GetPrimaryFrameFor(parentContent);
|
||||
nsIFrame * optFrame = parentContent->GetPrimaryFrame();
|
||||
if (optFrame) {
|
||||
optRect = optFrame->GetRect();
|
||||
}
|
||||
|
@ -339,8 +339,6 @@ nsFrame::Init(nsIContent* aContent,
|
||||
|
||||
if (aContent) {
|
||||
NS_ADDREF(aContent);
|
||||
aContent->SetMayHaveFrame(PR_TRUE);
|
||||
NS_ASSERTION(mContent->MayHaveFrame(), "SetMayHaveFrame failed?");
|
||||
}
|
||||
|
||||
if (aPrevInFlow) {
|
||||
@ -466,6 +464,11 @@ nsFrame::DestroyFrom(nsIFrame* aDestructRoot)
|
||||
view->Destroy();
|
||||
}
|
||||
|
||||
// Make sure that our deleted frame can't be returned from GetPrimaryFrame()
|
||||
if (mContent && mContent->GetPrimaryFrame() == this) {
|
||||
mContent->SetPrimaryFrame(nsnull);
|
||||
}
|
||||
|
||||
// Must retrieve the object ID before calling destructors, so the
|
||||
// vtable is still valid.
|
||||
//
|
||||
@ -755,13 +758,10 @@ nsFrame::GetChildList(nsIAtom* aListName) const
|
||||
static nsIFrame*
|
||||
GetActiveSelectionFrame(nsPresContext* aPresContext, nsIFrame* aFrame)
|
||||
{
|
||||
nsIPresShell* shell = aPresContext->GetPresShell();
|
||||
if (shell) {
|
||||
nsIContent* capturingContent = nsIPresShell::GetCapturingContent();
|
||||
if (capturingContent) {
|
||||
nsIFrame* activeFrame = shell->GetPrimaryFrameFor(capturingContent);
|
||||
return activeFrame ? activeFrame : aFrame;
|
||||
}
|
||||
nsIContent* capturingContent = nsIPresShell::GetCapturingContent();
|
||||
if (capturingContent) {
|
||||
nsIFrame* activeFrame = aPresContext->GetPrimaryFrameFor(capturingContent);
|
||||
return activeFrame ? activeFrame : aFrame;
|
||||
}
|
||||
|
||||
return aFrame;
|
||||
|
@ -284,7 +284,7 @@ nsSubDocumentFrame::Init(nsIContent* aContent,
|
||||
// Set the primary frame now so that
|
||||
// DocumentViewerImpl::FindContainerView called by ShowViewer below
|
||||
// can find it if necessary.
|
||||
PresContext()->FrameManager()->SetPrimaryFrameFor(aContent, this);
|
||||
aContent->SetPrimaryFrame(this);
|
||||
|
||||
ShowViewer();
|
||||
return NS_OK;
|
||||
@ -566,7 +566,7 @@ nsSubDocumentFrame::Reflow(nsPresContext* aPresContext,
|
||||
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
|
||||
NS_ASSERTION(aPresContext->GetPresShell()->GetPrimaryFrameFor(mContent) == this,
|
||||
NS_ASSERTION(mContent->GetPrimaryFrame() == this,
|
||||
"Shouldn't happen");
|
||||
|
||||
// "offset" is the offset of our content area from our frame's
|
||||
|
@ -414,6 +414,7 @@ nsHTMLFramesetFrame::Init(nsIContent* aContent,
|
||||
mChildFrameborder[mChildCount] = GetFrameBorder(child);
|
||||
mChildBorderColors[mChildCount].Set(GetBorderColor(child));
|
||||
}
|
||||
child->SetPrimaryFrame(frame);
|
||||
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
|
@ -2152,8 +2152,7 @@ nsGfxScrollFrameInner::IsLTR() const
|
||||
}
|
||||
|
||||
if (root) {
|
||||
nsIFrame *rootsFrame =
|
||||
presContext->PresShell()->GetPrimaryFrameFor(root);
|
||||
nsIFrame *rootsFrame = root->GetPrimaryFrame();
|
||||
if (rootsFrame)
|
||||
frame = rootsFrame;
|
||||
}
|
||||
|
@ -734,10 +734,9 @@ NS_IMPL_ISUPPORTS4(nsImageMap,
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImageMap::GetBoundsForAreaContent(nsIContent *aContent,
|
||||
nsPresContext* aPresContext,
|
||||
nsRect& aBounds)
|
||||
nsRect& aBounds)
|
||||
{
|
||||
NS_ENSURE_TRUE(aContent && aPresContext, NS_ERROR_INVALID_ARG);
|
||||
NS_ENSURE_TRUE(aContent, NS_ERROR_INVALID_ARG);
|
||||
|
||||
// Find the Area struct associated with this content node, and return bounds
|
||||
PRUint32 i, n = mAreas.Length();
|
||||
@ -745,12 +744,9 @@ nsImageMap::GetBoundsForAreaContent(nsIContent *aContent,
|
||||
Area* area = mAreas.ElementAt(i);
|
||||
if (area->mArea == aContent) {
|
||||
aBounds = nsRect();
|
||||
nsIPresShell* shell = aPresContext->PresShell();
|
||||
if (shell) {
|
||||
nsIFrame* frame = shell->GetPrimaryFrameFor(aContent);
|
||||
if (frame) {
|
||||
area->GetRect(frame, aBounds);
|
||||
}
|
||||
nsIFrame* frame = aContent->GetPrimaryFrame();
|
||||
if (frame) {
|
||||
area->GetRect(frame, aBounds);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@ -900,9 +896,7 @@ nsImageMap::AddArea(nsIContent* aArea)
|
||||
// nsCSSFrameConstructor::ContentRemoved (both hacks there), and
|
||||
// nsCSSFrameConstructor::ProcessRestyledFrames to work around this issue can
|
||||
// be removed.
|
||||
mPresShell->FrameManager()->SetPrimaryFrameFor(aArea, mImageFrame);
|
||||
aArea->SetMayHaveFrame(PR_TRUE);
|
||||
NS_ASSERTION(aArea->MayHaveFrame(), "SetMayHaveFrame failed?");
|
||||
aArea->SetPrimaryFrame(mImageFrame);
|
||||
|
||||
area->ParseCoords(coords);
|
||||
mAreas.AppendElement(area);
|
||||
@ -1017,22 +1011,15 @@ nsImageMap::ChangeFocus(nsIDOMEvent* aEvent, PRBool aFocus)
|
||||
Area* area = mAreas.ElementAt(i);
|
||||
nsCOMPtr<nsIContent> areaContent;
|
||||
area->GetArea(getter_AddRefs(areaContent));
|
||||
if (areaContent.get() == targetContent.get()) {
|
||||
if (areaContent == targetContent) {
|
||||
//Set or Remove internal focus
|
||||
area->HasFocus(aFocus);
|
||||
//Now invalidate the rect
|
||||
nsCOMPtr<nsIDocument> doc = targetContent->GetDocument();
|
||||
//This check is necessary to see if we're still attached to the doc
|
||||
if (doc) {
|
||||
nsIPresShell *presShell = doc->GetPrimaryShell();
|
||||
if (presShell) {
|
||||
nsIFrame* imgFrame = presShell->GetPrimaryFrameFor(targetContent);
|
||||
if (imgFrame) {
|
||||
nsRect dmgRect;
|
||||
area->GetRect(imgFrame, dmgRect);
|
||||
imgFrame->Invalidate(dmgRect);
|
||||
}
|
||||
}
|
||||
nsIFrame* imgFrame = targetContent->GetPrimaryFrame();
|
||||
if (imgFrame) {
|
||||
nsRect dmgRect;
|
||||
area->GetRect(imgFrame, dmgRect);
|
||||
imgFrame->Invalidate(dmgRect);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -98,7 +98,6 @@ public:
|
||||
|
||||
//nsIImageMap
|
||||
NS_IMETHOD GetBoundsForAreaContent(nsIContent *aContent,
|
||||
nsPresContext* aPresContext,
|
||||
nsRect& aBounds);
|
||||
|
||||
protected:
|
||||
|
@ -4907,19 +4907,8 @@ DepthOfVisual(const Screen* screen, const Visual* visual)
|
||||
|
||||
static GdkWindow* GetClosestWindow(nsIDOMElement *element)
|
||||
{
|
||||
nsCOMPtr<nsIDOMDocument> domDocument;
|
||||
element->GetOwnerDocument(getter_AddRefs(domDocument));
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDocument);
|
||||
if (!doc)
|
||||
return nsnull;
|
||||
|
||||
nsIPresShell *presShell = doc->GetPrimaryShell();
|
||||
if (!presShell)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(element);
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(content);
|
||||
nsIFrame* frame = content->GetPrimaryFrame();
|
||||
if (!frame)
|
||||
return nsnull;
|
||||
|
||||
|
@ -467,7 +467,7 @@ public:
|
||||
{
|
||||
if (mSelection && mPresContext)
|
||||
{
|
||||
nsWeakFrame frame = mPresContext->PresShell()->GetPrimaryFrameFor(mContent);
|
||||
nsWeakFrame frame = mPresContext->GetPrimaryFrameFor(mContent);
|
||||
mContent = nsnull;
|
||||
|
||||
mFrameSelection->HandleDrag(frame, mPoint);
|
||||
@ -968,7 +968,7 @@ nsFrameSelection::ConstrainFrameAndPointToAnchorSubtree(nsIFrame *aFrame,
|
||||
// frame.
|
||||
//
|
||||
|
||||
*aRetFrame = mShell->GetPrimaryFrameFor(anchorRoot);
|
||||
*aRetFrame = anchorRoot->GetPrimaryFrame();
|
||||
|
||||
if (!*aRetFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -2090,7 +2090,7 @@ nsFrameSelection::GetFrameForNodeOffset(nsIContent *aNode,
|
||||
}
|
||||
}
|
||||
|
||||
nsIFrame* returnFrame = mShell->GetPrimaryFrameFor(theNode);
|
||||
nsIFrame* returnFrame = theNode->GetPrimaryFrame();
|
||||
if (!returnFrame)
|
||||
return nsnull;
|
||||
|
||||
@ -2303,12 +2303,8 @@ nsITableCellLayout*
|
||||
nsFrameSelection::GetCellLayout(nsIContent *aCellContent) const
|
||||
{
|
||||
NS_ENSURE_TRUE(mShell, nsnull);
|
||||
// Get frame for cell
|
||||
nsIFrame *cellFrame = mShell->GetPrimaryFrameFor(aCellContent);
|
||||
if (!cellFrame)
|
||||
return nsnull;
|
||||
|
||||
nsITableCellLayout *cellLayoutObject = do_QueryFrame(cellFrame);
|
||||
nsITableCellLayout *cellLayoutObject =
|
||||
do_QueryFrame(aCellContent->GetPrimaryFrame());
|
||||
return cellLayoutObject;
|
||||
}
|
||||
|
||||
@ -2316,12 +2312,8 @@ nsITableLayout*
|
||||
nsFrameSelection::GetTableLayout(nsIContent *aTableContent) const
|
||||
{
|
||||
NS_ENSURE_TRUE(mShell, nsnull);
|
||||
// Get frame for table
|
||||
nsIFrame *tableFrame = mShell->GetPrimaryFrameFor(aTableContent);
|
||||
if (!tableFrame)
|
||||
return nsnull;
|
||||
|
||||
nsITableLayout *tableLayoutObject = do_QueryFrame(tableFrame);
|
||||
nsITableLayout *tableLayoutObject =
|
||||
do_QueryFrame(aTableContent->GetPrimaryFrame());
|
||||
return tableLayoutObject;
|
||||
}
|
||||
|
||||
@ -2489,8 +2481,7 @@ printf("HandleTableSelection: Mouse down event\n");
|
||||
// We have at least 1 other selected cell
|
||||
|
||||
// Check if new cell is already selected
|
||||
NS_ENSURE_STATE(mShell);
|
||||
nsIFrame *cellFrame = mShell->GetPrimaryFrameFor(childContent);
|
||||
nsIFrame *cellFrame = childContent->GetPrimaryFrame();
|
||||
if (!cellFrame) return NS_ERROR_NULL_POINTER;
|
||||
result = cellFrame->GetSelected(&isSelected);
|
||||
if (NS_FAILED(result)) return result;
|
||||
@ -4200,7 +4191,7 @@ nsTypedSelection::GetPrimaryFrameForRangeEndpoint(nsIDOMNode *aNode, PRInt32 aOf
|
||||
content = child; // releases the focusnode
|
||||
}
|
||||
}
|
||||
*aReturnFrame = mFrameSelection->GetShell()->GetPrimaryFrameFor(content);
|
||||
*aReturnFrame = content->GetPrimaryFrame();
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
@ -4286,7 +4277,7 @@ nsTypedSelection::SelectAllFramesForContent(nsIContentIterator *aInnerIter,
|
||||
if (NS_SUCCEEDED(result))
|
||||
{
|
||||
// First select frame of content passed in
|
||||
frame = shell->GetPrimaryFrameFor(aContent);
|
||||
frame = aContent->GetPrimaryFrame();
|
||||
if (frame)
|
||||
{
|
||||
frame->SetSelected(aSelected, mType);
|
||||
@ -4305,7 +4296,7 @@ nsTypedSelection::SelectAllFramesForContent(nsIContentIterator *aInnerIter,
|
||||
nsCOMPtr<nsIContent> innercontent =
|
||||
do_QueryInterface(aInnerIter->GetCurrentNode());
|
||||
|
||||
frame = shell->GetPrimaryFrameFor(innercontent);
|
||||
frame = innercontent->GetPrimaryFrame();
|
||||
if (frame)
|
||||
{
|
||||
frame->SetSelected(aSelected, mType);
|
||||
@ -4364,10 +4355,9 @@ nsTypedSelection::selectFrames(nsPresContext* aPresContext, nsIRange *aRange, PR
|
||||
if (!content)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
nsIFrame *frame;
|
||||
if (content->IsNodeOfType(nsINode::eTEXT))
|
||||
{
|
||||
frame = presShell->GetPrimaryFrameFor(content);
|
||||
nsIFrame* frame = content->GetPrimaryFrame();
|
||||
// The frame could be an SVG text frame, in which case we'll ignore
|
||||
// it.
|
||||
if (frame && frame->GetType() == nsGkAtoms::textFrame)
|
||||
@ -4404,7 +4394,7 @@ nsTypedSelection::selectFrames(nsPresContext* aPresContext, nsIRange *aRange, PR
|
||||
|
||||
if (content->IsNodeOfType(nsINode::eTEXT))
|
||||
{
|
||||
frame = presShell->GetPrimaryFrameFor(content);
|
||||
nsIFrame* frame = content->GetPrimaryFrame();
|
||||
// The frame could be an SVG text frame, in which case we'll
|
||||
// ignore it.
|
||||
if (frame && frame->GetType() == nsGkAtoms::textFrame)
|
||||
|
@ -100,13 +100,7 @@ inDOMUtils::IsIgnorableWhitespace(nsIDOMCharacterData *aDataNode,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell = inLayoutUtils::GetPresShellFor(win);
|
||||
if (!presShell) {
|
||||
// Display:none iframe or something... Bail out
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(content);
|
||||
nsIFrame* frame = content->GetPrimaryFrame();
|
||||
if (frame) {
|
||||
const nsStyleText* text = frame->GetStyleText();
|
||||
*aReturn = !text->WhiteSpaceIsSignificant();
|
||||
|
@ -133,11 +133,7 @@ NS_IMETHODIMP
|
||||
inFlasher::RepaintElement(nsIDOMElement* aElement)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aElement);
|
||||
nsCOMPtr<nsIDOMWindowInternal> window = inLayoutUtils::GetWindowFor(aElement);
|
||||
if (!window) return NS_OK;
|
||||
nsCOMPtr<nsIPresShell> presShell = inLayoutUtils::GetPresShellFor(window);
|
||||
if (!presShell) return NS_OK;
|
||||
nsIFrame* frame = inLayoutUtils::GetFrameFor(aElement, presShell);
|
||||
nsIFrame* frame = inLayoutUtils::GetFrameFor(aElement);
|
||||
if (!frame) return NS_OK;
|
||||
|
||||
frame->Invalidate(frame->GetRect());
|
||||
@ -154,7 +150,7 @@ inFlasher::DrawElementOutline(nsIDOMElement* aElement)
|
||||
nsCOMPtr<nsIPresShell> presShell = inLayoutUtils::GetPresShellFor(window);
|
||||
if (!presShell) return NS_OK;
|
||||
|
||||
nsIFrame* frame = inLayoutUtils::GetFrameFor(aElement, presShell);
|
||||
nsIFrame* frame = inLayoutUtils::GetFrameFor(aElement);
|
||||
|
||||
PRBool isFirstFrame = PR_TRUE;
|
||||
|
||||
|
@ -84,10 +84,10 @@ inLayoutUtils::GetPresShellFor(nsISupports* aThing)
|
||||
|
||||
/*static*/
|
||||
nsIFrame*
|
||||
inLayoutUtils::GetFrameFor(nsIDOMElement* aElement, nsIPresShell* aShell)
|
||||
inLayoutUtils::GetFrameFor(nsIDOMElement* aElement)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
|
||||
return aShell->GetPrimaryFrameFor(content);
|
||||
return content->GetPrimaryFrame();
|
||||
}
|
||||
|
||||
nsIEventStateManager*
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
static nsIDOMWindowInternal* GetWindowFor(nsIDOMNode* aNode);
|
||||
static nsIDOMWindowInternal* GetWindowFor(nsIDOMDocument* aDoc);
|
||||
static nsIPresShell* GetPresShellFor(nsISupports* aThing);
|
||||
static nsIFrame* GetFrameFor(nsIDOMElement* aElement, nsIPresShell* aShell);
|
||||
static nsIFrame* GetFrameFor(nsIDOMElement* aElement);
|
||||
static nsIEventStateManager* GetEventStateManagerFor(nsIDOMElement *aElement);
|
||||
static nsBindingManager* GetBindingManagerFor(nsIDOMNode* aNode);
|
||||
static nsIDOMDocument* GetSubDocumentFor(nsIDOMNode* aNode);
|
||||
|
@ -1817,8 +1817,7 @@ nsPrintEngine::ReflowDocList(nsPrintObject* aPO, PRBool aSetPixelScale)
|
||||
|
||||
// Check to see if the subdocument's element has been hidden by the parent document
|
||||
if (aPO->mParent && aPO->mParent->mPresShell) {
|
||||
nsIFrame * frame =
|
||||
aPO->mParent->mPresShell->GetPrimaryFrameFor(aPO->mContent);
|
||||
nsIFrame * frame = aPO->mContent->GetPrimaryFrame();
|
||||
if (frame) {
|
||||
if (!frame->GetStyleVisibility()->IsVisible()) {
|
||||
aPO->mDontPrint = PR_TRUE;
|
||||
@ -1872,10 +1871,7 @@ nsPrintEngine::ReflowPrintObject(nsPrintObject * aPO)
|
||||
return NS_OK;
|
||||
|
||||
if (aPO->mParent && aPO->mParent->IsPrintable()) {
|
||||
if (aPO->mParent->mPresShell) {
|
||||
frame = aPO->mParent->mPresShell->FrameManager()->
|
||||
GetPrimaryFrameFor(aPO->mContent, -1);
|
||||
}
|
||||
frame = aPO->mContent->GetPrimaryFrame();
|
||||
// Without a frame, this document can't be displayed; therefore, there is no
|
||||
// point to reflowing it
|
||||
if (!frame) {
|
||||
|
@ -354,7 +354,7 @@ nsComputedDOMStyle::GetStyleContextForContentNoFlush(nsIContent* aContent,
|
||||
}
|
||||
|
||||
if (!aPseudo) {
|
||||
nsIFrame* frame = aPresShell->GetPrimaryFrameFor(aContent);
|
||||
nsIFrame* frame = aContent->GetPrimaryFrame();
|
||||
if (frame) {
|
||||
nsStyleContext* result =
|
||||
nsLayoutUtils::GetStyleFrame(frame)->GetStyleContext();
|
||||
@ -453,7 +453,7 @@ nsComputedDOMStyle::GetPropertyCSSValue(const nsAString& aPropertyName,
|
||||
NS_ENSURE_TRUE(mPresShell && mPresShell->GetPresContext(),
|
||||
NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
mOuterFrame = mPresShell->GetPrimaryFrameFor(mContent);
|
||||
mOuterFrame = mContent->GetPrimaryFrame();
|
||||
mInnerFrame = mOuterFrame;
|
||||
if (mOuterFrame && !mPseudo) {
|
||||
nsIAtom* type = mOuterFrame->GetType();
|
||||
|
@ -410,7 +410,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);
|
||||
nsIFrame *bodyFrame = bodyContent->GetPrimaryFrame();
|
||||
if (!bodyFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
*aColor = bodyFrame->GetStyleColor()->mColor;
|
||||
|
@ -90,7 +90,7 @@ nsSVGRenderingObserver::GetReferencedFrame()
|
||||
nsIDocument* doc = mElement.get()->GetCurrentDoc();
|
||||
nsIPresShell* shell = doc ? doc->GetPrimaryShell() : nsnull;
|
||||
if (shell && !shell->FrameManager()->IsDestroyingFrames()) {
|
||||
nsIFrame* frame = shell->GetPrimaryFrameFor(mElement.get());
|
||||
nsIFrame* frame = mElement.get()->GetPrimaryFrame();
|
||||
if (frame) {
|
||||
mReferencedFrame = frame;
|
||||
mReferencedFramePresShell = shell;
|
||||
|
@ -95,7 +95,7 @@ nsSVGMutationObserver::AttributeChanged(nsIDocument *aDocument,
|
||||
nsPresShellIterator iter(aDocument);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
while ((shell = iter.GetNextShell())) {
|
||||
nsIFrame *frame = shell->GetPrimaryFrameFor(aContent);
|
||||
nsIFrame *frame = aContent->GetPrimaryFrame();
|
||||
if (!frame) {
|
||||
continue;
|
||||
}
|
||||
|
@ -557,15 +557,12 @@ nsSVGUtils::GetCTM(nsSVGElement *aElement, PRBool aScreenCTM)
|
||||
if (currentDoc && element->NodeInfo()->Equals(nsGkAtoms::svg, kNameSpaceID_SVG)) {
|
||||
nsIPresShell *presShell = currentDoc->GetPrimaryShell();
|
||||
if (presShell) {
|
||||
nsPresContext *context = presShell->GetPresContext();
|
||||
if (context) {
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(element);
|
||||
nsIFrame* ancestorFrame = presShell->GetRootFrame();
|
||||
if (frame && ancestorFrame) {
|
||||
nsPoint point = frame->GetOffsetTo(ancestorFrame);
|
||||
x = nsPresContext::AppUnitsToFloatCSSPixels(point.x);
|
||||
y = nsPresContext::AppUnitsToFloatCSSPixels(point.y);
|
||||
}
|
||||
nsIFrame* frame = element->GetPrimaryFrame();
|
||||
nsIFrame* ancestorFrame = presShell->GetRootFrame();
|
||||
if (frame && ancestorFrame) {
|
||||
nsPoint point = frame->GetOffsetTo(ancestorFrame);
|
||||
x = nsPresContext::AppUnitsToFloatCSSPixels(point.x);
|
||||
y = nsPresContext::AppUnitsToFloatCSSPixels(point.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -153,7 +153,12 @@ nsBoxObject::GetFrame(PRBool aFlushLayout)
|
||||
shell->FlushPendingNotifications(Flush_Frames);
|
||||
}
|
||||
|
||||
return shell->GetPrimaryFrameFor(mContent);
|
||||
// The flush might have killed mContent.
|
||||
if (!mContent) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
return mContent->GetPrimaryFrame();
|
||||
}
|
||||
|
||||
nsIPresShell*
|
||||
|
@ -1224,8 +1224,7 @@ nsListBoxBodyFrame::GetNextItemBox(nsIBox* aBox, PRInt32 aOffset,
|
||||
return GetNextItemBox(aBox, ++aOffset, aCreated);
|
||||
|
||||
nsPresContext* presContext = PresContext();
|
||||
nsIFrame* existingFrame =
|
||||
presContext->GetPresShell()->GetPrimaryFrameFor(nextContent);
|
||||
nsIFrame* existingFrame = nextContent->GetPrimaryFrame();
|
||||
|
||||
if (existingFrame && existingFrame->GetParent() != this)
|
||||
return GetNextItemBox(aBox, ++aOffset, aCreated);
|
||||
@ -1348,13 +1347,12 @@ nsListBoxBodyFrame::OnContentInserted(nsPresContext* aPresContext, nsIContent* a
|
||||
if (mRowCount >= 0)
|
||||
++mRowCount;
|
||||
|
||||
nsIPresShell *shell = aPresContext->PresShell();
|
||||
// The RDF content builder will build content nodes such that they are all
|
||||
// ready when OnContentInserted is first called, meaning the first call
|
||||
// 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 = shell->GetPrimaryFrameFor(aChildContent);
|
||||
nsIFrame* childFrame = aChildContent->GetPrimaryFrame();
|
||||
if (childFrame)
|
||||
return;
|
||||
|
||||
@ -1369,7 +1367,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 = shell->GetPrimaryFrameFor(nextSiblingContent);
|
||||
nsIFrame* nextSiblingFrame = nextSiblingContent->GetPrimaryFrame();
|
||||
mLinkupFrame = nextSiblingFrame;
|
||||
}
|
||||
|
||||
@ -1427,8 +1425,7 @@ nsListBoxBodyFrame::OnContentRemoved(nsPresContext* aPresContext,
|
||||
if (last.position() > 0) {
|
||||
iter.seek(last.position() - 1);
|
||||
nsIContent *lastChild = *iter;
|
||||
nsIFrame* lastChildFrame =
|
||||
aPresContext->PresShell()->GetPrimaryFrameFor(lastChild);
|
||||
nsIFrame* lastChildFrame = lastChild->GetPrimaryFrame();
|
||||
|
||||
if (lastChildFrame) {
|
||||
mTopFrame = nsnull;
|
||||
|
@ -194,7 +194,7 @@ nsListBoxObject::GetListBoxBody(PRBool aFlush)
|
||||
|
||||
nsIFrame* frame = aFlush ?
|
||||
GetFrame(PR_FALSE) /* does Flush_Frames */ :
|
||||
shell->GetPrimaryFrameFor(mContent);
|
||||
mContent->GetPrimaryFrame();
|
||||
if (!frame)
|
||||
return nsnull;
|
||||
|
||||
@ -203,7 +203,7 @@ nsListBoxObject::GetListBoxBody(PRBool aFlush)
|
||||
FindBodyContent(frame->GetContent(), getter_AddRefs(content));
|
||||
|
||||
// this frame will be a nsGFXScrollFrame
|
||||
frame = shell->GetPrimaryFrameFor(content);
|
||||
frame = content->GetPrimaryFrame();
|
||||
if (!frame)
|
||||
return nsnull;
|
||||
nsIScrollableFrame* scrollFrame = do_QueryFrame(frame);
|
||||
|
@ -1328,7 +1328,7 @@ nsMenuFrame::SetActiveChild(nsIDOMElement* aChild)
|
||||
|
||||
nsCOMPtr<nsIContent> child(do_QueryInterface(aChild));
|
||||
|
||||
nsIFrame* kid = PresContext()->PresShell()->GetPrimaryFrameFor(child);
|
||||
nsIFrame* kid = child->GetPrimaryFrame();
|
||||
if (kid && kid->GetType() == nsGkAtoms::menuFrame)
|
||||
mPopupFrame->ChangeMenuItem(static_cast<nsMenuFrame *>(kid), PR_FALSE);
|
||||
return NS_OK;
|
||||
|
@ -911,7 +911,7 @@ nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame)
|
||||
if (!shell)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
aAnchorFrame = shell->GetPrimaryFrameFor(mAnchorContent);
|
||||
aAnchorFrame = mAnchorContent->GetPrimaryFrame();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext,
|
||||
nsIContent* contentToResize =
|
||||
GetContentToResize(presShell, getter_AddRefs(window));
|
||||
if (contentToResize) {
|
||||
nsIFrame* frameToResize = presShell->GetPrimaryFrameFor(contentToResize);
|
||||
nsIFrame* frameToResize = contentToResize->GetPrimaryFrame();
|
||||
if (!frameToResize)
|
||||
break;
|
||||
|
||||
@ -165,7 +165,7 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext,
|
||||
// check if the returned content really is a menupopup
|
||||
nsMenuPopupFrame* menuPopupFrame = nsnull;
|
||||
if (contentToResize) {
|
||||
nsIFrame* frameToResize = presShell->GetPrimaryFrameFor(contentToResize);
|
||||
nsIFrame* frameToResize = contentToResize->GetPrimaryFrame();
|
||||
if (frameToResize && frameToResize->GetType() == nsGkAtoms::menuPopupFrame) {
|
||||
menuPopupFrame = static_cast<nsMenuPopupFrame *>(frameToResize);
|
||||
}
|
||||
|
@ -185,8 +185,7 @@ nsScrollbarFrame::GetScrollbarMediator()
|
||||
{
|
||||
if (!mScrollbarMediator)
|
||||
return nsnull;
|
||||
nsIFrame* f =
|
||||
PresContext()->PresShell()->GetPrimaryFrameFor(mScrollbarMediator);
|
||||
nsIFrame* f = mScrollbarMediator->GetPrimaryFrame();
|
||||
if (!f)
|
||||
return nsnull;
|
||||
|
||||
|
@ -818,13 +818,10 @@ nsSliderFrame::SetCurrentPositionInternal(nsIContent* aScrollbar, PRInt32 aNewPo
|
||||
mediator->PositionChanged(scrollbarFrame, GetCurrentPosition(scrollbar), aNewPos);
|
||||
// 'mediator' might be dangling now...
|
||||
UpdateAttribute(scrollbar, aNewPos, PR_FALSE, aIsSmooth);
|
||||
nsIPresShell* shell = context->GetPresShell();
|
||||
if (shell) {
|
||||
nsIFrame* frame = shell->GetPrimaryFrameFor(content);
|
||||
if (frame && frame->GetType() == nsGkAtoms::sliderFrame) {
|
||||
static_cast<nsSliderFrame*>(frame)->
|
||||
CurrentPositionChanged(frame->PresContext(), aImmediateRedraw);
|
||||
}
|
||||
nsIFrame* frame = content->GetPrimaryFrame();
|
||||
if (frame && frame->GetType() == nsGkAtoms::sliderFrame) {
|
||||
static_cast<nsSliderFrame*>(frame)->
|
||||
CurrentPositionChanged(frame->PresContext(), aImmediateRedraw);
|
||||
}
|
||||
mUserChanged = PR_FALSE;
|
||||
return;
|
||||
|
@ -287,7 +287,7 @@ nsXULPopupManager::GetFrameOfTypeForContent(nsIContent* aContent,
|
||||
if (aShouldFlush)
|
||||
presShell->FlushPendingNotifications(Flush_Frames);
|
||||
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(aContent);
|
||||
nsIFrame* frame = aContent->GetPrimaryFrame();
|
||||
if (frame && frame->GetType() == aFrameType)
|
||||
return frame;
|
||||
}
|
||||
@ -1064,7 +1064,7 @@ nsXULPopupManager::FirePopupShowingEvent(nsIContent* aPopup,
|
||||
document->FlushPendingNotifications(Flush_Layout);
|
||||
|
||||
// get the frame again in case it went away
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(aPopup);
|
||||
nsIFrame* frame = aPopup->GetPrimaryFrame();
|
||||
if (frame && frame->GetType() == nsGkAtoms::menuPopupFrame) {
|
||||
nsMenuPopupFrame* popupFrame = static_cast<nsMenuPopupFrame *>(frame);
|
||||
|
||||
@ -1113,7 +1113,7 @@ nsXULPopupManager::FirePopupHidingEvent(nsIContent* aPopup,
|
||||
}
|
||||
|
||||
// get frame again in case it went away
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(aPopup);
|
||||
nsIFrame* frame = aPopup->GetPrimaryFrame();
|
||||
if (frame && frame->GetType() == nsGkAtoms::menuPopupFrame) {
|
||||
nsMenuPopupFrame* popupFrame = static_cast<nsMenuPopupFrame *>(frame);
|
||||
|
||||
|
@ -696,9 +696,7 @@ nsXULTooltipListener::GetTooltipFor(nsIContent* aTarget, nsIContent** aTooltip)
|
||||
// Submenus can't be used as tooltips, see bug 288763.
|
||||
nsIContent* parent = tooltip->GetParent();
|
||||
if (parent) {
|
||||
nsIDocument* doc = parent->GetCurrentDoc();
|
||||
nsIPresShell* presShell = doc ? doc->GetPrimaryShell() : nsnull;
|
||||
nsIFrame* frame = presShell ? presShell->GetPrimaryFrameFor(parent) : nsnull;
|
||||
nsIFrame* frame = parent->GetPrimaryFrame();
|
||||
if (frame && frame->GetType() == nsGkAtoms::menuFrame) {
|
||||
NS_WARNING("Menu cannot be used as a tooltip");
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -882,11 +882,10 @@ FindScrollParts(nsIFrame* aCurrFrame, nsTreeBodyFrame::ScrollParts* aResult)
|
||||
|
||||
nsTreeBodyFrame::ScrollParts nsTreeBodyFrame::GetScrollParts()
|
||||
{
|
||||
nsPresContext* presContext = PresContext();
|
||||
ScrollParts result = { nsnull, nsnull, nsnull, nsnull, nsnull, nsnull };
|
||||
nsIContent* baseElement = GetBaseElement();
|
||||
nsIFrame* treeFrame =
|
||||
baseElement ? presContext->PresShell()->GetPrimaryFrameFor(baseElement) : nsnull;
|
||||
baseElement ? baseElement->GetPrimaryFrame() : nsnull;
|
||||
if (treeFrame) {
|
||||
// The way we do this, searching through the entire frame subtree, is pretty
|
||||
// dumb! We should know where these frames are.
|
||||
@ -1364,7 +1363,7 @@ nsTreeBodyFrame::AdjustForCellText(nsAutoString& aText,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
nsRect& aTextRect)
|
||||
{
|
||||
NS_PRECONDITION(aColumn && aColumn->GetFrame(this), "invalid column passed");
|
||||
NS_PRECONDITION(aColumn && aColumn->GetFrame(), "invalid column passed");
|
||||
|
||||
nscoord width =
|
||||
nsLayoutUtils::GetStringWidth(this, &aRenderingContext, aText.get(), aText.Length());
|
||||
@ -1522,7 +1521,7 @@ nsTreeBodyFrame::GetItemWithinCellAt(nscoord aX, const nsRect& aCellRect,
|
||||
PRInt32 aRowIndex,
|
||||
nsTreeColumn* aColumn)
|
||||
{
|
||||
NS_PRECONDITION(aColumn && aColumn->GetFrame(this), "invalid column passed");
|
||||
NS_PRECONDITION(aColumn && aColumn->GetFrame(), "invalid column passed");
|
||||
|
||||
// Obtain the properties for our cell.
|
||||
PrefillPropertyArray(aRowIndex, aColumn);
|
||||
@ -1966,7 +1965,7 @@ nsTreeBodyFrame::EndUpdateBatch()
|
||||
void
|
||||
nsTreeBodyFrame::PrefillPropertyArray(PRInt32 aRowIndex, nsTreeColumn* aCol)
|
||||
{
|
||||
NS_PRECONDITION(!aCol || aCol->GetFrame(this), "invalid column passed");
|
||||
NS_PRECONDITION(!aCol || aCol->GetFrame(), "invalid column passed");
|
||||
mScratchArray->Clear();
|
||||
|
||||
// focus
|
||||
@ -2911,7 +2910,7 @@ nsTreeBodyFrame::PaintColumn(nsTreeColumn* aColumn,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect)
|
||||
{
|
||||
NS_PRECONDITION(aColumn && aColumn->GetFrame(this), "invalid column passed");
|
||||
NS_PRECONDITION(aColumn && aColumn->GetFrame(), "invalid column passed");
|
||||
|
||||
// Now obtain the properties for our cell.
|
||||
PrefillPropertyArray(-1, aColumn);
|
||||
@ -3146,7 +3145,7 @@ nsTreeBodyFrame::PaintCell(PRInt32 aRowIndex,
|
||||
nscoord& aCurrX,
|
||||
nsPoint aPt)
|
||||
{
|
||||
NS_PRECONDITION(aColumn && aColumn->GetFrame(this), "invalid column passed");
|
||||
NS_PRECONDITION(aColumn && aColumn->GetFrame(), "invalid column passed");
|
||||
|
||||
// Now obtain the properties for our cell.
|
||||
// XXX Automatically fill in the following props: open, closed, container, leaf, selected, focused, and the col ID.
|
||||
@ -3325,7 +3324,7 @@ nsTreeBodyFrame::PaintTwisty(PRInt32 aRowIndex,
|
||||
nscoord& aRemainingWidth,
|
||||
nscoord& aCurrX)
|
||||
{
|
||||
NS_PRECONDITION(aColumn && aColumn->GetFrame(this), "invalid column passed");
|
||||
NS_PRECONDITION(aColumn && aColumn->GetFrame(), "invalid column passed");
|
||||
|
||||
PRBool isRTL = GetStyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
|
||||
nscoord rightEdge = aCurrX + aRemainingWidth;
|
||||
@ -3417,7 +3416,7 @@ nsTreeBodyFrame::PaintImage(PRInt32 aRowIndex,
|
||||
nscoord& aRemainingWidth,
|
||||
nscoord& aCurrX)
|
||||
{
|
||||
NS_PRECONDITION(aColumn && aColumn->GetFrame(this), "invalid column passed");
|
||||
NS_PRECONDITION(aColumn && aColumn->GetFrame(), "invalid column passed");
|
||||
|
||||
PRBool isRTL = GetStyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
|
||||
nscoord rightEdge = aCurrX + aRemainingWidth;
|
||||
@ -3553,7 +3552,7 @@ nsTreeBodyFrame::PaintText(PRInt32 aRowIndex,
|
||||
nscoord& aCurrX,
|
||||
PRBool aTextRTL)
|
||||
{
|
||||
NS_PRECONDITION(aColumn && aColumn->GetFrame(this), "invalid column passed");
|
||||
NS_PRECONDITION(aColumn && aColumn->GetFrame(), "invalid column passed");
|
||||
|
||||
PRBool isRTL = GetStyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
|
||||
nscoord rightEdge = aTextRect.XMost();
|
||||
@ -3659,7 +3658,7 @@ nsTreeBodyFrame::PaintCheckbox(PRInt32 aRowIndex,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect)
|
||||
{
|
||||
NS_PRECONDITION(aColumn && aColumn->GetFrame(this), "invalid column passed");
|
||||
NS_PRECONDITION(aColumn && aColumn->GetFrame(), "invalid column passed");
|
||||
|
||||
// Resolve style for the checkbox.
|
||||
nsStyleContext* checkboxContext = GetPseudoStyleContext(nsCSSAnonBoxes::moztreecheckbox);
|
||||
@ -3721,7 +3720,7 @@ nsTreeBodyFrame::PaintProgressMeter(PRInt32 aRowIndex,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect)
|
||||
{
|
||||
NS_PRECONDITION(aColumn && aColumn->GetFrame(this), "invalid column passed");
|
||||
NS_PRECONDITION(aColumn && aColumn->GetFrame(), "invalid column passed");
|
||||
|
||||
// Resolve style for the progress meter. It contains all the info we need
|
||||
// to lay ourselves out and to paint.
|
||||
|
@ -127,13 +127,10 @@ nsTreeBoxObject::GetTreeBody()
|
||||
// Iterate over our content model children looking for the body.
|
||||
nsCOMPtr<nsIContent> content;
|
||||
FindBodyElement(frame->GetContent(), getter_AddRefs(content));
|
||||
|
||||
nsIPresShell* shell = GetPresShell(PR_FALSE);
|
||||
if (!shell) {
|
||||
if (!content)
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
frame = shell->GetPrimaryFrameFor(content);
|
||||
frame = content->GetPrimaryFrame();
|
||||
if (!frame)
|
||||
return nsnull;
|
||||
|
||||
|
@ -92,50 +92,30 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsTreeColumn)
|
||||
else
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
nsIFrame*
|
||||
nsTreeColumn::GetFrame(nsTreeBodyFrame* aBodyFrame)
|
||||
{
|
||||
NS_PRECONDITION(aBodyFrame, "null frame?");
|
||||
|
||||
nsIPresShell *shell = aBodyFrame->PresContext()->PresShell();
|
||||
if (!shell)
|
||||
return nsnull;
|
||||
|
||||
return shell->GetPrimaryFrameFor(mContent);
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
nsTreeColumn::GetFrame()
|
||||
{
|
||||
NS_ENSURE_TRUE(mContent, nsnull);
|
||||
|
||||
nsCOMPtr<nsIDocument> document = mContent->GetDocument();
|
||||
if (!document)
|
||||
return nsnull;
|
||||
|
||||
nsIPresShell *shell = document->GetPrimaryShell();
|
||||
if (!shell)
|
||||
return nsnull;
|
||||
|
||||
return shell->GetPrimaryFrameFor(mContent);
|
||||
return mContent->GetPrimaryFrame();
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsTreeColumn::IsLastVisible(nsTreeBodyFrame* aBodyFrame)
|
||||
{
|
||||
NS_ASSERTION(GetFrame(aBodyFrame), "should have checked for this already");
|
||||
NS_ASSERTION(GetFrame(), "should have checked for this already");
|
||||
|
||||
// cyclers are fixed width, don't adjust them
|
||||
if (IsCycler())
|
||||
return PR_FALSE;
|
||||
|
||||
// we're certainly not the last visible if we're not visible
|
||||
if (GetFrame(aBodyFrame)->GetRect().width == 0)
|
||||
if (GetFrame()->GetRect().width == 0)
|
||||
return PR_FALSE;
|
||||
|
||||
// try to find a visible successor
|
||||
for (nsTreeColumn *next = GetNext(); next; next = next->GetNext()) {
|
||||
nsIFrame* frame = next->GetFrame(aBodyFrame);
|
||||
nsIFrame* frame = next->GetFrame();
|
||||
if (frame && frame->GetRect().width > 0)
|
||||
return PR_FALSE;
|
||||
}
|
||||
@ -145,7 +125,7 @@ nsTreeColumn::IsLastVisible(nsTreeBodyFrame* aBodyFrame)
|
||||
nsresult
|
||||
nsTreeColumn::GetRect(nsTreeBodyFrame* aBodyFrame, nscoord aY, nscoord aHeight, nsRect* aResult)
|
||||
{
|
||||
nsIFrame* frame = GetFrame(aBodyFrame);
|
||||
nsIFrame* frame = GetFrame();
|
||||
if (!frame) {
|
||||
*aResult = nsRect();
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -165,7 +145,7 @@ nsTreeColumn::GetRect(nsTreeBodyFrame* aBodyFrame, nscoord aY, nscoord aHeight,
|
||||
nsresult
|
||||
nsTreeColumn::GetXInTwips(nsTreeBodyFrame* aBodyFrame, nscoord* aResult)
|
||||
{
|
||||
nsIFrame* frame = GetFrame(aBodyFrame);
|
||||
nsIFrame* frame = GetFrame();
|
||||
if (!frame) {
|
||||
*aResult = 0;
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -177,7 +157,7 @@ nsTreeColumn::GetXInTwips(nsTreeBodyFrame* aBodyFrame, nscoord* aResult)
|
||||
nsresult
|
||||
nsTreeColumn::GetWidthInTwips(nsTreeBodyFrame* aBodyFrame, nscoord* aResult)
|
||||
{
|
||||
nsIFrame* frame = GetFrame(aBodyFrame);
|
||||
nsIFrame* frame = GetFrame();
|
||||
if (!frame) {
|
||||
*aResult = 0;
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -648,17 +628,12 @@ nsTreeColumns::EnsureColumns()
|
||||
if (!colsContent)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIDocument> document = treeContent->GetDocument();
|
||||
nsIPresShell *shell = document->GetPrimaryShell();
|
||||
if (!shell)
|
||||
return;
|
||||
|
||||
nsIContent* colContent =
|
||||
nsTreeUtils::GetDescendantChild(colsContent, nsGkAtoms::treecol);
|
||||
if (!colContent)
|
||||
return;
|
||||
|
||||
nsIFrame* colFrame = shell->GetPrimaryFrameFor(colContent);
|
||||
nsIFrame* colFrame = colContent->GetPrimaryFrame();
|
||||
if (!colFrame)
|
||||
return;
|
||||
|
||||
|
@ -1096,7 +1096,7 @@ nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell,
|
||||
if (!content)
|
||||
return PR_FALSE;
|
||||
|
||||
nsIFrame *frame = aPresShell->GetPrimaryFrameFor(content);
|
||||
nsIFrame *frame = content->GetPrimaryFrame();
|
||||
if (!frame)
|
||||
return PR_FALSE; // No frame! Not visible then.
|
||||
|
||||
|
@ -77,13 +77,7 @@ GetPrimaryFrameFor(nsIDOMNode *aDOMNode)
|
||||
if (nsnull == aContent)
|
||||
return nsnull;
|
||||
|
||||
nsIDocument* doc = aContent->GetCurrentDoc();
|
||||
if (nsnull == doc)
|
||||
return nsnull;
|
||||
nsIPresShell* presShell = doc->GetPrimaryShell();
|
||||
if ( nsnull == presShell)
|
||||
return nsnull;
|
||||
return presShell->GetPrimaryFrameFor(aContent);
|
||||
return aContent->GetPrimaryFrame();
|
||||
}
|
||||
|
||||
static bool
|
||||
|
@ -470,7 +470,7 @@ nsBaseDragService::DrawDrag(nsIDOMNode* aDOMNode,
|
||||
// otherwise, there was no region so just set the rectangle to
|
||||
// the size of the primary frame of the content.
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(dragNode);
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(content);
|
||||
nsIFrame* frame = content->GetPrimaryFrame();
|
||||
if (frame) {
|
||||
nsIntRect screenRect = frame->GetScreenRectExternal();
|
||||
aScreenDragRect->SetRect(screenRect.x, screenRect.y,
|
||||
|
@ -3070,8 +3070,8 @@ TestApp::GetSelCon(nsISelectionController** aSelCon)
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
nsr = docShell->GetPresShell(getter_AddRefs(presShell));
|
||||
if (NS_SUCCEEDED(nsr) && presShell) {
|
||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(
|
||||
nsCOMPtr<nsIContent>(do_QueryInterface(mCurrentNode)));
|
||||
nsIFrame* frame =
|
||||
nsCOMPtr<nsIContent>(do_QueryInterface(mCurrentNode))->GetPrimaryFrame();
|
||||
if (frame) {
|
||||
nsPresContext* presContext = presShell->GetPresContext();
|
||||
if (presContext) {
|
||||
|
Loading…
Reference in New Issue
Block a user