mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 08:12:05 +00:00
Bug 190735. nsIFrame deCOMtamination, r+rs=dbaron
This commit is contained in:
parent
e037e171a1
commit
c5b1837cc3
@ -104,8 +104,7 @@ nsBox::ListBox(nsAutoString& aResult)
|
||||
aResult.Append(name);
|
||||
aResult.Append(NS_LITERAL_STRING(" "));
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
frame->GetContent(getter_AddRefs(content));
|
||||
nsIContent* content = frame->GetContent();
|
||||
|
||||
// add on all the set attributes
|
||||
if (content) {
|
||||
@ -258,24 +257,18 @@ nsBox::GetInset(nsMargin& margin)
|
||||
NS_IMETHODIMP
|
||||
nsBox::IsDirty(PRBool& aDirty)
|
||||
{
|
||||
nsFrameState state;
|
||||
nsIFrame* frame;
|
||||
GetFrame(&frame);
|
||||
frame->GetFrameState(&state);
|
||||
|
||||
aDirty = (state & NS_FRAME_IS_DIRTY) != 0;
|
||||
aDirty = (frame->GetStateBits() & NS_FRAME_IS_DIRTY) != 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBox::HasDirtyChildren(PRBool& aDirty)
|
||||
{
|
||||
nsFrameState state;
|
||||
nsIFrame* frame;
|
||||
GetFrame(&frame);
|
||||
frame->GetFrameState(&state);
|
||||
|
||||
aDirty = (state & NS_FRAME_HAS_DIRTY_CHILDREN) != 0;
|
||||
aDirty = (frame->GetStateBits() & NS_FRAME_HAS_DIRTY_CHILDREN) != 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -284,28 +277,24 @@ nsBox::MarkDirty(nsBoxLayoutState& aState)
|
||||
{
|
||||
NeedsRecalc();
|
||||
|
||||
nsFrameState state;
|
||||
nsIFrame* frame;
|
||||
GetFrame(&frame);
|
||||
frame->GetFrameState(&state);
|
||||
|
||||
// only reflow if we aren't already dirty.
|
||||
if (state & NS_FRAME_IS_DIRTY) {
|
||||
if (frame->GetStateBits() & NS_FRAME_IS_DIRTY) {
|
||||
#ifdef DEBUG_COELESCED
|
||||
Coelesced();
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
state |= NS_FRAME_IS_DIRTY;
|
||||
frame->SetFrameState(state);
|
||||
frame->AddStateBits(NS_FRAME_IS_DIRTY);
|
||||
|
||||
nsCOMPtr<nsIBoxLayout> layout;
|
||||
GetLayoutManager(getter_AddRefs(layout));
|
||||
if (layout)
|
||||
layout->BecameDirty(this, aState);
|
||||
|
||||
if (state & NS_FRAME_HAS_DIRTY_CHILDREN) {
|
||||
if (frame->GetStateBits() & NS_FRAME_HAS_DIRTY_CHILDREN) {
|
||||
#ifdef DEBUG_COELESCED
|
||||
Coelesced();
|
||||
#endif
|
||||
@ -317,11 +306,9 @@ nsBox::MarkDirty(nsBoxLayoutState& aState)
|
||||
if (parent)
|
||||
return parent->RelayoutDirtyChild(aState, this);
|
||||
else {
|
||||
nsIFrame* parentFrame = nsnull;
|
||||
frame->GetParent(&parentFrame);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aState.GetPresShell(getter_AddRefs(shell));
|
||||
return parentFrame->ReflowDirtyChild(shell, frame);
|
||||
return frame->GetParent()->ReflowDirtyChild(shell, frame);
|
||||
}
|
||||
}
|
||||
|
||||
@ -363,12 +350,9 @@ nsBox::MarkStyleChange(nsBoxLayoutState& aState)
|
||||
*/
|
||||
nsIFrame* frame = nsnull;
|
||||
GetFrame(&frame);
|
||||
nsIFrame* parentFrame = nsnull;
|
||||
frame->GetParent(&parentFrame);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aState.GetPresShell(getter_AddRefs(shell));
|
||||
return parentFrame->ReflowDirtyChild(shell, frame);
|
||||
|
||||
return frame->GetParent()->ReflowDirtyChild(shell, frame);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -387,12 +371,9 @@ nsBox::SetStyleChangeFlag(PRBool aDirty)
|
||||
{
|
||||
NeedsRecalc();
|
||||
|
||||
nsFrameState state;
|
||||
nsIFrame* frame;
|
||||
GetFrame(&frame);
|
||||
frame->GetFrameState(&state);
|
||||
state |= (NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN);
|
||||
frame->SetFrameState(state);
|
||||
frame->AddStateBits(NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -425,11 +406,6 @@ nsBox::RelayoutStyleChange(nsBoxLayoutState& aState, nsIBox* aChild)
|
||||
NS_ERROR("Don't call this!!");
|
||||
|
||||
/*
|
||||
nsFrameState state;
|
||||
nsIFrame* frame;
|
||||
GetFrame(&frame);
|
||||
frame->GetFrameState(&state);
|
||||
|
||||
// if we are not dirty mark ourselves dirty and tell our parent we are dirty too.
|
||||
if (!HasStyleChange()) {
|
||||
// Mark yourself as dirty and needing to be recalculated
|
||||
@ -482,12 +458,11 @@ nsBox::RelayoutDirtyChild(nsBoxLayoutState& aState, nsIBox* aChild)
|
||||
}
|
||||
|
||||
// if we are not dirty mark ourselves dirty and tell our parent we are dirty too.
|
||||
if (!(state & NS_FRAME_HAS_DIRTY_CHILDREN)) {
|
||||
if (!(frame->GetStateBits() & NS_FRAME_HAS_DIRTY_CHILDREN)) {
|
||||
// Mark yourself as dirty and needing to be recalculated
|
||||
state |= NS_FRAME_HAS_DIRTY_CHILDREN;
|
||||
frame->SetFrameState(state);
|
||||
frame->AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
|
||||
|
||||
if (state & NS_FRAME_REFLOW_ROOT) {
|
||||
if (frame->GetStateBits() & NS_FRAME_REFLOW_ROOT) {
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aState.GetPresShell(getter_AddRefs(shell));
|
||||
nsFrame::CreateAndPostReflowCommand(shell, frame,
|
||||
@ -502,11 +477,9 @@ nsBox::RelayoutDirtyChild(nsBoxLayoutState& aState, nsIBox* aChild)
|
||||
GetParentBox(&parentBox);
|
||||
if (parentBox)
|
||||
return parentBox->RelayoutDirtyChild(aState, this);
|
||||
nsIFrame* parent = nsnull;
|
||||
frame->GetParent(&parent);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aState.GetPresShell(getter_AddRefs(shell));
|
||||
return parent->ReflowDirtyChild(shell, frame);
|
||||
return frame->GetParent()->ReflowDirtyChild(shell, frame);
|
||||
} else {
|
||||
#ifdef DEBUG_COELESCED
|
||||
Coelesced();
|
||||
@ -576,8 +549,8 @@ nsBox::GetBounds(nsRect& aRect)
|
||||
{
|
||||
nsIFrame* frame = nsnull;
|
||||
GetFrame(&frame);
|
||||
|
||||
return frame->GetRect(aRect);
|
||||
aRect = frame->GetRect();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -602,9 +575,9 @@ nsBox::SetBounds(nsBoxLayoutState& aState, const nsRect& aRect)
|
||||
flags |= stateFlags;
|
||||
|
||||
if (flags & NS_FRAME_NO_MOVE_FRAME)
|
||||
frame->SizeTo(presContext, aRect.width, aRect.height);
|
||||
frame->SetSize(nsSize(aRect.width, aRect.height));
|
||||
else
|
||||
frame->SetRect(presContext, aRect);
|
||||
frame->SetRect(aRect);
|
||||
|
||||
|
||||
if (!(flags & NS_FRAME_NO_MOVE_VIEW))
|
||||
@ -620,7 +593,7 @@ nsBox::SetBounds(nsBoxLayoutState& aState, const nsRect& aRect)
|
||||
if ((rect.x != aRect.x) || (rect.y != aRect.y)) {
|
||||
if (frame->HasView()) {
|
||||
nsContainerFrame::PositionFrameView(presContext, frame,
|
||||
frame->GetView(presContext));
|
||||
frame->GetView());
|
||||
} else {
|
||||
nsContainerFrame::PositionChildViews(presContext, frame);
|
||||
}
|
||||
@ -669,8 +642,7 @@ nsBox::GetBorder(nsMargin& aMargin)
|
||||
const nsStyleDisplay* disp = frame->GetStyleDisplay();
|
||||
if (disp->mAppearance && gTheme) {
|
||||
// Go to the theme for the border.
|
||||
nsCOMPtr<nsIContent> content;
|
||||
frame->GetContent(getter_AddRefs(content));
|
||||
nsIContent* content = frame->GetContent();
|
||||
if (content) {
|
||||
nsCOMPtr<nsIDocument> doc = content->GetDocument();
|
||||
if (doc) {
|
||||
@ -803,10 +775,7 @@ nsBox::GetWasCollapsed(nsBoxLayoutState& aState)
|
||||
{
|
||||
nsIFrame* frame = nsnull;
|
||||
GetFrame(&frame);
|
||||
nsFrameState state;
|
||||
frame->GetFrameState(&state);
|
||||
|
||||
return (state & NS_STATE_IS_COLLAPSED) != 0;
|
||||
return (frame->GetStateBits() & NS_STATE_IS_COLLAPSED) != 0;
|
||||
}
|
||||
|
||||
void
|
||||
@ -814,14 +783,10 @@ nsBox::SetWasCollapsed(nsBoxLayoutState& aState, PRBool aCollapsed)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
GetFrame(&frame);
|
||||
nsFrameState state;
|
||||
frame->GetFrameState(&state);
|
||||
if (aCollapsed)
|
||||
state |= NS_STATE_IS_COLLAPSED;
|
||||
frame->AddStateBits(NS_STATE_IS_COLLAPSED);
|
||||
else
|
||||
state &= ~NS_STATE_IS_COLLAPSED;
|
||||
|
||||
frame->SetFrameState(state);
|
||||
frame->RemoveStateBits(NS_STATE_IS_COLLAPSED);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -844,28 +809,23 @@ nsBox::CollapseChild(nsBoxLayoutState& aState, nsIFrame* aFrame, PRBool aHide)
|
||||
nsIPresContext* presContext = aState.GetPresContext();
|
||||
|
||||
// shrink the view
|
||||
nsIView* view = aFrame->GetView(presContext);
|
||||
nsIView* view = aFrame->GetView();
|
||||
|
||||
// if we find a view stop right here. All views under it
|
||||
// will be clipped.
|
||||
if (view) {
|
||||
// already hidden? We are done.
|
||||
//nsViewVisibility v;
|
||||
//view->GetVisibility(v);
|
||||
//nsViewVisibility v = view->GetVisibility();
|
||||
//if (v == nsViewVisibility_kHide)
|
||||
//return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
view->GetViewManager(*getter_AddRefs(vm));
|
||||
if (aHide) {
|
||||
vm->SetViewVisibility(view, nsViewVisibility_kHide);
|
||||
view->GetViewManager()->SetViewVisibility(view, nsViewVisibility_kHide);
|
||||
} else {
|
||||
vm->SetViewVisibility(view, nsViewVisibility_kShow);
|
||||
view->GetViewManager()->SetViewVisibility(view, nsViewVisibility_kShow);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
view->GetWidget(*getter_AddRefs(widget));
|
||||
if (widget) {
|
||||
if (view->HasWidget()) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
@ -877,8 +837,7 @@ nsBox::CollapseChild(nsBoxLayoutState& aState, nsIFrame* aFrame, PRBool aHide)
|
||||
while (nsnull != child)
|
||||
{
|
||||
CollapseChild(aState, child, aHide);
|
||||
nsresult rv = child->GetNextSibling(&child);
|
||||
NS_ASSERTION(rv == NS_OK,"failed to get next child");
|
||||
child = child->GetNextSibling();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -906,16 +865,10 @@ nsBox::UnCollapseChild(nsBoxLayoutState& aState, nsIBox* aBox)
|
||||
aBox->GetChildBox(&child);
|
||||
|
||||
if (child == nsnull) {
|
||||
nsFrameState childState;
|
||||
frame->GetFrameState(&childState);
|
||||
childState |= NS_FRAME_IS_DIRTY;
|
||||
frame->SetFrameState(childState);
|
||||
} else {
|
||||
frame->AddStateBits(NS_FRAME_IS_DIRTY);
|
||||
} else {
|
||||
child->GetFrame(&frame);
|
||||
nsFrameState childState;
|
||||
frame->GetFrameState(&childState);
|
||||
childState |= NS_FRAME_HAS_DIRTY_CHILDREN;
|
||||
frame->SetFrameState(childState);
|
||||
frame->AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
|
||||
|
||||
while (nsnull != child)
|
||||
{
|
||||
@ -1054,9 +1007,7 @@ nsBox::GetOrientation(PRBool& aIsHorizontal)
|
||||
{
|
||||
nsIFrame* frame = nsnull;
|
||||
GetFrame(&frame);
|
||||
nsFrameState state;
|
||||
frame->GetFrameState(&state);
|
||||
aIsHorizontal = (state & NS_STATE_IS_HORIZONTAL) != 0;
|
||||
aIsHorizontal = (frame->GetStateBits() & NS_STATE_IS_HORIZONTAL) != 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1065,9 +1016,7 @@ nsBox::GetDirection(PRBool& aIsNormal)
|
||||
{
|
||||
nsIFrame* frame = nsnull;
|
||||
GetFrame(&frame);
|
||||
nsFrameState state;
|
||||
frame->GetFrameState(&state);
|
||||
aIsNormal = (state & NS_STATE_IS_DIRECTION_NORMAL) != 0;
|
||||
aIsNormal = (frame->GetStateBits() & NS_STATE_IS_DIRECTION_NORMAL) != 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1089,12 +1038,10 @@ nsBox::SyncLayout(nsBoxLayoutState& aState)
|
||||
if (dirty || aState.GetLayoutReason() == nsBoxLayoutState::Initial)
|
||||
Redraw(aState);
|
||||
|
||||
nsFrameState state;
|
||||
nsIFrame* frame;
|
||||
GetFrame(&frame);
|
||||
frame->GetFrameState(&state);
|
||||
state &= ~(NS_FRAME_HAS_DIRTY_CHILDREN | NS_FRAME_IS_DIRTY | NS_FRAME_FIRST_REFLOW | NS_FRAME_IN_REFLOW);
|
||||
frame->SetFrameState(state);
|
||||
frame->RemoveStateBits(NS_FRAME_HAS_DIRTY_CHILDREN | NS_FRAME_IS_DIRTY
|
||||
| NS_FRAME_FIRST_REFLOW | NS_FRAME_IN_REFLOW);
|
||||
|
||||
nsIPresContext* presContext = aState.GetPresContext();
|
||||
nsRect rect(0,0,0,0);
|
||||
@ -1108,7 +1055,7 @@ nsBox::SyncLayout(nsBoxLayoutState& aState)
|
||||
|
||||
flags |= stateFlags;
|
||||
|
||||
nsIView* view = frame->GetView(presContext);
|
||||
nsIView* view = frame->GetView();
|
||||
|
||||
/*
|
||||
// only if the origin changed
|
||||
@ -1162,7 +1109,6 @@ nsBox::Redraw(nsBoxLayoutState& aState,
|
||||
nsIFrame* frame = nsnull;
|
||||
GetFrame(&frame);
|
||||
|
||||
nsCOMPtr<nsIViewManager> viewManager;
|
||||
nsRect damageRect(0,0,0,0);
|
||||
if (aDamageRect)
|
||||
damageRect = *aDamageRect;
|
||||
@ -1181,15 +1127,14 @@ nsBox::Redraw(nsBoxLayoutState& aState,
|
||||
|
||||
nsIView *view;
|
||||
if (frame->HasView()) {
|
||||
view = frame->GetView(presContext);
|
||||
view = frame->GetView();
|
||||
} else {
|
||||
nsPoint offset;
|
||||
frame->GetOffsetFromView(presContext, offset, &view);
|
||||
NS_BOX_ASSERTION(this, nsnull != view, "no view");
|
||||
damageRect += offset;
|
||||
}
|
||||
view->GetViewManager(*getter_AddRefs(viewManager));
|
||||
viewManager->UpdateView(view, damageRect, flags);
|
||||
view->GetViewManager()->UpdateView(view, damageRect, flags);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1216,9 +1161,7 @@ nsIBox::AddCSSPrefSize(nsBoxLayoutState& aState, nsIBox* aBox, nsSize& aSize)
|
||||
heightSet = PR_TRUE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
frame->GetContent(getter_AddRefs(content));
|
||||
|
||||
nsIContent* content = frame->GetContent();
|
||||
// ignore 'height' and 'width' attributes if the actual element is not XUL
|
||||
// For example, we might be magic XUL frames whose primary content is an HTML
|
||||
// <select>
|
||||
@ -1312,9 +1255,7 @@ nsIBox::AddCSSMinSize(nsBoxLayoutState& aState, nsIBox* aBox, nsSize& aSize)
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
frame->GetContent(getter_AddRefs(content));
|
||||
|
||||
nsIContent* content = frame->GetContent();
|
||||
if (content) {
|
||||
nsIPresContext* presContext = aState.GetPresContext();
|
||||
|
||||
@ -1378,9 +1319,7 @@ nsIBox::AddCSSMaxSize(nsBoxLayoutState& aState, nsIBox* aBox, nsSize& aSize)
|
||||
heightSet = PR_TRUE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
frame->GetContent(getter_AddRefs(content));
|
||||
|
||||
nsIContent* content = frame->GetContent();
|
||||
if (content) {
|
||||
nsIPresContext* presContext = aState.GetPresContext();
|
||||
|
||||
@ -1425,9 +1364,7 @@ nsIBox::AddCSSFlex(nsBoxLayoutState& aState, nsIBox* aBox, nscoord& aFlex)
|
||||
aBox->GetFrame(&frame);
|
||||
|
||||
// get the flexibility
|
||||
nsCOMPtr<nsIContent> content;
|
||||
frame->GetContent(getter_AddRefs(content));
|
||||
|
||||
nsIContent* content = frame->GetContent();
|
||||
if (content) {
|
||||
PRInt32 error;
|
||||
nsAutoString value;
|
||||
@ -1471,9 +1408,7 @@ nsIBox::AddCSSOrdinal(nsBoxLayoutState& aState, nsIBox* aBox, PRUint32& aOrdinal
|
||||
aBox->GetFrame(&frame);
|
||||
|
||||
// get the flexibility
|
||||
nsCOMPtr<nsIContent> content;
|
||||
frame->GetContent(getter_AddRefs(content));
|
||||
|
||||
nsIContent* content = frame->GetContent();
|
||||
if (content) {
|
||||
PRInt32 error;
|
||||
nsAutoString value;
|
||||
|
@ -209,10 +209,7 @@ nsBoxLayoutState::Unwind(nsReflowPath* aReflowPath, nsIBox* aRootBox)
|
||||
|
||||
// Clear the dirty-children bit. This will be re-set by MarkDirty
|
||||
// once we reach a target.
|
||||
nsFrameState state;
|
||||
(*iter)->GetFrameState(&state);
|
||||
state &= ~NS_FRAME_HAS_DIRTY_CHILDREN;
|
||||
(*iter)->SetFrameState(state);
|
||||
(*iter)->RemoveStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
|
||||
|
||||
if (isAdaptor) {
|
||||
// It's nested HTML. Mark the root box's frame with
|
||||
@ -221,15 +218,11 @@ nsBoxLayoutState::Unwind(nsReflowPath* aReflowPath, nsIBox* aRootBox)
|
||||
nsIFrame* frame;
|
||||
aRootBox->GetFrame(&frame);
|
||||
|
||||
frame->GetFrameState(&state);
|
||||
state |= NS_FRAME_HAS_DIRTY_CHILDREN;
|
||||
frame->SetFrameState(state);
|
||||
frame->AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
|
||||
|
||||
// Clear the frame's dirty bit so that MarkDirty doesn't
|
||||
// optimize the layout away.
|
||||
(*iter)->GetFrameState(&state);
|
||||
state &= ~NS_FRAME_IS_DIRTY;
|
||||
(*iter)->SetFrameState(state);
|
||||
(*iter)->RemoveStateBits(NS_FRAME_IS_DIRTY);
|
||||
|
||||
// Mark the adaptor dirty.
|
||||
ibox->MarkDirty(*this);
|
||||
@ -249,9 +242,7 @@ nsBoxLayoutState::Unwind(nsReflowPath* aReflowPath, nsIBox* aRootBox)
|
||||
nsIFrame* frame;
|
||||
aRootBox->GetFrame(&frame);
|
||||
|
||||
frame->GetFrameState(&state);
|
||||
state |= NS_FRAME_HAS_DIRTY_CHILDREN;
|
||||
frame->SetFrameState(state);
|
||||
frame->AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
|
||||
|
||||
// The target is a box. Mark it dirty, generating a new reflow
|
||||
// command targeted at us and coelesce out this one.
|
||||
@ -274,9 +265,7 @@ nsBoxLayoutState::Unwind(nsReflowPath* aReflowPath, nsIBox* aRootBox)
|
||||
if (parent) {
|
||||
nsIFrame* parentFrame;
|
||||
parent->GetFrame(&parentFrame);
|
||||
parentFrame->GetFrameState(&state);
|
||||
state |= NS_FRAME_IS_DIRTY;
|
||||
parentFrame->SetFrameState(state);
|
||||
parentFrame->AddStateBits(NS_FRAME_IS_DIRTY);
|
||||
}
|
||||
|
||||
}
|
||||
@ -301,8 +290,7 @@ nsBoxLayoutState::GetBoxForFrame(nsIFrame* aFrame, PRBool& aIsAdaptor)
|
||||
|
||||
// if we hit a non box. Find the box in out last container
|
||||
// and clear its cache.
|
||||
nsIFrame* parent = nsnull;
|
||||
aFrame->GetParent(&parent);
|
||||
nsIFrame* parent = aFrame->GetParent();
|
||||
nsIBox* parentBox = nsnull;
|
||||
if (NS_FAILED(parent->QueryInterface(NS_GET_IID(nsIBox), (void**)&parentBox)))
|
||||
return nsnull;
|
||||
|
@ -195,16 +195,13 @@ nsBoxObject::GetOffsetRect(nsRect& aRect)
|
||||
presShell->GetPrimaryFrameFor(mContent, &frame);
|
||||
if(frame != nsnull) {
|
||||
// Get its origin
|
||||
nsPoint origin;
|
||||
frame->GetOrigin(origin);
|
||||
nsPoint origin = frame->GetPosition();
|
||||
|
||||
// Get the union of all rectangles in this and continuation frames
|
||||
nsRect rcFrame;
|
||||
nsIFrame* next = frame;
|
||||
do {
|
||||
nsRect rect;
|
||||
next->GetRect(rect);
|
||||
rcFrame.UnionRect(rcFrame, rect);
|
||||
rcFrame.UnionRect(rcFrame, next->GetRect());
|
||||
next->GetNextInFlow(&next);
|
||||
} while (nsnull != next);
|
||||
|
||||
@ -213,25 +210,18 @@ nsBoxObject::GetOffsetRect(nsRect& aRect)
|
||||
// the tagName passed in or is the document element.
|
||||
nsCOMPtr<nsIContent> docElement;
|
||||
doc->GetRootContent(getter_AddRefs(docElement));
|
||||
nsIFrame* parent = frame;
|
||||
nsCOMPtr<nsIContent> parentContent;
|
||||
frame->GetParent(&parent);
|
||||
nsIFrame* parent = frame->GetParent();
|
||||
while (parent) {
|
||||
parent->GetContent(getter_AddRefs(parentContent));
|
||||
if (parentContent) {
|
||||
// If we've hit the document element, break here
|
||||
if (parentContent.get() == docElement.get()) {
|
||||
break;
|
||||
}
|
||||
// If we've hit the document element, break here
|
||||
if (parent->GetContent() == docElement.get()) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Add the parent's origin to our own to get to the
|
||||
// right coordinate system
|
||||
nsPoint parentOrigin;
|
||||
parent->GetOrigin(parentOrigin);
|
||||
origin += parentOrigin;
|
||||
origin += parent->GetPosition();
|
||||
|
||||
parent->GetParent(&parent);
|
||||
parent = parent->GetParent();
|
||||
}
|
||||
|
||||
// For the origin, add in the border for the frame
|
||||
@ -303,23 +293,22 @@ nsBoxObject::GetScreenRect(nsRect& aRect)
|
||||
|
||||
PRInt32 offsetX = 0;
|
||||
PRInt32 offsetY = 0;
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
nsIWidget* widget = nsnull;
|
||||
|
||||
while (frame) {
|
||||
// Look for a widget so we can get screen coordinates
|
||||
if (frame->HasView()) {
|
||||
frame->GetView(presContext)->GetWidget(*getter_AddRefs(widget));
|
||||
widget = frame->GetView()->GetWidget();
|
||||
if (widget)
|
||||
break;
|
||||
}
|
||||
|
||||
// No widget yet, so count up the coordinates of the frame
|
||||
nsPoint origin;
|
||||
frame->GetOrigin(origin);
|
||||
nsPoint origin = frame->GetPosition();
|
||||
offsetX += origin.x;
|
||||
offsetY += origin.y;
|
||||
|
||||
frame->GetParent(&frame);
|
||||
frame = frame->GetParent();
|
||||
}
|
||||
|
||||
if (widget) {
|
||||
@ -507,13 +496,10 @@ nsBoxObject::GetParentBox(nsIDOMElement * *aParentBox)
|
||||
{
|
||||
nsIFrame* frame = GetFrame();
|
||||
if (!frame) return NS_OK;
|
||||
nsIFrame* parent;
|
||||
frame->GetParent(&parent);
|
||||
nsIFrame* parent = frame->GetParent();
|
||||
if (!parent) return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
parent->GetContent(getter_AddRefs(content));
|
||||
nsCOMPtr<nsIDOMElement> el = do_QueryInterface(content);
|
||||
nsCOMPtr<nsIDOMElement> el = do_QueryInterface(parent->GetContent());
|
||||
*aParentBox = el;
|
||||
NS_IF_ADDREF(*aParentBox);
|
||||
return NS_OK;
|
||||
@ -542,13 +528,10 @@ nsBoxObject::GetNextSibling(nsIDOMElement **aNextOrdinalSibling)
|
||||
{
|
||||
nsIFrame* frame = GetFrame();
|
||||
if (!frame) return NS_OK;
|
||||
nsIFrame* nextFrame;
|
||||
frame->GetNextSibling(&nextFrame);
|
||||
nsIFrame* nextFrame = frame->GetNextSibling();
|
||||
if (!nextFrame) return NS_OK;
|
||||
// get the content for the box and query to a dom element
|
||||
nsCOMPtr<nsIContent> nextContent;
|
||||
nextFrame->GetContent(getter_AddRefs(nextContent));
|
||||
nsCOMPtr<nsIDOMElement> el = do_QueryInterface(nextContent);
|
||||
nsCOMPtr<nsIDOMElement> el = do_QueryInterface(nextFrame->GetContent());
|
||||
*aNextOrdinalSibling = el;
|
||||
NS_IF_ADDREF(*aNextOrdinalSibling);
|
||||
|
||||
@ -560,8 +543,7 @@ nsBoxObject::GetPreviousSibling(nsIDOMElement **aPreviousOrdinalSibling)
|
||||
{
|
||||
nsIFrame* frame = GetFrame();
|
||||
if (!frame) return NS_OK;
|
||||
nsIFrame* parentFrame;
|
||||
frame->GetParent(&parentFrame);
|
||||
nsIFrame* parentFrame = frame->GetParent();
|
||||
if (!parentFrame) return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIPresContext> presContext;
|
||||
@ -574,14 +556,12 @@ nsBoxObject::GetPreviousSibling(nsIDOMElement **aPreviousOrdinalSibling)
|
||||
if (nextFrame == frame)
|
||||
break;
|
||||
prevFrame = nextFrame;
|
||||
nextFrame->GetNextSibling(&nextFrame);
|
||||
nextFrame = nextFrame->GetNextSibling();
|
||||
}
|
||||
|
||||
if (!prevFrame) return NS_OK;
|
||||
// get the content for the box and query to a dom element
|
||||
nsCOMPtr<nsIContent> nextContent;
|
||||
prevFrame->GetContent(getter_AddRefs(nextContent));
|
||||
nsCOMPtr<nsIDOMElement> el = do_QueryInterface(nextContent);
|
||||
nsCOMPtr<nsIDOMElement> el = do_QueryInterface(prevFrame->GetContent());
|
||||
*aPreviousOrdinalSibling = el;
|
||||
NS_IF_ADDREF(*aPreviousOrdinalSibling);
|
||||
|
||||
@ -604,16 +584,14 @@ nsBoxObject::GetChildByOrdinalAt(PRUint32 aIndex)
|
||||
|
||||
PRUint32 i = 0;
|
||||
while (childFrame && i < aIndex) {
|
||||
childFrame->GetNextSibling(&childFrame);
|
||||
childFrame = childFrame->GetNextSibling();
|
||||
++i;
|
||||
}
|
||||
|
||||
if (!childFrame) return nsnull;
|
||||
|
||||
// get the content for the box and query to a dom element
|
||||
nsCOMPtr<nsIContent> content;
|
||||
childFrame->GetContent(getter_AddRefs(content));
|
||||
nsCOMPtr<nsIDOMElement> el = do_QueryInterface(content);
|
||||
nsCOMPtr<nsIDOMElement> el = do_QueryInterface(childFrame->GetContent());
|
||||
|
||||
return el;
|
||||
}
|
||||
|
@ -148,10 +148,7 @@ nsBoxToBlockAdaptor::nsBoxToBlockAdaptor(nsIPresShell* aPresShell, nsIFrame* aFr
|
||||
void *block;
|
||||
mFrame->QueryInterface(kBlockFrameCID, &block);
|
||||
if (block) {
|
||||
nsFrameState state;
|
||||
mFrame->GetFrameState(&state);
|
||||
state |= NS_BLOCK_SPACE_MGR;
|
||||
mFrame->SetFrameState(state);
|
||||
mFrame->AddStateBits(NS_BLOCK_SPACE_MGR);
|
||||
}
|
||||
#ifdef DEBUG_waterson
|
||||
else {
|
||||
@ -181,12 +178,9 @@ nsBoxToBlockAdaptor::SetParentBox(nsIBox* aParent)
|
||||
nsStyleContext* style = mFrame->GetStyleContext();
|
||||
nsHTMLContainerFrame::CreateViewForFrame(context,mFrame,style,nsnull,PR_TRUE);
|
||||
}
|
||||
nsIView* view = mFrame->GetView(context);
|
||||
nsIView* view = mFrame->GetView();
|
||||
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
view->GetWidget(*getter_AddRefs(widget));
|
||||
|
||||
if (!widget)
|
||||
if (!view->HasWidget())
|
||||
view->CreateWidget(kWidgetCID);
|
||||
}
|
||||
}
|
||||
@ -297,8 +291,7 @@ UseHTMLReflowConstraints(nsBoxToBlockAdaptor* aAdaptor, nsBoxLayoutState& aState
|
||||
if (!frame) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
nsIFrame* parentFrame;
|
||||
frame->GetParent(&parentFrame);
|
||||
nsIFrame* parentFrame = frame->GetParent();
|
||||
if (!parentFrame) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
@ -356,8 +349,7 @@ nsBoxToBlockAdaptor::RefreshSizeCache(nsBoxLayoutState& aState)
|
||||
return NS_OK;
|
||||
|
||||
// get the old rect.
|
||||
nsRect oldRect;
|
||||
mFrame->GetRect(oldRect);
|
||||
nsRect oldRect = mFrame->GetRect();
|
||||
|
||||
// the rect we plan to size to.
|
||||
nsRect rect(oldRect);
|
||||
@ -398,8 +390,7 @@ nsBoxToBlockAdaptor::RefreshSizeCache(nsBoxLayoutState& aState)
|
||||
rect.width,
|
||||
rect.height);
|
||||
|
||||
nsRect newRect;
|
||||
mFrame->GetRect(newRect);
|
||||
nsRect newRect = mFrame->GetRect();
|
||||
|
||||
// make sure we draw any size change
|
||||
if (reason == eReflowReason_Incremental && (oldRect.width != newRect.width || oldRect.height != newRect.height)) {
|
||||
@ -649,7 +640,7 @@ nsBoxToBlockAdaptor::DoLayout(nsBoxLayoutState& aState)
|
||||
PRBool collapsed = PR_FALSE;
|
||||
IsCollapsed(aState, collapsed);
|
||||
if (collapsed) {
|
||||
mFrame->SizeTo(presContext, 0, 0);
|
||||
mFrame->SetSize(nsSize(0, 0));
|
||||
} else {
|
||||
|
||||
// if our child needs to be bigger. This might happend with
|
||||
@ -674,7 +665,7 @@ nsBoxToBlockAdaptor::DoLayout(nsBoxLayoutState& aState)
|
||||
|
||||
// ensure our size is what we think is should be. Someone could have
|
||||
// reset the frame to be smaller or something dumb like that.
|
||||
mFrame->SizeTo(presContext, ourRect.width, ourRect.height);
|
||||
mFrame->SetSize(nsSize(ourRect.width, ourRect.height));
|
||||
}
|
||||
}
|
||||
|
||||
@ -730,10 +721,8 @@ nsBoxToBlockAdaptor::Reflow(nsBoxLayoutState& aState,
|
||||
GetParentBox(&parent);
|
||||
nsIFrame* frame;
|
||||
parent->GetFrame(&frame);
|
||||
nsFrameState frameState = 0;
|
||||
frame->GetFrameState(&frameState);
|
||||
|
||||
// if (frameState & NS_STATE_CURRENTLY_IN_DEBUG)
|
||||
// if (frame->GetStateBits() & NS_STATE_CURRENTLY_IN_DEBUG)
|
||||
// printf("In debug\n");
|
||||
*/
|
||||
|
||||
@ -768,7 +757,7 @@ nsBoxToBlockAdaptor::Reflow(nsBoxLayoutState& aState,
|
||||
needsReflow = PR_FALSE;
|
||||
aDesiredSize.width = aWidth;
|
||||
aDesiredSize.height = aHeight;
|
||||
mFrame->SizeTo(aPresContext, aDesiredSize.width, aDesiredSize.height);
|
||||
mFrame->SetSize(nsSize(aDesiredSize.width, aDesiredSize.height));
|
||||
} else {
|
||||
aDesiredSize.width = mLastSize.width;
|
||||
aDesiredSize.height = mLastSize.height;
|
||||
@ -907,14 +896,11 @@ nsBoxToBlockAdaptor::Reflow(nsBoxLayoutState& aState,
|
||||
mAscent = aDesiredSize.ascent;
|
||||
}
|
||||
|
||||
nsFrameState kidState;
|
||||
mFrame->GetFrameState(&kidState);
|
||||
|
||||
// printf("width: %d, height: %d\n", aDesiredSize.mCombinedArea.width, aDesiredSize.mCombinedArea.height);
|
||||
|
||||
// see if the overflow option is set. If it is then if our child's bounds overflow then
|
||||
// we will set the child's rect to include the overflow size.
|
||||
if (kidState & NS_FRAME_OUTSIDE_CHILDREN) {
|
||||
if (mFrame->GetStateBits() & NS_FRAME_OUTSIDE_CHILDREN) {
|
||||
// make sure we store the overflow size
|
||||
mOverflow.width = aDesiredSize.mOverflowArea.width;
|
||||
mOverflow.height = aDesiredSize.mOverflowArea.height;
|
||||
@ -940,8 +926,7 @@ nsBoxToBlockAdaptor::Reflow(nsBoxLayoutState& aState,
|
||||
#endif
|
||||
mFrame->WillReflow(aPresContext);
|
||||
mFrame->Reflow(aPresContext, aDesiredSize, reflowState, aStatus);
|
||||
mFrame->GetFrameState(&kidState);
|
||||
if (kidState & NS_FRAME_OUTSIDE_CHILDREN)
|
||||
if (mFrame->GetStateBits() & NS_FRAME_OUTSIDE_CHILDREN)
|
||||
aDesiredSize.height = aDesiredSize.mOverflowArea.height;
|
||||
|
||||
}
|
||||
@ -955,8 +940,7 @@ nsBoxToBlockAdaptor::Reflow(nsBoxLayoutState& aState,
|
||||
if (redrawAfterReflow) {
|
||||
nsIFrame* frame = nsnull;
|
||||
GetFrame(&frame);
|
||||
nsRect r;
|
||||
frame->GetRect(r);
|
||||
nsRect r = frame->GetRect();
|
||||
r.width = aDesiredSize.width;
|
||||
r.height = aDesiredSize.height;
|
||||
Redraw(aState, &r);
|
||||
@ -1041,8 +1025,7 @@ nsBoxToBlockAdaptor::HandleIncrementalReflow(nsBoxLayoutState& aState,
|
||||
PRBool& aRedrawAfterReflow,
|
||||
PRBool& aMoveFrame)
|
||||
{
|
||||
nsFrameState childState;
|
||||
mFrame->GetFrameState(&childState);
|
||||
nsFrameState childState = mFrame->GetStateBits();
|
||||
|
||||
aReason = aReflowState.reason;
|
||||
|
||||
|
@ -131,7 +131,7 @@ nsContainerBox::CreateBoxList(nsBoxLayoutState& aState, nsIFrame* aFrameList, ns
|
||||
|
||||
count++;
|
||||
aLast = aFirst;
|
||||
aFrameList->GetNextSibling(&aFrameList);
|
||||
aFrameList = aFrameList->GetNextSibling();
|
||||
nsIBox* last = aLast;
|
||||
|
||||
while(aFrameList) {
|
||||
@ -151,7 +151,7 @@ nsContainerBox::CreateBoxList(nsBoxLayoutState& aState, nsIFrame* aFrameList, ns
|
||||
|
||||
last->SetNextBox(aLast);
|
||||
last = aLast;
|
||||
aFrameList->GetNextSibling(&aFrameList);
|
||||
aFrameList = aFrameList->GetNextSibling();
|
||||
count++;
|
||||
}
|
||||
}
|
||||
@ -429,7 +429,7 @@ nsContainerBox::SanityCheck(nsFrameList& aFrameList)
|
||||
NS_ASSERTION(NS_SUCCEEDED(box->GetFrame(&frame)) && frame == child,"nsBox::ERROR!! box info list and child info lists don't match!!!");
|
||||
NS_ASSERTION(NS_SUCCEEDED(box->GetParentBox(&parent)) && parent == this,"nsBox::ERROR!! parent's don't match!!!");
|
||||
box->GetNextBox(&box);
|
||||
child->GetNextSibling(&child);
|
||||
child = child->GetNextSibling();
|
||||
count++;
|
||||
}
|
||||
#endif
|
||||
|
@ -141,14 +141,12 @@ nsDeckFrame::HideBox(nsIPresContext* aPresContext, nsIBox* aBox)
|
||||
nsIFrame* frame = nsnull;
|
||||
aBox->GetFrame(&frame);
|
||||
|
||||
nsIView* view = frame->GetView(aPresContext);
|
||||
nsIView* view = frame->GetView();
|
||||
|
||||
if (view) {
|
||||
nsCOMPtr<nsIViewManager> viewManager;
|
||||
view->GetViewManager(*getter_AddRefs(viewManager));
|
||||
nsIViewManager* viewManager = view->GetViewManager();
|
||||
viewManager->SetViewVisibility(view, nsViewVisibility_kHide);
|
||||
nsRect r(0, 0, 0, 0);
|
||||
viewManager->ResizeView(view, r);
|
||||
viewManager->ResizeView(view, nsRect(0, 0, 0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,12 +156,10 @@ nsDeckFrame::ShowBox(nsIPresContext* aPresContext, nsIBox* aBox)
|
||||
nsIFrame* frame = nsnull;
|
||||
aBox->GetFrame(&frame);
|
||||
|
||||
nsRect rect;
|
||||
frame->GetRect(rect);
|
||||
nsIView* view = frame->GetView(aPresContext);
|
||||
nsRect rect = frame->GetRect();
|
||||
nsIView* view = frame->GetView();
|
||||
if (view) {
|
||||
nsCOMPtr<nsIViewManager> viewManager;
|
||||
view->GetViewManager(*getter_AddRefs(viewManager));
|
||||
nsIViewManager* viewManager = view->GetViewManager();
|
||||
rect.x = rect.y = 0;
|
||||
viewManager->ResizeView(view, rect);
|
||||
viewManager->SetViewVisibility(view, nsViewVisibility_kShow);
|
||||
@ -280,8 +276,7 @@ nsDeckFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
||||
nsIFrame* selectedFrame = nsnull;
|
||||
selectedBox->GetFrame(&selectedFrame);
|
||||
|
||||
nsPoint tmp;
|
||||
tmp.MoveTo(aPoint.x - mRect.x, aPoint.y - mRect.y);
|
||||
nsPoint tmp(aPoint.x - mRect.x, aPoint.y - mRect.y);
|
||||
|
||||
return selectedFrame->GetFrameForPoint(aPresContext, tmp, aWhichLayer, aFrame);
|
||||
}
|
||||
|
@ -53,8 +53,7 @@ nsFrameNavigator::GetTag(nsIBox* aBox, nsCOMPtr<nsIAtom>& aAtom)
|
||||
nsIFrame* frame = nsnull;
|
||||
aBox->GetFrame(&frame);
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
frame->GetContent(getter_AddRefs(content));
|
||||
nsIContent* content = frame->GetContent();
|
||||
if (content) {
|
||||
content->GetTag(getter_AddRefs(aAtom));
|
||||
return;
|
||||
|
@ -98,11 +98,10 @@ nsGrippyFrame::MouseClicked (nsIPresContext* aPresContext, nsGUIEvent* aEvent)
|
||||
return;
|
||||
|
||||
// get the splitters content node
|
||||
nsCOMPtr<nsIContent> content;
|
||||
splitter->GetContent(getter_AddRefs(content));
|
||||
nsIContent* content = splitter->GetContent();
|
||||
|
||||
nsString a(NS_LITERAL_STRING("collapsed"));
|
||||
nsString value;
|
||||
nsString a(NS_LITERAL_STRING("collapsed"));
|
||||
nsString value;
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttr(kNameSpaceID_None, nsXULAtoms::state, value))
|
||||
{
|
||||
if (value.Equals(NS_LITERAL_STRING("collapsed")))
|
||||
@ -131,8 +130,7 @@ nsGrippyFrame::MouseClicked(nsIPresContext* aPresContext)
|
||||
return;
|
||||
|
||||
// get the splitters content node
|
||||
nsCOMPtr<nsIContent> content;
|
||||
splitter->GetContent(getter_AddRefs(content));
|
||||
nsIContent* content = splitter->GetContent();
|
||||
|
||||
// get the collapse attribute. If the attribute is not set collapse
|
||||
// the child before otherwise collapse the child after
|
||||
@ -151,7 +149,7 @@ nsGrippyFrame::MouseClicked(nsIPresContext* aPresContext)
|
||||
if (child == nsnull)
|
||||
return;
|
||||
|
||||
child->GetContent(getter_AddRefs(mCollapsedChild));
|
||||
mCollapsedChild = child->GetContent();
|
||||
|
||||
style = "visibility: collapse";
|
||||
mCollapsedChildStyle = "";
|
||||
@ -169,9 +167,8 @@ nsGrippyFrame::MouseClicked(nsIPresContext* aPresContext)
|
||||
nsIFrame*
|
||||
nsGrippyFrame::GetChildBeforeAfter(nsIPresContext* aPresContext, nsIFrame* start, PRBool before)
|
||||
{
|
||||
nsIFrame* parent = nsnull;
|
||||
start->GetParent(&parent);
|
||||
PRInt32 index = IndexOf(aPresContext, parent,start);
|
||||
nsIFrame* parent = start->GetParent();
|
||||
PRInt32 index = IndexOf(aPresContext, parent, start);
|
||||
PRInt32 count = CountFrames(aPresContext, parent);
|
||||
|
||||
if (index == -1)
|
||||
@ -205,8 +202,7 @@ nsGrippyFrame::IndexOf(nsIPresContext* aPresContext, nsIFrame* parent, nsIFrame*
|
||||
if (childFrame == child)
|
||||
return count;
|
||||
|
||||
nsresult rv = childFrame->GetNextSibling(&childFrame);
|
||||
NS_ASSERTION(rv == NS_OK,"failed to get next child");
|
||||
childFrame = childFrame->GetNextSibling();
|
||||
count++;
|
||||
}
|
||||
|
||||
@ -222,8 +218,7 @@ nsGrippyFrame::CountFrames(nsIPresContext* aPresContext, nsIFrame* aFrame)
|
||||
aFrame->FirstChild(aPresContext, nsnull, &childFrame);
|
||||
while (nsnull != childFrame)
|
||||
{
|
||||
nsresult rv = childFrame->GetNextSibling(&childFrame);
|
||||
NS_ASSERTION(rv == NS_OK,"failed to get next child");
|
||||
childFrame = childFrame->GetNextSibling();
|
||||
count++;
|
||||
}
|
||||
|
||||
@ -242,8 +237,7 @@ nsGrippyFrame::GetChildAt(nsIPresContext* aPresContext, nsIFrame* parent, PRInt3
|
||||
if (count == index)
|
||||
return childFrame;
|
||||
|
||||
nsresult rv = childFrame->GetNextSibling(&childFrame);
|
||||
NS_ASSERTION(rv == NS_OK,"failed to get next child");
|
||||
childFrame = childFrame->GetNextSibling();
|
||||
count++;
|
||||
}
|
||||
|
||||
|
@ -117,12 +117,9 @@ nsLeafBoxFrame::Init(nsIPresContext* aPresContext,
|
||||
if (!HasView()) {
|
||||
nsHTMLContainerFrame::CreateViewForFrame(aPresContext,this,mStyleContext,nsnull,PR_TRUE);
|
||||
}
|
||||
nsIView* view = GetView(aPresContext);
|
||||
nsIView* view = GetView();
|
||||
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
view->GetWidget(*getter_AddRefs(widget));
|
||||
|
||||
if (!widget)
|
||||
if (!view->HasWidget())
|
||||
view->CreateWidget(kWidgetCID);
|
||||
}
|
||||
}
|
||||
|
@ -234,8 +234,7 @@ nsListBoxBodyFrame::Init(nsIPresContext* aPresContext, nsIContent* aContent,
|
||||
aPresContext->GetScaledPixelsToTwips(&p2t);
|
||||
mOnePixel = NSIntPixelsToTwips(1, p2t);
|
||||
|
||||
nsIFrame* box = nsnull;
|
||||
aParent->GetParent(&box);
|
||||
nsIFrame* box = aParent->GetParent();
|
||||
if (!box)
|
||||
return rv;
|
||||
|
||||
@ -558,13 +557,9 @@ nsListBoxBodyFrame::ScrollByLines(PRInt32 aNumLines)
|
||||
// w/out going back to the main event loop we can easily scroll the wrong
|
||||
// bits and it looks like garbage (bug 63465).
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
mPresContext->GetShell(getter_AddRefs(shell));
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
shell->GetViewManager(getter_AddRefs(vm));
|
||||
// I'd use Composite here, but it doesn't always work.
|
||||
// vm->Composite();
|
||||
vm->ForceUpdate();
|
||||
mPresContext->GetViewManager()->ForceUpdate();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -997,14 +992,6 @@ nsListBoxBodyFrame::GetFirstFrame()
|
||||
return mTopFrame;
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
nsListBoxBodyFrame::GetNextFrame(nsIFrame* aPrevFrame)
|
||||
{
|
||||
nsIFrame* nextFrame = nsnull;
|
||||
aPrevFrame->GetNextSibling(&nextFrame);
|
||||
return nextFrame;
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
nsListBoxBodyFrame::GetLastFrame()
|
||||
{
|
||||
@ -1068,7 +1055,7 @@ nsListBoxBodyFrame::DestroyRows(PRInt32& aRowsToLose)
|
||||
while (childFrame && aRowsToLose > 0) {
|
||||
--aRowsToLose;
|
||||
|
||||
nsIFrame* nextFrame = GetNextFrame(childFrame);
|
||||
nsIFrame* nextFrame = childFrame->GetNextSibling();
|
||||
mFrameConstructor->RemoveMappingsForFrameSubtree(mPresContext, childFrame, nsnull);
|
||||
nsBoxLayoutState state(mPresContext);
|
||||
|
||||
@ -1139,8 +1126,7 @@ nsListBoxBodyFrame::GetFirstItemBox(PRInt32 aOffset, PRBool* aCreated)
|
||||
nsCOMPtr<nsIContent> startContent;
|
||||
if (mTopFrame && mRowsToPrepend > 0) {
|
||||
// We need to insert rows before the top frame
|
||||
nsCOMPtr<nsIContent> topContent;
|
||||
mTopFrame->GetContent(getter_AddRefs(topContent));
|
||||
nsIContent* topContent = mTopFrame->GetContent();
|
||||
nsIContent* topParent = topContent->GetParent();
|
||||
PRInt32 contentIndex;
|
||||
topParent->IndexOf(topContent, contentIndex);
|
||||
@ -1189,16 +1175,14 @@ nsListBoxBodyFrame::GetNextItemBox(nsIBox* aBox, PRInt32 aOffset, PRBool* aCreat
|
||||
if (aCreated)
|
||||
*aCreated = PR_FALSE;
|
||||
|
||||
nsIFrame* result = nsnull;
|
||||
nsIFrame* frame = nsnull;
|
||||
aBox->GetFrame(&frame);
|
||||
frame->GetNextSibling(&result);
|
||||
nsIFrame* result = frame->GetNextSibling();
|
||||
|
||||
if (!result || result == mLinkupFrame || mRowsToPrepend > 0) {
|
||||
// No result found. See if there's a content node that wants a frame.
|
||||
PRInt32 i, childCount;
|
||||
nsCOMPtr<nsIContent> prevContent;
|
||||
frame->GetContent(getter_AddRefs(prevContent));
|
||||
nsIContent* prevContent = frame->GetContent();
|
||||
nsIContent* parentContent = prevContent->GetParent();
|
||||
parentContent->IndexOf(prevContent, i);
|
||||
parentContent->ChildCount(childCount);
|
||||
@ -1248,13 +1232,11 @@ nsListBoxBodyFrame::ContinueReflow(nscoord height)
|
||||
if (lastChild != startingPoint) {
|
||||
// We have some hangers on (probably caused by shrinking the size of the window).
|
||||
// Nuke them.
|
||||
nsIFrame* currFrame;
|
||||
startingPoint->GetNextSibling(&currFrame);
|
||||
nsIFrame* currFrame = startingPoint->GetNextSibling();
|
||||
nsBoxLayoutState state(mPresContext);
|
||||
|
||||
while (currFrame) {
|
||||
nsIFrame* nextFrame;
|
||||
currFrame->GetNextSibling(&nextFrame);
|
||||
nsIFrame* nextFrame = currFrame->GetNextSibling();
|
||||
mFrameConstructor->RemoveMappingsForFrameSubtree(mPresContext, currFrame, nsnull);
|
||||
|
||||
Remove(state, currFrame);
|
||||
@ -1396,7 +1378,7 @@ nsListBoxBodyFrame::OnContentRemoved(nsIPresContext* aPresContext, nsIFrame* aCh
|
||||
|
||||
// if we're removing the top row, the new top row is the next row
|
||||
if (mTopFrame && mTopFrame == aChildFrame)
|
||||
mTopFrame->GetNextSibling(&mTopFrame);
|
||||
mTopFrame = mTopFrame->GetNextSibling();
|
||||
|
||||
// Go ahead and delete the frame.
|
||||
nsBoxLayoutState state(aPresContext);
|
||||
@ -1474,20 +1456,17 @@ nsListBoxBodyFrame::ForceDrawFrame(nsIPresContext* aPresContext, nsIFrame * aFra
|
||||
if (aFrame == nsnull) {
|
||||
return;
|
||||
}
|
||||
nsRect rect;
|
||||
nsIView * view;
|
||||
nsPoint pnt;
|
||||
aFrame->GetOffsetFromView(aPresContext, pnt, &view);
|
||||
aFrame->GetRect(rect);
|
||||
nsRect rect = aFrame->GetRect();
|
||||
rect.x = pnt.x;
|
||||
rect.y = pnt.y;
|
||||
if (view) {
|
||||
nsCOMPtr<nsIViewManager> viewMgr;
|
||||
view->GetViewManager(*getter_AddRefs(viewMgr));
|
||||
nsIViewManager* viewMgr = view->GetViewManager();
|
||||
if (viewMgr)
|
||||
viewMgr->UpdateView(view, rect, NS_VMREFRESH_IMMEDIATE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -1516,9 +1495,7 @@ nsListboxScrollPortFrame::GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize&
|
||||
nsListBoxBodyFrame* outer = NS_STATIC_CAST(nsListBoxBodyFrame*,child);
|
||||
|
||||
nsAutoString sizeMode;
|
||||
nsCOMPtr<nsIContent> content;
|
||||
outer->GetContent(getter_AddRefs(content));
|
||||
content->GetAttr(kNameSpaceID_None, nsXULAtoms::sizemode, sizeMode);
|
||||
outer->GetContent()->GetAttr(kNameSpaceID_None, nsXULAtoms::sizemode, sizeMode);
|
||||
if (!sizeMode.IsEmpty()) {
|
||||
nsCOMPtr<nsIScrollableFrame> scrollFrame(do_QueryInterface(mParent));
|
||||
if (scrollFrame) {
|
||||
|
@ -111,7 +111,6 @@ public:
|
||||
|
||||
// frames
|
||||
nsIFrame* GetFirstFrame();
|
||||
nsIFrame* GetNextFrame(nsIFrame* aCurrFrame);
|
||||
nsIFrame* GetLastFrame();
|
||||
|
||||
// lazy row creation and destruction
|
||||
|
@ -71,10 +71,8 @@ nsListBoxLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, ns
|
||||
nscoord remainder = m == 0 ? 0 : rowheight - m;
|
||||
aSize.height += remainder;
|
||||
}
|
||||
nsCOMPtr<nsIContent> content;
|
||||
frame->GetContent(getter_AddRefs(content));
|
||||
nsAutoString sizeMode;
|
||||
content->GetAttr(kNameSpaceID_None, nsXULAtoms::sizemode, sizeMode);
|
||||
frame->GetContent()->GetAttr(kNameSpaceID_None, nsXULAtoms::sizemode, sizeMode);
|
||||
if (!sizeMode.IsEmpty()) {
|
||||
nscoord width = frame->ComputeIntrinsicWidth(aBoxLayoutState);
|
||||
if (width > aSize.width)
|
||||
@ -100,10 +98,8 @@ nsListBoxLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsS
|
||||
nscoord remainder = m == 0 ? 0 : rowheight - m;
|
||||
aSize.height += remainder;
|
||||
}
|
||||
nsCOMPtr<nsIContent> content;
|
||||
frame->GetContent(getter_AddRefs(content));
|
||||
nsAutoString sizeMode;
|
||||
content->GetAttr(kNameSpaceID_None, nsXULAtoms::sizemode, sizeMode);
|
||||
frame->GetContent()->GetAttr(kNameSpaceID_None, nsXULAtoms::sizemode, sizeMode);
|
||||
if (!sizeMode.IsEmpty()) {
|
||||
nscoord width = frame->ComputeIntrinsicWidth(aBoxLayoutState);
|
||||
if (width > aSize.width)
|
||||
|
@ -225,11 +225,8 @@ nsListBoxObject::GetListBoxBody()
|
||||
return nsnull;
|
||||
|
||||
// Iterate over our content model children looking for the body.
|
||||
nsCOMPtr<nsIContent> startContent;
|
||||
frame->GetContent(getter_AddRefs(startContent));
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
FindBodyContent(startContent, getter_AddRefs(content));
|
||||
FindBodyContent(frame->GetContent(), getter_AddRefs(content));
|
||||
|
||||
// this frame will be a nsGFXScrollFrame
|
||||
mPresShell->GetPrimaryFrameFor(content, &frame);
|
||||
|
@ -300,9 +300,9 @@ static void GetInsertionPoint(nsIPresShell* aShell, nsIFrame* aFrame, nsIFrame*
|
||||
{
|
||||
nsCOMPtr<nsIStyleSet> styleSet;
|
||||
aShell->GetStyleSet(getter_AddRefs(styleSet));
|
||||
nsCOMPtr<nsIContent> child;
|
||||
nsIContent* child = nsnull;
|
||||
if (aChild)
|
||||
aChild->GetContent(getter_AddRefs(child));
|
||||
child = aChild->GetContent();
|
||||
styleSet->GetInsertionPoint(aShell, aFrame, child, aResult);
|
||||
}
|
||||
|
||||
@ -324,8 +324,7 @@ nsMenuBarFrame::FindMenuWithShortcut(nsIDOMKeyEvent* aKeyEvent)
|
||||
immediateParent->FirstChild(mPresContext, nsnull, &currFrame);
|
||||
|
||||
while (currFrame) {
|
||||
nsCOMPtr<nsIContent> current;
|
||||
currFrame->GetContent(getter_AddRefs(current));
|
||||
nsIContent* current = currFrame->GetContent();
|
||||
|
||||
// See if it's a menu item.
|
||||
if (IsValidItem(current)) {
|
||||
@ -345,7 +344,7 @@ nsMenuBarFrame::FindMenuWithShortcut(nsIDOMKeyEvent* aKeyEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
currFrame->GetNextSibling(&currFrame);
|
||||
currFrame = currFrame->GetNextSibling();
|
||||
}
|
||||
|
||||
// didn't find a matching menu item
|
||||
@ -456,7 +455,7 @@ nsMenuBarFrame::GetNextMenuItem(nsIMenuFrame* aStart, nsIMenuFrame** aResult)
|
||||
aStart->QueryInterface(NS_GET_IID(nsIFrame), (void**)&currFrame);
|
||||
if (currFrame) {
|
||||
startFrame = currFrame;
|
||||
currFrame->GetNextSibling(&currFrame);
|
||||
currFrame = currFrame->GetNextSibling();
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -465,17 +464,14 @@ nsMenuBarFrame::GetNextMenuItem(nsIMenuFrame* aStart, nsIMenuFrame** aResult)
|
||||
&currFrame);
|
||||
|
||||
while (currFrame) {
|
||||
nsCOMPtr<nsIContent> current;
|
||||
currFrame->GetContent(getter_AddRefs(current));
|
||||
|
||||
// See if it's a menu item.
|
||||
if (IsValidItem(current)) {
|
||||
if (IsValidItem(currFrame->GetContent())) {
|
||||
nsCOMPtr<nsIMenuFrame> menuFrame = do_QueryInterface(currFrame);
|
||||
*aResult = menuFrame.get();
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
currFrame->GetNextSibling(&currFrame);
|
||||
currFrame = currFrame->GetNextSibling();
|
||||
}
|
||||
|
||||
immediateParent->FirstChild(mPresContext,
|
||||
@ -484,18 +480,15 @@ nsMenuBarFrame::GetNextMenuItem(nsIMenuFrame* aStart, nsIMenuFrame** aResult)
|
||||
|
||||
// Still don't have anything. Try cycling from the beginning.
|
||||
while (currFrame && currFrame != startFrame) {
|
||||
nsCOMPtr<nsIContent> current;
|
||||
currFrame->GetContent(getter_AddRefs(current));
|
||||
|
||||
// See if it's a menu item.
|
||||
if (IsValidItem(current)) {
|
||||
if (IsValidItem(currFrame->GetContent())) {
|
||||
nsCOMPtr<nsIMenuFrame> menuFrame = do_QueryInterface(currFrame);
|
||||
*aResult = menuFrame.get();
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
currFrame->GetNextSibling(&currFrame);
|
||||
currFrame = currFrame->GetNextSibling();
|
||||
}
|
||||
|
||||
// No luck. Just return our start value.
|
||||
@ -530,11 +523,8 @@ nsMenuBarFrame::GetPreviousMenuItem(nsIMenuFrame* aStart, nsIMenuFrame** aResult
|
||||
else currFrame = frames.LastChild();
|
||||
|
||||
while (currFrame) {
|
||||
nsCOMPtr<nsIContent> current;
|
||||
currFrame->GetContent(getter_AddRefs(current));
|
||||
|
||||
// See if it's a menu item.
|
||||
if (IsValidItem(current)) {
|
||||
if (IsValidItem(currFrame->GetContent())) {
|
||||
nsCOMPtr<nsIMenuFrame> menuFrame = do_QueryInterface(currFrame);
|
||||
*aResult = menuFrame.get();
|
||||
NS_IF_ADDREF(*aResult);
|
||||
@ -547,11 +537,8 @@ nsMenuBarFrame::GetPreviousMenuItem(nsIMenuFrame* aStart, nsIMenuFrame** aResult
|
||||
|
||||
// Still don't have anything. Try cycling from the end.
|
||||
while (currFrame && currFrame != startFrame) {
|
||||
nsCOMPtr<nsIContent> current;
|
||||
currFrame->GetContent(getter_AddRefs(current));
|
||||
|
||||
// See if it's a menu item.
|
||||
if (IsValidItem(current)) {
|
||||
if (IsValidItem(currFrame->GetContent())) {
|
||||
nsCOMPtr<nsIMenuFrame> menuFrame = do_QueryInterface(currFrame);
|
||||
*aResult = menuFrame.get();
|
||||
NS_IF_ADDREF(*aResult);
|
||||
@ -747,7 +734,8 @@ nsMenuBarFrame::GetWidget(nsIWidget **aWidget)
|
||||
if (!view)
|
||||
return NS_OK;
|
||||
|
||||
view->GetWidget(*aWidget);
|
||||
*aWidget = view->GetWidget();
|
||||
NS_IF_ADDREF(*aWidget);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -151,9 +151,7 @@ nsMenuDismissalListener::GetSubmenuWidgetChain(nsISupportsArray **_retval)
|
||||
// move up the chain
|
||||
nsIFrame* currAsFrame = nsnull;
|
||||
if ( NS_SUCCEEDED(CallQueryInterface(curr, &currAsFrame)) ) {
|
||||
nsIFrame* parentFrame = nsnull;
|
||||
currAsFrame->GetParent(&parentFrame);
|
||||
nsCOMPtr<nsIMenuFrame> menuFrame ( do_QueryInterface(parentFrame) );
|
||||
nsCOMPtr<nsIMenuFrame> menuFrame ( do_QueryInterface(currAsFrame->GetParent()) );
|
||||
if ( menuFrame ) {
|
||||
menuFrame->GetMenuParent ( &curr ); // Advance to next parent
|
||||
}
|
||||
|
@ -167,12 +167,12 @@ NS_IMETHODIMP
|
||||
nsMenuFrame::SetParent(const nsIFrame* aParent)
|
||||
{
|
||||
nsBoxFrame::SetParent(aParent);
|
||||
nsIFrame* currFrame = (nsIFrame*)aParent;
|
||||
const nsIFrame* currFrame = aParent;
|
||||
while (!mMenuParent && currFrame) {
|
||||
// Set our menu parent.
|
||||
CallQueryInterface(currFrame, &mMenuParent);
|
||||
CallQueryInterface(NS_CONST_CAST(nsIFrame*, currFrame), &mMenuParent);
|
||||
|
||||
currFrame->GetParent(&currFrame);
|
||||
currFrame = currFrame->GetParent();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -194,7 +194,7 @@ nsMenuFrame::Init(nsIPresContext* aPresContext,
|
||||
// Set our menu parent.
|
||||
CallQueryInterface(currFrame, &mMenuParent);
|
||||
|
||||
currFrame->GetParent(&currFrame);
|
||||
currFrame = currFrame->GetParent();
|
||||
}
|
||||
|
||||
// Do the type="checkbox" magic
|
||||
@ -297,7 +297,7 @@ nsMenuFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
||||
rv = nsBoxFrame::SetInitialChildList(aPresContext, aListName, first);
|
||||
return rv;
|
||||
}
|
||||
frame->GetNextSibling(&frame);
|
||||
frame = frame->GetNextSibling();
|
||||
}
|
||||
|
||||
// Didn't find it.
|
||||
@ -333,7 +333,7 @@ nsMenuFrame::DestroyPopupFrames(nsIPresContext* aPresContext)
|
||||
nsIFrame* curFrame = mPopupFrames.FirstChild();
|
||||
while (curFrame) {
|
||||
mFrameConstructor->RemoveMappingsForFrameSubtree(aPresContext, curFrame, nsnull);
|
||||
curFrame->GetNextSibling(&curFrame);
|
||||
curFrame = curFrame->GetNextSibling();
|
||||
}
|
||||
}
|
||||
|
||||
@ -367,8 +367,7 @@ nsMenuFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
||||
if ((result != NS_OK) || (*aFrame == this)) {
|
||||
return result;
|
||||
}
|
||||
nsCOMPtr<nsIContent> content;
|
||||
(*aFrame)->GetContent(getter_AddRefs(content));
|
||||
nsIContent* content = (*aFrame)->GetContent();
|
||||
if (content) {
|
||||
// This allows selective overriding for subcontent.
|
||||
nsAutoString value;
|
||||
@ -655,11 +654,9 @@ nsMenuFrame::ActivateMenu(PRBool aActivateFlag)
|
||||
return NS_OK;
|
||||
|
||||
if (aActivateFlag) {
|
||||
nsRect rect;
|
||||
menuPopup->GetRect(rect);
|
||||
nsIView* view = menuPopup->GetView(mPresContext);
|
||||
nsCOMPtr<nsIViewManager> viewManager;
|
||||
view->GetViewManager(*getter_AddRefs(viewManager));
|
||||
nsRect rect = menuPopup->GetRect();
|
||||
nsIView* view = menuPopup->GetView();
|
||||
nsIViewManager* viewManager = view->GetViewManager();
|
||||
rect.x = rect.y = 0;
|
||||
viewManager->ResizeView(view, rect);
|
||||
|
||||
@ -678,15 +675,13 @@ nsMenuFrame::ActivateMenu(PRBool aActivateFlag)
|
||||
viewManager->SetViewVisibility(view, nsViewVisibility_kShow);
|
||||
|
||||
} else {
|
||||
nsIView* view = menuPopup->GetView(mPresContext);
|
||||
nsIView* view = menuPopup->GetView();
|
||||
NS_ASSERTION(view, "View is gone, looks like someone forgot to rollup the popup!");
|
||||
if (view) {
|
||||
nsCOMPtr<nsIViewManager> viewManager;
|
||||
view->GetViewManager(*getter_AddRefs(viewManager));
|
||||
nsIViewManager* viewManager = view->GetViewManager();
|
||||
if (viewManager) { // the view manager can be null during widget teardown
|
||||
viewManager->SetViewVisibility(view, nsViewVisibility_kHide);
|
||||
nsRect r(0, 0, 0, 0);
|
||||
viewManager->ResizeView(view, r);
|
||||
viewManager->ResizeView(view, nsRect(0, 0, 0, 0));
|
||||
}
|
||||
}
|
||||
// set here so hide chain can close the menu as well.
|
||||
@ -718,9 +713,7 @@ nsMenuFrame::AttributeChanged(nsIPresContext* aPresContext,
|
||||
UpdateMenuSpecialState(aPresContext);
|
||||
} else if (aAttribute == nsXULAtoms::acceltext) {
|
||||
// someone reset the accelText attribute, so clear the bit that says *we* set it
|
||||
nsFrameState state;
|
||||
GetFrameState(&state);
|
||||
SetFrameState(state & ~NS_STATE_ACCELTEXT_IS_DERIVED);
|
||||
AddStateBits(NS_STATE_ACCELTEXT_IS_DERIVED);
|
||||
BuildAcceleratorText();
|
||||
} else if (aAttribute == nsXULAtoms::key) {
|
||||
BuildAcceleratorText();
|
||||
@ -798,8 +791,7 @@ nsMenuFrame::OpenMenuInternal(PRBool aActivateFlag)
|
||||
if (mMenuParent)
|
||||
mMenuParent->SetActive(PR_TRUE);
|
||||
|
||||
nsCOMPtr<nsIContent> menuPopupContent;
|
||||
menuPopup->GetContent(getter_AddRefs(menuPopupContent));
|
||||
nsIContent* menuPopupContent = menuPopup->GetContent();
|
||||
|
||||
// Sync up the view.
|
||||
nsAutoString popupAnchor, popupAlign;
|
||||
@ -837,9 +829,8 @@ nsMenuFrame::OpenMenuInternal(PRBool aActivateFlag)
|
||||
|
||||
menuPopup->SetBounds(state, nsRect(0,0,mLastPref.width, mLastPref.height));
|
||||
|
||||
nsIView* view = menuPopup->GetView(mPresContext);
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
view->GetViewManager(*getter_AddRefs(vm));
|
||||
nsIView* view = menuPopup->GetView();
|
||||
nsIViewManager* vm = view->GetViewManager();
|
||||
if (vm) {
|
||||
vm->SetViewVisibility(view, nsViewVisibility_kHide);
|
||||
}
|
||||
@ -905,12 +896,10 @@ nsMenuFrame::OpenMenuInternal(PRBool aActivateFlag)
|
||||
// XXX, bug 137033, In Windows, if mouse is outside the window when the menupopup closes, no
|
||||
// mouse_enter/mouse_exit event will be fired to clear current hover state, we should clear it manually.
|
||||
// This code may not the best solution, but we can leave it here untill we find the better approach.
|
||||
nsCOMPtr<nsIContent> menuPopupContent;
|
||||
menuPopup->GetContent(getter_AddRefs(menuPopupContent));
|
||||
nsCOMPtr<nsIEventStateManager> esm;
|
||||
mPresContext->GetEventStateManager(getter_AddRefs(esm));
|
||||
PRInt32 state;
|
||||
esm->GetContentState(menuPopupContent, state);
|
||||
esm->GetContentState(menuPopup->GetContent(), state);
|
||||
if (state & NS_EVENT_STATE_HOVER)
|
||||
esm->SetContentState(nsnull, NS_EVENT_STATE_HOVER);
|
||||
}
|
||||
@ -1071,11 +1060,9 @@ nsMenuFrame::DoLayout(nsBoxLayoutState& aState)
|
||||
|
||||
// Only size the popups view if open.
|
||||
if (mMenuOpen) {
|
||||
nsIView* view = popupChild->GetView(aState.GetPresContext());
|
||||
nsCOMPtr<nsIViewManager> viewManager;
|
||||
view->GetViewManager(*getter_AddRefs(viewManager));
|
||||
nsIView* view = popupChild->GetView();
|
||||
nsRect r(0, 0, bounds.width, bounds.height);
|
||||
viewManager->ResizeView(view, r);
|
||||
view->GetViewManager()->ResizeView(view, r);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1134,7 +1121,7 @@ nsMenuFrame::SetDebug(nsBoxLayoutState& aState, nsIFrame* aList, PRBool aDebug)
|
||||
ibox->SetDebug(aState, aDebug);
|
||||
}
|
||||
|
||||
aList->GetNextSibling(&aList);
|
||||
aList = aList->GetNextSibling();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -1194,8 +1181,7 @@ nsMenuFrame::RePositionPopup(nsBoxLayoutState& aState)
|
||||
nsIFrame* frame = mPopupFrames.FirstChild();
|
||||
nsMenuPopupFrame* menuPopup = (nsMenuPopupFrame*)frame;
|
||||
if (mMenuOpen && menuPopup) {
|
||||
nsCOMPtr<nsIContent> menuPopupContent;
|
||||
menuPopup->GetContent(getter_AddRefs(menuPopupContent));
|
||||
nsIContent* menuPopupContent = menuPopup->GetContent();
|
||||
nsAutoString popupAnchor, popupAlign;
|
||||
|
||||
menuPopupContent->GetAttr(kNameSpaceID_None, nsXULAtoms::popupanchor, popupAnchor);
|
||||
@ -1437,20 +1423,16 @@ nsMenuFrame::UpdateMenuSpecialState(nsIPresContext* aPresContext) {
|
||||
*/
|
||||
|
||||
/* walk siblings, looking for the other checked item with the same name */
|
||||
nsIFrame *parent, *sib;
|
||||
nsIFrame *sib;
|
||||
nsIMenuFrame *sibMenu;
|
||||
nsMenuType sibType;
|
||||
nsAutoString sibGroup;
|
||||
PRBool sibChecked;
|
||||
|
||||
nsresult rv = GetParent(&parent);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "couldn't get parent of radio menu frame\n");
|
||||
if (NS_FAILED(rv)) return;
|
||||
|
||||
// get the first sibling in this menu popup. This frame may be it, and if we're
|
||||
// being called at creation time, this frame isn't yet in the parent's child list.
|
||||
// All I'm saying is that this may fail, but it's most likely alright.
|
||||
rv = parent->FirstChild(aPresContext, NULL, &sib);
|
||||
nsresult rv = GetParent()->FirstChild(aPresContext, NULL, &sib);
|
||||
if ( NS_FAILED(rv) || !sib )
|
||||
return;
|
||||
|
||||
@ -1459,8 +1441,6 @@ nsMenuFrame::UpdateMenuSpecialState(nsIPresContext* aPresContext) {
|
||||
// Moving the declaration out of the loop works around this problem.
|
||||
// http://bugzilla.mozilla.org/show_bug.cgi?id=80988
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
|
||||
do {
|
||||
if (NS_FAILED(sib->QueryInterface(NS_GET_IID(nsIMenuFrame),
|
||||
(void **)&sibMenu)))
|
||||
@ -1471,29 +1451,24 @@ nsMenuFrame::UpdateMenuSpecialState(nsIPresContext* aPresContext) {
|
||||
(sibMenu->MenuIsChecked(sibChecked), sibChecked) &&
|
||||
(sibMenu->GetRadioGroupName(sibGroup), sibGroup == mGroupName)) {
|
||||
|
||||
if (NS_FAILED(sib->GetContent(getter_AddRefs(content))))
|
||||
continue; // break?
|
||||
|
||||
/* uncheck the old item */
|
||||
content->UnsetAttr(kNameSpaceID_None, nsHTMLAtoms::checked,
|
||||
PR_TRUE);
|
||||
sib->GetContent()->UnsetAttr(kNameSpaceID_None, nsHTMLAtoms::checked,
|
||||
PR_TRUE);
|
||||
|
||||
/* XXX in DEBUG, check to make sure that there aren't two checked items */
|
||||
return;
|
||||
}
|
||||
|
||||
} while(NS_SUCCEEDED(sib->GetNextSibling(&sib)) && sib);
|
||||
} while ((sib = sib->GetNextSibling()) != nsnull);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
nsMenuFrame::BuildAcceleratorText()
|
||||
{
|
||||
nsFrameState state;
|
||||
nsAutoString accelText;
|
||||
|
||||
GetFrameState(&state);
|
||||
if ((state & NS_STATE_ACCELTEXT_IS_DERIVED) == 0) {
|
||||
if ((GetStateBits() & NS_STATE_ACCELTEXT_IS_DERIVED) == 0) {
|
||||
mContent->GetAttr(kNameSpaceID_None, nsXULAtoms::acceltext, accelText);
|
||||
if (!accelText.IsEmpty())
|
||||
return;
|
||||
@ -1501,7 +1476,7 @@ nsMenuFrame::BuildAcceleratorText()
|
||||
// accelText is definitely empty here.
|
||||
|
||||
// Now we're going to compute the accelerator text, so remember that we did.
|
||||
SetFrameState(state | NS_STATE_ACCELTEXT_IS_DERIVED);
|
||||
AddStateBits(NS_STATE_ACCELTEXT_IS_DERIVED);
|
||||
|
||||
// If anything below fails, just leave the accelerator text blank.
|
||||
mContent->UnsetAttr(kNameSpaceID_None, nsXULAtoms::acceltext, PR_FALSE);
|
||||
@ -1696,12 +1671,11 @@ nsMenuFrame::Execute(nsGUIEvent *aEvent)
|
||||
// important below. We want the pres shell to get released before the
|
||||
// associated view manager on exit from this function.
|
||||
// See bug 54233.
|
||||
nsCOMPtr<nsIViewManager> kungFuDeathGrip;
|
||||
nsCOMPtr<nsIViewManager> kungFuDeathGrip = mPresContext->GetViewManager();
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
nsresult result = mPresContext->GetShell(getter_AddRefs(shell));
|
||||
nsIFrame* me = this;
|
||||
if (NS_SUCCEEDED(result) && shell) {
|
||||
shell->GetViewManager(getter_AddRefs(kungFuDeathGrip));
|
||||
shell->HandleDOMEventWithTarget(mContent, &event, &status);
|
||||
}
|
||||
|
||||
@ -2081,9 +2055,7 @@ nsMenuFrame::GetActiveChild(nsIDOMElement** aResult)
|
||||
else {
|
||||
nsIFrame* f;
|
||||
menuFrame->QueryInterface(NS_GET_IID(nsIFrame), (void**)&f);
|
||||
nsCOMPtr<nsIContent> c;
|
||||
f->GetContent(getter_AddRefs(c));
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(c));
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(f->GetContent()));
|
||||
*aResult = elt;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
}
|
||||
@ -2132,9 +2104,7 @@ nsMenuFrame::GetScrollableView(nsIPresContext* aPresContext, nsIScrollableView**
|
||||
popup->FirstChild(mPresContext, nsnull, &childFrame);
|
||||
if (childFrame) {
|
||||
*aView = popup->GetScrollableView(childFrame);
|
||||
nsRect itemRect;
|
||||
childFrame->GetRect(itemRect);
|
||||
(*aView)->SetLineHeight(itemRect.height);
|
||||
(*aView)->SetLineHeight(childFrame->GetSize().height);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -159,10 +159,7 @@ nsMenuPopupFrame::nsMenuPopupFrame(nsIPresShell* aShell)
|
||||
SetIsContextMenu(PR_FALSE); // we're not a context menu by default
|
||||
// Don't allow container frames to automatically position
|
||||
// the popup because they will put it in the wrong position.
|
||||
nsFrameState state;
|
||||
GetFrameState(&state);
|
||||
state &= ~NS_FRAME_SYNC_FRAME_AND_VIEW;
|
||||
SetFrameState(state);
|
||||
RemoveStateBits(NS_FRAME_SYNC_FRAME_AND_VIEW);
|
||||
} // ctor
|
||||
|
||||
|
||||
@ -193,10 +190,8 @@ nsMenuPopupFrame::Init(nsIPresContext* aPresContext,
|
||||
// Now that we've made a view, remove it and insert it at the correct
|
||||
// position in the view hierarchy (as the root view). We do this so that we
|
||||
// can draw the menus outside the confines of the window.
|
||||
nsIView* ourView = GetView(aPresContext);
|
||||
|
||||
nsCOMPtr<nsIViewManager> viewManager;
|
||||
ourView->GetViewManager(*getter_AddRefs(viewManager));
|
||||
nsIView* ourView = GetView();
|
||||
nsIViewManager* viewManager = ourView->GetViewManager();
|
||||
|
||||
// Remove the view from its old position.
|
||||
viewManager->RemoveChild(ourView);
|
||||
@ -282,11 +277,9 @@ nsMenuPopupFrame::MarkStyleChange(nsBoxLayoutState& aState)
|
||||
else {
|
||||
nsIFrame* frame = nsnull;
|
||||
GetFrame(&frame);
|
||||
nsIFrame* parentFrame = nsnull;
|
||||
frame->GetParent(&parentFrame);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aState.GetPresShell(getter_AddRefs(shell));
|
||||
return parentFrame->ReflowDirtyChild(shell, frame);
|
||||
return frame->GetParent()->ReflowDirtyChild(shell, frame);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
@ -297,28 +290,25 @@ nsMenuPopupFrame::MarkDirty(nsBoxLayoutState& aState)
|
||||
{
|
||||
NeedsRecalc();
|
||||
|
||||
nsFrameState state;
|
||||
nsIFrame* frame;
|
||||
GetFrame(&frame);
|
||||
frame->GetFrameState(&state);
|
||||
|
||||
// only reflow if we aren't already dirty.
|
||||
if (state & NS_FRAME_IS_DIRTY) {
|
||||
if (frame->GetStateBits() & NS_FRAME_IS_DIRTY) {
|
||||
#ifdef DEBUG_COELESCED
|
||||
Coelesced();
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
state |= NS_FRAME_IS_DIRTY;
|
||||
frame->SetFrameState(state);
|
||||
frame->AddStateBits(NS_FRAME_IS_DIRTY);
|
||||
|
||||
nsCOMPtr<nsIBoxLayout> layout;
|
||||
GetLayoutManager(getter_AddRefs(layout));
|
||||
if (layout)
|
||||
layout->BecameDirty(this, aState);
|
||||
|
||||
if (state & NS_FRAME_HAS_DIRTY_CHILDREN) {
|
||||
if (frame->GetStateBits() & NS_FRAME_HAS_DIRTY_CHILDREN) {
|
||||
#ifdef DEBUG_COELESCED
|
||||
Coelesced();
|
||||
#endif
|
||||
@ -340,11 +330,9 @@ nsMenuPopupFrame::MarkDirty(nsBoxLayoutState& aState)
|
||||
box->MarkDirtyChildren(state); // Mark the popupset as dirty.
|
||||
}
|
||||
else {
|
||||
nsIFrame* parentFrame = nsnull;
|
||||
frame->GetParent(&parentFrame);
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aState.GetPresShell(getter_AddRefs(shell));
|
||||
return parentFrame->ReflowDirtyChild(shell, frame);
|
||||
return frame->GetParent()->ReflowDirtyChild(shell, frame);
|
||||
}
|
||||
}
|
||||
|
||||
@ -354,10 +342,8 @@ nsMenuPopupFrame::MarkDirty(nsBoxLayoutState& aState)
|
||||
NS_IMETHODIMP
|
||||
nsMenuPopupFrame::RelayoutDirtyChild(nsBoxLayoutState& aState, nsIBox* aChild)
|
||||
{
|
||||
nsFrameState state;
|
||||
nsIFrame* frame;
|
||||
GetFrame(&frame);
|
||||
frame->GetFrameState(&state);
|
||||
|
||||
if (aChild != nsnull) {
|
||||
nsCOMPtr<nsIBoxLayout> layout;
|
||||
@ -367,10 +353,9 @@ nsMenuPopupFrame::RelayoutDirtyChild(nsBoxLayoutState& aState, nsIBox* aChild)
|
||||
}
|
||||
|
||||
// if we are not dirty mark ourselves dirty and tell our parent we are dirty too.
|
||||
if (!(state & NS_FRAME_HAS_DIRTY_CHILDREN)) {
|
||||
if (!(frame->GetStateBits() & NS_FRAME_HAS_DIRTY_CHILDREN)) {
|
||||
// Mark yourself as dirty and needing to be recalculated
|
||||
state |= NS_FRAME_HAS_DIRTY_CHILDREN;
|
||||
frame->SetFrameState(state);
|
||||
frame->AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
|
||||
NeedsRecalc();
|
||||
|
||||
nsIBox* parentBox = nsnull;
|
||||
@ -404,9 +389,8 @@ nsMenuPopupFrame::GetLayoutFlags(PRUint32& aFlags)
|
||||
PRBool ParentIsScrollableView(nsIView* aStartView);
|
||||
PRBool ParentIsScrollableView(nsIView* aStartView)
|
||||
{
|
||||
nsIView* scrollportView = nsnull;
|
||||
nsIView* scrollportView = aStartView->GetParent();
|
||||
nsIScrollableView* scrollableView = nsnull;
|
||||
aStartView->GetParent(scrollportView);
|
||||
if (scrollportView)
|
||||
scrollportView->QueryInterface(NS_GET_IID(nsIScrollableView), (void**) &scrollableView);
|
||||
return scrollableView != nsnull;
|
||||
@ -438,17 +422,14 @@ nsMenuPopupFrame::GetViewOffset(nsIView* aView, nsPoint& aPoint)
|
||||
aPoint.y = 0;
|
||||
|
||||
// Keep track of the root view so that we know to stop there
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
aView->GetViewManager(*getter_AddRefs(vm));
|
||||
nsIView* rootView;
|
||||
vm->GetRootView(rootView);
|
||||
aView->GetViewManager()->GetRootView(rootView);
|
||||
|
||||
nsIView *parent;
|
||||
nsRect bounds;
|
||||
|
||||
parent = aView;
|
||||
while (parent) {
|
||||
parent->GetBounds(bounds);
|
||||
nsRect bounds = parent->GetBounds();
|
||||
if ((bounds.y >= 0 && bounds.x >= 0) || !ParentIsScrollableView(parent)) {
|
||||
//
|
||||
// The Extremely Tall Menu:
|
||||
@ -492,7 +473,7 @@ nsMenuPopupFrame::GetViewOffset(nsIView* aView, nsPoint& aPoint)
|
||||
}
|
||||
if (parent == rootView)
|
||||
break;
|
||||
parent->GetParent(parent);
|
||||
parent = parent->GetParent();
|
||||
}
|
||||
}
|
||||
|
||||
@ -511,38 +492,19 @@ nsMenuPopupFrame::GetRootViewForPopup(nsIPresContext* aPresContext,
|
||||
{
|
||||
*aResult = nsnull;
|
||||
|
||||
// A frame with a view.
|
||||
nsIFrame* parentWithView = nsnull;
|
||||
|
||||
nsFrameState fs;
|
||||
aStartFrame->GetFrameState(&fs);
|
||||
if (fs & NS_FRAME_HAS_VIEW) {
|
||||
// If the given frame has a view, we don't need to climb anywhere.
|
||||
parentWithView = aStartFrame;
|
||||
}
|
||||
else {
|
||||
// Otherwise, walk up the frame tree looking for the first parent which
|
||||
// has a view.
|
||||
aStartFrame->GetParentWithView(aPresContext, &parentWithView);
|
||||
}
|
||||
|
||||
if (parentWithView) {
|
||||
nsIView* view = parentWithView->GetView(aPresContext);
|
||||
NS_ASSERTION(view, "GetParentWithView returned frame with no view!");
|
||||
nsIView* view = aStartFrame->GetClosestView();
|
||||
NS_ASSERTION(view, "frame must have a closest view!");
|
||||
if (view) {
|
||||
nsIView* rootView = nsnull;
|
||||
if (aStopAtViewManagerRoot) {
|
||||
nsCOMPtr<nsIViewManager> viewManager;
|
||||
view->GetViewManager(*getter_AddRefs(viewManager));
|
||||
NS_ASSERTION(viewManager, "View must have a viewmanager");
|
||||
viewManager->GetRootView(rootView);
|
||||
view->GetViewManager()->GetRootView(rootView);
|
||||
}
|
||||
|
||||
while (view) {
|
||||
// Walk up the view hierachy looking for a view whose widget has a
|
||||
// window type of eWindowType_popup - in other words a popup window
|
||||
// widget. If we find one, this is the view we want.
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
view->GetWidget(*getter_AddRefs(widget));
|
||||
nsIWidget* widget = view->GetWidget();
|
||||
if (widget) {
|
||||
nsWindowType wtype;
|
||||
widget->GetWindowType(wtype);
|
||||
@ -557,8 +519,7 @@ nsMenuPopupFrame::GetRootViewForPopup(nsIPresContext* aPresContext,
|
||||
return;
|
||||
}
|
||||
|
||||
nsIView* temp = nsnull;
|
||||
view->GetParent(temp);
|
||||
nsIView* temp = view->GetParent();
|
||||
if (!temp) {
|
||||
// Otherwise, we've walked all the way up to the root view and not
|
||||
// found a view for a popup window widget. Just return the root view.
|
||||
@ -577,9 +538,11 @@ void GetWidgetForView(nsIView *aView, nsIWidget *&aWidget)
|
||||
nsIView *view = aView;
|
||||
while (!aWidget && view)
|
||||
{
|
||||
view->GetWidget(aWidget);
|
||||
aWidget = view->GetWidget();
|
||||
if (!aWidget)
|
||||
view->GetParent(view);
|
||||
view = view->GetParent();
|
||||
else
|
||||
NS_ADDREF(aWidget);
|
||||
}
|
||||
}
|
||||
|
||||
@ -603,8 +566,7 @@ nsMenuPopupFrame::AdjustClientXYForNestedDocuments ( nsIDOMXULDocument* inPopupD
|
||||
|
||||
// Find the widget associated with the popup's document
|
||||
nsCOMPtr<nsIWidget> popupDocumentWidget;
|
||||
nsCOMPtr<nsIViewManager> viewManager;
|
||||
inPopupShell->GetViewManager(getter_AddRefs(viewManager));
|
||||
nsIViewManager* viewManager = inPopupShell->GetViewManager();
|
||||
if ( viewManager ) {
|
||||
nsIView* rootView;
|
||||
viewManager->GetRootView(rootView);
|
||||
@ -635,7 +597,6 @@ nsMenuPopupFrame::AdjustClientXYForNestedDocuments ( nsIDOMXULDocument* inPopupD
|
||||
if (targetDocument) {
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
targetDocument->GetShellAt(0, getter_AddRefs(shell));
|
||||
nsCOMPtr<nsIViewManager> viewManagerTarget;
|
||||
if ( shell ) {
|
||||
// We might be inside a popup widget. If so, we need to use that widget and
|
||||
// not the root view's widget.
|
||||
@ -653,7 +614,7 @@ nsMenuPopupFrame::AdjustClientXYForNestedDocuments ( nsIDOMXULDocument* inPopupD
|
||||
if (!targetDocumentWidget) {
|
||||
// We aren't inside a popup. This means we should use the root view's
|
||||
// widget.
|
||||
shell->GetViewManager(getter_AddRefs(viewManagerTarget));
|
||||
nsIViewManager* viewManagerTarget = shell->GetViewManager();
|
||||
if ( viewManagerTarget ) {
|
||||
nsIView* rootViewTarget;
|
||||
viewManagerTarget->GetRootView(rootViewTarget);
|
||||
@ -907,7 +868,7 @@ nsMenuPopupFrame::SyncViewWithFrame(nsIPresContext* aPresContext,
|
||||
// |view|
|
||||
// The root view for the popup window widget associated with this frame,
|
||||
// or, the view associated with this frame.
|
||||
nsIView* view = GetView(aPresContext);
|
||||
nsIView* view = GetView();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@ -940,8 +901,7 @@ nsMenuPopupFrame::SyncViewWithFrame(nsIPresContext* aPresContext,
|
||||
// a window or other view, whose bounds should not be taken into account.
|
||||
//
|
||||
if (ParentIsScrollableView(containingView)) {
|
||||
nsRect bounds;
|
||||
containingView->GetBounds(bounds);
|
||||
nsRect bounds = containingView->GetBounds();
|
||||
offset += nsPoint(bounds.x, bounds.y);
|
||||
}
|
||||
|
||||
@ -953,14 +913,12 @@ nsMenuPopupFrame::SyncViewWithFrame(nsIPresContext* aPresContext,
|
||||
|
||||
// |parentRect|
|
||||
// The dimensions of the frame invoking the popup.
|
||||
nsRect parentRect;
|
||||
aFrame->GetRect(parentRect);
|
||||
nsRect parentRect = aFrame->GetRect();
|
||||
|
||||
float p2t, t2p;
|
||||
aPresContext->GetScaledPixelsToTwips(&p2t);
|
||||
|
||||
nsCOMPtr<nsIViewManager> viewManager;
|
||||
containingView->GetViewManager(*getter_AddRefs(viewManager));
|
||||
nsIViewManager* viewManager = containingView->GetViewManager();
|
||||
|
||||
nsCOMPtr<nsIDeviceContext> dx;
|
||||
viewManager->GetDeviceContext(*getter_AddRefs(dx));
|
||||
@ -974,12 +932,10 @@ nsMenuPopupFrame::SyncViewWithFrame(nsIPresContext* aPresContext,
|
||||
nsCOMPtr<nsIScriptGlobalObject> scriptGlobalObject;
|
||||
document->GetScriptGlobalObject(getter_AddRefs(scriptGlobalObject));
|
||||
|
||||
nsCOMPtr<nsIContent> parentContent;
|
||||
aFrame->GetContent(getter_AddRefs(parentContent));
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
mContent->GetTag(getter_AddRefs(tag));
|
||||
PRBool sizedToPopup = (tag != nsXULAtoms::tooltip)
|
||||
&& (nsMenuFrame::IsSizedToPopup(parentContent, PR_FALSE));
|
||||
&& (nsMenuFrame::IsSizedToPopup(aFrame->GetContent(), PR_FALSE));
|
||||
|
||||
// If we stick to our parent's width, set it here before we move the
|
||||
// window around, because moving is done with respect to the width...
|
||||
@ -1188,7 +1144,7 @@ nsMenuPopupFrame::SyncViewWithFrame(nsIPresContext* aPresContext,
|
||||
// - - - - - - - - - - screenBottomTwips (bottom of the screen)
|
||||
// | \
|
||||
// | } moveDistY
|
||||
// | /
|
||||
// | /
|
||||
// +---- screenViewLocY + mRect.height
|
||||
//
|
||||
|
||||
@ -1259,11 +1215,11 @@ nsMenuPopupFrame::SyncViewWithFrame(nsIPresContext* aPresContext,
|
||||
viewManager->MoveViewTo(view, xpos, ypos);
|
||||
|
||||
// Now that we've positioned the view, sync up the frame's origin.
|
||||
nsPoint frameOrigin, offsetToView;
|
||||
GetOrigin(frameOrigin);
|
||||
nsPoint frameOrigin = GetPosition();
|
||||
nsPoint offsetToView;
|
||||
GetOriginToViewOffset(aPresContext, offsetToView, nsnull);
|
||||
frameOrigin -= offsetToView;
|
||||
nsBoxFrame::MoveTo(aPresContext, frameOrigin.x, frameOrigin.y);
|
||||
nsBoxFrame::SetPosition(frameOrigin);
|
||||
|
||||
if (sizedToPopup) {
|
||||
nsBoxLayoutState state(mPresContext);
|
||||
@ -1286,9 +1242,9 @@ static void GetInsertionPoint(nsIPresShell* aShell, nsIFrame* aFrame, nsIFrame*
|
||||
{
|
||||
nsCOMPtr<nsIStyleSet> styleSet;
|
||||
aShell->GetStyleSet(getter_AddRefs(styleSet));
|
||||
nsCOMPtr<nsIContent> child;
|
||||
nsIContent* child = nsnull;
|
||||
if (aChild)
|
||||
aChild->GetContent(getter_AddRefs(child));
|
||||
child = aChild->GetContent();
|
||||
styleSet->GetInsertionPoint(aShell, aFrame, child, aResult);
|
||||
}
|
||||
|
||||
@ -1308,7 +1264,7 @@ nsMenuPopupFrame::GetNextMenuItem(nsIMenuFrame* aStart, nsIMenuFrame** aResult)
|
||||
aStart->QueryInterface(NS_GET_IID(nsIFrame), (void**)&currFrame);
|
||||
if (currFrame) {
|
||||
startFrame = currFrame;
|
||||
currFrame->GetNextSibling(&currFrame);
|
||||
currFrame = currFrame->GetNextSibling();
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1318,17 +1274,14 @@ nsMenuPopupFrame::GetNextMenuItem(nsIMenuFrame* aStart, nsIMenuFrame** aResult)
|
||||
|
||||
|
||||
while (currFrame) {
|
||||
nsCOMPtr<nsIContent> current;
|
||||
currFrame->GetContent(getter_AddRefs(current));
|
||||
|
||||
// See if it's a menu item.
|
||||
if (IsValidItem(current)) {
|
||||
if (IsValidItem(currFrame->GetContent())) {
|
||||
nsCOMPtr<nsIMenuFrame> menuFrame = do_QueryInterface(currFrame);
|
||||
*aResult = menuFrame.get();
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
currFrame->GetNextSibling(&currFrame);
|
||||
currFrame = currFrame->GetNextSibling();
|
||||
}
|
||||
|
||||
immediateParent->FirstChild(mPresContext,
|
||||
@ -1337,18 +1290,15 @@ nsMenuPopupFrame::GetNextMenuItem(nsIMenuFrame* aStart, nsIMenuFrame** aResult)
|
||||
|
||||
// Still don't have anything. Try cycling from the beginning.
|
||||
while (currFrame && currFrame != startFrame) {
|
||||
nsCOMPtr<nsIContent> current;
|
||||
currFrame->GetContent(getter_AddRefs(current));
|
||||
|
||||
// See if it's a menu item.
|
||||
if (IsValidItem(current)) {
|
||||
if (IsValidItem(currFrame->GetContent())) {
|
||||
nsCOMPtr<nsIMenuFrame> menuFrame = do_QueryInterface(currFrame);
|
||||
*aResult = menuFrame.get();
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
currFrame->GetNextSibling(&currFrame);
|
||||
currFrame = currFrame->GetNextSibling();
|
||||
}
|
||||
|
||||
// No luck. Just return our start value.
|
||||
@ -1384,11 +1334,8 @@ nsMenuPopupFrame::GetPreviousMenuItem(nsIMenuFrame* aStart, nsIMenuFrame** aResu
|
||||
else currFrame = frames.LastChild();
|
||||
|
||||
while (currFrame) {
|
||||
nsCOMPtr<nsIContent> current;
|
||||
currFrame->GetContent(getter_AddRefs(current));
|
||||
|
||||
// See if it's a menu item.
|
||||
if (IsValidItem(current)) {
|
||||
if (IsValidItem(currFrame->GetContent())) {
|
||||
nsCOMPtr<nsIMenuFrame> menuFrame = do_QueryInterface(currFrame);
|
||||
*aResult = menuFrame.get();
|
||||
NS_IF_ADDREF(*aResult);
|
||||
@ -1401,11 +1348,8 @@ nsMenuPopupFrame::GetPreviousMenuItem(nsIMenuFrame* aStart, nsIMenuFrame** aResu
|
||||
|
||||
// Still don't have anything. Try cycling from the end.
|
||||
while (currFrame && currFrame != startFrame) {
|
||||
nsCOMPtr<nsIContent> current;
|
||||
currFrame->GetContent(getter_AddRefs(current));
|
||||
|
||||
// See if it's a menu item.
|
||||
if (IsValidItem(current)) {
|
||||
if (IsValidItem(currFrame->GetContent())) {
|
||||
nsCOMPtr<nsIMenuFrame> menuFrame = do_QueryInterface(currFrame);
|
||||
*aResult = menuFrame.get();
|
||||
NS_IF_ADDREF(*aResult);
|
||||
@ -1480,18 +1424,17 @@ nsIScrollableView* nsMenuPopupFrame::GetScrollableView(nsIFrame* aStart)
|
||||
return nsnull;
|
||||
|
||||
nsIFrame* currFrame;
|
||||
nsIView* view=nsnull;
|
||||
nsIScrollableView* scrollableView=nsnull;
|
||||
|
||||
// try start frame and siblings
|
||||
currFrame=aStart;
|
||||
do {
|
||||
view = currFrame->GetView(mPresContext);
|
||||
nsIView* view = currFrame->GetView();
|
||||
if ( view )
|
||||
CallQueryInterface(view, &scrollableView);
|
||||
if ( scrollableView )
|
||||
return scrollableView;
|
||||
currFrame->GetNextSibling(&currFrame);
|
||||
currFrame = currFrame->GetNextSibling();
|
||||
} while ( currFrame );
|
||||
|
||||
// try children
|
||||
@ -1502,7 +1445,7 @@ nsIScrollableView* nsMenuPopupFrame::GetScrollableView(nsIFrame* aStart)
|
||||
scrollableView=GetScrollableView(childFrame);
|
||||
if ( scrollableView )
|
||||
return scrollableView;
|
||||
currFrame->GetNextSibling(&currFrame);
|
||||
currFrame = currFrame->GetNextSibling();
|
||||
} while ( currFrame );
|
||||
|
||||
return nsnull;
|
||||
@ -1521,11 +1464,10 @@ void nsMenuPopupFrame::EnsureMenuItemIsVisible(nsIMenuFrame* aMenuItem)
|
||||
nsIView* view=nsnull;
|
||||
scrollableView->QueryInterface(NS_GET_IID(nsIView), (void**)&view);
|
||||
if ( view ) {
|
||||
nsRect viewRect, itemRect;
|
||||
nscoord scrollX, scrollY;
|
||||
|
||||
view->GetBounds(viewRect);
|
||||
frame->GetRect(itemRect);
|
||||
nsRect viewRect = view->GetBounds();
|
||||
nsRect itemRect = frame->GetRect();
|
||||
scrollableView->GetScrollPosition(scrollX, scrollY);
|
||||
|
||||
// scroll down
|
||||
@ -1755,8 +1697,7 @@ nsMenuPopupFrame::FindMenuWithShortcut(nsIDOMKeyEvent* aKeyEvent, PRBool& doActi
|
||||
// We start searching from first child. This process is divided into two parts
|
||||
// -- before current and after current -- by the current item
|
||||
while (currFrame) {
|
||||
nsCOMPtr<nsIContent> current;
|
||||
currFrame->GetContent(getter_AddRefs(current));
|
||||
nsIContent* current = currFrame->GetContent();
|
||||
|
||||
// See if it's a menu item.
|
||||
if (IsValidItem(current)) {
|
||||
@ -1814,7 +1755,7 @@ nsMenuPopupFrame::FindMenuWithShortcut(nsIDOMKeyEvent* aKeyEvent, PRBool& doActi
|
||||
}
|
||||
}
|
||||
}
|
||||
currFrame->GetNextSibling(&currFrame);
|
||||
currFrame = currFrame->GetNextSibling();
|
||||
}
|
||||
|
||||
doAction = (isMenu && (matchCount == 1 || matchShortcutCount == 1));
|
||||
@ -1957,11 +1898,9 @@ NS_IMETHODIMP
|
||||
nsMenuPopupFrame::GetParentPopup(nsIMenuParent** aMenuParent)
|
||||
{
|
||||
*aMenuParent = nsnull;
|
||||
nsIFrame* frame;
|
||||
GetParent(&frame);
|
||||
nsIFrame* frame = GetParent();
|
||||
if (frame) {
|
||||
nsIFrame* grandparent;
|
||||
frame->GetParent(&grandparent);
|
||||
nsIFrame* grandparent = frame->GetParent();
|
||||
if (grandparent) {
|
||||
nsCOMPtr<nsIMenuParent> menuParent = do_QueryInterface(grandparent);
|
||||
if (menuParent) {
|
||||
@ -1985,8 +1924,7 @@ nsMenuPopupFrame::HideChain()
|
||||
if (nsMenuFrame::sDismissalListener)
|
||||
nsMenuFrame::sDismissalListener->Unregister();
|
||||
|
||||
nsIFrame* frame;
|
||||
GetParent(&frame);
|
||||
nsIFrame* frame = GetParent();
|
||||
if (frame) {
|
||||
nsCOMPtr<nsIMenuFrame> menuFrame = do_QueryInterface(frame);
|
||||
if (!menuFrame) {
|
||||
@ -2021,8 +1959,7 @@ nsMenuPopupFrame::DismissChain()
|
||||
nsMenuFrame::sDismissalListener->Unregister();
|
||||
|
||||
// Get our menu parent.
|
||||
nsIFrame* frame;
|
||||
GetParent(&frame);
|
||||
nsIFrame* frame = GetParent();
|
||||
if (frame) {
|
||||
nsIMenuFrame *menuFrame = nsnull;
|
||||
CallQueryInterface(frame, &menuFrame);
|
||||
@ -2060,7 +1997,8 @@ nsMenuPopupFrame::GetWidget(nsIWidget **aWidget)
|
||||
if (!view)
|
||||
return NS_OK;
|
||||
|
||||
view->GetWidget(*aWidget);
|
||||
*aWidget = view->GetWidget();
|
||||
NS_IF_ADDREF(*aWidget);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -2330,43 +2268,35 @@ nsMenuPopupFrame::MoveTo(PRInt32 aLeft, PRInt32 aTop)
|
||||
mContent->SetAttr(kNameSpaceID_None, nsXULAtoms::left, left, PR_FALSE);
|
||||
mContent->SetAttr(kNameSpaceID_None, nsXULAtoms::top, top, PR_FALSE);
|
||||
|
||||
nsIView* view = GetView(mPresContext);
|
||||
nsIView* view = GetView();
|
||||
|
||||
// Retrieve screen position of parent view
|
||||
nsIView* parentView = nsnull;
|
||||
view->GetParent(parentView);
|
||||
nsPoint screenPos;
|
||||
GetScreenPosition(parentView, screenPos);
|
||||
GetScreenPosition(view->GetParent(), screenPos);
|
||||
|
||||
// Move the widget
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
view->GetWidget(*getter_AddRefs(widget));
|
||||
widget->Move(aLeft - screenPos.x, aTop - screenPos.y);
|
||||
view->GetWidget()->Move(aLeft - screenPos.x, aTop - screenPos.y);
|
||||
}
|
||||
|
||||
void
|
||||
nsMenuPopupFrame::GetScreenPosition(nsIView* aView, nsPoint& aScreenPosition)
|
||||
{
|
||||
nsPoint screenPos(0,0);
|
||||
nscoord x, y;
|
||||
|
||||
nsIView* currView = aView;
|
||||
nsIView* nextView = nsnull;
|
||||
|
||||
while (1) {
|
||||
currView->GetPosition(&x, &y);
|
||||
screenPos.x += x;
|
||||
screenPos.y += y;
|
||||
screenPos += currView->GetPosition();
|
||||
|
||||
currView->GetParent(nextView);
|
||||
nextView = currView->GetParent();
|
||||
if (!nextView)
|
||||
break;
|
||||
else
|
||||
currView = nextView;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWidget> rootWidget;
|
||||
currView->GetWidget(*getter_AddRefs(rootWidget));
|
||||
nsIWidget* rootWidget = currView->GetWidget();
|
||||
nsRect bounds, screenBounds;
|
||||
rootWidget->GetScreenBounds(bounds);
|
||||
rootWidget->WidgetToScreen(bounds, screenBounds);
|
||||
|
@ -111,11 +111,11 @@ nsNativeScrollbarFrame::Init(nsIPresContext* aPresContext, nsIContent* aContent,
|
||||
// suit. We don't have to lift a finger!
|
||||
static NS_DEFINE_IID(kScrollbarCID, NS_NATIVESCROLLBAR_CID);
|
||||
if ( NS_SUCCEEDED(CreateViewForFrame(aPresContext, this, aContext, PR_TRUE)) ) {
|
||||
nsIView* myView = GetView(aPresContext);
|
||||
nsIView* myView = GetView();
|
||||
if ( myView ) {
|
||||
nsWidgetInitData widgetData;
|
||||
if ( NS_SUCCEEDED(myView->CreateWidget(kScrollbarCID, &widgetData, nsnull)) ) {
|
||||
myView->GetWidget(*getter_AddRefs(mScrollbar));
|
||||
mScrollbar = myView->GetWidget();
|
||||
if (mScrollbar) {
|
||||
mScrollbar->Show(PR_TRUE);
|
||||
mScrollbar->Enable(PR_TRUE);
|
||||
@ -150,15 +150,14 @@ nsNativeScrollbarFrame::FindScrollbar(nsIFrame* start, nsIFrame** outFrame, nsIC
|
||||
*outFrame = nsnull;
|
||||
|
||||
while ( start ) {
|
||||
start->GetParent(&start);
|
||||
start = start->GetParent();
|
||||
if ( start ) {
|
||||
// get the content node
|
||||
nsCOMPtr<nsIContent> currContent;
|
||||
start->GetContent(getter_AddRefs(currContent));
|
||||
nsIContent* currContent = start->GetContent();
|
||||
|
||||
nsCOMPtr<nsIAtom> atom;
|
||||
if (currContent && currContent->GetTag(getter_AddRefs(atom)) == NS_OK && atom.get() == nsXULAtoms::scrollbar) {
|
||||
*outContent = currContent.get();
|
||||
*outContent = currContent;
|
||||
*outFrame = start;
|
||||
NS_IF_ADDREF(*outContent);
|
||||
return NS_OK;
|
||||
|
@ -160,10 +160,8 @@ nsPopupSetFrame::Init(nsIPresContext* aPresContext,
|
||||
mPresContext = aPresContext; // Don't addref it. Our lifetime is shorter.
|
||||
nsresult rv = nsBoxFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
|
||||
|
||||
nsIFrame *grandParent;
|
||||
aParent->GetParent(&grandParent);
|
||||
nsIRootBox *rootBox;
|
||||
nsresult res = CallQueryInterface(grandParent, &rootBox);
|
||||
nsresult res = CallQueryInterface(aParent->GetParent(), &rootBox);
|
||||
NS_ASSERTION(NS_SUCCEEDED(res), "grandparent should be root box");
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
rootBox->SetPopupSetFrame(this);
|
||||
@ -188,10 +186,8 @@ nsPopupSetFrame::Destroy(nsIPresContext* aPresContext)
|
||||
}
|
||||
}
|
||||
|
||||
nsIFrame *grandParent;
|
||||
mParent->GetParent(&grandParent);
|
||||
nsIRootBox *rootBox;
|
||||
nsresult res = CallQueryInterface(grandParent, &rootBox);
|
||||
nsresult res = CallQueryInterface(mParent->GetParent(), &rootBox);
|
||||
NS_ASSERTION(NS_SUCCEEDED(res), "grandparent should be root box");
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
rootBox->SetPopupSetFrame(nsnull);
|
||||
@ -271,9 +267,8 @@ nsPopupSetFrame::DoLayout(nsBoxLayoutState& aState)
|
||||
|
||||
// only size popup if open
|
||||
if (currEntry->mCreateHandlerSucceeded) {
|
||||
nsIView* view = popupChild->GetView(aState.GetPresContext());
|
||||
nsCOMPtr<nsIViewManager> viewManager;
|
||||
view->GetViewManager(*getter_AddRefs(viewManager));
|
||||
nsIView* view = popupChild->GetView();
|
||||
nsIViewManager* viewManager = view->GetViewManager();
|
||||
nsRect r(0, 0, bounds.width, bounds.height);
|
||||
viewManager->ResizeView(view, r);
|
||||
viewManager->SetViewVisibility(view, nsViewVisibility_kShow);
|
||||
@ -317,7 +312,7 @@ nsPopupSetFrame::SetDebug(nsBoxLayoutState& aState, nsIFrame* aList, PRBool aDeb
|
||||
ibox->SetDebug(aState, aDebug);
|
||||
}
|
||||
|
||||
aList->GetNextSibling(&aList);
|
||||
aList = aList->GetNextSibling();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -567,11 +562,10 @@ nsPopupSetFrame::ActivatePopup(nsPopupFrameList* aEntry, PRBool aActivateFlag)
|
||||
// destroy the popup.
|
||||
nsIFrame* activeChild = aEntry->mPopupFrame;
|
||||
if (activeChild) {
|
||||
nsIView* view = activeChild->GetView(mPresContext);
|
||||
nsIView* view = activeChild->GetView();
|
||||
NS_ASSERTION(view, "View is gone, looks like someone forgot to roll up the popup!");
|
||||
if (view) {
|
||||
nsCOMPtr<nsIViewManager> viewManager;
|
||||
view->GetViewManager(*getter_AddRefs(viewManager));
|
||||
nsIViewManager* viewManager = view->GetViewManager();
|
||||
viewManager->SetViewVisibility(view, nsViewVisibility_kHide);
|
||||
nsRect r(0, 0, 0, 0);
|
||||
viewManager->ResizeView(view, r);
|
||||
@ -806,8 +800,7 @@ nsPopupSetFrame::AddPopupFrame(nsIFrame* aPopup)
|
||||
// popup visible straightaway, e.g., the autocomplete widget).
|
||||
|
||||
// First look for an entry by content.
|
||||
nsCOMPtr<nsIContent> content;
|
||||
aPopup->GetContent(getter_AddRefs(content));
|
||||
nsIContent* content = aPopup->GetContent();
|
||||
nsPopupFrameList* entry = nsnull;
|
||||
if (mPopupList)
|
||||
entry = mPopupList->GetEntry(content);
|
||||
|
@ -120,15 +120,9 @@ nsProgressMeterFrame::AttributeChanged(nsIPresContext* aPresContext,
|
||||
nsIFrame* barChild = nsnull;
|
||||
FirstChild(aPresContext, nsnull, &barChild);
|
||||
if (!barChild) return NS_OK;
|
||||
nsIFrame* remainderChild = nsnull;
|
||||
barChild->GetNextSibling(&remainderChild);
|
||||
nsIFrame* remainderChild = barChild->GetNextSibling();
|
||||
if (!remainderChild) return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIContent> progressBar;
|
||||
barChild->GetContent(getter_AddRefs(progressBar));
|
||||
nsCOMPtr<nsIContent> progressRemainder;
|
||||
remainderChild->GetContent(getter_AddRefs(progressRemainder));
|
||||
|
||||
nsAutoString value;
|
||||
mContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::value, value);
|
||||
|
||||
@ -142,8 +136,8 @@ nsProgressMeterFrame::AttributeChanged(nsIPresContext* aPresContext,
|
||||
nsAutoString leftFlex, rightFlex;
|
||||
leftFlex.AppendInt(flex);
|
||||
rightFlex.AppendInt(remainder);
|
||||
progressBar->SetAttr(kNameSpaceID_None, nsXULAtoms::flex, leftFlex, PR_TRUE);
|
||||
progressRemainder->SetAttr(kNameSpaceID_None, nsXULAtoms::flex, rightFlex, PR_TRUE);
|
||||
barChild->GetContent()->SetAttr(kNameSpaceID_None, nsXULAtoms::flex, leftFlex, PR_TRUE);
|
||||
remainderChild->GetContent()->SetAttr(kNameSpaceID_None, nsXULAtoms::flex, rightFlex, PR_TRUE);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -141,13 +141,6 @@ nsScrollBoxFrame::SetUpScrolledFrame(nsIPresContext* aPresContext)
|
||||
nsStyleContext* context = frame->GetStyleContext();
|
||||
nsHTMLContainerFrame::CreateViewForFrame(aPresContext, frame,
|
||||
context, nsnull, PR_TRUE);
|
||||
|
||||
// We need to allow the view's position to be different than the
|
||||
// frame's position
|
||||
nsFrameState state;
|
||||
frame->GetFrameState(&state);
|
||||
state &= ~NS_FRAME_SYNC_FRAME_AND_VIEW;
|
||||
frame->SetFrameState(state);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -158,12 +151,8 @@ nsScrollBoxFrame::AppendFrames(nsIPresContext* aPresContext,
|
||||
{
|
||||
nsresult rv = nsBoxFrame::AppendFrames(aPresContext, aPresShell, aListName, aFrameList);
|
||||
|
||||
#ifdef DEBUG
|
||||
// make sure we only have 1 child.
|
||||
nsIFrame* frame = mFrames.FirstChild();
|
||||
frame->GetNextSibling(&frame);
|
||||
NS_ASSERTION(!frame, "Error ScrollBoxes can only have 1 child");
|
||||
#endif
|
||||
NS_ASSERTION(!mFrames.FirstChild()->GetNextSibling(), "Error ScrollBoxes can only have 1 child");
|
||||
|
||||
SetUpScrolledFrame(aPresContext);
|
||||
|
||||
@ -179,13 +168,8 @@ nsScrollBoxFrame::InsertFrames(nsIPresContext* aPresContext,
|
||||
{
|
||||
nsresult rv = nsBoxFrame::InsertFrames(aPresContext, aPresShell, aListName, aPrevFrame, aFrameList);
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
// make sure we only have 1 child.
|
||||
nsIFrame* frame = mFrames.FirstChild();
|
||||
frame->GetNextSibling(&frame);
|
||||
NS_ASSERTION(!frame, "Error ScrollBoxes can only have 1 child");
|
||||
#endif
|
||||
NS_ASSERTION(!mFrames.FirstChild()->GetNextSibling(), "Error ScrollBoxes can only have 1 child");
|
||||
|
||||
SetUpScrolledFrame(aPresContext);
|
||||
|
||||
@ -222,8 +206,8 @@ nsScrollBoxFrame::GetScrollingParentView(nsIPresContext* aPresContext,
|
||||
nsIFrame* aParent,
|
||||
nsIView** aParentView)
|
||||
{
|
||||
*aParentView = aParent->GetView(aPresContext);
|
||||
NS_ASSERTION(aParentView, "GetParentWithView failed");
|
||||
*aParentView = aParent->GetView();
|
||||
NS_ASSERTION(*aParentView, "GetParentWithView failed");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -233,8 +217,7 @@ nsScrollBoxFrame::CreateScrollingView(nsIPresContext* aPresContext)
|
||||
nsIView* view;
|
||||
|
||||
//Get parent frame
|
||||
nsIFrame* parent;
|
||||
GetParentWithView(aPresContext, &parent);
|
||||
nsIFrame* parent = GetAncestorWithView();
|
||||
NS_ASSERTION(parent, "GetParentWithView failed");
|
||||
|
||||
// Get parent view
|
||||
@ -242,11 +225,11 @@ nsScrollBoxFrame::CreateScrollingView(nsIPresContext* aPresContext)
|
||||
GetScrollingParentView(aPresContext, parent, &parentView);
|
||||
|
||||
// Get the view manager
|
||||
nsCOMPtr<nsIViewManager> viewManager;
|
||||
parentView->GetViewManager(*getter_AddRefs(viewManager));
|
||||
nsIViewManager* viewManager = parentView->GetViewManager();
|
||||
|
||||
// Create the scrolling view
|
||||
nsresult rv = CallCreateInstance(kScrollBoxViewCID, &view);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Initialize the scrolling view
|
||||
view->Init(viewManager, mRect, parentView);
|
||||
@ -280,7 +263,7 @@ nsScrollBoxFrame::CreateScrollingView(nsIPresContext* aPresContext)
|
||||
scrollingView->SetControlInsets(border);
|
||||
|
||||
// Remember our view
|
||||
SetView(aPresContext, view);
|
||||
SetView(view);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
@ -385,15 +368,14 @@ nsScrollBoxFrame::DoLayout(nsBoxLayoutState& aState)
|
||||
if (adaptor) {
|
||||
nsIFrame* frame;
|
||||
kid->GetFrame(&frame);
|
||||
nsIView* view = frame->GetView(presContext);
|
||||
|
||||
nsRect r(0, 0, childRect.width, childRect.height);
|
||||
nsContainerFrame::SyncFrameViewAfterReflow(presContext, frame, view, &r,
|
||||
NS_FRAME_NO_MOVE_VIEW);
|
||||
nsContainerFrame::SyncFrameViewAfterReflow(presContext, frame,
|
||||
frame->GetView(), &r, NS_FRAME_NO_MOVE_VIEW);
|
||||
}
|
||||
|
||||
nsIView* view = GetView();
|
||||
nsIScrollableView* scrollingView;
|
||||
nsIView* view = GetView(presContext);
|
||||
if (NS_SUCCEEDED(CallQueryInterface(view, &scrollingView))) {
|
||||
scrollingView->ComputeScrollOffsets(PR_TRUE);
|
||||
}
|
||||
@ -465,8 +447,6 @@ nsScrollBoxFrame::DoLayout(nsBoxLayoutState& aState)
|
||||
// make sure our scroll position did not change for where we last put
|
||||
// it. if it does then the user must have moved it, and we no longer
|
||||
// need to restore.
|
||||
nsIPresContext* presContext = aState.GetPresContext();
|
||||
nsIView* view = GetView(presContext);
|
||||
if (!view)
|
||||
return NS_OK; // don't freak out if we have no view
|
||||
|
||||
@ -483,7 +463,7 @@ nsScrollBoxFrame::DoLayout(nsBoxLayoutState& aState)
|
||||
nsIView* child = nsnull;
|
||||
nsresult rv = scrollingView->GetScrolledView(child);
|
||||
if (NS_SUCCEEDED(rv) && child)
|
||||
child->GetBounds(childRect);
|
||||
childRect = child->GetBounds();
|
||||
|
||||
PRInt32 cx, cy, x, y;
|
||||
scrollingView->GetScrollPosition(cx,cy);
|
||||
@ -622,7 +602,9 @@ nsScrollBoxFrame::Paint(nsIPresContext* aPresContext,
|
||||
nsresult
|
||||
nsScrollBoxFrame::GetContentOf(nsIContent** aContent)
|
||||
{
|
||||
return GetContent(aContent);
|
||||
*aContent = GetContent();
|
||||
NS_IF_ADDREF(*aContent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -674,7 +656,7 @@ nsScrollBoxFrame::SaveState(nsIPresContext* aPresContext,
|
||||
nsCOMPtr<nsIPresState> state;
|
||||
nsresult res = NS_OK;
|
||||
|
||||
nsIView* view = GetView(aPresContext);
|
||||
nsIView* view = GetView();
|
||||
NS_ENSURE_TRUE(view, NS_ERROR_FAILURE);
|
||||
|
||||
PRInt32 x,y;
|
||||
@ -690,8 +672,7 @@ nsScrollBoxFrame::SaveState(nsIPresContext* aPresContext,
|
||||
scrollingView->GetScrolledView(child);
|
||||
NS_ENSURE_TRUE(child, NS_ERROR_FAILURE);
|
||||
|
||||
nsRect childRect(0,0,0,0);
|
||||
child->GetBounds(childRect);
|
||||
nsRect childRect = child->GetBounds();
|
||||
|
||||
res = NS_NewPresState(getter_AddRefs(state));
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
@ -771,7 +752,7 @@ nsScrollBoxFrame::RestoreState(nsIPresContext* aPresContext,
|
||||
// don't do it now, store it later and do it in layout.
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
mRestoreRect.SetRect(x, y, w, h);
|
||||
nsIView* view = GetView(aPresContext);
|
||||
nsIView* view = GetView();
|
||||
if (!view)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -378,11 +378,8 @@ nsScrollBoxObject::GetScrollableView()
|
||||
if (!frame)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
mPresShell->GetPresContext(getter_AddRefs(context));
|
||||
nsIView* view = frame->GetView(context);
|
||||
nsIScrollableView* scrollingView;
|
||||
if (NS_SUCCEEDED(CallQueryInterface(view, &scrollingView))) {
|
||||
if (NS_SUCCEEDED(CallQueryInterface(frame->GetView(), &scrollingView))) {
|
||||
return scrollingView;
|
||||
}
|
||||
|
||||
|
@ -156,8 +156,7 @@ nsScrollbarButtonFrame::MouseClicked()
|
||||
return;
|
||||
|
||||
// get the scrollbars content node
|
||||
nsCOMPtr<nsIContent> content;
|
||||
scrollbar->GetContent(getter_AddRefs(content));
|
||||
nsIContent* content = scrollbar->GetContent();
|
||||
|
||||
// get the current pos
|
||||
PRInt32 curpos = nsSliderFrame::GetCurrentPosition(content);
|
||||
@ -221,8 +220,7 @@ nsScrollbarButtonFrame::GetChildWithTag(nsIPresContext* aPresContext,
|
||||
while (nsnull != childFrame)
|
||||
{
|
||||
// get the content node
|
||||
nsCOMPtr<nsIContent> child;
|
||||
childFrame->GetContent(getter_AddRefs(child));
|
||||
nsIContent* child = childFrame->GetContent();
|
||||
|
||||
if (child) {
|
||||
// see if it is the child
|
||||
@ -240,8 +238,7 @@ nsScrollbarButtonFrame::GetChildWithTag(nsIPresContext* aPresContext,
|
||||
if (result != nsnull)
|
||||
return NS_OK;
|
||||
|
||||
nsresult rv = childFrame->GetNextSibling(&childFrame);
|
||||
NS_ASSERTION(rv == NS_OK,"failed to get next child");
|
||||
childFrame = childFrame->GetNextSibling();
|
||||
}
|
||||
|
||||
result = nsnull;
|
||||
@ -251,14 +248,13 @@ nsScrollbarButtonFrame::GetChildWithTag(nsIPresContext* aPresContext,
|
||||
nsresult
|
||||
nsScrollbarButtonFrame::GetParentWithTag(nsIAtom* toFind, nsIFrame* start, nsIFrame*& result)
|
||||
{
|
||||
while(nsnull != start)
|
||||
while (start)
|
||||
{
|
||||
start->GetParent(&start);
|
||||
start = start->GetParent();
|
||||
|
||||
if (start) {
|
||||
// get the content node
|
||||
nsCOMPtr<nsIContent> child;
|
||||
start->GetContent(getter_AddRefs(child));
|
||||
nsIContent* child = start->GetContent();
|
||||
|
||||
nsCOMPtr<nsIAtom> atom;
|
||||
if (child && child->GetTag(getter_AddRefs(atom)) == NS_OK && atom.get() == toFind) {
|
||||
|
@ -88,10 +88,8 @@ nsScrollbarFrame::Init(nsIPresContext* aPresContext,
|
||||
{
|
||||
nsresult rv = nsBoxFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
|
||||
CreateViewForFrame(aPresContext,this,aContext,PR_TRUE);
|
||||
nsIView* view = GetView(aPresContext);
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
view->GetViewManager(*getter_AddRefs(vm));
|
||||
vm->SetViewContentTransparency(view, PR_TRUE);
|
||||
nsIView* view = GetView();
|
||||
view->GetViewManager()->SetViewContentTransparency(view, PR_TRUE);
|
||||
|
||||
// We want to be a reflow root since we use reflows to move the
|
||||
// slider. Any reflow inside the scrollbar frame will be a reflow to
|
||||
@ -127,8 +125,7 @@ nsScrollbarFrame::AttributeChanged(nsIPresContext* aPresContext,
|
||||
if (aAttribute != nsXULAtoms::curpos)
|
||||
return rv;
|
||||
|
||||
nsIFrame* parent;
|
||||
GetParent(&parent);
|
||||
nsIFrame* parent = GetParent();
|
||||
if (!parent)
|
||||
return rv;
|
||||
|
||||
|
@ -86,9 +86,9 @@ static already_AddRefed<nsIContent>
|
||||
GetContentOfBox(nsIBox *aBox)
|
||||
{
|
||||
nsIFrame *frame;
|
||||
nsIContent *content;
|
||||
aBox->GetFrame(&frame);
|
||||
frame->GetContent(&content);
|
||||
nsIContent* content = frame->GetContent();
|
||||
NS_IF_ADDREF(content);
|
||||
return content;
|
||||
}
|
||||
|
||||
@ -137,10 +137,8 @@ nsSliderFrame::Init(nsIPresContext* aPresContext,
|
||||
}
|
||||
|
||||
CreateViewForFrame(aPresContext,this,aContext,PR_TRUE);
|
||||
nsIView* view = GetView(aPresContext);
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
view->GetViewManager(*getter_AddRefs(vm));
|
||||
vm->SetViewContentTransparency(view, PR_TRUE);
|
||||
nsIView* view = GetView();
|
||||
view->GetViewManager()->SetViewContentTransparency(view, PR_TRUE);
|
||||
// XXX Hack
|
||||
mPresContext = aPresContext;
|
||||
return rv;
|
||||
@ -497,7 +495,7 @@ nsSliderFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||
{
|
||||
// if we hit a scrollable view make sure we take into account
|
||||
// how much we are scrolled.
|
||||
nsIView* view = parent->GetView(aPresContext);
|
||||
nsIView* view = parent->GetView();
|
||||
if (view) {
|
||||
nsIScrollableView* scrollingView;
|
||||
nsresult result = CallQueryInterface(view, &scrollingView);
|
||||
@ -509,22 +507,19 @@ nsSliderFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||
}
|
||||
}
|
||||
|
||||
nsRect r;
|
||||
parent->GetRect(r);
|
||||
nsRect r = parent->GetRect();
|
||||
isHorizontal ? start -= r.x : start -= r.y;
|
||||
|
||||
if (view) {
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
view->GetWidget(*getter_AddRefs(widget));
|
||||
if (widget) {
|
||||
if (view->HasWidget()) {
|
||||
nsWindowType windowType;
|
||||
widget->GetWindowType(windowType);
|
||||
view->GetWidget()->GetWindowType(windowType);
|
||||
if (windowType == eWindowType_popup)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
parent->GetParent(&parent);
|
||||
parent = parent->GetParent();
|
||||
}
|
||||
|
||||
#else // Kin's new offset calculation code.
|
||||
@ -535,13 +530,12 @@ nsSliderFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||
// in the coordinate system for the frame's contained view so that it
|
||||
// matches aEvent->point's coordinate system.
|
||||
|
||||
nsIView *view = this->GetClosestView(aPresContext);
|
||||
nsIView *view = GetClosestView();
|
||||
|
||||
nsCOMPtr<nsIWidget> rootWidget;
|
||||
|
||||
if (view) {
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
view->GetViewManager(*getter_AddRefs(vm));
|
||||
nsIViewManager* vm = view->GetViewManager();
|
||||
if (vm)
|
||||
vm->GetWidget(getter_AddRefs(rootWidget));
|
||||
}
|
||||
@ -555,8 +549,7 @@ nsSliderFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||
// view's coordinate system.
|
||||
|
||||
while (view) {
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
view->GetWidget(*getter_AddRefs(widget));
|
||||
nsIWidget* widget = view->GetWidget();
|
||||
|
||||
if (widget) {
|
||||
nsWindowType windowType;
|
||||
@ -566,11 +559,10 @@ nsSliderFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||
break;
|
||||
}
|
||||
|
||||
nscoord vx=0, vy=0;
|
||||
view->GetPosition(&vx, &vy);
|
||||
isHorizontal ? start -= vx : start -= vy;
|
||||
nsPoint p = view->GetPosition();
|
||||
start -= (isHorizontal ? p.x : p.y);
|
||||
|
||||
view->GetParent(view);
|
||||
view = view->GetParent();
|
||||
}
|
||||
}
|
||||
|
||||
@ -584,8 +576,7 @@ nsSliderFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||
pos -= start;
|
||||
PRBool isMouseOutsideThumb = PR_FALSE;
|
||||
if (mSnapMultiplier) {
|
||||
nsSize thumbSize;
|
||||
thumbFrame->GetSize(thumbSize);
|
||||
nsSize thumbSize = thumbFrame->GetSize();
|
||||
if (isHorizontal) {
|
||||
// horizontal scrollbar - check if mouse is above or below thumb
|
||||
if (aEvent->point.y < (-mSnapMultiplier * thumbSize.height) ||
|
||||
@ -649,8 +640,7 @@ nsSliderFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||
|
||||
// adjust so that the middle of the thumb is placed under the click
|
||||
nsIFrame* thumbFrame = mFrames.FirstChild();
|
||||
nsSize thumbSize;
|
||||
thumbFrame->GetSize(thumbSize);
|
||||
nsSize thumbSize = thumbFrame->GetSize();
|
||||
nscoord thumbLength = isHorizontal ? thumbSize.width : thumbSize.height;
|
||||
thumbLength /= onePixel;
|
||||
pospx -= (thumbLength/2);
|
||||
@ -669,7 +659,7 @@ nsSliderFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||
{
|
||||
// if we hit a scrollable view make sure we take into account
|
||||
// how much we are scrolled.
|
||||
nsIView* view = parent->GetView(aPresContext);
|
||||
nsIView* view = parent->GetView();
|
||||
if (view) {
|
||||
nsIScrollableView* scrollingView;
|
||||
nsresult result = CallQueryInterface(view, &scrollingView);
|
||||
@ -681,21 +671,18 @@ nsSliderFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||
}
|
||||
}
|
||||
|
||||
nsRect r;
|
||||
parent->GetRect(r);
|
||||
isHorizontal ? pos += r.x : pos += r.y;
|
||||
parent->GetParent(&parent);
|
||||
nsPoint p = parent->GetPosition();
|
||||
pos += isHorizontal ? p.x : p.y;
|
||||
parent = parent->GetParent();
|
||||
}
|
||||
|
||||
RemoveListener();
|
||||
DragThumb(mPresContext, PR_TRUE);
|
||||
nsRect thumbRect;
|
||||
thumbFrame->GetRect(thumbRect);
|
||||
|
||||
if (isHorizontal)
|
||||
mThumbStart = thumbRect.x;
|
||||
mThumbStart = thumbFrame->GetPosition().x;
|
||||
else
|
||||
mThumbStart = thumbRect.y;
|
||||
mThumbStart = thumbFrame->GetPosition().y;
|
||||
|
||||
mDragStartPx =pos/onePixel;
|
||||
}
|
||||
@ -787,8 +774,7 @@ nsSliderFrame::CurrentPositionChanged(nsIPresContext* aPresContext)
|
||||
if (!thumbFrame)
|
||||
return NS_OK; // The thumb may stream in asynchronously via XBL.
|
||||
|
||||
nsRect thumbRect;
|
||||
thumbFrame->GetRect(thumbRect);
|
||||
nsRect thumbRect = thumbFrame->GetRect();
|
||||
|
||||
nsRect clientRect;
|
||||
GetClientRect(clientRect);
|
||||
@ -802,7 +788,7 @@ nsSliderFrame::CurrentPositionChanged(nsIPresContext* aPresContext)
|
||||
newThumbRect.y = clientRect.y + nscoord(float(curpospx)*mRatio);
|
||||
|
||||
// set the rect
|
||||
thumbFrame->SetRect(aPresContext, newThumbRect);
|
||||
thumbFrame->SetRect(newThumbRect);
|
||||
|
||||
// figure out the union of the rect so we know what to redraw
|
||||
nsRect changeRect;
|
||||
@ -972,7 +958,7 @@ nsSliderFrame::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||
// if we hit a scrollable view make sure we take into account
|
||||
// how much we are scrolled.
|
||||
// XXX hack
|
||||
nsIView* view = parent->GetView(mPresContext);
|
||||
nsIView* view = parent->GetView();
|
||||
if (view) {
|
||||
nsIScrollableView* scrollingView;
|
||||
nsresult result = CallQueryInterface(view, &scrollingView);
|
||||
@ -984,10 +970,8 @@ nsSliderFrame::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||
}
|
||||
}
|
||||
|
||||
nsRect r;
|
||||
parent->GetRect(r);
|
||||
isHorizontal ? pos -= r.x : pos -= r.y;
|
||||
parent->GetParent(&parent);
|
||||
pos -= (isHorizontal ? parent->GetPosition().x : parent->GetPosition().y);
|
||||
parent = parent->GetParent();
|
||||
}
|
||||
|
||||
// now convert back into pixels
|
||||
@ -995,10 +979,7 @@ nsSliderFrame::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||
|
||||
// adjust so that the middle of the thumb is placed under the click
|
||||
nsIFrame* thumbFrame = mFrames.FirstChild();
|
||||
nsRect thumbRect;
|
||||
thumbFrame->GetRect(thumbRect);
|
||||
nsSize thumbSize;
|
||||
thumbFrame->GetSize(thumbSize);
|
||||
nsSize thumbSize = thumbFrame->GetSize();
|
||||
nscoord thumbLength = isHorizontal ? thumbSize.width : thumbSize.height;
|
||||
thumbLength /= onePixel;
|
||||
pospx -= (thumbLength/2);
|
||||
@ -1024,13 +1005,11 @@ nsSliderFrame::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||
|
||||
mDragStartPx = c;
|
||||
nsIFrame* thumbFrame = mFrames.FirstChild();
|
||||
nsRect thumbRect;
|
||||
thumbFrame->GetRect(thumbRect);
|
||||
|
||||
if (isHorizontal)
|
||||
mThumbStart = thumbRect.x;
|
||||
mThumbStart = thumbFrame->GetPosition().x;
|
||||
else
|
||||
mThumbStart = thumbRect.y;
|
||||
mThumbStart = thumbFrame->GetPosition().y;
|
||||
|
||||
//printf("Pressed mDragStartPx=%d\n",mDragStartPx);
|
||||
|
||||
@ -1049,14 +1028,14 @@ NS_IMETHODIMP
|
||||
nsSliderFrame :: DragThumb(nsIPresContext* aPresContext, PRBool aGrabMouseEvents)
|
||||
{
|
||||
// get its view
|
||||
nsIView* view = GetView(aPresContext);
|
||||
nsCOMPtr<nsIViewManager> viewMan;
|
||||
PRBool result;
|
||||
nsIView* view = GetView();
|
||||
|
||||
if (view) {
|
||||
view->GetViewManager(*getter_AddRefs(viewMan));
|
||||
nsIViewManager* viewMan = view->GetViewManager();
|
||||
|
||||
if (viewMan) {
|
||||
PRBool result;
|
||||
|
||||
if (aGrabMouseEvents) {
|
||||
viewMan->GrabMouseEvents(view,result);
|
||||
} else {
|
||||
@ -1072,11 +1051,10 @@ PRBool
|
||||
nsSliderFrame :: isDraggingThumb(nsIPresContext* aPresContext)
|
||||
{
|
||||
// get its view
|
||||
nsIView* view = GetView(aPresContext);
|
||||
nsCOMPtr<nsIViewManager> viewMan;
|
||||
nsIView* view = GetView();
|
||||
|
||||
if (view) {
|
||||
view->GetViewManager(*getter_AddRefs(viewMan));
|
||||
nsIViewManager* viewMan = view->GetViewManager();
|
||||
|
||||
if (viewMan) {
|
||||
nsIView* grabbingView;
|
||||
@ -1099,12 +1077,10 @@ nsSliderFrame::AddListener()
|
||||
|
||||
nsIFrame* thumbFrame = mFrames.FirstChild();
|
||||
if (thumbFrame) {
|
||||
nsCOMPtr<nsIContent> content;
|
||||
thumbFrame->GetContent(getter_AddRefs(content));
|
||||
nsCOMPtr<nsIDOMEventReceiver>
|
||||
receiver(do_QueryInterface(thumbFrame->GetContent()));
|
||||
|
||||
nsCOMPtr<nsIDOMEventReceiver> reciever(do_QueryInterface(content));
|
||||
|
||||
reciever->AddEventListenerByIID(mMediator, NS_GET_IID(nsIDOMMouseListener));
|
||||
receiver->AddEventListenerByIID(mMediator, NS_GET_IID(nsIDOMMouseListener));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1117,12 +1093,10 @@ nsSliderFrame::RemoveListener()
|
||||
if (!thumbFrame)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
thumbFrame->GetContent(getter_AddRefs(content));
|
||||
nsCOMPtr<nsIDOMEventReceiver>
|
||||
receiver(do_QueryInterface(thumbFrame->GetContent()));
|
||||
|
||||
nsCOMPtr<nsIDOMEventReceiver> reciever(do_QueryInterface(content));
|
||||
|
||||
reciever->RemoveEventListenerByIID(mMediator, NS_GET_IID(nsIDOMMouseListener));
|
||||
receiver->RemoveEventListenerByIID(mMediator, NS_GET_IID(nsIDOMMouseListener));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -1134,8 +1108,7 @@ nsSliderFrame::HandlePress(nsIPresContext* aPresContext,
|
||||
if (!thumbFrame) // display:none?
|
||||
return NS_OK;
|
||||
|
||||
nsRect thumbRect;
|
||||
thumbFrame->GetRect(thumbRect);
|
||||
nsRect thumbRect = thumbFrame->GetRect();
|
||||
|
||||
nscoord change = 1;
|
||||
if (IsHorizontal() ? aEvent->point.x < thumbRect.x
|
||||
@ -1205,10 +1178,8 @@ nsSliderFrame::EnsureOrient()
|
||||
|
||||
nsIFrame* frame = nsnull;
|
||||
scrollbarBox->GetFrame(&frame);
|
||||
nsFrameState state;
|
||||
frame->GetFrameState(&state);
|
||||
|
||||
PRBool isHorizontal = state & NS_STATE_IS_HORIZONTAL;
|
||||
PRBool isHorizontal = frame->GetStateBits() & NS_STATE_IS_HORIZONTAL;
|
||||
if (isHorizontal)
|
||||
mState |= NS_STATE_IS_HORIZONTAL;
|
||||
else
|
||||
@ -1235,8 +1206,7 @@ NS_IMETHODIMP_(void) nsSliderFrame::Notify(nsITimer *timer)
|
||||
PRBool stop = PR_FALSE;
|
||||
|
||||
nsIFrame* thumbFrame = mFrames.FirstChild();
|
||||
nsRect thumbRect;
|
||||
thumbFrame->GetRect(thumbRect);
|
||||
nsRect thumbRect = thumbFrame->GetRect();
|
||||
|
||||
PRBool isHorizontal = IsHorizontal();
|
||||
|
||||
|
@ -182,11 +182,9 @@ NS_IMPL_ISUPPORTS2(nsSplitterFrameInner, nsIDOMMouseListener, nsIDOMMouseMotionL
|
||||
nsSplitterFrameInner::ResizeType
|
||||
nsSplitterFrameInner::GetResizeBefore()
|
||||
{
|
||||
nsCOMPtr<nsIContent> content;
|
||||
mOuter->GetContent(getter_AddRefs(content));
|
||||
|
||||
nsString value;
|
||||
content->GetAttr(kNameSpaceID_None, nsXULAtoms::resizebefore, value);
|
||||
mOuter->GetContent()->GetAttr(kNameSpaceID_None,
|
||||
nsXULAtoms::resizebefore, value);
|
||||
if (value.EqualsIgnoreCase("farthest"))
|
||||
return Farthest;
|
||||
else
|
||||
@ -202,11 +200,9 @@ nsSplitterFrameInner::~nsSplitterFrameInner()
|
||||
nsSplitterFrameInner::ResizeType
|
||||
nsSplitterFrameInner::GetResizeAfter()
|
||||
{
|
||||
nsCOMPtr<nsIContent> content;
|
||||
mOuter->GetContent(getter_AddRefs(content));
|
||||
|
||||
nsString value;
|
||||
content->GetAttr(kNameSpaceID_None, nsXULAtoms::resizeafter, value);
|
||||
mOuter->GetContent()->GetAttr(kNameSpaceID_None,
|
||||
nsXULAtoms::resizeafter, value);
|
||||
if (value.EqualsIgnoreCase("farthest"))
|
||||
return Farthest;
|
||||
else if (value.EqualsIgnoreCase("grow"))
|
||||
@ -218,11 +214,9 @@ nsSplitterFrameInner::GetResizeAfter()
|
||||
nsSplitterFrameInner::State
|
||||
nsSplitterFrameInner::GetState()
|
||||
{
|
||||
nsCOMPtr<nsIContent> content;
|
||||
mOuter->GetContent(getter_AddRefs(content));
|
||||
|
||||
nsString value;
|
||||
content->GetAttr(kNameSpaceID_None, nsXULAtoms::state, value);
|
||||
mOuter->GetContent()->GetAttr(kNameSpaceID_None,
|
||||
nsXULAtoms::state, value);
|
||||
if (value.EqualsIgnoreCase("dragging"))
|
||||
return Dragging;
|
||||
else if (value.EqualsIgnoreCase("collapsed"))
|
||||
@ -367,10 +361,9 @@ nsSplitterFrame::Init(nsIPresContext* aPresContext,
|
||||
mPresContext = aPresContext;
|
||||
|
||||
nsHTMLContainerFrame::CreateViewForFrame(aPresContext,this,aContext,nsnull,PR_TRUE);
|
||||
nsIView* view = GetView(aPresContext);
|
||||
nsIView* view = GetView();
|
||||
|
||||
nsCOMPtr<nsIViewManager> viewManager;
|
||||
view->GetViewManager(*getter_AddRefs(viewManager));
|
||||
nsIViewManager* viewManager = view->GetViewManager();
|
||||
viewManager->SetViewContentTransparency(view, PR_TRUE);
|
||||
viewManager->SetViewZIndex(view, PR_FALSE, kMaxZ);
|
||||
|
||||
@ -394,10 +387,7 @@ nsSplitterFrame::DoLayout(nsBoxLayoutState& aState)
|
||||
nsIFrame* frame;
|
||||
GetFrame(&frame);
|
||||
|
||||
nsFrameState childState;
|
||||
frame->GetFrameState(&childState);
|
||||
|
||||
if (childState & NS_FRAME_FIRST_REFLOW)
|
||||
if (frame->GetStateBits() & NS_FRAME_FIRST_REFLOW)
|
||||
{
|
||||
GetParentBox(&mInner->mParentBox);
|
||||
mInner->UpdateState();
|
||||
@ -549,7 +539,7 @@ nsSplitterFrameInner::MouseDrag(nsIPresContext* aPresContext, nsGUIEvent* aEvent
|
||||
{
|
||||
// if we hit a scrollable view make sure we take into account
|
||||
// how much we are scrolled.
|
||||
nsIView* view = parent->GetView(aPresContext);
|
||||
nsIView* view = parent->GetView();
|
||||
if (view) {
|
||||
nsIScrollableView* scrollingView;
|
||||
nsresult result = CallQueryInterface(view, &scrollingView);
|
||||
@ -561,10 +551,9 @@ nsSplitterFrameInner::MouseDrag(nsIPresContext* aPresContext, nsGUIEvent* aEvent
|
||||
}
|
||||
}
|
||||
|
||||
nsRect r;
|
||||
parent->GetRect(r);
|
||||
nsRect r = parent->GetRect();
|
||||
isHorizontal ? start -= r.x : start -= r.y;
|
||||
parent->GetParent(&parent);
|
||||
parent = parent->GetParent();
|
||||
}
|
||||
|
||||
// take our current position and substract the start location
|
||||
@ -669,25 +658,22 @@ nsSplitterFrameInner::AddListener(nsIPresContext* aPresContext)
|
||||
{
|
||||
nsIFrame* thumbFrame = nsnull;
|
||||
mOuter->FirstChild(aPresContext, nsnull,&thumbFrame);
|
||||
nsCOMPtr<nsIContent> content;
|
||||
mOuter->GetContent(getter_AddRefs(content));
|
||||
|
||||
nsCOMPtr<nsIDOMEventReceiver> reciever(do_QueryInterface(content));
|
||||
nsCOMPtr<nsIDOMEventReceiver>
|
||||
receiver(do_QueryInterface(mOuter->GetContent()));
|
||||
|
||||
reciever->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseListener*,this), NS_GET_IID(nsIDOMMouseListener));
|
||||
reciever->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseMotionListener*,this), NS_GET_IID(nsIDOMMouseMotionListener));
|
||||
receiver->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseListener*,this), NS_GET_IID(nsIDOMMouseListener));
|
||||
receiver->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseMotionListener*,this), NS_GET_IID(nsIDOMMouseMotionListener));
|
||||
}
|
||||
|
||||
void
|
||||
nsSplitterFrameInner::RemoveListener()
|
||||
{
|
||||
nsCOMPtr<nsIContent> content;
|
||||
mOuter->GetContent(getter_AddRefs(content));
|
||||
nsCOMPtr<nsIDOMEventReceiver>
|
||||
receiver(do_QueryInterface(mOuter->GetContent()));
|
||||
|
||||
nsCOMPtr<nsIDOMEventReceiver> reciever(do_QueryInterface(content));
|
||||
|
||||
reciever->RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseListener*,this),NS_GET_IID(nsIDOMMouseListener));
|
||||
reciever->RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseMotionListener*,this),NS_GET_IID(nsIDOMMouseMotionListener));
|
||||
receiver->RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseListener*,this),NS_GET_IID(nsIDOMMouseListener));
|
||||
receiver->RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseMotionListener*,this),NS_GET_IID(nsIDOMMouseMotionListener));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -695,15 +681,13 @@ nsresult
|
||||
nsSplitterFrameInner :: CaptureMouse(nsIPresContext* aPresContext, PRBool aGrabMouseEvents)
|
||||
{
|
||||
// get its view
|
||||
nsIView* view = mOuter->GetView(aPresContext);
|
||||
nsCOMPtr<nsIViewManager> viewMan;
|
||||
nsIView* view = mOuter->GetView();
|
||||
PRBool result;
|
||||
//nsCOMPtr<nsIWidget> widget;
|
||||
|
||||
if (view) {
|
||||
view->GetViewManager(*getter_AddRefs(viewMan));
|
||||
//view->GetWidget(*getter_AddRefs(widget));
|
||||
nsIViewManager* viewMan = view->GetViewManager();
|
||||
if (viewMan) {
|
||||
// nsIWidget* widget = view->GetWidget();
|
||||
if (aGrabMouseEvents) {
|
||||
viewMan->GrabMouseEvents(view,result);
|
||||
// if (widget)
|
||||
@ -724,11 +708,10 @@ PRBool
|
||||
nsSplitterFrameInner :: IsMouseCaptured(nsIPresContext* aPresContext)
|
||||
{
|
||||
// get its view
|
||||
nsIView* view = mOuter->GetView(aPresContext);
|
||||
nsCOMPtr<nsIViewManager> viewMan;
|
||||
nsIView* view = mOuter->GetView();
|
||||
|
||||
if (view) {
|
||||
view->GetViewManager(*getter_AddRefs(viewMan));
|
||||
nsIViewManager* viewMan = view->GetViewManager();
|
||||
|
||||
if (viewMan) {
|
||||
nsIView* grabbingView;
|
||||
@ -764,11 +747,9 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||
if (button != 0)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
mOuter->GetContent(getter_AddRefs(content));
|
||||
|
||||
nsAutoString disabled;
|
||||
content->GetAttr(kNameSpaceID_None, nsHTMLAtoms::disabled, disabled);
|
||||
mOuter->GetContent()->GetAttr(kNameSpaceID_None,
|
||||
nsHTMLAtoms::disabled, disabled);
|
||||
if (disabled.Equals(NS_LITERAL_STRING("true")))
|
||||
return NS_OK;
|
||||
|
||||
@ -815,7 +796,7 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||
nsIFrame* childFrame = nsnull;
|
||||
childBox->GetFrame(&childFrame);
|
||||
|
||||
childFrame->GetContent(getter_AddRefs(content));
|
||||
nsIContent* content = childFrame->GetContent();
|
||||
nsCOMPtr<nsIAtom> atom;
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIXBLService> xblService =
|
||||
@ -918,9 +899,7 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||
if (resizeAfter == Grow)
|
||||
mChildInfosAfterCount = 0;
|
||||
|
||||
nsRect vr(0,0,0,0);
|
||||
nsIView *v = mOuter->GetView(mOuter->mPresContext);
|
||||
v->GetBounds(vr);
|
||||
nsRect vr = mOuter->GetView()->GetBounds();
|
||||
|
||||
PRInt32 c = 0;
|
||||
if (isHorizontal) {
|
||||
@ -1018,9 +997,8 @@ nsSplitterFrameInner::UpdateState()
|
||||
if (splitterSibling) {
|
||||
nsIFrame* splitterSiblingFrame = nsnull;
|
||||
splitterSibling->GetFrame(&splitterSiblingFrame);
|
||||
nsCOMPtr<nsIContent> sibling;
|
||||
if (NS_SUCCEEDED(splitterSiblingFrame->GetContent(getter_AddRefs(sibling)))
|
||||
&& sibling) {
|
||||
nsIContent* sibling = splitterSiblingFrame->GetContent();
|
||||
if (sibling) {
|
||||
if (mState == Collapsed) {
|
||||
// Collapsed -> Open
|
||||
// Collapsed -> Dragging
|
||||
@ -1045,10 +1023,8 @@ nsSplitterFrameInner::EnsureOrient()
|
||||
{
|
||||
nsIFrame* frame = nsnull;
|
||||
mParentBox->GetFrame(&frame);
|
||||
nsFrameState state;
|
||||
frame->GetFrameState(&state);
|
||||
|
||||
PRBool isHorizontal = !(state & NS_STATE_IS_HORIZONTAL);
|
||||
PRBool isHorizontal = !(frame->GetStateBits() & NS_STATE_IS_HORIZONTAL);
|
||||
if (isHorizontal)
|
||||
mOuter->mState |= NS_STATE_IS_HORIZONTAL;
|
||||
else
|
||||
@ -1074,15 +1050,14 @@ if (realTimeDrag) {
|
||||
nsIFrame* frame = nsnull;
|
||||
mParentBox->GetFrame(&frame);
|
||||
|
||||
nsCOMPtr<nsIViewManager> viewManager;
|
||||
nsIView* view = frame->GetView(aPresContext);
|
||||
nsIView* view = frame->GetView();
|
||||
|
||||
if (!view) {
|
||||
nsPoint offset;
|
||||
frame->GetOffsetFromView(aPresContext, offset, &view);
|
||||
NS_ASSERTION(nsnull != view, "no view");
|
||||
}
|
||||
view->GetViewManager(*getter_AddRefs(viewManager));
|
||||
nsIViewManager* viewManager = view->GetViewManager();
|
||||
|
||||
viewManager->DisableRefresh();
|
||||
shell->FlushPendingNotifications(PR_FALSE);
|
||||
@ -1170,8 +1145,7 @@ nsSplitterFrameInner::SetPreferredSize(nsBoxLayoutState& aState, nsIBox* aChildB
|
||||
nsIFrame* childFrame = nsnull;
|
||||
aChildBox->GetFrame(&childFrame);
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
childFrame->GetContent(getter_AddRefs(content));
|
||||
nsIContent* content = childFrame->GetContent();
|
||||
|
||||
// set its preferred size.
|
||||
nsAutoString prefValue;
|
||||
@ -1257,20 +1231,18 @@ void
|
||||
nsSplitterFrameInner::MoveSplitterBy(nsIPresContext* aPresContext, nscoord aDiff)
|
||||
{
|
||||
const nsRect& r = mOuter->mRect;
|
||||
nsRect vr;
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
nsIView *v = mOuter->GetView(aPresContext);
|
||||
v->GetViewManager(*getter_AddRefs(vm));
|
||||
v->GetBounds(vr);
|
||||
nsIView *v = mOuter->GetView();
|
||||
nsIViewManager* vm = v->GetViewManager();
|
||||
nsRect vr = v->GetBounds();
|
||||
nsRect invalid;
|
||||
EnsureOrient();
|
||||
PRBool isHorizontal = !mOuter->IsHorizontal();
|
||||
if (isHorizontal) {
|
||||
mOuter->MoveTo(aPresContext, mSplitterPos + aDiff, r.y);
|
||||
mOuter->SetPosition(nsPoint(mSplitterPos + aDiff, r.y));
|
||||
vm->MoveViewTo(v, mSplitterViewPos + aDiff, vr.y);
|
||||
invalid.UnionRect(r,mOuter->mRect);
|
||||
} else {
|
||||
mOuter->MoveTo(aPresContext, r.x, mSplitterPos + aDiff);
|
||||
mOuter->SetPosition(nsPoint(r.x, mSplitterPos + aDiff));
|
||||
vm->MoveViewTo(v, vr.x, mSplitterViewPos + aDiff);
|
||||
invalid.UnionRect(r,mOuter->mRect);
|
||||
}
|
||||
|
@ -94,9 +94,7 @@ nsSprocketLayout::IsHorizontal(nsIBox* aBox)
|
||||
{
|
||||
nsIFrame* frame = nsnull;
|
||||
aBox->GetFrame(&frame);
|
||||
nsFrameState state;
|
||||
frame->GetFrameState(&state);
|
||||
return state & NS_STATE_IS_HORIZONTAL;
|
||||
return frame->GetStateBits() & NS_STATE_IS_HORIZONTAL;
|
||||
}
|
||||
|
||||
void
|
||||
@ -104,15 +102,7 @@ nsSprocketLayout::GetFrameState(nsIBox* aBox, nsFrameState& aState)
|
||||
{
|
||||
nsIFrame* frame = nsnull;
|
||||
aBox->GetFrame(&frame);
|
||||
frame->GetFrameState(&aState);
|
||||
}
|
||||
|
||||
void
|
||||
nsSprocketLayout::SetFrameState(nsIBox* aBox, nsFrameState aState)
|
||||
{
|
||||
nsIFrame* frame = nsnull;
|
||||
aBox->GetFrame(&frame);
|
||||
frame->SetFrameState(aState);
|
||||
aState = frame->GetStateBits();
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -172,7 +172,6 @@ protected:
|
||||
virtual PRBool GetDefaultFlex(PRInt32& aFlex);
|
||||
|
||||
virtual void GetFrameState(nsIBox* aBox, nsFrameState& aState);
|
||||
virtual void SetFrameState(nsIBox* aBox, nsFrameState aState);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -174,12 +174,11 @@ nsStackFrame::GetStackedFrameForPoint(nsIPresContext* aPresContext,
|
||||
{
|
||||
// look at all the children is reverse order. Use the stack to do
|
||||
// this.
|
||||
nsIFrame* next;
|
||||
nsresult rv;
|
||||
aChild->GetNextSibling(&next);
|
||||
if (next != nsnull) {
|
||||
nsIFrame* next = aChild->GetNextSibling();
|
||||
if (next) {
|
||||
rv = GetStackedFrameForPoint(aPresContext, next, aRect, aPoint, aFrame);
|
||||
if (NS_SUCCEEDED(rv) && *aFrame)
|
||||
if (NS_SUCCEEDED(rv) && *aFrame)
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -194,12 +194,9 @@ nsStackLayout::AddOffset(nsBoxLayoutState& aState, nsIBox* aChild, nsSize& aSize
|
||||
nsIFrame* frame;
|
||||
aChild->GetFrame(&frame);
|
||||
|
||||
nsFrameState state;
|
||||
frame->GetFrameState(&state);
|
||||
|
||||
// As an optimization, we cache the fact that we are not positioned to avoid
|
||||
// wasting time fetching attributes and checking style data.
|
||||
if (state & NS_STATE_STACK_NOT_POSITIONED)
|
||||
if (frame->GetStateBits() & NS_STATE_STACK_NOT_POSITIONED)
|
||||
return PR_FALSE;
|
||||
|
||||
PRBool offsetSpecified = PR_FALSE;
|
||||
@ -218,8 +215,7 @@ nsStackLayout::AddOffset(nsBoxLayoutState& aState, nsIBox* aChild, nsSize& aSize
|
||||
offsetSpecified = PR_TRUE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
frame->GetContent(getter_AddRefs(content));
|
||||
nsIContent* content = frame->GetContent();
|
||||
|
||||
if (content) {
|
||||
nsIPresContext* presContext = aState.GetPresContext();
|
||||
@ -248,8 +244,7 @@ nsStackLayout::AddOffset(nsBoxLayoutState& aState, nsIBox* aChild, nsSize& aSize
|
||||
if (!offsetSpecified) {
|
||||
// If no offset was specified at all, then we cache this fact to avoid requerying
|
||||
// CSS or the content model.
|
||||
state |= NS_STATE_STACK_NOT_POSITIONED;
|
||||
frame->SetFrameState(state);
|
||||
frame->AddStateBits(NS_STATE_STACK_NOT_POSITIONED);
|
||||
}
|
||||
|
||||
return offsetSpecified;
|
||||
|
@ -209,16 +209,13 @@ NS_IMETHODIMP
|
||||
nsTitleBarFrame::CaptureMouseEvents(nsIPresContext* aPresContext,PRBool aGrabMouseEvents)
|
||||
{
|
||||
// get its view
|
||||
nsIView* view = GetView(aPresContext);
|
||||
nsCOMPtr<nsIViewManager> viewMan;
|
||||
nsIView* view = GetView();
|
||||
PRBool result;
|
||||
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
|
||||
if (view) {
|
||||
view->GetViewManager(*getter_AddRefs(viewMan));
|
||||
nsIViewManager* viewMan = view->GetViewManager();
|
||||
if (viewMan) {
|
||||
view->GetWidget(*getter_AddRefs(widget));
|
||||
// nsIWidget* widget = view->GetWidget();
|
||||
if (aGrabMouseEvents) {
|
||||
viewMan->GrabMouseEvents(view,result);
|
||||
//mIsCapturingMouseEvents = PR_TRUE;
|
||||
|
@ -287,9 +287,7 @@ nsTreeColumn::nsTreeColumn(nsIContent* aColElement, nsIFrame* aFrame)
|
||||
inline nscoord nsTreeColumn::GetWidth()
|
||||
{
|
||||
if (mColFrame) {
|
||||
nsRect rect;
|
||||
mColFrame->GetRect(rect);
|
||||
return rect.width;
|
||||
return mColFrame->GetSize().width;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -376,7 +374,7 @@ static nsIFrame* InitScrollbarFrame(nsIPresContext* aPresContext, nsIFrame* aCur
|
||||
nsIFrame* result = InitScrollbarFrame(aPresContext, child, aSM);
|
||||
if (result)
|
||||
return result;
|
||||
child->GetNextSibling(&child);
|
||||
child = child->GetNextSibling();
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
@ -405,12 +403,12 @@ nsTreeBodyFrame::Init(nsIPresContext* aPresContext, nsIContent* aContent,
|
||||
mPresContext = aPresContext;
|
||||
nsresult rv = nsLeafBoxFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
|
||||
nsBoxFrame::CreateViewForFrame(aPresContext, this, aContext, PR_TRUE);
|
||||
nsIView* ourView = nsLeafBoxFrame::GetView(aPresContext);
|
||||
nsIView* ourView = nsLeafBoxFrame::GetView();
|
||||
|
||||
static NS_DEFINE_CID(kWidgetCID, NS_CHILD_CID);
|
||||
|
||||
ourView->CreateWidget(kWidgetCID);
|
||||
ourView->GetWidget(*getter_AddRefs(mTreeWidget));
|
||||
mTreeWidget = ourView->GetWidget();
|
||||
mIndentation = GetIndentation();
|
||||
mRowHeight = GetRowHeight();
|
||||
return rv;
|
||||
@ -1030,15 +1028,13 @@ nsTreeBodyFrame::UpdateScrollbar()
|
||||
// Update the scrollbar.
|
||||
if (!EnsureScrollbar())
|
||||
return;
|
||||
nsCOMPtr<nsIContent> scrollbarContent;
|
||||
mScrollbar->GetContent(getter_AddRefs(scrollbarContent));
|
||||
float t2p;
|
||||
mPresContext->GetTwipsToPixels(&t2p);
|
||||
nscoord rowHeightAsPixels = NSToCoordRound((float)mRowHeight*t2p);
|
||||
|
||||
nsAutoString curPos;
|
||||
curPos.AppendInt(mTopRowIndex*rowHeightAsPixels);
|
||||
scrollbarContent->SetAttr(kNameSpaceID_None, nsXULAtoms::curpos, curPos, PR_TRUE);
|
||||
mScrollbar->GetContent()->SetAttr(kNameSpaceID_None, nsXULAtoms::curpos, curPos, PR_TRUE);
|
||||
}
|
||||
|
||||
nsresult nsTreeBodyFrame::CheckVerticalOverflow()
|
||||
@ -1076,8 +1072,7 @@ NS_IMETHODIMP nsTreeBodyFrame::InvalidateScrollbar()
|
||||
if (!EnsureScrollbar() || !mView)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIContent> scrollbar;
|
||||
mScrollbar->GetContent(getter_AddRefs(scrollbar));
|
||||
nsIContent* scrollbar = mScrollbar->GetContent();
|
||||
|
||||
nsAutoString maxposStr;
|
||||
|
||||
@ -1128,9 +1123,7 @@ nsTreeBodyFrame::AdjustEventCoordsToBoxCoordSpace (PRInt32 aX, PRInt32 aY, PRInt
|
||||
// Take into account the parent's scroll offset, since clientX and clientY
|
||||
// are relative to the viewport.
|
||||
|
||||
nsIView* parentView = nsLeafBoxFrame::GetView(mPresContext);
|
||||
parentView->GetParent(parentView);
|
||||
parentView->GetParent(parentView);
|
||||
nsIView* parentView = nsLeafBoxFrame::GetView()->GetParent()->GetParent();
|
||||
|
||||
if (parentView) {
|
||||
nsIScrollableView* scrollView = nsnull;
|
||||
@ -3376,11 +3369,10 @@ nsTreeBodyFrame::PositionChanged(PRInt32 aOldIndex, PRInt32& aNewIndex)
|
||||
|
||||
// Go exactly where we're supposed to
|
||||
// Update the scrollbar.
|
||||
nsCOMPtr<nsIContent> scrollbarContent;
|
||||
mScrollbar->GetContent(getter_AddRefs(scrollbarContent));
|
||||
nsAutoString curPos;
|
||||
curPos.AppendInt(aNewIndex);
|
||||
scrollbarContent->SetAttr(kNameSpaceID_None, nsXULAtoms::curpos, curPos, PR_TRUE);
|
||||
mScrollbar->GetContent()->SetAttr(kNameSpaceID_None,
|
||||
nsXULAtoms::curpos, curPos, PR_TRUE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -3485,8 +3477,7 @@ nsTreeBodyFrame::EnsureColumns()
|
||||
while (colBox) {
|
||||
nsIFrame* frame = nsnull;
|
||||
colBox->GetFrame(&frame);
|
||||
nsCOMPtr<nsIContent> content;
|
||||
frame->GetContent(getter_AddRefs(content));
|
||||
nsIContent* content = frame->GetContent();
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
content->GetTag(getter_AddRefs(tag));
|
||||
if (tag == nsXULAtoms::treecol) {
|
||||
|
@ -155,11 +155,8 @@ nsTreeBoxObject::GetTreeBody()
|
||||
return nsnull;
|
||||
|
||||
// Iterate over our content model children looking for the body.
|
||||
nsCOMPtr<nsIContent> startContent;
|
||||
frame->GetContent(getter_AddRefs(startContent));
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
FindBodyElement(startContent, getter_AddRefs(content));
|
||||
FindBodyElement(frame->GetContent(), getter_AddRefs(content));
|
||||
|
||||
mPresShell->GetPrimaryFrameFor(content, &frame);
|
||||
if (!frame)
|
||||
|
@ -138,13 +138,12 @@ nsTreeColFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
||||
nsIFrame* child;
|
||||
if (left)
|
||||
child = frames.GetPrevSiblingFor(this);
|
||||
else GetNextSibling(&child);
|
||||
else
|
||||
child = GetNextSibling();
|
||||
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
nsCOMPtr<nsIContent> content;
|
||||
if (child) {
|
||||
child->GetContent(getter_AddRefs(content));
|
||||
content->GetTag(getter_AddRefs(tag));
|
||||
child->GetContent()->GetTag(getter_AddRefs(tag));
|
||||
if (tag.get() == nsXULAtoms::splitter) {
|
||||
*aFrame = child;
|
||||
return NS_OK;
|
||||
@ -153,9 +152,8 @@ nsTreeColFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
||||
}
|
||||
|
||||
nsresult result = nsBoxFrame::GetFrameForPoint(aPresContext, aPoint, aWhichLayer, aFrame);
|
||||
nsCOMPtr<nsIContent> content;
|
||||
if (result == NS_OK) {
|
||||
(*aFrame)->GetContent(getter_AddRefs(content));
|
||||
nsIContent* content = (*aFrame)->GetContent();
|
||||
if (content) {
|
||||
// This allows selective overriding for subcontent.
|
||||
nsAutoString value;
|
||||
|
Loading…
Reference in New Issue
Block a user