зеркало из https://github.com/mozilla/gecko-dev.git
Bug 500882 part 3. Switch accessibility module to using the new GetPrimaryFrame API. r=surkov, sr=roc
This commit is contained in:
Родитель
b0ba4290ce
Коммит
6733cb0519
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
@ -1015,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:
|
||||
|
|
Загрузка…
Ссылка в новой задаче