Ongoing deCOMtamination. r+sr=dbaron

This commit is contained in:
roc+%cs.cmu.edu 2003-07-04 12:50:32 +00:00
parent ed0078430d
commit 0b15c3893e
22 changed files with 348 additions and 818 deletions

View File

@ -76,26 +76,20 @@ nsButtonFrameRenderer::GetFrame()
void
nsButtonFrameRenderer::SetDisabled(PRBool aDisabled, PRBool notify)
{
// get the content
nsCOMPtr<nsIContent> content;
mFrame->GetContent(getter_AddRefs(content));
if (aDisabled)
content->SetAttr(kNameSpaceID_None, nsHTMLAtoms::disabled, nsString(),
notify);
mFrame->GetContent()->SetAttr(kNameSpaceID_None, nsHTMLAtoms::disabled, nsString(),
notify);
else
content->UnsetAttr(kNameSpaceID_None, nsHTMLAtoms::disabled, notify);
mFrame->GetContent()->UnsetAttr(kNameSpaceID_None, nsHTMLAtoms::disabled, notify);
}
PRBool
nsButtonFrameRenderer::isDisabled()
{
// get the content
nsCOMPtr<nsIContent> content;
mFrame->GetContent(getter_AddRefs(content));
nsAutoString value;
if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttr(kNameSpaceID_None, nsHTMLAtoms::disabled, value))
if (NS_CONTENT_ATTR_HAS_VALUE ==
mFrame->GetContent()->GetAttr(kNameSpaceID_None, nsHTMLAtoms::disabled, value))
return PR_TRUE;
return PR_FALSE;
@ -104,8 +98,7 @@ nsButtonFrameRenderer::isDisabled()
void
nsButtonFrameRenderer::Redraw(nsIPresContext* aPresContext)
{
nsRect rect;
mFrame->GetRect(rect);
nsRect rect = mFrame->GetRect();
rect.x = 0;
rect.y = 0;
mFrame->Invalidate(aPresContext, rect, PR_FALSE);
@ -314,23 +307,18 @@ nsButtonFrameRenderer::GetAddedButtonBorderAndPadding()
void
nsButtonFrameRenderer::ReResolveStyles(nsIPresContext* aPresContext)
{
// get all the styles
nsCOMPtr<nsIContent> content;
mFrame->GetContent(getter_AddRefs(content));
nsStyleContext* context = mFrame->GetStyleContext();
// style for the inner such as a dotted line (Windows)
mInnerFocusStyle = aPresContext->ProbePseudoStyleContextFor(content,
mInnerFocusStyle = aPresContext->ProbePseudoStyleContextFor(mFrame->GetContent(),
nsCSSPseudoElements::mozFocusInner,
context);
// style for outer focus like a ridged border (MAC).
mOuterFocusStyle = aPresContext->ProbePseudoStyleContextFor(content,
mOuterFocusStyle = aPresContext->ProbePseudoStyleContextFor(mFrame->GetContent(),
nsCSSPseudoElements::mozFocusOuter,
context);
}
nsStyleContext*

View File

@ -167,10 +167,7 @@ NS_NewComboboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRUin
return NS_ERROR_OUT_OF_MEMORY;
}
// set the state flags (if any are provided)
nsFrameState state;
it->GetFrameState( &state );
state |= aStateFlags;
it->SetFrameState( state );
it->AddStateBits(aStateFlags);
*aNewFrame = it;
return NS_OK;
}
@ -443,11 +440,9 @@ nsComboboxControlFrame::GetType() const
NS_IMETHODIMP
nsComboboxControlFrame::GetFormContent(nsIContent*& aContent) const
{
nsIContent* content;
nsresult rv;
rv = GetContent(&content);
aContent = content;
return rv;
aContent = GetContent();
NS_IF_ADDREF(aContent);
return NS_OK;
}
//--------------------------------------------------------------
@ -540,14 +535,9 @@ nsComboboxControlFrame::SetFocus(PRBool aOn, PRBool aRepaint)
// Make sure the content area gets updated for where the dropdown was
// This is only needed for embedding, the focus may go to
// the chrome that is not part of the Gecko system (Bug 83493)
nsCOMPtr<nsIPresShell> presShell;
mPresContext->GetShell(getter_AddRefs(presShell));
if (presShell) {
nsCOMPtr<nsIViewManager> vm;
presShell->GetViewManager(getter_AddRefs(vm));
if (vm) {
vm->UpdateAllViews(NS_VMREFRESH_NO_SYNC);
}
nsIViewManager* vm = GetPresContext()->GetViewManager();
if (vm) {
vm->UpdateAllViews(NS_VMREFRESH_NO_SYNC);
}
}
@ -568,13 +558,11 @@ nsComboboxControlFrame::ScrollIntoView(nsIPresContext* aPresContext)
void
nsComboboxControlFrame::ShowPopup(PRBool aShowPopup)
{
nsIView* view = mDropdownFrame->GetView(mPresContext);
nsCOMPtr<nsIViewManager> viewManager;
view->GetViewManager(*getter_AddRefs(viewManager));
nsIView* view = mDropdownFrame->GetView();
nsIViewManager* viewManager = view->GetViewManager();
if (aShowPopup) {
nsRect rect;
mDropdownFrame->GetRect(rect);
nsRect rect = mDropdownFrame->GetRect();
rect.x = rect.y = 0;
viewManager->ResizeView(view, rect);
nsIScrollableView* scrollingView;
@ -611,15 +599,15 @@ nsComboboxControlFrame::ShowPopup(PRBool aShowPopup)
void
nsComboboxControlFrame::ShowList(nsIPresContext* aPresContext, PRBool aShowList)
{
nsCOMPtr<nsIWidget> widget;
nsIWidget* widget = nsnull;
// Get parent view
nsIFrame * listFrame;
if (NS_OK == mListControlFrame->QueryInterface(NS_GET_IID(nsIFrame), (void **)&listFrame)) {
nsIView* view = listFrame->GetView(aPresContext);
NS_ASSERTION(view != nsnull, "nsComboboxControlFrame view is null");
nsIView* view = listFrame->GetView();
NS_ASSERTION(view, "nsComboboxControlFrame view is null");
if (view) {
view->GetWidget(*getter_AddRefs(widget));
widget = view->GetWidget();
}
}
@ -656,7 +644,6 @@ nsComboboxControlFrame::MouseClicked(nsIPresContext* aPresContext)
//ToggleList(aPresContext);
}
nsresult
nsComboboxControlFrame::ReflowComboChildFrame(nsIFrame* aFrame,
nsIPresContext* aPresContext,
@ -675,23 +662,21 @@ nsComboboxControlFrame::ReflowComboChildFrame(nsIFrame* aFrame,
// ensure we start off hidden
if (aReflowState.reason == eReflowReason_Initial) {
nsIView* view = mDropdownFrame->GetView(mPresContext);
nsCOMPtr<nsIViewManager> viewManager;
view->GetViewManager(*getter_AddRefs(viewManager));
nsIView* view = mDropdownFrame->GetView();
nsIViewManager* viewManager = view->GetViewManager();
viewManager->SetViewVisibility(view, nsViewVisibility_kHide);
nsRect emptyRect(0, 0, 0, 0);
viewManager->ResizeView(view, emptyRect);
}
// Reflow child
nsRect rect;
aFrame->GetRect(rect);
nsRect rect = aFrame->GetRect();
nsresult rv = ReflowChild(aFrame, aPresContext, aDesiredSize, kidReflowState,
rect.x, rect.y, NS_FRAME_NO_MOVE_VIEW |NS_FRAME_NO_SIZE_VIEW | NS_FRAME_NO_VISIBILITY, aStatus);
rect.x, rect.y, NS_FRAME_NO_MOVE_VIEW | NS_FRAME_NO_SIZE_VIEW | NS_FRAME_NO_VISIBILITY, aStatus);
// Set the child's width and height to it's desired size
FinishReflowChild(aFrame, aPresContext, &kidReflowState, aDesiredSize,
rect.x, rect.y, NS_FRAME_NO_MOVE_VIEW |NS_FRAME_NO_SIZE_VIEW | NS_FRAME_NO_VISIBILITY);
rect.x, rect.y, NS_FRAME_NO_MOVE_VIEW | NS_FRAME_NO_SIZE_VIEW | NS_FRAME_NO_VISIBILITY);
return rv;
}
@ -744,8 +729,7 @@ nsComboboxControlFrame::PositionDropdown(nsIPresContext* aPresContext,
nsresult rv = NS_OK;
nscoord dropdownYOffset = aHeight;
// XXX: Enable this code to debug popping up above the display frame, rather than below it
nsRect dropdownRect;
mDropdownFrame->GetRect(dropdownRect);
nsRect dropdownRect = mDropdownFrame->GetRect();
nscoord screenHeightInPixels = 0;
if (NS_SUCCEEDED(nsFormControlFrame::GetScreenHeight(aPresContext, screenHeightInPixels))) {
@ -763,10 +747,8 @@ nsComboboxControlFrame::PositionDropdown(nsIPresContext* aPresContext,
dropdownRect.x = 0;
dropdownRect.y = dropdownYOffset;
nsRect currentRect;
mDropdownFrame->GetRect(currentRect);
mDropdownFrame->SetRect(aPresContext, dropdownRect);
mDropdownFrame->SetRect(dropdownRect);
return rv;
}
@ -961,8 +943,8 @@ nsComboboxControlFrame::ReflowCombobox(nsIPresContext * aPresContext,
nsRect buttonRect(0,0,0,0);
nsRect displayRect(0,0,0,0);
aBtnWidth = 0;
aDisplayFrame->SetRect(aPresContext, displayRect);
aDropDownBtn->SetRect(aPresContext, buttonRect);
aDisplayFrame->SetRect(displayRect);
aDropDownBtn->SetRect(buttonRect);
SetChildFrameSize(aDropDownBtn, aBtnWidth, aDesiredSize.height);
aDesiredSize.width = 0;
aDesiredSize.height = dispHeight;
@ -1044,8 +1026,8 @@ nsComboboxControlFrame::ReflowCombobox(nsIPresContext * aPresContext,
nsHTMLReflowState txtKidReflowState(aPresContext, aReflowState, aDisplayFrame, txtAvailSize, reason);
aDisplayFrame->WillReflow(aPresContext);
//aDisplayFrame->MoveTo(aPresContext, dspBorderPadding.left + aBorderPadding.left, dspBorderPadding.top + aBorderPadding.top);
aDisplayFrame->MoveTo(aPresContext, aBorderPadding.left, aBorderPadding.top);
//aDisplayFrame->SetPosition(nsPoint(dspBorderPadding.left + aBorderPadding.left, dspBorderPadding.top + aBorderPadding.top));
aDisplayFrame->SetPosition(nsPoint(aBorderPadding.left, aBorderPadding.top));
nsAreaFrame::PositionFrameView(aPresContext, aDisplayFrame);
nsReflowStatus status;
nsresult rv = aDisplayFrame->Reflow(aPresContext, txtKidSize, txtKidReflowState, status);
@ -1069,13 +1051,6 @@ nsComboboxControlFrame::ReflowCombobox(nsIPresContext * aPresContext,
// doesn't position things exactly where we want them
nscoord insideHeight = aDesiredSize.height - aBorderPadding.top - aBorderPadding.bottom;
// the gets for the Display "block" frame and for the button
// make adjustments
nsRect buttonRect;
nsRect displayRect;
aDisplayFrame->GetRect(displayRect);
aDropDownBtn->GetRect(buttonRect);
// If the css width has been set to something very small
//i.e. smaller than the dropdown button, set the button's width to zero
if (aBtnWidth > dispWidth) {
@ -1083,19 +1058,13 @@ nsComboboxControlFrame::ReflowCombobox(nsIPresContext * aPresContext,
}
// set the display rect to be left justifed and
// fills the entire area except the button
nscoord x = aBorderPadding.left;
displayRect.x = x;
displayRect.y = aBorderPadding.top;
displayRect.height = insideHeight;
displayRect.width = PR_MAX(dispWidth - aBtnWidth, 0); // make sure the width is never negative
aDisplayFrame->SetRect(aPresContext, displayRect);
x += displayRect.width;
nscoord x = aBorderPadding.left;
nsRect displayRect(x, aBorderPadding.top, PR_MAX(dispWidth - aBtnWidth, 0), insideHeight);
aDisplayFrame->SetRect(displayRect);
x += displayRect.width;
// right justify the button
buttonRect.x = x;
buttonRect.y = aBorderPadding.top;
buttonRect.height = insideHeight;
buttonRect.width = aBtnWidth;
nsRect buttonRect(x, aBorderPadding.top, aBtnWidth, insideHeight);
#ifdef IBMBIDI
if (vis->mDirection == NS_STYLE_DIRECTION_RTL)
{
@ -1103,11 +1072,11 @@ nsComboboxControlFrame::ReflowCombobox(nsIPresContext * aPresContext,
{
buttonRect.x = displayRect.x;
displayRect.x += buttonRect.width;
aDisplayFrame->SetRect(aPresContext, displayRect);
aDisplayFrame->SetRect(displayRect);
}
}
#endif // IBMBIDI
aDropDownBtn->SetRect(aPresContext, buttonRect);
aDropDownBtn->SetRect(buttonRect);
// since we have changed the height of the button
// make sure it has these new values
@ -1283,16 +1252,6 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext,
return nsAreaFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
}
// size of each part of the combo box
nsRect displayRect;
nsRect buttonRect;
nsRect dropdownRect;
// Get the current sizes of the combo box child frames
mDisplayFrame->GetRect(displayRect);
mButtonFrame->GetRect(buttonRect);
mDropdownFrame->GetRect(dropdownRect);
// We should cache this instead getting it everytime
// the default size of the of scrollbar
// that will be the default width of the dropdown button
@ -1416,8 +1375,6 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext,
plainLstFrame->FirstChild(aPresContext, nsnull, &frame);
nsIScrollableFrame * scrollFrame;
if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsIScrollableFrame), (void**)&scrollFrame))) {
nsRect rect;
plainLstFrame->GetRect(rect);
plainLstFrame->Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
aDesiredSize.width = mCacheSize.width;
@ -1456,14 +1413,6 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext,
}
#endif // IBMBIDI
// This ifdef is for the new approach to reflow
// where we don't reflow the dropdown
// we just figure out or width from the list of items
//
// This next section is the Current implementation
// the else contains the new reflow code
#ifndef DO_NEW_REFLOW_X
// Here is another special optimization
// Only reflow the dropdown if it has never been reflowed unconstrained
//
@ -1554,7 +1503,7 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext,
// dropdownRect will hold the content size (minus border padding)
// for the display area
mDropdownFrame->GetRect(dropdownRect);
nsRect dropdownRect = mDropdownFrame->GetRect();
if (eReflowReason_Resize == aReflowState.reason) {
dropdownRect.Deflate(aReflowState.mComputedBorderPadding);
}
@ -1642,7 +1591,7 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext,
// Optimization - The style (font, etc.) maybe different for the display item
// than for any particular item in the dropdown. So, if the new size of combobox
// is smaller than the dropdown, that is OK, The dropdown MUST always be either the same
//size as the combo or larger if necessary
// size as the combo or larger if necessary
if (aDesiredSize.width > dropdownDesiredSize.width) {
if (eReflowReason_Initial == firstPassState.reason) {
firstPassState.reason = eReflowReason_Resize;
@ -1659,43 +1608,6 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext,
lcf->SetPassId(0);
}
#else // DO_NEW_REFLOW
if (
#ifdef IBMBIDI
eReflowReason_StyleChange == aReflowState.reason ||
#endif // IBMBIDI
mCacheSize.width == kSizeNotSet) {
ReflowItems(aPresContext, aReflowState, aDesiredSize);
} else {
aDesiredSize.width = mCacheSize.width;
aDesiredSize.height = mCacheSize.height;
}
// get the borderPadding for the display area
nsMargin dspBorderPadding(0, 0, 0, 0);
mDisplayFrame->CalcBorderPadding(dspBorderPadding);
if (NS_UNCONSTRAINEDSIZE == firstPassState.mComputedWidth) {
mItemDisplayWidth = aDesiredSize.width - (dspBorderPadding.left + dspBorderPadding.right);
mItemDisplayWidth -= borderPadding.left + borderPadding.right;
} else {
if (firstPassState.mComputedWidth > 0) {
// Compute the display item's width from reflow's mComputedWidth
// mComputedWidth has already excluded border and padding
// so subtract off the button's size
mItemDisplayWidth = firstPassState.mComputedWidth - dspBorderPadding.left - dspBorderPadding.right;
}
}
// this reflows and makes and last minute adjustments
ReflowCombobox(aPresContext, firstPassState, aDesiredSize, aStatus,
mDisplayFrame, mButtonFrame, mItemDisplayWidth, scrollbarWidth,
borderPadding,
aDesiredSize.height- borderPadding.top - borderPadding.bottom -
dspBorderPadding.top - dspBorderPadding.bottom);
#endif // DO_NEW_REFLOW
// Set the max element size to be the same as the desired element size.
if (aDesiredSize.mComputeMEW) {
aDesiredSize.mMaxElementWidth = aDesiredSize.width;
@ -1807,7 +1719,7 @@ nsComboboxControlFrame::ShowDropDown(PRBool aDoDropDown)
if (!mDroppedDown && aDoDropDown) {
// XXX Temporary for Bug 19416
nsIView* lstView = mDropdownFrame->GetView(mPresContext);
nsIView* lstView = mDropdownFrame->GetView();
if (lstView) {
lstView->IgnoreSetPosition(PR_FALSE);
}
@ -1868,10 +1780,8 @@ nsComboboxControlFrame::AbsolutelyPositionDropDown()
nsRect absoluteTwips;
nsRect absolutePixels;
nsRect rect;
this->GetRect(rect);
if (NS_SUCCEEDED(nsFormControlFrame::GetAbsoluteFramePosition(mPresContext, this, absoluteTwips, absolutePixels))) {
PositionDropdown(mPresContext, rect.height, absoluteTwips, absolutePixels);
PositionDropdown(mPresContext, GetRect().height, absoluteTwips, absolutePixels);
}
return NS_OK;
}
@ -1880,11 +1790,7 @@ NS_IMETHODIMP
nsComboboxControlFrame::GetAbsoluteRect(nsRect* aRect)
{
nsRect absoluteTwips;
nsRect rect;
this->GetRect(rect);
nsresult rv = nsFormControlFrame::GetAbsoluteFramePosition(mPresContext, this, absoluteTwips, *aRect);
return rv;
return nsFormControlFrame::GetAbsoluteFramePosition(mPresContext, this, absoluteTwips, *aRect);
}
///////////////////////////////////////////////////////////////
@ -1934,13 +1840,8 @@ nsComboboxControlFrame::RedisplayText(PRInt32 aIndex)
}
if (shouldSetValue) {
rv = ActuallyDisplayText(textToDisplay, PR_TRUE);
nsFrameState state;
//mTextFrame->GetFrameState(&state);
//state |= NS_FRAME_IS_DIRTY;
//mTextFrame->SetFrameState(state);
mDisplayFrame->GetFrameState(&state);
state |= NS_FRAME_IS_DIRTY;
mDisplayFrame->SetFrameState(state);
//mTextFrame->AddStateBits(NS_FRAME_IS_DIRTY);
mDisplayFrame->AddStateBits(NS_FRAME_IS_DIRTY);
nsCOMPtr<nsIPresShell> shell;
rv = mPresContext->GetShell(getter_AddRefs(shell));
ReflowDirtyChild(shell, (nsIFrame*) mDisplayFrame);
@ -2351,14 +2252,13 @@ nsComboboxControlFrame::Destroy(nsIPresContext* aPresContext)
nsFormControlFrame::RegUnRegAccessKey(mPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_FALSE);
if (mDroppedDown) {
nsCOMPtr<nsIWidget> widget;
// Get parent view
nsIFrame * listFrame;
if (NS_OK == mListControlFrame->QueryInterface(NS_GET_IID(nsIFrame), (void **)&listFrame)) {
nsIView* view = listFrame->GetView(aPresContext);
NS_ASSERTION(view != nsnull, "nsComboboxControlFrame view is null");
nsIView* view = listFrame->GetView();
NS_ASSERTION(view, "nsComboboxControlFrame view is null");
if (view) {
view->GetWidget(*getter_AddRefs(widget));
nsIWidget* widget = view->GetWidget();
if (widget)
widget->CaptureRollupEvents((nsIRollupListener *)this, PR_FALSE, PR_TRUE);
}
@ -2405,8 +2305,8 @@ nsComboboxControlFrame::SetInitialChildList(nsIPresContext* aPresContext,
rv = nsAreaFrame::SetInitialChildList(aPresContext, aListName, aChildList);
InitTextStr();
nsIFrame * child = aChildList;
while (child) {
for (nsIFrame * child = aChildList; child;
child = child->GetNextSibling()) {
nsIFormControlFrame* fcFrame = nsnull;
CallQueryInterface(child, &fcFrame);
if (fcFrame) {
@ -2416,7 +2316,6 @@ nsComboboxControlFrame::SetInitialChildList(nsIPresContext* aPresContext,
} else {
mDisplayFrame = child;
}
child->GetNextSibling(&child);
}
}
return rv;
@ -2524,8 +2423,7 @@ nsComboboxControlFrame::Paint(nsIPresContext* aPresContext,
if (mDisplayFrame) {
aRenderingContext.PushState();
PRBool clipEmpty;
nsRect clipRect;
mDisplayFrame->GetRect(clipRect);
nsRect clipRect = mDisplayFrame->GetRect();
aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect, clipEmpty);
PaintChild(aPresContext, aRenderingContext, aDirtyRect,
mDisplayFrame, NS_FRAME_PAINT_LAYER_BACKGROUND);

View File

@ -142,10 +142,7 @@ NS_NewFieldSetFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRUint32 aSt
}
// set the state flags (if any are provided)
nsFrameState state;
it->GetFrameState( &state );
state |= aStateFlags;
it->SetFrameState( state );
it->AddStateBits(aStateFlags);
*aNewFrame = it;
return NS_OK;
@ -177,7 +174,7 @@ nsFieldSetFrame::SetInitialChildList(nsIPresContext* aPresContext,
// get the content and legend frames.
mContentFrame = aChildList;
mContentFrame->GetNextSibling(&mLegendFrame);
mLegendFrame = mContentFrame->GetNextSibling();
// Queue up the frames for the content frame
return nsHTMLContainerFrame::SetInitialChildList(aPresContext, nsnull, aChildList);
@ -371,17 +368,17 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext,
// if dirty then check dirty flags
if (reason == eReflowReason_Dirty)
{
if (reflowContent) {
nsFrameState state;
mContentFrame->GetFrameState(&state);
reflowContent = (state & NS_FRAME_IS_DIRTY) || (state & NS_FRAME_HAS_DIRTY_CHILDREN);
}
if (reflowContent) {
reflowContent =
(mContentFrame->GetStateBits()
& (NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN)) != 0;
}
if (reflowLegend) {
nsFrameState state;
mLegendFrame->GetFrameState(&state);
reflowLegend = (state & NS_FRAME_IS_DIRTY) || (state & NS_FRAME_HAS_DIRTY_CHILDREN);
}
if (reflowLegend) {
reflowLegend =
(mLegendFrame->GetStateBits()
& (NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN)) != 0;
}
}
// availSize could have unconstrained values, don't perform any addition on them
@ -515,13 +512,10 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext,
aDesiredSize.mMaxElementWidth = kidDesiredSize.mMaxElementWidth;
}
nsFrameState kidState;
mContentFrame->GetFrameState(&kidState);
// printf("width: %d, height: %d\n", desiredSize.mCombinedArea.width, desiredSize.mCombinedArea.height);
/*
if (kidState & NS_FRAME_OUTSIDE_CHILDREN) {
if (mContentFrame->GetStateBits() & NS_FRAME_OUTSIDE_CHILDREN) {
mState |= NS_FRAME_OUTSIDE_CHILDREN;
aDesiredSize.mOverflowArea.width += borderPadding.left + borderPadding.right;
aDesiredSize.mOverflowArea.height += borderPadding.top + borderPadding.bottom + mLegendSpace;
@ -532,7 +526,7 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext,
} else {
// if we don't need to reflow just get the old size
mContentFrame->GetRect(contentRect);
contentRect = mContentFrame->GetRect();
const nsStyleMargin* marginStyle = mContentFrame->GetStyleMargin();
nsMargin m(0,0,0,0);
@ -570,12 +564,11 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext,
nsRect actualLegendRect(mLegendRect);
actualLegendRect.Deflate(legendMargin);
nsPoint curOrigin;
mLegendFrame->GetOrigin(curOrigin);
nsPoint curOrigin = mLegendFrame->GetPosition();
// only if the origin changed
if ((curOrigin.x != mLegendRect.x) || (curOrigin.y != mLegendRect.y)) {
mLegendFrame->MoveTo(aPresContext, actualLegendRect.x , actualLegendRect.y);
mLegendFrame->SetPosition(nsPoint(actualLegendRect.x , actualLegendRect.y));
nsContainerFrame::PositionFrameView(aPresContext, mLegendFrame);
// We need to recursively process the legend frame's
@ -661,16 +654,10 @@ nsFieldSetFrame::RemoveFrame(nsIPresContext* aPresContext,
// XXX XXX
// XXX temporary fix for bug 70648
if (aOldFrame == mLegendFrame) {
nsIFrame* sibling;
mContentFrame->GetNextSibling(&sibling);
nsIFrame* sibling = mContentFrame->GetNextSibling();
NS_ASSERTION(sibling == mLegendFrame, "legendFrame is not next sibling");
#ifdef DEBUG
nsIFrame* legendParent;
mLegendFrame->GetParent(&legendParent);
NS_ASSERTION(legendParent == this, "Legend Parent has wrong parent");
#endif
nsIFrame* legendSibling;
sibling->GetNextSibling(&legendSibling);
NS_ASSERTION(mLegendFrame->GetParent() == this, "Legend Parent has wrong parent");
nsIFrame* legendSibling = sibling->GetNextSibling();
// replace the legend, which is the next sibling, with any siblings of the legend (XXX always null?)
mContentFrame->SetNextSibling(legendSibling);
// OK, the legend is now removed from the sibling list, but who has ownership of it?

View File

@ -224,8 +224,7 @@ nsFileControlFrame::SetFocus(PRBool aOn, PRBool aRepaint)
{
// Fix for Bug 6133
if (mTextFrame) {
nsCOMPtr<nsIContent> content;
mTextFrame->GetContent(getter_AddRefs(content));
nsIContent* content = mTextFrame->GetContent();
if (content) {
content->SetFocus(mPresContext);
}
@ -266,10 +265,9 @@ nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent)
nsresult result;
// Get parent nsIDOMWindowInternal object.
nsCOMPtr<nsIContent> content;
result = GetContent(getter_AddRefs(content));
nsIContent* content = GetContent();
if (!content)
return NS_FAILED(result) ? result : NS_ERROR_FAILURE;
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDocument> doc;
result = content->GetDocument(getter_AddRefs(doc));
@ -378,14 +376,12 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext* aPresContext,
nsIFrame * child;
FirstChild(aPresContext, nsnull, &child);
while (child == mTextFrame) {
child->GetNextSibling(&child);
if (child == mTextFrame) {
child = child->GetNextSibling();
}
if (child != nsnull) {
nsRect buttonRect;
nsRect txtRect;
mTextFrame->GetRect(txtRect);
child->GetRect(buttonRect);
if (child) {
nsRect buttonRect = child->GetRect();
nsRect txtRect = mTextFrame->GetRect();
// check to see if we must reflow just the area frame again
// in order for the text field to be the correct height
@ -410,7 +406,7 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext* aPresContext,
// now adjust the frame positions
txtRect.y = aReflowState.mComputedBorderPadding.top;
txtRect.height = aDesiredSize.height;
mTextFrame->SetRect(aPresContext, txtRect);
mTextFrame->SetRect(txtRect);
}
}
@ -420,11 +416,11 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext* aPresContext,
// and we must make sure the text field is the correct height
if (NS_STYLE_DIRECTION_RTL == vis->mDirection) {
buttonRect.x = aReflowState.mComputedBorderPadding.left;
child->SetRect(aPresContext, buttonRect);
child->SetRect(buttonRect);
txtRect.x = aDesiredSize.width - txtRect.width + aReflowState.mComputedBorderPadding.left;
txtRect.y = aReflowState.mComputedBorderPadding.top;
txtRect.height = aDesiredSize.height;
mTextFrame->SetRect(aPresContext, txtRect);
mTextFrame->SetRect(txtRect);
}
}
@ -458,11 +454,10 @@ nsFileControlFrame::GetTextControlFrame(nsIPresContext* aPresContext, nsIFrame*
while (childFrame) {
// see if the child is a text control
nsCOMPtr<nsIContent> content;
nsresult res = childFrame->GetContent(getter_AddRefs(content));
if (NS_SUCCEEDED(res) && content) {
nsIContent* content = childFrame->GetContent();
if (content) {
nsCOMPtr<nsIAtom> atom;
res = content->GetTag(getter_AddRefs(atom));
nsresult res = content->GetTag(getter_AddRefs(atom));
if (NS_SUCCEEDED(res) && atom) {
if (atom.get() == nsHTMLAtoms::input) {
@ -482,8 +477,7 @@ nsFileControlFrame::GetTextControlFrame(nsIPresContext* aPresContext, nsIFrame*
if (frame)
result = frame;
res = childFrame->GetNextSibling(&childFrame);
NS_ASSERTION(res == NS_OK,"failed to get next child");
childFrame = childFrame->GetNextSibling();
}
return result;
@ -579,12 +573,9 @@ nsFileControlFrame::GetFrameName(nsAString& aResult) const
NS_IMETHODIMP
nsFileControlFrame::GetFormContent(nsIContent*& aContent) const
{
nsIContent* content;
nsresult rv;
rv = GetContent(&content);
aContent = content;
return rv;
aContent = GetContent();
NS_IF_ADDREF(aContent);
return NS_OK;
}
NS_IMETHODIMP

View File

@ -496,17 +496,14 @@ nsFormControlFrame::DidReflow(nsIPresContext* aPresContext,
// The view is created hidden; once we have reflowed it and it has been
// positioned then we show it.
if (NS_FRAME_REFLOW_FINISHED == aStatus) {
nsIView* view = GetView(aPresContext);
nsIView* view = GetView();
if (view) {
nsViewVisibility newVis = GetStyleVisibility()->IsVisible()
? nsViewVisibility_kShow
: nsViewVisibility_kHide;
nsViewVisibility oldVis;
// only change if different.
view->GetVisibility(oldVis);
if (newVis != oldVis) {
nsCOMPtr<nsIViewManager> vm;
view->GetViewManager(*getter_AddRefs(vm));
if (newVis != view->GetVisibility()) {
nsIViewManager* vm = view->GetViewManager();
if (vm) {
vm->SetViewVisibility(view, newVis);
}
@ -573,9 +570,8 @@ nsFormControlFrame::RegUnRegAccessKey(nsIPresContext* aPresContext, nsIFrame * a
nsresult rv = NS_ERROR_FAILURE;
nsAutoString accessKey;
if (aFrame != nsnull) {
nsCOMPtr<nsIContent> content;
if (NS_SUCCEEDED(aFrame->GetContent(getter_AddRefs(content)))) {
if (aFrame) {
nsIContent* content = aFrame->GetContent();
#if 1
nsAutoString resultValue;
rv = content->GetAttr(kNameSpaceID_None,
@ -606,18 +602,15 @@ nsFormControlFrame::RegUnRegAccessKey(nsIPresContext* aPresContext, nsIFrame * a
}
}
#endif
}
}
if (NS_CONTENT_ATTR_NOT_THERE != rv) {
nsCOMPtr<nsIEventStateManager> stateManager;
if (NS_SUCCEEDED(aPresContext->GetEventStateManager(getter_AddRefs(stateManager)))) {
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
if (aDoReg) {
return stateManager->RegisterAccessKey(content, (PRUint32)accessKey.First());
return stateManager->RegisterAccessKey(aFrame->GetContent(), (PRUint32)accessKey.First());
} else {
return stateManager->UnregisterAccessKey(content, (PRUint32)accessKey.First());
return stateManager->UnregisterAccessKey(aFrame->GetContent(), (PRUint32)accessKey.First());
}
}
}
@ -784,12 +777,9 @@ nsFormControlFrame::GetStyleSize(nsIPresContext* aPresContext,
NS_IMETHODIMP
nsFormControlFrame::GetFormContent(nsIContent*& aContent) const
{
nsIContent* content;
nsresult rv;
rv = GetContent(&content);
aContent = content;
return rv;
aContent = GetContent();
NS_IF_ADDREF(aContent);
return NS_OK;
}
NS_IMETHODIMP
@ -909,7 +899,7 @@ nsFormControlFrame::GetAbsoluteFramePosition(nsIPresContext* aPresContext,
{
nsresult rv = NS_OK;
aFrame->GetRect(aAbsoluteTwipsRect);
aAbsoluteTwipsRect = aFrame->GetRect();
// zero these out,
// because the GetOffsetFromView figures them out
// XXXbz why do we need to do this, really? Will we ever fail to
@ -931,21 +921,18 @@ nsFormControlFrame::GetAbsoluteFramePosition(nsIPresContext* aPresContext,
if (NS_SUCCEEDED(rv) && view) {
aAbsoluteTwipsRect.MoveTo(frameOffset);
nsCOMPtr<nsIWidget> widget;
nsIWidget* widget;
// Walk up the views, looking for a widget
do {
// add in the offset of the view from its parent.
nsPoint viewPosition;
view->GetPosition(&viewPosition.x, &viewPosition.y);
aAbsoluteTwipsRect += viewPosition;
aAbsoluteTwipsRect += view->GetPosition();
view->GetWidget(*getter_AddRefs(widget));
widget = view->GetWidget();
if (widget) {
// account for space above and to the left of the view origin.
// the widget is aligned with view's bounds, not its origin
nsRect bounds;
view->GetBounds(bounds);
nsRect bounds = view->GetBounds();
aAbsoluteTwipsRect.x -= bounds.x;
aAbsoluteTwipsRect.y -= bounds.y;
@ -960,7 +947,7 @@ nsFormControlFrame::GetAbsoluteFramePosition(nsIPresContext* aPresContext,
break;
}
view->GetParent(view);
view = view->GetParent();
} while (view);
}

View File

@ -97,26 +97,21 @@ nsFormControlHelper::~nsFormControlHelper()
void nsFormControlHelper::ForceDrawFrame(nsIPresContext* aPresContext, nsIFrame * aFrame)
{
if (aFrame == nsnull) {
if (!aFrame) {
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 != nsnull) {
nsIViewManager * viewMgr;
view->GetViewManager(viewMgr);
if (viewMgr != nsnull) {
if (view) {
nsIViewManager* viewMgr = view->GetViewManager();
if (viewMgr) {
viewMgr->UpdateView(view, rect, NS_VMREFRESH_NO_SYNC);
NS_RELEASE(viewMgr);
}
}
}
void nsFormControlHelper::PlatformToDOMLineBreaks(nsString &aString)
@ -499,10 +494,7 @@ nsFormControlHelper::GetLocalizedString(const char * aPropFileName, const PRUnic
nsresult
nsFormControlHelper::Reset(nsIFrame* aFrame, nsIPresContext* aPresContext)
{
nsCOMPtr<nsIContent> controlContent;
aFrame->GetContent(getter_AddRefs(controlContent));
nsCOMPtr<nsIFormControl> control = do_QueryInterface(controlContent);
nsCOMPtr<nsIFormControl> control = do_QueryInterface(aFrame->GetContent());
if (control) {
control->Reset();
return NS_OK;

View File

@ -186,8 +186,7 @@ NS_IMETHODIMP nsHTMLButtonControlFrame::GetAccessible(nsIAccessible** aAccessibl
nsCOMPtr<nsIAccessibilityService> accService = do_GetService("@mozilla.org/accessibilityService;1");
if (accService) {
nsCOMPtr<nsIContent> content;
GetContent(getter_AddRefs(content));
nsIContent* content = GetContent();
nsCOMPtr<nsIDOMHTMLButtonElement> buttonElement(do_QueryInterface(content));
if (buttonElement) //If turned XBL-base form control off, the frame contains HTML 4 button
return accService->CreateHTML4ButtonAccessible(NS_STATIC_CAST(nsIFrame*, this), aAccessible);
@ -272,11 +271,9 @@ nsHTMLButtonControlFrame::GetTranslatedRect(nsIPresContext* aPresContext, nsRect
nsIView* view;
nsPoint viewOffset(0,0);
GetOffsetFromView(aPresContext, viewOffset, &view);
while (nsnull != view) {
nsPoint tempOffset;
view->GetPosition(&tempOffset.x, &tempOffset.y);
viewOffset += tempOffset;
view->GetParent(view);
while (view) {
viewOffset += view->GetPosition();
view = view->GetParent();
}
aRect = nsRect(viewOffset.x, viewOffset.y, mRect.width, mRect.height);
}
@ -336,7 +333,7 @@ nsHTMLButtonControlFrame::SetInitialChildList(nsIPresContext* aPresContext,
newParentContext = mFrames.FirstChild()->GetStyleContext();
// Set the parent for each of the child frames
for (nsIFrame* frame = aChildList; nsnull != frame; frame->GetNextSibling(&frame)) {
for (nsIFrame* frame = aChildList; frame; frame = frame->GetNextSibling()) {
frame->SetParent(mFrames.FirstChild());
// now reparent the contexts for the reparented frame too
if (frameManager) {
@ -440,19 +437,12 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext* aPresContext,
#if 0
if (!mDidInit) {
// create our view, we need a view to grab the mouse
nsIView* view;
GetView(&view);
nsIView* view = GetView();
if (!view) {
nsresult result = nsComponentManager::CreateInstance(kViewCID, nsnull, NS_GET_IID(nsIView), (void **)&view);
nsCOMPtr<nsIPresShell> presShell;
aPresContext->GetShell(getter_AddRefs(presShell));
nsCOMPtr<nsIViewManager> viewMan;
presShell->GetViewManager(getter_AddRefs(viewMan));
nsIFrame* parWithView;
nsIView *parView;
GetParentWithView(&parWithView);
parWithView->GetView(&parView);
nsIViewManager* viewMan = aPresContext->GetViewManager();
nsIFrame* parWithView = GetAncestorWithView();
nsIView* parView = parWithView->GetView();
// the view's size is not know yet, but its size will be kept in synch with our frame.
nsRect boundBox(0, 0, 500, 500);
result = view->Init(viewMan, boundBox, parView, nsnull);
@ -652,12 +642,9 @@ nsHTMLButtonControlFrame::GetFont(nsIPresContext* aPresContext,
NS_IMETHODIMP
nsHTMLButtonControlFrame::GetFormContent(nsIContent*& aContent) const
{
nsIContent* content;
nsresult rv;
rv = GetContent(&content);
aContent = content;
return rv;
aContent = GetContent();
NS_IF_ADDREF(aContent);
return NS_OK;
}
nscoord

View File

@ -271,14 +271,10 @@ nsImageControlFrame::Init(nsIPresContext* aPresContext,
if (!HasView()) {
nsIView* view;
nsresult result = CallCreateInstance(kViewCID, &view);
nsCOMPtr<nsIPresShell> presShell;
aPresContext->GetShell(getter_AddRefs(presShell));
nsCOMPtr<nsIViewManager> viewMan;
presShell->GetViewManager(getter_AddRefs(viewMan));
nsIViewManager* viewMan = aPresContext->GetViewManager();
nsIFrame* parWithView;
GetParentWithView(aPresContext, &parWithView);
nsIView *parView = parWithView->GetView(aPresContext);
nsIFrame* parWithView = GetAncestorWithView();
nsIView *parView = parWithView->GetView();
// the view's size is not know yet, but its size will be kept in synch with our frame.
nsRect boundBox(0, 0, 0, 0);
result = view->Init(viewMan, boundBox, parView);
@ -290,7 +286,7 @@ nsImageControlFrame::Init(nsIPresContext* aPresContext,
// XXX put the view last in document order until we know how to do better
viewMan->InsertChild(parView, view, nsnull, PR_TRUE);
SetView(aPresContext, view);
SetView(view);
}
return rv;
@ -380,11 +376,9 @@ nsImageControlFrame::GetTranslatedRect(nsIPresContext* aPresContext, nsRect& aRe
nsIView* view;
nsPoint viewOffset(0,0);
GetOffsetFromView(aPresContext, viewOffset, &view);
while (nsnull != view) {
nsPoint tempOffset;
view->GetPosition(&tempOffset.x, &tempOffset.y);
viewOffset += tempOffset;
view->GetParent(view);
while (view) {
viewOffset += view->GetPosition();
view = view->GetParent();
}
aRect = nsRect(viewOffset.x, viewOffset.y, mRect.width, mRect.height);
}
@ -432,12 +426,9 @@ nsImageControlFrame::GetFont(nsIPresContext* aPresContext,
NS_IMETHODIMP
nsImageControlFrame::GetFormContent(nsIContent*& aContent) const
{
nsIContent* content;
nsresult rv;
rv = GetContent(&content);
aContent = content;
return rv;
aContent = GetContent();
NS_IF_ADDREF(aContent);
return NS_OK;
}
nscoord

View File

@ -127,10 +127,7 @@ NS_NewListControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
}
#if 0
// set the state flags (if any are provided)
nsFrameState state;
it->GetFrameState( &state );
state |= NS_BLOCK_SPACE_MGR;
it->SetFrameState( state );
it->AddStateBits(NS_BLOCK_SPACE_MGR);
#endif
*aNewFrame = it;
return NS_OK;
@ -636,17 +633,13 @@ void nsListControlFrame::PaintFocus(nsIRenderingContext& aRC, nsFramePaintLayer
if (NS_FAILED(result) || !childframe) return;
// get the child rect
nsRect fRect;
childframe->GetRect(fRect);
nsRect fRect = childframe->GetRect();
// get it into the coordinates of containerFrame
nsIFrame* ancestor;
childframe->GetParent(&ancestor);
while (ancestor && ancestor != containerFrame) {
nsPoint pt;
ancestor->GetOrigin(pt);
fRect += pt;
ancestor->GetParent(&ancestor);
for (nsIFrame* ancestor = childframe->GetParent();
ancestor && ancestor != containerFrame;
ancestor = ancestor->GetParent()) {
fRect += ancestor->GetPosition();
}
PRBool lastItemIsSelected = PR_FALSE;
@ -751,8 +744,7 @@ nsListControlFrame::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);
@ -828,7 +820,7 @@ nsListControlFrame::RestoreState(nsIPresContext* aPresContext,
nsIView* child = nsnull;
nsRect childRect(0,0,0,0);
if (NS_SUCCEEDED(scrollingView->GetScrolledView(child)) && child) {
child->GetBounds(childRect);
childRect = child->GetBounds();
}
x = (int)(((float)childRect.width / w) * x);
y = (int)(((float)childRect.height / h) * y);
@ -878,18 +870,15 @@ GetMaxOptionHeight(nsIPresContext *aPresContext, nsIFrame *aContainer)
nscoord result = 0;
nsIFrame *option;
for (aContainer->FirstChild(aPresContext, nsnull, &option);
option; option->GetNextSibling(&option)) {
option; option = option->GetNextSibling()) {
nscoord optionHeight;
nsCOMPtr<nsIContent> content;
option->GetContent(getter_AddRefs(content));
if (nsCOMPtr<nsIDOMHTMLOptGroupElement>(do_QueryInterface(content))) {
if (nsCOMPtr<nsIDOMHTMLOptGroupElement>
(do_QueryInterface(option->GetContent()))) {
// an optgroup
optionHeight = GetMaxOptionHeight(aPresContext, option);
} else {
// an option
nsSize size;
option->GetSize(size);
optionHeight = size.height;
optionHeight = option->GetSize().height;
}
if (result < optionHeight)
result = optionHeight;
@ -1416,12 +1405,9 @@ nsListControlFrame::Reflow(nsIPresContext* aPresContext,
NS_IMETHODIMP
nsListControlFrame::GetFormContent(nsIContent*& aContent) const
{
nsIContent* content;
nsresult rv;
rv = GetContent(&content);
aContent = content;
return rv;
aContent = GetContent();
NS_IF_ADDREF(aContent);
return NS_OK;
}
nsListControlFrame::ScrollbarStyles
@ -1666,31 +1652,29 @@ nsListControlFrame::CaptureMouseEvents(nsIPresContext* aPresContext, PRBool aGra
{
nsIView* view = nsnull;
if (IsInDropDownMode()) {
view = GetView(aPresContext);
view = GetView();
} else {
nsIFrame* scrolledFrame = nsnull;
GetScrolledFrame(aPresContext, scrolledFrame);
NS_ASSERTION(scrolledFrame, "No scrolled frame found");
NS_ENSURE_TRUE(scrolledFrame, NS_ERROR_FAILURE);
nsIFrame* scrollport = nsnull;
scrolledFrame->GetParent(&scrollport);
nsIFrame* scrollport = scrolledFrame->GetParent();
NS_ASSERTION(scrollport, "No scrollport found");
NS_ENSURE_TRUE(scrollport, NS_ERROR_FAILURE);
view = scrollport->GetView(aPresContext);
view = scrollport->GetView();
}
NS_ASSERTION(view, "no view???");
NS_ENSURE_TRUE(view, NS_ERROR_FAILURE);
nsCOMPtr<nsIViewManager> viewMan;
view->GetViewManager(*getter_AddRefs(viewMan));
nsIViewManager* viewMan = view->GetViewManager();
if (viewMan) {
PRBool result;
// It's not clear why we don't have the widget capture mouse events here.
if (aGrabMouseEvents) {
viewMan->GrabMouseEvents(view,result);
viewMan->GrabMouseEvents(view, result);
mIsCapturingMouseEvents = PR_TRUE;
} else {
nsIView* curGrabber;
@ -2573,21 +2557,10 @@ nsListControlFrame::GetViewOffset(nsIViewManager* aManager, nsIView* aView,
aPoint.x = 0;
aPoint.y = 0;
nsIView *parent;
parent = aView;
while (nsnull != parent) {
nsCOMPtr<nsIViewManager> vm;
parent->GetViewManager(*getter_AddRefs(vm));
if (vm != aManager) {
break;
}
nscoord x, y;
parent->GetPosition(&x, &y);
aPoint.x += x;
aPoint.y += y;
parent->GetParent(parent);
for (nsIView* parent = aView;
parent && parent->GetViewManager() == aManager;
parent = parent->GetParent(parent)) {
aPoint += parent->GetPosition();
}
}
@ -2675,21 +2648,6 @@ nsListControlFrame::DidReflow(nsIPresContext* aPresContext,
}
}
NS_IMETHODIMP nsListControlFrame::MoveTo(nsIPresContext* aPresContext, nscoord aX, nscoord aY)
{
if (PR_TRUE == IsInDropDownMode())
{
//SyncViewWithFrame();
mState &= ~NS_FRAME_SYNC_FRAME_AND_VIEW;
nsresult rv = nsGfxScrollFrame::MoveTo(aPresContext, aX, aY);
mState |= NS_FRAME_SYNC_FRAME_AND_VIEW;
//SyncViewWithFrame();
return rv;
} else {
return nsGfxScrollFrame::MoveTo(aPresContext, aX, aY);
}
}
NS_IMETHODIMP
nsListControlFrame::GetFrameType(nsIAtom** aType) const
{
@ -3133,16 +3091,13 @@ nsListControlFrame::ScrollToFrame(nsIContent* aOptElement)
nscoord y;
scrollableView->GetScrollPosition(x,y);
// get the clipped rect
nsRect rect;
clippedView->GetBounds(rect);
nsRect rect = clippedView->GetBounds();
// now move it by the offset of the scroll position
rect.x = 0;
rect.y = 0;
rect.MoveBy(x,y);
rect.x = x;
rect.y = y;
// get the child
nsRect fRect;
childframe->GetRect(fRect);
nsRect fRect = childframe->GetRect();
nsPoint pnt;
nsIView * view;
childframe->GetOffsetFromView(mPresContext, pnt, &view);
@ -3162,7 +3117,7 @@ nsListControlFrame::ScrollToFrame(nsIContent* aOptElement)
nsIFrame * optFrame;
result = presShell->GetPrimaryFrameFor(parentContent, &optFrame);
if (NS_SUCCEEDED(result) && optFrame) {
optFrame->GetRect(optRect);
optRect = optFrame->GetRect();
}
}
fRect.y += optRect.y;
@ -3617,7 +3572,7 @@ nsListEventListener::SetFrame(nsListControlFrame *aFrame)
mFrame.SetReference(aFrame->WeakReferent());
if (aFrame)
{
aFrame->GetContent(getter_AddRefs(mContent));
mContent = aFrame->GetContent();
}
return NS_OK;
}

View File

@ -209,7 +209,6 @@ public:
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus);
NS_IMETHOD MoveTo(nsIPresContext* aPresContext, nscoord aX, nscoord aY);
NS_IMETHOD Destroy(nsIPresContext *aPresContext);
NS_IMETHOD Paint(nsIPresContext* aPresContext,

View File

@ -381,12 +381,11 @@ nsTextInputListener::EditAction()
nsresult
nsTextInputListener::UpdateTextInputCommands(const nsAString& commandsToUpdate)
{
nsCOMPtr<nsIContent> content;
nsresult rv = mFrame->GetContent(getter_AddRefs(content));
nsIContent* content = mFrame->GetContent();
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
nsCOMPtr<nsIDocument> doc;
rv = content->GetDocument(getter_AddRefs(doc));
nsresult rv = content->GetDocument(getter_AddRefs(doc));
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
nsCOMPtr<nsIScriptGlobalObject> scriptGlobalObject;
@ -2178,12 +2177,9 @@ nsTextControlFrame::GetFont(nsIPresContext* aPresContext,
NS_IMETHODIMP
nsTextControlFrame::GetFormContent(nsIContent*& aContent) const
{
nsIContent* content;
nsresult rv;
rv = GetContent(&content);
aContent = content;
return rv;
aContent = GetContent();
NS_IF_ADDREF(aContent);
return NS_OK;
}
NS_IMETHODIMP nsTextControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAString& aValue)
@ -3079,13 +3075,10 @@ nsTextControlFrame::SetInitialChildList(nsIPresContext* aPresContext,
nsIFrame* aChildList)
{
/*nsIFrame *list = aChildList;
nsFrameState frameState;
while (list)
{
list->GetFrameState(&frameState);
frameState |= NS_FRAME_INDEPENDENT_SELECTION;
list->SetFrameState(frameState);
list->GetNextSibling(&list);
list->AddStateBits(NS_FRAME_INDEPENDENT_SELECTION);
list = list->GetNextSibling();
}
*/
nsresult rv = nsBoxFrame::SetInitialChildList(aPresContext, aListName, aChildList);
@ -3098,10 +3091,7 @@ nsTextControlFrame::SetInitialChildList(nsIPresContext* aPresContext,
// Mark the scroll frame as being a reflow root. This will allow
// incremental reflows to be initiated at the scroll frame, rather
// than descending from the root frame of the frame hierarchy.
nsFrameState state;
first->GetFrameState(&state);
state |= NS_FRAME_REFLOW_ROOT;
first->SetFrameState(state);
first->AddStateBits(NS_FRAME_REFLOW_ROOT);
//we must turn off scrollbars for singleline text controls
if (IsSingleLineTextControl())
@ -3130,7 +3120,7 @@ nsTextControlFrame::SetInitialChildList(nsIPresContext* aPresContext,
while(first)
{
nsIView *view = first->GetView(aPresContext);
nsIView *view = first->GetView();
if (view)
{
nsIScrollableView *scrollView;
@ -3189,7 +3179,7 @@ nsTextControlFrame::GetScrollableView(nsIPresContext* aPresContext,
rv = view->QueryInterface(NS_GET_IID(nsIScrollableView), (void **)&scrollableView);
if (NS_SUCCEEDED(rv) && scrollableView)
*aView = scrollableView;
view->GetParent(view);
view = view->GetParent();
}
}
return rv;

View File

@ -76,26 +76,20 @@ nsButtonFrameRenderer::GetFrame()
void
nsButtonFrameRenderer::SetDisabled(PRBool aDisabled, PRBool notify)
{
// get the content
nsCOMPtr<nsIContent> content;
mFrame->GetContent(getter_AddRefs(content));
if (aDisabled)
content->SetAttr(kNameSpaceID_None, nsHTMLAtoms::disabled, nsString(),
notify);
mFrame->GetContent()->SetAttr(kNameSpaceID_None, nsHTMLAtoms::disabled, nsString(),
notify);
else
content->UnsetAttr(kNameSpaceID_None, nsHTMLAtoms::disabled, notify);
mFrame->GetContent()->UnsetAttr(kNameSpaceID_None, nsHTMLAtoms::disabled, notify);
}
PRBool
nsButtonFrameRenderer::isDisabled()
{
// get the content
nsCOMPtr<nsIContent> content;
mFrame->GetContent(getter_AddRefs(content));
nsAutoString value;
if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttr(kNameSpaceID_None, nsHTMLAtoms::disabled, value))
if (NS_CONTENT_ATTR_HAS_VALUE ==
mFrame->GetContent()->GetAttr(kNameSpaceID_None, nsHTMLAtoms::disabled, value))
return PR_TRUE;
return PR_FALSE;
@ -104,8 +98,7 @@ nsButtonFrameRenderer::isDisabled()
void
nsButtonFrameRenderer::Redraw(nsIPresContext* aPresContext)
{
nsRect rect;
mFrame->GetRect(rect);
nsRect rect = mFrame->GetRect();
rect.x = 0;
rect.y = 0;
mFrame->Invalidate(aPresContext, rect, PR_FALSE);
@ -314,23 +307,18 @@ nsButtonFrameRenderer::GetAddedButtonBorderAndPadding()
void
nsButtonFrameRenderer::ReResolveStyles(nsIPresContext* aPresContext)
{
// get all the styles
nsCOMPtr<nsIContent> content;
mFrame->GetContent(getter_AddRefs(content));
nsStyleContext* context = mFrame->GetStyleContext();
// style for the inner such as a dotted line (Windows)
mInnerFocusStyle = aPresContext->ProbePseudoStyleContextFor(content,
mInnerFocusStyle = aPresContext->ProbePseudoStyleContextFor(mFrame->GetContent(),
nsCSSPseudoElements::mozFocusInner,
context);
// style for outer focus like a ridged border (MAC).
mOuterFocusStyle = aPresContext->ProbePseudoStyleContextFor(content,
mOuterFocusStyle = aPresContext->ProbePseudoStyleContextFor(mFrame->GetContent(),
nsCSSPseudoElements::mozFocusOuter,
context);
}
nsStyleContext*

View File

@ -167,10 +167,7 @@ NS_NewComboboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRUin
return NS_ERROR_OUT_OF_MEMORY;
}
// set the state flags (if any are provided)
nsFrameState state;
it->GetFrameState( &state );
state |= aStateFlags;
it->SetFrameState( state );
it->AddStateBits(aStateFlags);
*aNewFrame = it;
return NS_OK;
}
@ -443,11 +440,9 @@ nsComboboxControlFrame::GetType() const
NS_IMETHODIMP
nsComboboxControlFrame::GetFormContent(nsIContent*& aContent) const
{
nsIContent* content;
nsresult rv;
rv = GetContent(&content);
aContent = content;
return rv;
aContent = GetContent();
NS_IF_ADDREF(aContent);
return NS_OK;
}
//--------------------------------------------------------------
@ -540,14 +535,9 @@ nsComboboxControlFrame::SetFocus(PRBool aOn, PRBool aRepaint)
// Make sure the content area gets updated for where the dropdown was
// This is only needed for embedding, the focus may go to
// the chrome that is not part of the Gecko system (Bug 83493)
nsCOMPtr<nsIPresShell> presShell;
mPresContext->GetShell(getter_AddRefs(presShell));
if (presShell) {
nsCOMPtr<nsIViewManager> vm;
presShell->GetViewManager(getter_AddRefs(vm));
if (vm) {
vm->UpdateAllViews(NS_VMREFRESH_NO_SYNC);
}
nsIViewManager* vm = GetPresContext()->GetViewManager();
if (vm) {
vm->UpdateAllViews(NS_VMREFRESH_NO_SYNC);
}
}
@ -568,13 +558,11 @@ nsComboboxControlFrame::ScrollIntoView(nsIPresContext* aPresContext)
void
nsComboboxControlFrame::ShowPopup(PRBool aShowPopup)
{
nsIView* view = mDropdownFrame->GetView(mPresContext);
nsCOMPtr<nsIViewManager> viewManager;
view->GetViewManager(*getter_AddRefs(viewManager));
nsIView* view = mDropdownFrame->GetView();
nsIViewManager* viewManager = view->GetViewManager();
if (aShowPopup) {
nsRect rect;
mDropdownFrame->GetRect(rect);
nsRect rect = mDropdownFrame->GetRect();
rect.x = rect.y = 0;
viewManager->ResizeView(view, rect);
nsIScrollableView* scrollingView;
@ -611,15 +599,15 @@ nsComboboxControlFrame::ShowPopup(PRBool aShowPopup)
void
nsComboboxControlFrame::ShowList(nsIPresContext* aPresContext, PRBool aShowList)
{
nsCOMPtr<nsIWidget> widget;
nsIWidget* widget = nsnull;
// Get parent view
nsIFrame * listFrame;
if (NS_OK == mListControlFrame->QueryInterface(NS_GET_IID(nsIFrame), (void **)&listFrame)) {
nsIView* view = listFrame->GetView(aPresContext);
NS_ASSERTION(view != nsnull, "nsComboboxControlFrame view is null");
nsIView* view = listFrame->GetView();
NS_ASSERTION(view, "nsComboboxControlFrame view is null");
if (view) {
view->GetWidget(*getter_AddRefs(widget));
widget = view->GetWidget();
}
}
@ -656,7 +644,6 @@ nsComboboxControlFrame::MouseClicked(nsIPresContext* aPresContext)
//ToggleList(aPresContext);
}
nsresult
nsComboboxControlFrame::ReflowComboChildFrame(nsIFrame* aFrame,
nsIPresContext* aPresContext,
@ -675,23 +662,21 @@ nsComboboxControlFrame::ReflowComboChildFrame(nsIFrame* aFrame,
// ensure we start off hidden
if (aReflowState.reason == eReflowReason_Initial) {
nsIView* view = mDropdownFrame->GetView(mPresContext);
nsCOMPtr<nsIViewManager> viewManager;
view->GetViewManager(*getter_AddRefs(viewManager));
nsIView* view = mDropdownFrame->GetView();
nsIViewManager* viewManager = view->GetViewManager();
viewManager->SetViewVisibility(view, nsViewVisibility_kHide);
nsRect emptyRect(0, 0, 0, 0);
viewManager->ResizeView(view, emptyRect);
}
// Reflow child
nsRect rect;
aFrame->GetRect(rect);
nsRect rect = aFrame->GetRect();
nsresult rv = ReflowChild(aFrame, aPresContext, aDesiredSize, kidReflowState,
rect.x, rect.y, NS_FRAME_NO_MOVE_VIEW |NS_FRAME_NO_SIZE_VIEW | NS_FRAME_NO_VISIBILITY, aStatus);
rect.x, rect.y, NS_FRAME_NO_MOVE_VIEW | NS_FRAME_NO_SIZE_VIEW | NS_FRAME_NO_VISIBILITY, aStatus);
// Set the child's width and height to it's desired size
FinishReflowChild(aFrame, aPresContext, &kidReflowState, aDesiredSize,
rect.x, rect.y, NS_FRAME_NO_MOVE_VIEW |NS_FRAME_NO_SIZE_VIEW | NS_FRAME_NO_VISIBILITY);
rect.x, rect.y, NS_FRAME_NO_MOVE_VIEW | NS_FRAME_NO_SIZE_VIEW | NS_FRAME_NO_VISIBILITY);
return rv;
}
@ -744,8 +729,7 @@ nsComboboxControlFrame::PositionDropdown(nsIPresContext* aPresContext,
nsresult rv = NS_OK;
nscoord dropdownYOffset = aHeight;
// XXX: Enable this code to debug popping up above the display frame, rather than below it
nsRect dropdownRect;
mDropdownFrame->GetRect(dropdownRect);
nsRect dropdownRect = mDropdownFrame->GetRect();
nscoord screenHeightInPixels = 0;
if (NS_SUCCEEDED(nsFormControlFrame::GetScreenHeight(aPresContext, screenHeightInPixels))) {
@ -763,10 +747,8 @@ nsComboboxControlFrame::PositionDropdown(nsIPresContext* aPresContext,
dropdownRect.x = 0;
dropdownRect.y = dropdownYOffset;
nsRect currentRect;
mDropdownFrame->GetRect(currentRect);
mDropdownFrame->SetRect(aPresContext, dropdownRect);
mDropdownFrame->SetRect(dropdownRect);
return rv;
}
@ -961,8 +943,8 @@ nsComboboxControlFrame::ReflowCombobox(nsIPresContext * aPresContext,
nsRect buttonRect(0,0,0,0);
nsRect displayRect(0,0,0,0);
aBtnWidth = 0;
aDisplayFrame->SetRect(aPresContext, displayRect);
aDropDownBtn->SetRect(aPresContext, buttonRect);
aDisplayFrame->SetRect(displayRect);
aDropDownBtn->SetRect(buttonRect);
SetChildFrameSize(aDropDownBtn, aBtnWidth, aDesiredSize.height);
aDesiredSize.width = 0;
aDesiredSize.height = dispHeight;
@ -1044,8 +1026,8 @@ nsComboboxControlFrame::ReflowCombobox(nsIPresContext * aPresContext,
nsHTMLReflowState txtKidReflowState(aPresContext, aReflowState, aDisplayFrame, txtAvailSize, reason);
aDisplayFrame->WillReflow(aPresContext);
//aDisplayFrame->MoveTo(aPresContext, dspBorderPadding.left + aBorderPadding.left, dspBorderPadding.top + aBorderPadding.top);
aDisplayFrame->MoveTo(aPresContext, aBorderPadding.left, aBorderPadding.top);
//aDisplayFrame->SetPosition(nsPoint(dspBorderPadding.left + aBorderPadding.left, dspBorderPadding.top + aBorderPadding.top));
aDisplayFrame->SetPosition(nsPoint(aBorderPadding.left, aBorderPadding.top));
nsAreaFrame::PositionFrameView(aPresContext, aDisplayFrame);
nsReflowStatus status;
nsresult rv = aDisplayFrame->Reflow(aPresContext, txtKidSize, txtKidReflowState, status);
@ -1069,13 +1051,6 @@ nsComboboxControlFrame::ReflowCombobox(nsIPresContext * aPresContext,
// doesn't position things exactly where we want them
nscoord insideHeight = aDesiredSize.height - aBorderPadding.top - aBorderPadding.bottom;
// the gets for the Display "block" frame and for the button
// make adjustments
nsRect buttonRect;
nsRect displayRect;
aDisplayFrame->GetRect(displayRect);
aDropDownBtn->GetRect(buttonRect);
// If the css width has been set to something very small
//i.e. smaller than the dropdown button, set the button's width to zero
if (aBtnWidth > dispWidth) {
@ -1083,19 +1058,13 @@ nsComboboxControlFrame::ReflowCombobox(nsIPresContext * aPresContext,
}
// set the display rect to be left justifed and
// fills the entire area except the button
nscoord x = aBorderPadding.left;
displayRect.x = x;
displayRect.y = aBorderPadding.top;
displayRect.height = insideHeight;
displayRect.width = PR_MAX(dispWidth - aBtnWidth, 0); // make sure the width is never negative
aDisplayFrame->SetRect(aPresContext, displayRect);
x += displayRect.width;
nscoord x = aBorderPadding.left;
nsRect displayRect(x, aBorderPadding.top, PR_MAX(dispWidth - aBtnWidth, 0), insideHeight);
aDisplayFrame->SetRect(displayRect);
x += displayRect.width;
// right justify the button
buttonRect.x = x;
buttonRect.y = aBorderPadding.top;
buttonRect.height = insideHeight;
buttonRect.width = aBtnWidth;
nsRect buttonRect(x, aBorderPadding.top, aBtnWidth, insideHeight);
#ifdef IBMBIDI
if (vis->mDirection == NS_STYLE_DIRECTION_RTL)
{
@ -1103,11 +1072,11 @@ nsComboboxControlFrame::ReflowCombobox(nsIPresContext * aPresContext,
{
buttonRect.x = displayRect.x;
displayRect.x += buttonRect.width;
aDisplayFrame->SetRect(aPresContext, displayRect);
aDisplayFrame->SetRect(displayRect);
}
}
#endif // IBMBIDI
aDropDownBtn->SetRect(aPresContext, buttonRect);
aDropDownBtn->SetRect(buttonRect);
// since we have changed the height of the button
// make sure it has these new values
@ -1283,16 +1252,6 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext,
return nsAreaFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
}
// size of each part of the combo box
nsRect displayRect;
nsRect buttonRect;
nsRect dropdownRect;
// Get the current sizes of the combo box child frames
mDisplayFrame->GetRect(displayRect);
mButtonFrame->GetRect(buttonRect);
mDropdownFrame->GetRect(dropdownRect);
// We should cache this instead getting it everytime
// the default size of the of scrollbar
// that will be the default width of the dropdown button
@ -1416,8 +1375,6 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext,
plainLstFrame->FirstChild(aPresContext, nsnull, &frame);
nsIScrollableFrame * scrollFrame;
if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsIScrollableFrame), (void**)&scrollFrame))) {
nsRect rect;
plainLstFrame->GetRect(rect);
plainLstFrame->Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
aDesiredSize.width = mCacheSize.width;
@ -1456,14 +1413,6 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext,
}
#endif // IBMBIDI
// This ifdef is for the new approach to reflow
// where we don't reflow the dropdown
// we just figure out or width from the list of items
//
// This next section is the Current implementation
// the else contains the new reflow code
#ifndef DO_NEW_REFLOW_X
// Here is another special optimization
// Only reflow the dropdown if it has never been reflowed unconstrained
//
@ -1554,7 +1503,7 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext,
// dropdownRect will hold the content size (minus border padding)
// for the display area
mDropdownFrame->GetRect(dropdownRect);
nsRect dropdownRect = mDropdownFrame->GetRect();
if (eReflowReason_Resize == aReflowState.reason) {
dropdownRect.Deflate(aReflowState.mComputedBorderPadding);
}
@ -1642,7 +1591,7 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext,
// Optimization - The style (font, etc.) maybe different for the display item
// than for any particular item in the dropdown. So, if the new size of combobox
// is smaller than the dropdown, that is OK, The dropdown MUST always be either the same
//size as the combo or larger if necessary
// size as the combo or larger if necessary
if (aDesiredSize.width > dropdownDesiredSize.width) {
if (eReflowReason_Initial == firstPassState.reason) {
firstPassState.reason = eReflowReason_Resize;
@ -1659,43 +1608,6 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext,
lcf->SetPassId(0);
}
#else // DO_NEW_REFLOW
if (
#ifdef IBMBIDI
eReflowReason_StyleChange == aReflowState.reason ||
#endif // IBMBIDI
mCacheSize.width == kSizeNotSet) {
ReflowItems(aPresContext, aReflowState, aDesiredSize);
} else {
aDesiredSize.width = mCacheSize.width;
aDesiredSize.height = mCacheSize.height;
}
// get the borderPadding for the display area
nsMargin dspBorderPadding(0, 0, 0, 0);
mDisplayFrame->CalcBorderPadding(dspBorderPadding);
if (NS_UNCONSTRAINEDSIZE == firstPassState.mComputedWidth) {
mItemDisplayWidth = aDesiredSize.width - (dspBorderPadding.left + dspBorderPadding.right);
mItemDisplayWidth -= borderPadding.left + borderPadding.right;
} else {
if (firstPassState.mComputedWidth > 0) {
// Compute the display item's width from reflow's mComputedWidth
// mComputedWidth has already excluded border and padding
// so subtract off the button's size
mItemDisplayWidth = firstPassState.mComputedWidth - dspBorderPadding.left - dspBorderPadding.right;
}
}
// this reflows and makes and last minute adjustments
ReflowCombobox(aPresContext, firstPassState, aDesiredSize, aStatus,
mDisplayFrame, mButtonFrame, mItemDisplayWidth, scrollbarWidth,
borderPadding,
aDesiredSize.height- borderPadding.top - borderPadding.bottom -
dspBorderPadding.top - dspBorderPadding.bottom);
#endif // DO_NEW_REFLOW
// Set the max element size to be the same as the desired element size.
if (aDesiredSize.mComputeMEW) {
aDesiredSize.mMaxElementWidth = aDesiredSize.width;
@ -1807,7 +1719,7 @@ nsComboboxControlFrame::ShowDropDown(PRBool aDoDropDown)
if (!mDroppedDown && aDoDropDown) {
// XXX Temporary for Bug 19416
nsIView* lstView = mDropdownFrame->GetView(mPresContext);
nsIView* lstView = mDropdownFrame->GetView();
if (lstView) {
lstView->IgnoreSetPosition(PR_FALSE);
}
@ -1868,10 +1780,8 @@ nsComboboxControlFrame::AbsolutelyPositionDropDown()
nsRect absoluteTwips;
nsRect absolutePixels;
nsRect rect;
this->GetRect(rect);
if (NS_SUCCEEDED(nsFormControlFrame::GetAbsoluteFramePosition(mPresContext, this, absoluteTwips, absolutePixels))) {
PositionDropdown(mPresContext, rect.height, absoluteTwips, absolutePixels);
PositionDropdown(mPresContext, GetRect().height, absoluteTwips, absolutePixels);
}
return NS_OK;
}
@ -1880,11 +1790,7 @@ NS_IMETHODIMP
nsComboboxControlFrame::GetAbsoluteRect(nsRect* aRect)
{
nsRect absoluteTwips;
nsRect rect;
this->GetRect(rect);
nsresult rv = nsFormControlFrame::GetAbsoluteFramePosition(mPresContext, this, absoluteTwips, *aRect);
return rv;
return nsFormControlFrame::GetAbsoluteFramePosition(mPresContext, this, absoluteTwips, *aRect);
}
///////////////////////////////////////////////////////////////
@ -1934,13 +1840,8 @@ nsComboboxControlFrame::RedisplayText(PRInt32 aIndex)
}
if (shouldSetValue) {
rv = ActuallyDisplayText(textToDisplay, PR_TRUE);
nsFrameState state;
//mTextFrame->GetFrameState(&state);
//state |= NS_FRAME_IS_DIRTY;
//mTextFrame->SetFrameState(state);
mDisplayFrame->GetFrameState(&state);
state |= NS_FRAME_IS_DIRTY;
mDisplayFrame->SetFrameState(state);
//mTextFrame->AddStateBits(NS_FRAME_IS_DIRTY);
mDisplayFrame->AddStateBits(NS_FRAME_IS_DIRTY);
nsCOMPtr<nsIPresShell> shell;
rv = mPresContext->GetShell(getter_AddRefs(shell));
ReflowDirtyChild(shell, (nsIFrame*) mDisplayFrame);
@ -2351,14 +2252,13 @@ nsComboboxControlFrame::Destroy(nsIPresContext* aPresContext)
nsFormControlFrame::RegUnRegAccessKey(mPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_FALSE);
if (mDroppedDown) {
nsCOMPtr<nsIWidget> widget;
// Get parent view
nsIFrame * listFrame;
if (NS_OK == mListControlFrame->QueryInterface(NS_GET_IID(nsIFrame), (void **)&listFrame)) {
nsIView* view = listFrame->GetView(aPresContext);
NS_ASSERTION(view != nsnull, "nsComboboxControlFrame view is null");
nsIView* view = listFrame->GetView();
NS_ASSERTION(view, "nsComboboxControlFrame view is null");
if (view) {
view->GetWidget(*getter_AddRefs(widget));
nsIWidget* widget = view->GetWidget();
if (widget)
widget->CaptureRollupEvents((nsIRollupListener *)this, PR_FALSE, PR_TRUE);
}
@ -2405,8 +2305,8 @@ nsComboboxControlFrame::SetInitialChildList(nsIPresContext* aPresContext,
rv = nsAreaFrame::SetInitialChildList(aPresContext, aListName, aChildList);
InitTextStr();
nsIFrame * child = aChildList;
while (child) {
for (nsIFrame * child = aChildList; child;
child = child->GetNextSibling()) {
nsIFormControlFrame* fcFrame = nsnull;
CallQueryInterface(child, &fcFrame);
if (fcFrame) {
@ -2416,7 +2316,6 @@ nsComboboxControlFrame::SetInitialChildList(nsIPresContext* aPresContext,
} else {
mDisplayFrame = child;
}
child->GetNextSibling(&child);
}
}
return rv;
@ -2524,8 +2423,7 @@ nsComboboxControlFrame::Paint(nsIPresContext* aPresContext,
if (mDisplayFrame) {
aRenderingContext.PushState();
PRBool clipEmpty;
nsRect clipRect;
mDisplayFrame->GetRect(clipRect);
nsRect clipRect = mDisplayFrame->GetRect();
aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect, clipEmpty);
PaintChild(aPresContext, aRenderingContext, aDirtyRect,
mDisplayFrame, NS_FRAME_PAINT_LAYER_BACKGROUND);

View File

@ -142,10 +142,7 @@ NS_NewFieldSetFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRUint32 aSt
}
// set the state flags (if any are provided)
nsFrameState state;
it->GetFrameState( &state );
state |= aStateFlags;
it->SetFrameState( state );
it->AddStateBits(aStateFlags);
*aNewFrame = it;
return NS_OK;
@ -177,7 +174,7 @@ nsFieldSetFrame::SetInitialChildList(nsIPresContext* aPresContext,
// get the content and legend frames.
mContentFrame = aChildList;
mContentFrame->GetNextSibling(&mLegendFrame);
mLegendFrame = mContentFrame->GetNextSibling();
// Queue up the frames for the content frame
return nsHTMLContainerFrame::SetInitialChildList(aPresContext, nsnull, aChildList);
@ -371,17 +368,17 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext,
// if dirty then check dirty flags
if (reason == eReflowReason_Dirty)
{
if (reflowContent) {
nsFrameState state;
mContentFrame->GetFrameState(&state);
reflowContent = (state & NS_FRAME_IS_DIRTY) || (state & NS_FRAME_HAS_DIRTY_CHILDREN);
}
if (reflowContent) {
reflowContent =
(mContentFrame->GetStateBits()
& (NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN)) != 0;
}
if (reflowLegend) {
nsFrameState state;
mLegendFrame->GetFrameState(&state);
reflowLegend = (state & NS_FRAME_IS_DIRTY) || (state & NS_FRAME_HAS_DIRTY_CHILDREN);
}
if (reflowLegend) {
reflowLegend =
(mLegendFrame->GetStateBits()
& (NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN)) != 0;
}
}
// availSize could have unconstrained values, don't perform any addition on them
@ -515,13 +512,10 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext,
aDesiredSize.mMaxElementWidth = kidDesiredSize.mMaxElementWidth;
}
nsFrameState kidState;
mContentFrame->GetFrameState(&kidState);
// printf("width: %d, height: %d\n", desiredSize.mCombinedArea.width, desiredSize.mCombinedArea.height);
/*
if (kidState & NS_FRAME_OUTSIDE_CHILDREN) {
if (mContentFrame->GetStateBits() & NS_FRAME_OUTSIDE_CHILDREN) {
mState |= NS_FRAME_OUTSIDE_CHILDREN;
aDesiredSize.mOverflowArea.width += borderPadding.left + borderPadding.right;
aDesiredSize.mOverflowArea.height += borderPadding.top + borderPadding.bottom + mLegendSpace;
@ -532,7 +526,7 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext,
} else {
// if we don't need to reflow just get the old size
mContentFrame->GetRect(contentRect);
contentRect = mContentFrame->GetRect();
const nsStyleMargin* marginStyle = mContentFrame->GetStyleMargin();
nsMargin m(0,0,0,0);
@ -570,12 +564,11 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext,
nsRect actualLegendRect(mLegendRect);
actualLegendRect.Deflate(legendMargin);
nsPoint curOrigin;
mLegendFrame->GetOrigin(curOrigin);
nsPoint curOrigin = mLegendFrame->GetPosition();
// only if the origin changed
if ((curOrigin.x != mLegendRect.x) || (curOrigin.y != mLegendRect.y)) {
mLegendFrame->MoveTo(aPresContext, actualLegendRect.x , actualLegendRect.y);
mLegendFrame->SetPosition(nsPoint(actualLegendRect.x , actualLegendRect.y));
nsContainerFrame::PositionFrameView(aPresContext, mLegendFrame);
// We need to recursively process the legend frame's
@ -661,16 +654,10 @@ nsFieldSetFrame::RemoveFrame(nsIPresContext* aPresContext,
// XXX XXX
// XXX temporary fix for bug 70648
if (aOldFrame == mLegendFrame) {
nsIFrame* sibling;
mContentFrame->GetNextSibling(&sibling);
nsIFrame* sibling = mContentFrame->GetNextSibling();
NS_ASSERTION(sibling == mLegendFrame, "legendFrame is not next sibling");
#ifdef DEBUG
nsIFrame* legendParent;
mLegendFrame->GetParent(&legendParent);
NS_ASSERTION(legendParent == this, "Legend Parent has wrong parent");
#endif
nsIFrame* legendSibling;
sibling->GetNextSibling(&legendSibling);
NS_ASSERTION(mLegendFrame->GetParent() == this, "Legend Parent has wrong parent");
nsIFrame* legendSibling = sibling->GetNextSibling();
// replace the legend, which is the next sibling, with any siblings of the legend (XXX always null?)
mContentFrame->SetNextSibling(legendSibling);
// OK, the legend is now removed from the sibling list, but who has ownership of it?

View File

@ -224,8 +224,7 @@ nsFileControlFrame::SetFocus(PRBool aOn, PRBool aRepaint)
{
// Fix for Bug 6133
if (mTextFrame) {
nsCOMPtr<nsIContent> content;
mTextFrame->GetContent(getter_AddRefs(content));
nsIContent* content = mTextFrame->GetContent();
if (content) {
content->SetFocus(mPresContext);
}
@ -266,10 +265,9 @@ nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent)
nsresult result;
// Get parent nsIDOMWindowInternal object.
nsCOMPtr<nsIContent> content;
result = GetContent(getter_AddRefs(content));
nsIContent* content = GetContent();
if (!content)
return NS_FAILED(result) ? result : NS_ERROR_FAILURE;
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDocument> doc;
result = content->GetDocument(getter_AddRefs(doc));
@ -378,14 +376,12 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext* aPresContext,
nsIFrame * child;
FirstChild(aPresContext, nsnull, &child);
while (child == mTextFrame) {
child->GetNextSibling(&child);
if (child == mTextFrame) {
child = child->GetNextSibling();
}
if (child != nsnull) {
nsRect buttonRect;
nsRect txtRect;
mTextFrame->GetRect(txtRect);
child->GetRect(buttonRect);
if (child) {
nsRect buttonRect = child->GetRect();
nsRect txtRect = mTextFrame->GetRect();
// check to see if we must reflow just the area frame again
// in order for the text field to be the correct height
@ -410,7 +406,7 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext* aPresContext,
// now adjust the frame positions
txtRect.y = aReflowState.mComputedBorderPadding.top;
txtRect.height = aDesiredSize.height;
mTextFrame->SetRect(aPresContext, txtRect);
mTextFrame->SetRect(txtRect);
}
}
@ -420,11 +416,11 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext* aPresContext,
// and we must make sure the text field is the correct height
if (NS_STYLE_DIRECTION_RTL == vis->mDirection) {
buttonRect.x = aReflowState.mComputedBorderPadding.left;
child->SetRect(aPresContext, buttonRect);
child->SetRect(buttonRect);
txtRect.x = aDesiredSize.width - txtRect.width + aReflowState.mComputedBorderPadding.left;
txtRect.y = aReflowState.mComputedBorderPadding.top;
txtRect.height = aDesiredSize.height;
mTextFrame->SetRect(aPresContext, txtRect);
mTextFrame->SetRect(txtRect);
}
}
@ -458,11 +454,10 @@ nsFileControlFrame::GetTextControlFrame(nsIPresContext* aPresContext, nsIFrame*
while (childFrame) {
// see if the child is a text control
nsCOMPtr<nsIContent> content;
nsresult res = childFrame->GetContent(getter_AddRefs(content));
if (NS_SUCCEEDED(res) && content) {
nsIContent* content = childFrame->GetContent();
if (content) {
nsCOMPtr<nsIAtom> atom;
res = content->GetTag(getter_AddRefs(atom));
nsresult res = content->GetTag(getter_AddRefs(atom));
if (NS_SUCCEEDED(res) && atom) {
if (atom.get() == nsHTMLAtoms::input) {
@ -482,8 +477,7 @@ nsFileControlFrame::GetTextControlFrame(nsIPresContext* aPresContext, nsIFrame*
if (frame)
result = frame;
res = childFrame->GetNextSibling(&childFrame);
NS_ASSERTION(res == NS_OK,"failed to get next child");
childFrame = childFrame->GetNextSibling();
}
return result;
@ -579,12 +573,9 @@ nsFileControlFrame::GetFrameName(nsAString& aResult) const
NS_IMETHODIMP
nsFileControlFrame::GetFormContent(nsIContent*& aContent) const
{
nsIContent* content;
nsresult rv;
rv = GetContent(&content);
aContent = content;
return rv;
aContent = GetContent();
NS_IF_ADDREF(aContent);
return NS_OK;
}
NS_IMETHODIMP

View File

@ -496,17 +496,14 @@ nsFormControlFrame::DidReflow(nsIPresContext* aPresContext,
// The view is created hidden; once we have reflowed it and it has been
// positioned then we show it.
if (NS_FRAME_REFLOW_FINISHED == aStatus) {
nsIView* view = GetView(aPresContext);
nsIView* view = GetView();
if (view) {
nsViewVisibility newVis = GetStyleVisibility()->IsVisible()
? nsViewVisibility_kShow
: nsViewVisibility_kHide;
nsViewVisibility oldVis;
// only change if different.
view->GetVisibility(oldVis);
if (newVis != oldVis) {
nsCOMPtr<nsIViewManager> vm;
view->GetViewManager(*getter_AddRefs(vm));
if (newVis != view->GetVisibility()) {
nsIViewManager* vm = view->GetViewManager();
if (vm) {
vm->SetViewVisibility(view, newVis);
}
@ -573,9 +570,8 @@ nsFormControlFrame::RegUnRegAccessKey(nsIPresContext* aPresContext, nsIFrame * a
nsresult rv = NS_ERROR_FAILURE;
nsAutoString accessKey;
if (aFrame != nsnull) {
nsCOMPtr<nsIContent> content;
if (NS_SUCCEEDED(aFrame->GetContent(getter_AddRefs(content)))) {
if (aFrame) {
nsIContent* content = aFrame->GetContent();
#if 1
nsAutoString resultValue;
rv = content->GetAttr(kNameSpaceID_None,
@ -606,18 +602,15 @@ nsFormControlFrame::RegUnRegAccessKey(nsIPresContext* aPresContext, nsIFrame * a
}
}
#endif
}
}
if (NS_CONTENT_ATTR_NOT_THERE != rv) {
nsCOMPtr<nsIEventStateManager> stateManager;
if (NS_SUCCEEDED(aPresContext->GetEventStateManager(getter_AddRefs(stateManager)))) {
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
if (aDoReg) {
return stateManager->RegisterAccessKey(content, (PRUint32)accessKey.First());
return stateManager->RegisterAccessKey(aFrame->GetContent(), (PRUint32)accessKey.First());
} else {
return stateManager->UnregisterAccessKey(content, (PRUint32)accessKey.First());
return stateManager->UnregisterAccessKey(aFrame->GetContent(), (PRUint32)accessKey.First());
}
}
}
@ -784,12 +777,9 @@ nsFormControlFrame::GetStyleSize(nsIPresContext* aPresContext,
NS_IMETHODIMP
nsFormControlFrame::GetFormContent(nsIContent*& aContent) const
{
nsIContent* content;
nsresult rv;
rv = GetContent(&content);
aContent = content;
return rv;
aContent = GetContent();
NS_IF_ADDREF(aContent);
return NS_OK;
}
NS_IMETHODIMP
@ -909,7 +899,7 @@ nsFormControlFrame::GetAbsoluteFramePosition(nsIPresContext* aPresContext,
{
nsresult rv = NS_OK;
aFrame->GetRect(aAbsoluteTwipsRect);
aAbsoluteTwipsRect = aFrame->GetRect();
// zero these out,
// because the GetOffsetFromView figures them out
// XXXbz why do we need to do this, really? Will we ever fail to
@ -931,21 +921,18 @@ nsFormControlFrame::GetAbsoluteFramePosition(nsIPresContext* aPresContext,
if (NS_SUCCEEDED(rv) && view) {
aAbsoluteTwipsRect.MoveTo(frameOffset);
nsCOMPtr<nsIWidget> widget;
nsIWidget* widget;
// Walk up the views, looking for a widget
do {
// add in the offset of the view from its parent.
nsPoint viewPosition;
view->GetPosition(&viewPosition.x, &viewPosition.y);
aAbsoluteTwipsRect += viewPosition;
aAbsoluteTwipsRect += view->GetPosition();
view->GetWidget(*getter_AddRefs(widget));
widget = view->GetWidget();
if (widget) {
// account for space above and to the left of the view origin.
// the widget is aligned with view's bounds, not its origin
nsRect bounds;
view->GetBounds(bounds);
nsRect bounds = view->GetBounds();
aAbsoluteTwipsRect.x -= bounds.x;
aAbsoluteTwipsRect.y -= bounds.y;
@ -960,7 +947,7 @@ nsFormControlFrame::GetAbsoluteFramePosition(nsIPresContext* aPresContext,
break;
}
view->GetParent(view);
view = view->GetParent();
} while (view);
}

View File

@ -97,26 +97,21 @@ nsFormControlHelper::~nsFormControlHelper()
void nsFormControlHelper::ForceDrawFrame(nsIPresContext* aPresContext, nsIFrame * aFrame)
{
if (aFrame == nsnull) {
if (!aFrame) {
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 != nsnull) {
nsIViewManager * viewMgr;
view->GetViewManager(viewMgr);
if (viewMgr != nsnull) {
if (view) {
nsIViewManager* viewMgr = view->GetViewManager();
if (viewMgr) {
viewMgr->UpdateView(view, rect, NS_VMREFRESH_NO_SYNC);
NS_RELEASE(viewMgr);
}
}
}
void nsFormControlHelper::PlatformToDOMLineBreaks(nsString &aString)
@ -499,10 +494,7 @@ nsFormControlHelper::GetLocalizedString(const char * aPropFileName, const PRUnic
nsresult
nsFormControlHelper::Reset(nsIFrame* aFrame, nsIPresContext* aPresContext)
{
nsCOMPtr<nsIContent> controlContent;
aFrame->GetContent(getter_AddRefs(controlContent));
nsCOMPtr<nsIFormControl> control = do_QueryInterface(controlContent);
nsCOMPtr<nsIFormControl> control = do_QueryInterface(aFrame->GetContent());
if (control) {
control->Reset();
return NS_OK;

View File

@ -186,8 +186,7 @@ NS_IMETHODIMP nsHTMLButtonControlFrame::GetAccessible(nsIAccessible** aAccessibl
nsCOMPtr<nsIAccessibilityService> accService = do_GetService("@mozilla.org/accessibilityService;1");
if (accService) {
nsCOMPtr<nsIContent> content;
GetContent(getter_AddRefs(content));
nsIContent* content = GetContent();
nsCOMPtr<nsIDOMHTMLButtonElement> buttonElement(do_QueryInterface(content));
if (buttonElement) //If turned XBL-base form control off, the frame contains HTML 4 button
return accService->CreateHTML4ButtonAccessible(NS_STATIC_CAST(nsIFrame*, this), aAccessible);
@ -272,11 +271,9 @@ nsHTMLButtonControlFrame::GetTranslatedRect(nsIPresContext* aPresContext, nsRect
nsIView* view;
nsPoint viewOffset(0,0);
GetOffsetFromView(aPresContext, viewOffset, &view);
while (nsnull != view) {
nsPoint tempOffset;
view->GetPosition(&tempOffset.x, &tempOffset.y);
viewOffset += tempOffset;
view->GetParent(view);
while (view) {
viewOffset += view->GetPosition();
view = view->GetParent();
}
aRect = nsRect(viewOffset.x, viewOffset.y, mRect.width, mRect.height);
}
@ -336,7 +333,7 @@ nsHTMLButtonControlFrame::SetInitialChildList(nsIPresContext* aPresContext,
newParentContext = mFrames.FirstChild()->GetStyleContext();
// Set the parent for each of the child frames
for (nsIFrame* frame = aChildList; nsnull != frame; frame->GetNextSibling(&frame)) {
for (nsIFrame* frame = aChildList; frame; frame = frame->GetNextSibling()) {
frame->SetParent(mFrames.FirstChild());
// now reparent the contexts for the reparented frame too
if (frameManager) {
@ -440,19 +437,12 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext* aPresContext,
#if 0
if (!mDidInit) {
// create our view, we need a view to grab the mouse
nsIView* view;
GetView(&view);
nsIView* view = GetView();
if (!view) {
nsresult result = nsComponentManager::CreateInstance(kViewCID, nsnull, NS_GET_IID(nsIView), (void **)&view);
nsCOMPtr<nsIPresShell> presShell;
aPresContext->GetShell(getter_AddRefs(presShell));
nsCOMPtr<nsIViewManager> viewMan;
presShell->GetViewManager(getter_AddRefs(viewMan));
nsIFrame* parWithView;
nsIView *parView;
GetParentWithView(&parWithView);
parWithView->GetView(&parView);
nsIViewManager* viewMan = aPresContext->GetViewManager();
nsIFrame* parWithView = GetAncestorWithView();
nsIView* parView = parWithView->GetView();
// the view's size is not know yet, but its size will be kept in synch with our frame.
nsRect boundBox(0, 0, 500, 500);
result = view->Init(viewMan, boundBox, parView, nsnull);
@ -652,12 +642,9 @@ nsHTMLButtonControlFrame::GetFont(nsIPresContext* aPresContext,
NS_IMETHODIMP
nsHTMLButtonControlFrame::GetFormContent(nsIContent*& aContent) const
{
nsIContent* content;
nsresult rv;
rv = GetContent(&content);
aContent = content;
return rv;
aContent = GetContent();
NS_IF_ADDREF(aContent);
return NS_OK;
}
nscoord

View File

@ -271,14 +271,10 @@ nsImageControlFrame::Init(nsIPresContext* aPresContext,
if (!HasView()) {
nsIView* view;
nsresult result = CallCreateInstance(kViewCID, &view);
nsCOMPtr<nsIPresShell> presShell;
aPresContext->GetShell(getter_AddRefs(presShell));
nsCOMPtr<nsIViewManager> viewMan;
presShell->GetViewManager(getter_AddRefs(viewMan));
nsIViewManager* viewMan = aPresContext->GetViewManager();
nsIFrame* parWithView;
GetParentWithView(aPresContext, &parWithView);
nsIView *parView = parWithView->GetView(aPresContext);
nsIFrame* parWithView = GetAncestorWithView();
nsIView *parView = parWithView->GetView();
// the view's size is not know yet, but its size will be kept in synch with our frame.
nsRect boundBox(0, 0, 0, 0);
result = view->Init(viewMan, boundBox, parView);
@ -290,7 +286,7 @@ nsImageControlFrame::Init(nsIPresContext* aPresContext,
// XXX put the view last in document order until we know how to do better
viewMan->InsertChild(parView, view, nsnull, PR_TRUE);
SetView(aPresContext, view);
SetView(view);
}
return rv;
@ -380,11 +376,9 @@ nsImageControlFrame::GetTranslatedRect(nsIPresContext* aPresContext, nsRect& aRe
nsIView* view;
nsPoint viewOffset(0,0);
GetOffsetFromView(aPresContext, viewOffset, &view);
while (nsnull != view) {
nsPoint tempOffset;
view->GetPosition(&tempOffset.x, &tempOffset.y);
viewOffset += tempOffset;
view->GetParent(view);
while (view) {
viewOffset += view->GetPosition();
view = view->GetParent();
}
aRect = nsRect(viewOffset.x, viewOffset.y, mRect.width, mRect.height);
}
@ -432,12 +426,9 @@ nsImageControlFrame::GetFont(nsIPresContext* aPresContext,
NS_IMETHODIMP
nsImageControlFrame::GetFormContent(nsIContent*& aContent) const
{
nsIContent* content;
nsresult rv;
rv = GetContent(&content);
aContent = content;
return rv;
aContent = GetContent();
NS_IF_ADDREF(aContent);
return NS_OK;
}
nscoord

View File

@ -127,10 +127,7 @@ NS_NewListControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
}
#if 0
// set the state flags (if any are provided)
nsFrameState state;
it->GetFrameState( &state );
state |= NS_BLOCK_SPACE_MGR;
it->SetFrameState( state );
it->AddStateBits(NS_BLOCK_SPACE_MGR);
#endif
*aNewFrame = it;
return NS_OK;
@ -636,17 +633,13 @@ void nsListControlFrame::PaintFocus(nsIRenderingContext& aRC, nsFramePaintLayer
if (NS_FAILED(result) || !childframe) return;
// get the child rect
nsRect fRect;
childframe->GetRect(fRect);
nsRect fRect = childframe->GetRect();
// get it into the coordinates of containerFrame
nsIFrame* ancestor;
childframe->GetParent(&ancestor);
while (ancestor && ancestor != containerFrame) {
nsPoint pt;
ancestor->GetOrigin(pt);
fRect += pt;
ancestor->GetParent(&ancestor);
for (nsIFrame* ancestor = childframe->GetParent();
ancestor && ancestor != containerFrame;
ancestor = ancestor->GetParent()) {
fRect += ancestor->GetPosition();
}
PRBool lastItemIsSelected = PR_FALSE;
@ -751,8 +744,7 @@ nsListControlFrame::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);
@ -828,7 +820,7 @@ nsListControlFrame::RestoreState(nsIPresContext* aPresContext,
nsIView* child = nsnull;
nsRect childRect(0,0,0,0);
if (NS_SUCCEEDED(scrollingView->GetScrolledView(child)) && child) {
child->GetBounds(childRect);
childRect = child->GetBounds();
}
x = (int)(((float)childRect.width / w) * x);
y = (int)(((float)childRect.height / h) * y);
@ -878,18 +870,15 @@ GetMaxOptionHeight(nsIPresContext *aPresContext, nsIFrame *aContainer)
nscoord result = 0;
nsIFrame *option;
for (aContainer->FirstChild(aPresContext, nsnull, &option);
option; option->GetNextSibling(&option)) {
option; option = option->GetNextSibling()) {
nscoord optionHeight;
nsCOMPtr<nsIContent> content;
option->GetContent(getter_AddRefs(content));
if (nsCOMPtr<nsIDOMHTMLOptGroupElement>(do_QueryInterface(content))) {
if (nsCOMPtr<nsIDOMHTMLOptGroupElement>
(do_QueryInterface(option->GetContent()))) {
// an optgroup
optionHeight = GetMaxOptionHeight(aPresContext, option);
} else {
// an option
nsSize size;
option->GetSize(size);
optionHeight = size.height;
optionHeight = option->GetSize().height;
}
if (result < optionHeight)
result = optionHeight;
@ -1416,12 +1405,9 @@ nsListControlFrame::Reflow(nsIPresContext* aPresContext,
NS_IMETHODIMP
nsListControlFrame::GetFormContent(nsIContent*& aContent) const
{
nsIContent* content;
nsresult rv;
rv = GetContent(&content);
aContent = content;
return rv;
aContent = GetContent();
NS_IF_ADDREF(aContent);
return NS_OK;
}
nsListControlFrame::ScrollbarStyles
@ -1666,31 +1652,29 @@ nsListControlFrame::CaptureMouseEvents(nsIPresContext* aPresContext, PRBool aGra
{
nsIView* view = nsnull;
if (IsInDropDownMode()) {
view = GetView(aPresContext);
view = GetView();
} else {
nsIFrame* scrolledFrame = nsnull;
GetScrolledFrame(aPresContext, scrolledFrame);
NS_ASSERTION(scrolledFrame, "No scrolled frame found");
NS_ENSURE_TRUE(scrolledFrame, NS_ERROR_FAILURE);
nsIFrame* scrollport = nsnull;
scrolledFrame->GetParent(&scrollport);
nsIFrame* scrollport = scrolledFrame->GetParent();
NS_ASSERTION(scrollport, "No scrollport found");
NS_ENSURE_TRUE(scrollport, NS_ERROR_FAILURE);
view = scrollport->GetView(aPresContext);
view = scrollport->GetView();
}
NS_ASSERTION(view, "no view???");
NS_ENSURE_TRUE(view, NS_ERROR_FAILURE);
nsCOMPtr<nsIViewManager> viewMan;
view->GetViewManager(*getter_AddRefs(viewMan));
nsIViewManager* viewMan = view->GetViewManager();
if (viewMan) {
PRBool result;
// It's not clear why we don't have the widget capture mouse events here.
if (aGrabMouseEvents) {
viewMan->GrabMouseEvents(view,result);
viewMan->GrabMouseEvents(view, result);
mIsCapturingMouseEvents = PR_TRUE;
} else {
nsIView* curGrabber;
@ -2573,21 +2557,10 @@ nsListControlFrame::GetViewOffset(nsIViewManager* aManager, nsIView* aView,
aPoint.x = 0;
aPoint.y = 0;
nsIView *parent;
parent = aView;
while (nsnull != parent) {
nsCOMPtr<nsIViewManager> vm;
parent->GetViewManager(*getter_AddRefs(vm));
if (vm != aManager) {
break;
}
nscoord x, y;
parent->GetPosition(&x, &y);
aPoint.x += x;
aPoint.y += y;
parent->GetParent(parent);
for (nsIView* parent = aView;
parent && parent->GetViewManager() == aManager;
parent = parent->GetParent(parent)) {
aPoint += parent->GetPosition();
}
}
@ -2675,21 +2648,6 @@ nsListControlFrame::DidReflow(nsIPresContext* aPresContext,
}
}
NS_IMETHODIMP nsListControlFrame::MoveTo(nsIPresContext* aPresContext, nscoord aX, nscoord aY)
{
if (PR_TRUE == IsInDropDownMode())
{
//SyncViewWithFrame();
mState &= ~NS_FRAME_SYNC_FRAME_AND_VIEW;
nsresult rv = nsGfxScrollFrame::MoveTo(aPresContext, aX, aY);
mState |= NS_FRAME_SYNC_FRAME_AND_VIEW;
//SyncViewWithFrame();
return rv;
} else {
return nsGfxScrollFrame::MoveTo(aPresContext, aX, aY);
}
}
NS_IMETHODIMP
nsListControlFrame::GetFrameType(nsIAtom** aType) const
{
@ -3133,16 +3091,13 @@ nsListControlFrame::ScrollToFrame(nsIContent* aOptElement)
nscoord y;
scrollableView->GetScrollPosition(x,y);
// get the clipped rect
nsRect rect;
clippedView->GetBounds(rect);
nsRect rect = clippedView->GetBounds();
// now move it by the offset of the scroll position
rect.x = 0;
rect.y = 0;
rect.MoveBy(x,y);
rect.x = x;
rect.y = y;
// get the child
nsRect fRect;
childframe->GetRect(fRect);
nsRect fRect = childframe->GetRect();
nsPoint pnt;
nsIView * view;
childframe->GetOffsetFromView(mPresContext, pnt, &view);
@ -3162,7 +3117,7 @@ nsListControlFrame::ScrollToFrame(nsIContent* aOptElement)
nsIFrame * optFrame;
result = presShell->GetPrimaryFrameFor(parentContent, &optFrame);
if (NS_SUCCEEDED(result) && optFrame) {
optFrame->GetRect(optRect);
optRect = optFrame->GetRect();
}
}
fRect.y += optRect.y;
@ -3617,7 +3572,7 @@ nsListEventListener::SetFrame(nsListControlFrame *aFrame)
mFrame.SetReference(aFrame->WeakReferent());
if (aFrame)
{
aFrame->GetContent(getter_AddRefs(mContent));
mContent = aFrame->GetContent();
}
return NS_OK;
}

View File

@ -209,7 +209,6 @@ public:
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus);
NS_IMETHOD MoveTo(nsIPresContext* aPresContext, nscoord aX, nscoord aY);
NS_IMETHOD Destroy(nsIPresContext *aPresContext);
NS_IMETHOD Paint(nsIPresContext* aPresContext,

View File

@ -381,12 +381,11 @@ nsTextInputListener::EditAction()
nsresult
nsTextInputListener::UpdateTextInputCommands(const nsAString& commandsToUpdate)
{
nsCOMPtr<nsIContent> content;
nsresult rv = mFrame->GetContent(getter_AddRefs(content));
nsIContent* content = mFrame->GetContent();
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
nsCOMPtr<nsIDocument> doc;
rv = content->GetDocument(getter_AddRefs(doc));
nsresult rv = content->GetDocument(getter_AddRefs(doc));
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
nsCOMPtr<nsIScriptGlobalObject> scriptGlobalObject;
@ -2178,12 +2177,9 @@ nsTextControlFrame::GetFont(nsIPresContext* aPresContext,
NS_IMETHODIMP
nsTextControlFrame::GetFormContent(nsIContent*& aContent) const
{
nsIContent* content;
nsresult rv;
rv = GetContent(&content);
aContent = content;
return rv;
aContent = GetContent();
NS_IF_ADDREF(aContent);
return NS_OK;
}
NS_IMETHODIMP nsTextControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAString& aValue)
@ -3079,13 +3075,10 @@ nsTextControlFrame::SetInitialChildList(nsIPresContext* aPresContext,
nsIFrame* aChildList)
{
/*nsIFrame *list = aChildList;
nsFrameState frameState;
while (list)
{
list->GetFrameState(&frameState);
frameState |= NS_FRAME_INDEPENDENT_SELECTION;
list->SetFrameState(frameState);
list->GetNextSibling(&list);
list->AddStateBits(NS_FRAME_INDEPENDENT_SELECTION);
list = list->GetNextSibling();
}
*/
nsresult rv = nsBoxFrame::SetInitialChildList(aPresContext, aListName, aChildList);
@ -3098,10 +3091,7 @@ nsTextControlFrame::SetInitialChildList(nsIPresContext* aPresContext,
// Mark the scroll frame as being a reflow root. This will allow
// incremental reflows to be initiated at the scroll frame, rather
// than descending from the root frame of the frame hierarchy.
nsFrameState state;
first->GetFrameState(&state);
state |= NS_FRAME_REFLOW_ROOT;
first->SetFrameState(state);
first->AddStateBits(NS_FRAME_REFLOW_ROOT);
//we must turn off scrollbars for singleline text controls
if (IsSingleLineTextControl())
@ -3130,7 +3120,7 @@ nsTextControlFrame::SetInitialChildList(nsIPresContext* aPresContext,
while(first)
{
nsIView *view = first->GetView(aPresContext);
nsIView *view = first->GetView();
if (view)
{
nsIScrollableView *scrollView;
@ -3189,7 +3179,7 @@ nsTextControlFrame::GetScrollableView(nsIPresContext* aPresContext,
rv = view->QueryInterface(NS_GET_IID(nsIScrollableView), (void **)&scrollableView);
if (NS_SUCCEEDED(rv) && scrollableView)
*aView = scrollableView;
view->GetParent(view);
view = view->GetParent();
}
}
return rv;