Bug 117564. Make Inspector flash the right spot when things are

positioned.  r=caillon, sr=hewitt.
This commit is contained in:
bzbarsky%mit.edu 2002-08-06 01:20:08 +00:00
Родитель ab40df200e
Коммит 2519e8cabe
3 изменённых файлов: 24 добавлений и 22 удалений

Просмотреть файл

@ -111,20 +111,11 @@ inFlasher::DrawElementOutline(nsIDOMElement* aElement, const PRUnichar* aColor,
presShell->CreateRenderingContext(frame, getter_AddRefs(rcontext));
// get view bounds in case this frame is being scrolled
nsIFrame* parentFrame = nsnull;
frame->GetParentWithView(presContext, &parentFrame);
if (!parentFrame)
return NS_OK;
nsIView* parentView = nsnull;
parentFrame->GetView(presContext, &parentView);
nsRect bounds;
parentView->GetBounds(bounds);
nsRect rect;
frame->GetRect(rect);
nsPoint origin = inLayoutUtils::GetClientOrigin(frame);
rect.x = origin.x + bounds.x;
rect.y = origin.y + bounds.y;
nsPoint origin = inLayoutUtils::GetClientOrigin(presContext, frame);
rect.x = origin.x;
rect.y = origin.y;
mCSSUtils->AdjustRectForMargins(frame, rect);
nsAutoString colorStr;

Просмотреть файл

@ -143,16 +143,18 @@ inLayoutUtils::GetEventStateManagerFor(nsIDOMElement *aElement)
}
nsPoint
inLayoutUtils::GetClientOrigin(nsIFrame* aFrame)
inLayoutUtils::GetClientOrigin(nsIPresContext* aPresContext,
nsIFrame* aFrame)
{
nsPoint result(0,0);
nsIFrame* parent = aFrame;
while (parent) {
nsPoint origin;
parent->GetOrigin(origin);
result.x += origin.x;
result.y += origin.y;
parent->GetParent(&parent);
nsIView* view;
aFrame->GetOffsetFromView(aPresContext, result, &view);
while (view) {
nscoord x, y;
view->GetPosition(&x, &y);
result.x += x;
result.y += y;
view->GetParent(view);
}
return result;
}
@ -313,7 +315,7 @@ inLayoutUtils::IsDocumentElement(nsIDOMNode* aNode)
if (parent) {
PRUint16 nodeType;
parent->GetNodeType(&nodeType);
if (nodeType == 9)
if (nodeType == nsIDOMNode::DOCUMENT_NODE)
result = PR_TRUE;
}

Просмотреть файл

@ -62,7 +62,16 @@ public:
static nsIDOMDocument* GetSubDocumentFor(nsIDOMNode* aNode);
static nsIDOMNode* GetContainerFor(nsIDOMDocument* aDoc);
static PRBool IsDocumentElement(nsIDOMNode* aNode);
static nsPoint GetClientOrigin(nsIFrame* aFrame);
/**
* This function returns the offset of a frame with respect to the
* root view (for use by inFlasher::DrawElementOutline and the like
*
* @param aFrame the frame whose offset we want
* @param aPresContext the presentation context
* @return the offset
*/
static nsPoint GetClientOrigin(nsIPresContext* aPresContext,
nsIFrame* aFrame);
static nsRect& GetScreenOrigin(nsIDOMElement* aElement);
};