ongoing deCOMtamination work. r+sr=dbaron

This commit is contained in:
roc+%cs.cmu.edu 2003-06-27 18:13:48 +00:00
Родитель 071310bd47
Коммит de3cc3b4cb
12 изменённых файлов: 170 добавлений и 312 удалений

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

@ -102,9 +102,8 @@ nsBlockReflowContext::ComputeCollapsedTopMargin(nsIPresContext* aPresContext,
// top-padding then this step is skipped because it will be a margin
// root. It is also skipped if the frame is a margin root for other
// reasons.
nsFrameState state;
if (0 == aRS.mComputedBorderPadding.top &&
(aRS.frame->GetFrameState(&state), !(state & NS_BLOCK_MARGIN_ROOT))) {
!(aRS.frame->GetStateBits() & NS_BLOCK_MARGIN_ROOT)) {
nsBlockFrame* bf;
if (NS_SUCCEEDED(aRS.frame->QueryInterface(kBlockFrameCID,
NS_REINTERPRET_CAST(void**, &bf)))) {
@ -327,9 +326,7 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
// line). In this case the reason will be wrong so we need to check
// the frame state.
aFrameRS.reason = eReflowReason_Resize;
nsFrameState state;
mFrame->GetFrameState(&state);
if (NS_FRAME_FIRST_REFLOW & state) {
if (NS_FRAME_FIRST_REFLOW & mFrame->GetStateBits()) {
aFrameRS.reason = eReflowReason_Initial;
}
else if (mOuterReflowState.reason == eReflowReason_Incremental) {
@ -351,7 +348,7 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
if (type == eReflowType_StyleChanged)
aFrameRS.reason = eReflowReason_StyleChange;
else if (type == eReflowType_ReflowDirty &&
(state & NS_FRAME_IS_DIRTY) &&
(mFrame->GetStateBits() & NS_FRAME_IS_DIRTY) &&
!frameIsOnReflowPath) {
aFrameRS.reason = eReflowReason_Dirty;
}
@ -361,7 +358,7 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
aFrameRS.reason = eReflowReason_StyleChange;
}
else if (mOuterReflowState.reason == eReflowReason_Dirty) {
if (state & NS_FRAME_IS_DIRTY)
if (mFrame->GetStateBits() & NS_FRAME_IS_DIRTY)
aFrameRS.reason = eReflowReason_Dirty;
}
@ -435,12 +432,8 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
nscoord frameWidth;
if (NS_UNCONSTRAINEDSIZE == aFrameRS.mComputedWidth) {
nsSize frameSize;
// Use the current frame width
mFrame->GetSize(frameSize);
frameWidth = frameSize.width;
frameWidth = mFrame->GetSize().width;
} else {
frameWidth = aFrameRS.mComputedWidth +
aFrameRS.mComputedBorderPadding.left +
@ -466,11 +459,9 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
// width to determine where it will be placed horizontally
if (aFrameRS.reason != eReflowReason_Initial) {
nsBlockHorizontalAlign align;
nsSize size;
mFrame->GetSize(size);
align.mXOffset = x;
AlignBlockHorizontally(size.width, align);
AlignBlockHorizontally(mFrame->GetSize().width, align);
// Don't reset "mX". because PlaceBlock() will recompute the
// x-offset and expects "mX" to be at the left margin edge
x = align.mXOffset;
@ -489,7 +480,7 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
// Position it and its view (if it has one)
// Note: Use "x" and "y" and not "mX" and "mY" because they more accurately
// represents where we think the block will be placed
mFrame->MoveTo(mPresContext, x, y);
mFrame->SetPosition(nsPoint(x, y));
nsContainerFrame::PositionFrameView(mPresContext, mFrame);
#ifdef DEBUG
@ -595,8 +586,7 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
}
#endif
mFrame->GetFrameState(&state);
if (0 == (NS_FRAME_OUTSIDE_CHILDREN & state)) {
if (!(NS_FRAME_OUTSIDE_CHILDREN & mFrame->GetStateBits())) {
// Provide overflow area for child that doesn't have any
mMetrics.mOverflowArea.x = 0;
mMetrics.mOverflowArea.y = 0;
@ -608,11 +598,11 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
// the NS_FRAME_FIRST_REFLOW bit is cleared so that never give it an
// initial reflow reason again.
if (eReflowReason_Initial == aFrameRS.reason) {
mFrame->SetFrameState(state & ~NS_FRAME_FIRST_REFLOW);
mFrame->RemoveStateBits(NS_FRAME_FIRST_REFLOW);
}
if (!NS_INLINE_IS_BREAK_BEFORE(aFrameReflowStatus) ||
(state & NS_FRAME_OUT_OF_FLOW)) {
(mFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
// If frame is complete and has a next-in-flow, we need to delete
// them now. Do not do this when a break-before is signaled because
// the frame is going to get reflowed again (and may end up wanting
@ -625,9 +615,8 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
// the right parent to do the removal (it's possible that the
// parent is not this because we are executing pullup code)
/* XXX promote DeleteChildsNextInFlow to nsIFrame to elminate this cast */
nsHTMLContainerFrame* parent;
kidNextInFlow->GetParent((nsIFrame**)&parent);
parent->DeleteNextInFlowChild(mPresContext, kidNextInFlow);
NS_STATIC_CAST(nsHTMLContainerFrame*, kidNextInFlow->GetParent())
->DeleteNextInFlowChild(mPresContext, kidNextInFlow);
}
}
}

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

@ -493,9 +493,8 @@ nsBlockReflowState::RecoverFloaters(nsLineList::iterator aLine,
if (aDeltaY != 0) {
fc->mRegion.y += aDeltaY;
fc->mCombinedArea.y += aDeltaY;
nsPoint p;
floater->GetOrigin(p);
floater->MoveTo(mPresContext, p.x, p.y + aDeltaY);
nsPoint p = floater->GetPosition();
floater->SetPosition(nsPoint(p.x, p.y + aDeltaY));
}
#ifdef DEBUG
if (nsBlockFrame::gNoisyReflow || nsBlockFrame::gNoisySpaceManager) {
@ -855,8 +854,7 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
nsRect region;
// The floater's old region, so we can propagate damage.
nsRect oldRegion;
floater->GetRect(oldRegion);
nsRect oldRegion = floater->GetRect();
oldRegion.Inflate(aFloaterCache->mMargins);
// Enforce CSS2 9.5.1 rule [2], i.e., make sure that a float isn't
@ -877,7 +875,7 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
mBlock->ReflowFloater(*this, placeholder, aFloaterCache, aReflowStatus);
// Get the floaters bounding box and margin information
floater->GetRect(region);
region = floater->GetRect();
#ifdef DEBUG
if (nsBlockFrame::gNoisyReflow) {
@ -934,8 +932,7 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
if(nsLayoutAtoms::tableOuterFrame == atom) {
//see if it has "align="
// IE makes a difference between align and he float property
nsCOMPtr<nsIContent> content;
prevFrame->GetContent(getter_AddRefs(content));
nsIContent* content = prevFrame->GetContent();
if (content) {
nsAutoString value;
if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttr(kNameSpaceID_None, nsHTMLAtoms::align, value)) {
@ -959,7 +956,7 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
// reflow the floater again now since we have more space
mBlock->ReflowFloater(*this, placeholder, aFloaterCache, aReflowStatus);
// Get the floaters bounding box and margin information
floater->GetRect(region);
region = floater->GetRect();
// Adjust the floater size by its margin. That's the area that will
// impact the space manager.
region.width += aFloaterCache->mMargins.left + aFloaterCache->mMargins.right;
@ -972,27 +969,25 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
nsIFrame* prevInFlow;
floater->GetPrevInFlow(&prevInFlow);
if (prevInFlow) {
prevInFlow->GetRect(prevRect);
prevRect = prevInFlow->GetRect();
nsCOMPtr<nsIPresShell> presShell;
mPresContext->GetShell(getter_AddRefs(presShell));
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
nsIFrame *placeParent, *placeParentPrev, *prevPlace, *prevPlaceParent;
nsIFrame *placeParentPrev, *prevPlace;
// If prevInFlow's placeholder is in a block that wasn't continued, we need to adjust
// prevRect.x to account for the missing frame offsets.
placeholder->GetParent(&placeParent);
nsIFrame* placeParent = placeholder->GetParent();
placeParent->GetPrevInFlow(&placeParentPrev);
frameManager->GetPlaceholderFrameFor(prevInFlow, &prevPlace);
prevPlace->GetParent(&prevPlaceParent);
nsIFrame* prevPlaceParent = prevPlace->GetParent();
for (nsIFrame* ancestor = prevPlaceParent;
ancestor && (ancestor != placeParentPrev);
ancestor->GetParent(&ancestor)) {
nsRect rect;
ancestor->GetRect(rect);
prevRect.x += rect.x;
ancestor = ancestor->GetParent()) {
prevRect.x += ancestor->GetRect().x;
}
}
// Assign an x and y coordinate to the floater. Note that the x,y
@ -1099,7 +1094,7 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
// Position the floater and make sure and views are properly
// positioned. We need to explicitly position its child views as
// well, since we're moving the floater after flowing it.
floater->MoveTo(mPresContext, x, y);
floater->SetPosition(nsPoint(x, y));
nsContainerFrame::PositionFrameView(mPresContext, floater);
nsContainerFrame::PositionChildViews(mPresContext, floater);
@ -1129,8 +1124,7 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
#ifdef DEBUG
if (nsBlockFrame::gNoisyReflow) {
nsRect r;
floater->GetRect(r);
nsRect r = floater->GetRect();
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
printf("placed floater: ");
nsFrame::ListTag(stdout, floater);

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

@ -1723,10 +1723,7 @@ NS_IMETHODIMP nsBulletFrame::OnStartContainer(imgIRequest *aRequest,
mParent->FirstChild(mPresContext, nsnull, &frame);
NS_ASSERTION(frame, "No frame to mark dirty for bullet frame.");
if (frame) {
nsFrameState state;
frame->GetFrameState(&state);
state |= NS_FRAME_IS_DIRTY;
frame->SetFrameState(state);
frame->AddStateBits(NS_FRAME_IS_DIRTY);
mParent->ReflowDirtyChild(shell, frame);
}
}

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

@ -409,12 +409,8 @@ static PRBool
TranslatePointTo(nsPoint& aPoint, nsIView* aChildView, nsIView* aParentView)
{
do {
nscoord x, y;
aChildView->GetPosition(&x, &y);
aPoint.x += x;
aPoint.y += y;
aChildView->GetParent(aChildView);
aPoint += aChildView->GetPosition();
aChildView = aChildView->GetParent();
} while (aChildView && (aChildView != aParentView));
return aChildView == aParentView;
@ -433,15 +429,13 @@ nsContainerFrame::PositionFrameView(nsIPresContext* aPresContext,
nsIView* view = aKidFrame->GetView();
// Position view relative to its parent, not relative to aKidFrame's
// frame which may not have a view
nsIView* parentView;
view->GetParent(parentView);
nsIView* parentView = view->GetParent();
nsIView* containingView;
nsPoint origin;
aKidFrame->GetOffsetFromView(aPresContext, origin, &containingView);
nsCOMPtr<nsIViewManager> vm;
view->GetViewManager(*getter_AddRefs(vm));
nsIViewManager* vm = view->GetViewManager();
// it's possible for the parentView to be nonnull but containingView to be
// null, when the parent view doesn't belong to this frame tree but to
@ -450,7 +444,7 @@ nsContainerFrame::PositionFrameView(nsIPresContext* aPresContext,
if (nsnull != containingView && containingView != parentView) {
NS_ERROR("This hack should not be needed now!!! See bug 126263.");
// XXX roc this is no longer needed; remove it!!
// XXX roc this should be no longer needed, but it still is for printing/print preview
// it is possible for parent view not to have a frame attached to it
// kind of an anonymous view. This happens with native scrollbars and
@ -459,17 +453,13 @@ nsContainerFrame::PositionFrameView(nsIPresContext* aPresContext,
// the HACK below. COMBO box code should NOT be in the container code!!!
// And the case it looks from does not just happen for combo boxes. Native
// scrollframes get in this situation too!!
while(parentView) {
void *data = 0;
parentView->GetClientData(data);
while (parentView) {
void *data = parentView->GetClientData();
if (data)
break;
nscoord x, y;
parentView->GetPosition(&x, &y);
origin.x -= x;
origin.y -= y;
parentView->GetParent(parentView);
origin -= parentView->GetPosition();
parentView = parentView->GetParent();
}
if (containingView != parentView)
@ -545,8 +535,7 @@ SyncFrameViewGeometryDependentProperties(nsIPresContext* aPresContext,
nsIView* aView,
PRUint32 aFlags)
{
nsCOMPtr<nsIViewManager> vm;
aView->GetViewManager(*getter_AddRefs(vm));
nsIViewManager* vm = aView->GetViewManager();
PRBool isCanvas;
const nsStyleBackground* bg;
@ -570,8 +559,7 @@ SyncFrameViewGeometryDependentProperties(nsIPresContext* aPresContext,
if (isCanvas) {
nsIView* rootView;
vm->GetRootView(rootView);
nsIView* rootParent;
rootView->GetParent(rootParent);
nsIView* rootParent = rootView->GetParent();
if (!rootParent) {
// We're the root of a view manager hierarchy. We will have to
// paint something. NOTE: this can be overridden below.
@ -590,13 +578,11 @@ SyncFrameViewGeometryDependentProperties(nsIPresContext* aPresContext,
if (!parentDoc && rootElem && rootElem->IsContentOfType(nsIContent::eXUL)) {
// we're XUL at the root of the document hierarchy. Try to make our
// window translucent.
nsCOMPtr<nsIWidget> widget;
aView->GetWidget(*getter_AddRefs(widget));
// don't proceed unless this is the root view
// (sometimes the non-root-view is a canvas)
if (widget && aView == rootView) {
if (aView->HasWidget() && aView == rootView) {
viewHasTransparentContent = hasBG && (bg->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT);
widget->SetWindowTranslucency(viewHasTransparentContent);
aView->GetWidget()->SetWindowTranslucency(viewHasTransparentContent);
}
}
}
@ -608,10 +594,8 @@ SyncFrameViewGeometryDependentProperties(nsIPresContext* aPresContext,
if (!viewHasTransparentContent) {
// If we're showing the view but the frame is hidden, then the view is transparent
nsViewVisibility visibility;
aView->GetVisibility(visibility);
const nsStyleVisibility* vis = aStyleContext->GetStyleVisibility();
if ((nsViewVisibility_kShow == visibility
if ((nsViewVisibility_kShow == aView->GetVisibility()
&& NS_STYLE_VISIBILITY_HIDDEN == vis->mVisible)
|| (NS_STYLE_OVERFLOW_VISIBLE == display->mOverflow
&& (kidState & NS_FRAME_OUTSIDE_CHILDREN) != 0)) {
@ -683,12 +667,8 @@ SyncFrameViewGeometryDependentProperties(nsIPresContext* aPresContext,
}
}
nsRect newSize;
aView->GetBounds(newSize);
nscoord x, y;
aView->GetPosition(&x, &y);
newSize.x -= x;
newSize.y -= y;
nsRect newSize = aView->GetBounds();
newSize -= aView->GetPosition();
// If part of the view is being clipped out, then mark it transparent
if (clipRect.y > newSize.y
@ -727,10 +707,7 @@ nsContainerFrame::SyncFrameViewAfterReflow(nsIPresContext* aPresContext,
}
if (0 == (aFlags & NS_FRAME_NO_SIZE_VIEW)) {
nsCOMPtr<nsIViewManager> vm;
aView->GetViewManager(*getter_AddRefs(vm));
nsRect oldBounds;
aView->GetBounds(oldBounds);
nsIViewManager* vm = aView->GetViewManager();
// If the frame has child frames that stick outside the content
// area, then size the view large enough to include those child
@ -783,8 +760,7 @@ nsContainerFrame::SyncFrameViewProperties(nsIPresContext* aPresContext,
return;
}
nsCOMPtr<nsIViewManager> vm;
aView->GetViewManager(*getter_AddRefs(vm));
nsIViewManager* vm = aView->GetViewManager();
if (nsnull == aStyleContext) {
aStyleContext = aFrame->GetStyleContext();
@ -812,8 +788,7 @@ nsContainerFrame::SyncFrameViewProperties(nsIPresContext* aPresContext,
viewIsVisible = PR_FALSE;
} else {
// if the view is for a popup, don't show the view if the popup is closed
nsCOMPtr<nsIWidget> widget;
aView->GetWidget(*getter_AddRefs(widget));
nsIWidget* widget = aView->GetWidget();
if (widget) {
nsWindowType windowType;
widget->GetWindowType(windowType);

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

@ -169,10 +169,13 @@ nsFirstLetterFrame::SetSelected(nsIPresContext* aPresContext, nsIDOMRange *aRang
return NS_OK;
nsIFrame *child;
nsresult result = FirstChild(aPresContext, nsnull, &child);
while (NS_SUCCEEDED(result) && child)
if (NS_FAILED(result))
return NS_OK;
while (child)
{
child->SetSelected(aPresContext,aRange, aSelected,aSpread);//dont worry about result. there are more frames to come
result = child->GetNextSibling(&child);
child->SetSelected(aPresContext, aRange, aSelected, aSpread);
// don't worry about result. there are more frames to come
child = child->GetNextSibling();
}
return NS_OK;
}
@ -252,8 +255,7 @@ nsFirstLetterFrame::Reflow(nsIPresContext* aPresContext,
}
// Place and size the child and update the output metrics
kid->MoveTo(aPresContext, bp.left, bp.top);
kid->SizeTo(aPresContext, aMetrics.width, aMetrics.height);
kid->SetRect(nsRect(bp.left, bp.top, aMetrics.width, aMetrics.height));
kid->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
aMetrics.width += lr;
aMetrics.height += tb;
@ -268,11 +270,10 @@ nsFirstLetterFrame::Reflow(nsIPresContext* aPresContext,
if (NS_FRAME_IS_COMPLETE(aReflowStatus)) {
nsIFrame* kidNextInFlow;
kid->GetNextInFlow(&kidNextInFlow);
if (nsnull != kidNextInFlow) {
if (kidNextInFlow) {
// Remove all of the childs next-in-flows
nsContainerFrame* parent;
kidNextInFlow->GetParent((nsIFrame**)&parent);
parent->DeleteNextInFlowChild(aPresContext, kidNextInFlow);
NS_STATIC_CAST(nsContainerFrame*, kidNextInFlow->GetParent())
->DeleteNextInFlowChild(aPresContext, kidNextInFlow);
}
}
else {
@ -290,8 +291,7 @@ nsFirstLetterFrame::Reflow(nsIPresContext* aPresContext,
SetOverflowFrames(aPresContext, nextInFlow);
}
else {
nsIFrame* nextSib;
kid->GetNextSibling(&nextSib);
nsIFrame* nextSib = kid->GetNextSibling();
if (nextSib) {
kid->SetNextSibling(nsnull);
SetOverflowFrames(aPresContext, nextSib);
@ -328,7 +328,7 @@ nsFirstLetterFrame::DrainOverflowFrames(nsIPresContext* aPresContext)
nsIFrame* f = overflowFrames;
while (f) {
nsHTMLContainerFrame::ReparentFrameView(aPresContext, f, prevInFlow, this);
f->GetNextSibling(&f);
f = f->GetNextSibling();
}
mFrames.InsertFrames(this, nsnull, overflowFrames);
}
@ -347,8 +347,7 @@ nsFirstLetterFrame::DrainOverflowFrames(nsIPresContext* aPresContext)
nsIFrame* kid = mFrames.FirstChild();
if (kid) {
nsRefPtr<nsStyleContext> sc;
nsCOMPtr<nsIContent> kidContent;
kid->GetContent(getter_AddRefs(kidContent));
nsIContent* kidContent = kid->GetContent();
if (kidContent) {
NS_ASSERTION(kidContent->IsContentOfType(nsIContent::eTEXT),
"should contain only text nodes");

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

@ -528,8 +528,7 @@ nsFrame::Init(nsIPresContext* aPresContext,
if (aPrevInFlow) {
// Make sure the general flags bits are the same
nsFrameState state;
aPrevInFlow->GetFrameState(&state);
nsFrameState state = aPrevInFlow->GetStateBits();
// Make bits that are currently on (see constructor) the same:
mState &= state | ~(NS_FRAME_SYNC_FRAME_AND_VIEW);
@ -541,8 +540,7 @@ nsFrame::Init(nsIPresContext* aPresContext,
NS_FRAME_IS_SPECIAL);
}
if (mParent) {
nsFrameState state;
mParent->GetFrameState(&state);
nsFrameState state = mParent->GetStateBits();
// Make bits that are currently off (see constructor) the same:
mState |= state & (NS_FRAME_INDEPENDENT_SELECTION |
@ -617,7 +615,7 @@ nsFrame::Destroy(nsIPresContext* aPresContext)
// Get the view pointer now before the frame properties disappear
// when we call NotifyDestroyingFrame()
nsIView* view = GetView(aPresContext);
nsIView* view = GetView();
// XXX Rather than always doing this it would be better if it was part of
// a frame observer mechanism and the pres shell could register as an
@ -774,17 +772,14 @@ nsFrame::SetOverflowClipRect(nsIRenderingContext& aRenderingContext)
*********************************************************/
static void RefreshAllContentFrames(nsIPresContext* aPresContext, nsIFrame * aFrame, nsIContent * aContent)
{
nsIContent* frameContent;
aFrame->GetContent(&frameContent);
if (frameContent == aContent) {
if (aFrame->GetContent() == aContent) {
ForceDrawFrame(aPresContext, (nsFrame *)aFrame);
}
NS_IF_RELEASE(frameContent);
aFrame->FirstChild(aPresContext, nsnull, &aFrame);
while (aFrame) {
RefreshAllContentFrames(aPresContext, aFrame, aContent);
aFrame->GetNextSibling(&aFrame);
aFrame = aFrame->GetNextSibling();
}
}
@ -797,26 +792,22 @@ static void RefreshAllContentFrames(nsIPresContext* aPresContext, nsIFrame * aFr
*/
void ForceDrawFrame(nsIPresContext* aPresContext, nsFrame * aFrame)//, PRBool)
{
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, 0);
NS_RELEASE(viewMgr);
}
//viewMgr->UpdateView(view, rect, NS_VMREFRESH_DOUBLE_BUFFER | NS_VMREFRESH_IMMEDIATE);
}
}
@ -850,9 +841,7 @@ nsFrame::Paint(nsIPresContext* aPresContext,
//check frame selection state
PRBool isSelected;
nsFrameState frameState;
GetFrameState(&frameState);
isSelected = (frameState & NS_FRAME_SELECTED_CONTENT) == NS_FRAME_SELECTED_CONTENT;
isSelected = (GetStateBits() & NS_FRAME_SELECTED_CONTENT) == NS_FRAME_SELECTED_CONTENT;
//if not selected then return
if (!isSelected)
return NS_OK; //nothing to do
@ -897,8 +886,7 @@ nsFrame::Paint(nsIPresContext* aPresContext,
if (details)
{
nsRect rect;
GetRect(rect);
nsRect rect = GetRect();
rect.width-=2;
rect.height-=2;
rect.x=1; //we are in the coordinate system of the frame now with regards to the rendering context.
@ -974,7 +962,9 @@ nsFrame::GetContentForEvent(nsIPresContext* aPresContext,
nsEvent* aEvent,
nsIContent** aContent)
{
return GetContent(aContent);
*aContent = GetContent();
NS_IF_ADDREF(*aContent);
return NS_OK;
}
/**
@ -1094,24 +1084,18 @@ nsFrame::GetDataForTableSelection(nsIFrameSelection *aFrameSelection,
// or select column when along top edge?
break;
} else {
result = frame->GetParent(&frame);
frame = frame->GetParent();
result = NS_OK;
// Stop if we have hit the selection's limiting content node
if (frame)
{
nsIContent* frameContent;
frame->GetContent(&frameContent);
if (frameContent == limiter.get())
break;
}
if (frame && frame->GetContent() == limiter.get())
break;
}
}
}
// We aren't in a cell or table
if (!foundCell && !foundTable) return NS_OK;
nsCOMPtr<nsIContent> tableOrCellContent;
result = frame->GetContent(getter_AddRefs(tableOrCellContent));
if (NS_FAILED(result)) return result;
nsIContent* tableOrCellContent = frame->GetContent();
if (!tableOrCellContent) return NS_ERROR_FAILURE;
nsCOMPtr<nsIContent> parentContent;
@ -1160,7 +1144,7 @@ nsFrame::FrameOrParentHasSpecialSelectionStyle(PRUint8 aSelectionStyle, nsIFrame
return NS_OK;
}
thisFrame->GetParent(&thisFrame);
thisFrame = thisFrame->GetParent();
}
*foundFrame = nsnull;
@ -1191,11 +1175,10 @@ nsFrame::IsSelectable(PRBool* aSelectable, PRUint8* aSelectStyle) const
// _MOZ_ALL -> TEXT -> AUTO -> AUTO, the returned value is _MOZ_ALL
// AUTO -> CELL -> TEXT -> AUTO, the returned value is TEXT
//
nsresult result = NS_OK;
PRUint8 selectStyle = NS_STYLE_USER_SELECT_AUTO;
nsIFrame* frame = (nsIFrame*)this;
while (frame && NS_SUCCEEDED(result)) {
while (frame) {
const nsStyleUIReset* userinterface = frame->GetStyleUIReset();
switch (userinterface->mUserSelect) {
case NS_STYLE_USER_SELECT_ALL:
@ -1211,7 +1194,7 @@ nsFrame::IsSelectable(PRBool* aSelectable, PRUint8* aSelectStyle) const
}
break;
}
result = frame->GetParent(&frame);
frame = frame->GetParent();
}
// convert internal values to standard values
@ -1250,7 +1233,6 @@ ContentContainsPoint(nsIPresContext *aPresContext,
if (NS_FAILED(rv) || !frame) return PR_FALSE;
nsIView *frameView = nsnull;
nsRect frameRect;
nsPoint offsetPoint;
// Get the view that contains the content's frame.
@ -1270,16 +1252,9 @@ ContentContainsPoint(nsIPresContext *aPresContext,
// of aRelativeView and walk up the view hierarchy calculating what
// the actual point is, relative to frameView.
nsPoint viewOffset(0, 0);
while (aRelativeView && aRelativeView != frameView) {
aRelativeView->GetPosition(&viewOffset.x, &viewOffset.y);
point.x += viewOffset.x;
point.y += viewOffset.y;
rv = aRelativeView->GetParent(aRelativeView);
if (NS_FAILED(rv)) return PR_FALSE;
point += aRelativeView->GetPosition();
aRelativeView = aRelativeView->GetParent();
}
// At this point the point should be in the correct
@ -1295,7 +1270,7 @@ ContentContainsPoint(nsIPresContext *aPresContext,
// Get the frame's rect and make it relative to the
// upper left corner of it's parent view.
frame->GetRect(frameRect);
nsRect frameRect = frame->GetRect();
frameRect.x = offsetPoint.x;
frameRect.y = offsetPoint.y;

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

@ -102,9 +102,8 @@ nsBlockReflowContext::ComputeCollapsedTopMargin(nsIPresContext* aPresContext,
// top-padding then this step is skipped because it will be a margin
// root. It is also skipped if the frame is a margin root for other
// reasons.
nsFrameState state;
if (0 == aRS.mComputedBorderPadding.top &&
(aRS.frame->GetFrameState(&state), !(state & NS_BLOCK_MARGIN_ROOT))) {
!(aRS.frame->GetStateBits() & NS_BLOCK_MARGIN_ROOT)) {
nsBlockFrame* bf;
if (NS_SUCCEEDED(aRS.frame->QueryInterface(kBlockFrameCID,
NS_REINTERPRET_CAST(void**, &bf)))) {
@ -327,9 +326,7 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
// line). In this case the reason will be wrong so we need to check
// the frame state.
aFrameRS.reason = eReflowReason_Resize;
nsFrameState state;
mFrame->GetFrameState(&state);
if (NS_FRAME_FIRST_REFLOW & state) {
if (NS_FRAME_FIRST_REFLOW & mFrame->GetStateBits()) {
aFrameRS.reason = eReflowReason_Initial;
}
else if (mOuterReflowState.reason == eReflowReason_Incremental) {
@ -351,7 +348,7 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
if (type == eReflowType_StyleChanged)
aFrameRS.reason = eReflowReason_StyleChange;
else if (type == eReflowType_ReflowDirty &&
(state & NS_FRAME_IS_DIRTY) &&
(mFrame->GetStateBits() & NS_FRAME_IS_DIRTY) &&
!frameIsOnReflowPath) {
aFrameRS.reason = eReflowReason_Dirty;
}
@ -361,7 +358,7 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
aFrameRS.reason = eReflowReason_StyleChange;
}
else if (mOuterReflowState.reason == eReflowReason_Dirty) {
if (state & NS_FRAME_IS_DIRTY)
if (mFrame->GetStateBits() & NS_FRAME_IS_DIRTY)
aFrameRS.reason = eReflowReason_Dirty;
}
@ -435,12 +432,8 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
nscoord frameWidth;
if (NS_UNCONSTRAINEDSIZE == aFrameRS.mComputedWidth) {
nsSize frameSize;
// Use the current frame width
mFrame->GetSize(frameSize);
frameWidth = frameSize.width;
frameWidth = mFrame->GetSize().width;
} else {
frameWidth = aFrameRS.mComputedWidth +
aFrameRS.mComputedBorderPadding.left +
@ -466,11 +459,9 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
// width to determine where it will be placed horizontally
if (aFrameRS.reason != eReflowReason_Initial) {
nsBlockHorizontalAlign align;
nsSize size;
mFrame->GetSize(size);
align.mXOffset = x;
AlignBlockHorizontally(size.width, align);
AlignBlockHorizontally(mFrame->GetSize().width, align);
// Don't reset "mX". because PlaceBlock() will recompute the
// x-offset and expects "mX" to be at the left margin edge
x = align.mXOffset;
@ -489,7 +480,7 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
// Position it and its view (if it has one)
// Note: Use "x" and "y" and not "mX" and "mY" because they more accurately
// represents where we think the block will be placed
mFrame->MoveTo(mPresContext, x, y);
mFrame->SetPosition(nsPoint(x, y));
nsContainerFrame::PositionFrameView(mPresContext, mFrame);
#ifdef DEBUG
@ -595,8 +586,7 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
}
#endif
mFrame->GetFrameState(&state);
if (0 == (NS_FRAME_OUTSIDE_CHILDREN & state)) {
if (!(NS_FRAME_OUTSIDE_CHILDREN & mFrame->GetStateBits())) {
// Provide overflow area for child that doesn't have any
mMetrics.mOverflowArea.x = 0;
mMetrics.mOverflowArea.y = 0;
@ -608,11 +598,11 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
// the NS_FRAME_FIRST_REFLOW bit is cleared so that never give it an
// initial reflow reason again.
if (eReflowReason_Initial == aFrameRS.reason) {
mFrame->SetFrameState(state & ~NS_FRAME_FIRST_REFLOW);
mFrame->RemoveStateBits(NS_FRAME_FIRST_REFLOW);
}
if (!NS_INLINE_IS_BREAK_BEFORE(aFrameReflowStatus) ||
(state & NS_FRAME_OUT_OF_FLOW)) {
(mFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
// If frame is complete and has a next-in-flow, we need to delete
// them now. Do not do this when a break-before is signaled because
// the frame is going to get reflowed again (and may end up wanting
@ -625,9 +615,8 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
// the right parent to do the removal (it's possible that the
// parent is not this because we are executing pullup code)
/* XXX promote DeleteChildsNextInFlow to nsIFrame to elminate this cast */
nsHTMLContainerFrame* parent;
kidNextInFlow->GetParent((nsIFrame**)&parent);
parent->DeleteNextInFlowChild(mPresContext, kidNextInFlow);
NS_STATIC_CAST(nsHTMLContainerFrame*, kidNextInFlow->GetParent())
->DeleteNextInFlowChild(mPresContext, kidNextInFlow);
}
}
}

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

@ -493,9 +493,8 @@ nsBlockReflowState::RecoverFloaters(nsLineList::iterator aLine,
if (aDeltaY != 0) {
fc->mRegion.y += aDeltaY;
fc->mCombinedArea.y += aDeltaY;
nsPoint p;
floater->GetOrigin(p);
floater->MoveTo(mPresContext, p.x, p.y + aDeltaY);
nsPoint p = floater->GetPosition();
floater->SetPosition(nsPoint(p.x, p.y + aDeltaY));
}
#ifdef DEBUG
if (nsBlockFrame::gNoisyReflow || nsBlockFrame::gNoisySpaceManager) {
@ -855,8 +854,7 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
nsRect region;
// The floater's old region, so we can propagate damage.
nsRect oldRegion;
floater->GetRect(oldRegion);
nsRect oldRegion = floater->GetRect();
oldRegion.Inflate(aFloaterCache->mMargins);
// Enforce CSS2 9.5.1 rule [2], i.e., make sure that a float isn't
@ -877,7 +875,7 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
mBlock->ReflowFloater(*this, placeholder, aFloaterCache, aReflowStatus);
// Get the floaters bounding box and margin information
floater->GetRect(region);
region = floater->GetRect();
#ifdef DEBUG
if (nsBlockFrame::gNoisyReflow) {
@ -934,8 +932,7 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
if(nsLayoutAtoms::tableOuterFrame == atom) {
//see if it has "align="
// IE makes a difference between align and he float property
nsCOMPtr<nsIContent> content;
prevFrame->GetContent(getter_AddRefs(content));
nsIContent* content = prevFrame->GetContent();
if (content) {
nsAutoString value;
if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttr(kNameSpaceID_None, nsHTMLAtoms::align, value)) {
@ -959,7 +956,7 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
// reflow the floater again now since we have more space
mBlock->ReflowFloater(*this, placeholder, aFloaterCache, aReflowStatus);
// Get the floaters bounding box and margin information
floater->GetRect(region);
region = floater->GetRect();
// Adjust the floater size by its margin. That's the area that will
// impact the space manager.
region.width += aFloaterCache->mMargins.left + aFloaterCache->mMargins.right;
@ -972,27 +969,25 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
nsIFrame* prevInFlow;
floater->GetPrevInFlow(&prevInFlow);
if (prevInFlow) {
prevInFlow->GetRect(prevRect);
prevRect = prevInFlow->GetRect();
nsCOMPtr<nsIPresShell> presShell;
mPresContext->GetShell(getter_AddRefs(presShell));
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
nsIFrame *placeParent, *placeParentPrev, *prevPlace, *prevPlaceParent;
nsIFrame *placeParentPrev, *prevPlace;
// If prevInFlow's placeholder is in a block that wasn't continued, we need to adjust
// prevRect.x to account for the missing frame offsets.
placeholder->GetParent(&placeParent);
nsIFrame* placeParent = placeholder->GetParent();
placeParent->GetPrevInFlow(&placeParentPrev);
frameManager->GetPlaceholderFrameFor(prevInFlow, &prevPlace);
prevPlace->GetParent(&prevPlaceParent);
nsIFrame* prevPlaceParent = prevPlace->GetParent();
for (nsIFrame* ancestor = prevPlaceParent;
ancestor && (ancestor != placeParentPrev);
ancestor->GetParent(&ancestor)) {
nsRect rect;
ancestor->GetRect(rect);
prevRect.x += rect.x;
ancestor = ancestor->GetParent()) {
prevRect.x += ancestor->GetRect().x;
}
}
// Assign an x and y coordinate to the floater. Note that the x,y
@ -1099,7 +1094,7 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
// Position the floater and make sure and views are properly
// positioned. We need to explicitly position its child views as
// well, since we're moving the floater after flowing it.
floater->MoveTo(mPresContext, x, y);
floater->SetPosition(nsPoint(x, y));
nsContainerFrame::PositionFrameView(mPresContext, floater);
nsContainerFrame::PositionChildViews(mPresContext, floater);
@ -1129,8 +1124,7 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
#ifdef DEBUG
if (nsBlockFrame::gNoisyReflow) {
nsRect r;
floater->GetRect(r);
nsRect r = floater->GetRect();
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
printf("placed floater: ");
nsFrame::ListTag(stdout, floater);

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

@ -1723,10 +1723,7 @@ NS_IMETHODIMP nsBulletFrame::OnStartContainer(imgIRequest *aRequest,
mParent->FirstChild(mPresContext, nsnull, &frame);
NS_ASSERTION(frame, "No frame to mark dirty for bullet frame.");
if (frame) {
nsFrameState state;
frame->GetFrameState(&state);
state |= NS_FRAME_IS_DIRTY;
frame->SetFrameState(state);
frame->AddStateBits(NS_FRAME_IS_DIRTY);
mParent->ReflowDirtyChild(shell, frame);
}
}

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

@ -409,12 +409,8 @@ static PRBool
TranslatePointTo(nsPoint& aPoint, nsIView* aChildView, nsIView* aParentView)
{
do {
nscoord x, y;
aChildView->GetPosition(&x, &y);
aPoint.x += x;
aPoint.y += y;
aChildView->GetParent(aChildView);
aPoint += aChildView->GetPosition();
aChildView = aChildView->GetParent();
} while (aChildView && (aChildView != aParentView));
return aChildView == aParentView;
@ -433,15 +429,13 @@ nsContainerFrame::PositionFrameView(nsIPresContext* aPresContext,
nsIView* view = aKidFrame->GetView();
// Position view relative to its parent, not relative to aKidFrame's
// frame which may not have a view
nsIView* parentView;
view->GetParent(parentView);
nsIView* parentView = view->GetParent();
nsIView* containingView;
nsPoint origin;
aKidFrame->GetOffsetFromView(aPresContext, origin, &containingView);
nsCOMPtr<nsIViewManager> vm;
view->GetViewManager(*getter_AddRefs(vm));
nsIViewManager* vm = view->GetViewManager();
// it's possible for the parentView to be nonnull but containingView to be
// null, when the parent view doesn't belong to this frame tree but to
@ -450,7 +444,7 @@ nsContainerFrame::PositionFrameView(nsIPresContext* aPresContext,
if (nsnull != containingView && containingView != parentView) {
NS_ERROR("This hack should not be needed now!!! See bug 126263.");
// XXX roc this is no longer needed; remove it!!
// XXX roc this should be no longer needed, but it still is for printing/print preview
// it is possible for parent view not to have a frame attached to it
// kind of an anonymous view. This happens with native scrollbars and
@ -459,17 +453,13 @@ nsContainerFrame::PositionFrameView(nsIPresContext* aPresContext,
// the HACK below. COMBO box code should NOT be in the container code!!!
// And the case it looks from does not just happen for combo boxes. Native
// scrollframes get in this situation too!!
while(parentView) {
void *data = 0;
parentView->GetClientData(data);
while (parentView) {
void *data = parentView->GetClientData();
if (data)
break;
nscoord x, y;
parentView->GetPosition(&x, &y);
origin.x -= x;
origin.y -= y;
parentView->GetParent(parentView);
origin -= parentView->GetPosition();
parentView = parentView->GetParent();
}
if (containingView != parentView)
@ -545,8 +535,7 @@ SyncFrameViewGeometryDependentProperties(nsIPresContext* aPresContext,
nsIView* aView,
PRUint32 aFlags)
{
nsCOMPtr<nsIViewManager> vm;
aView->GetViewManager(*getter_AddRefs(vm));
nsIViewManager* vm = aView->GetViewManager();
PRBool isCanvas;
const nsStyleBackground* bg;
@ -570,8 +559,7 @@ SyncFrameViewGeometryDependentProperties(nsIPresContext* aPresContext,
if (isCanvas) {
nsIView* rootView;
vm->GetRootView(rootView);
nsIView* rootParent;
rootView->GetParent(rootParent);
nsIView* rootParent = rootView->GetParent();
if (!rootParent) {
// We're the root of a view manager hierarchy. We will have to
// paint something. NOTE: this can be overridden below.
@ -590,13 +578,11 @@ SyncFrameViewGeometryDependentProperties(nsIPresContext* aPresContext,
if (!parentDoc && rootElem && rootElem->IsContentOfType(nsIContent::eXUL)) {
// we're XUL at the root of the document hierarchy. Try to make our
// window translucent.
nsCOMPtr<nsIWidget> widget;
aView->GetWidget(*getter_AddRefs(widget));
// don't proceed unless this is the root view
// (sometimes the non-root-view is a canvas)
if (widget && aView == rootView) {
if (aView->HasWidget() && aView == rootView) {
viewHasTransparentContent = hasBG && (bg->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT);
widget->SetWindowTranslucency(viewHasTransparentContent);
aView->GetWidget()->SetWindowTranslucency(viewHasTransparentContent);
}
}
}
@ -608,10 +594,8 @@ SyncFrameViewGeometryDependentProperties(nsIPresContext* aPresContext,
if (!viewHasTransparentContent) {
// If we're showing the view but the frame is hidden, then the view is transparent
nsViewVisibility visibility;
aView->GetVisibility(visibility);
const nsStyleVisibility* vis = aStyleContext->GetStyleVisibility();
if ((nsViewVisibility_kShow == visibility
if ((nsViewVisibility_kShow == aView->GetVisibility()
&& NS_STYLE_VISIBILITY_HIDDEN == vis->mVisible)
|| (NS_STYLE_OVERFLOW_VISIBLE == display->mOverflow
&& (kidState & NS_FRAME_OUTSIDE_CHILDREN) != 0)) {
@ -683,12 +667,8 @@ SyncFrameViewGeometryDependentProperties(nsIPresContext* aPresContext,
}
}
nsRect newSize;
aView->GetBounds(newSize);
nscoord x, y;
aView->GetPosition(&x, &y);
newSize.x -= x;
newSize.y -= y;
nsRect newSize = aView->GetBounds();
newSize -= aView->GetPosition();
// If part of the view is being clipped out, then mark it transparent
if (clipRect.y > newSize.y
@ -727,10 +707,7 @@ nsContainerFrame::SyncFrameViewAfterReflow(nsIPresContext* aPresContext,
}
if (0 == (aFlags & NS_FRAME_NO_SIZE_VIEW)) {
nsCOMPtr<nsIViewManager> vm;
aView->GetViewManager(*getter_AddRefs(vm));
nsRect oldBounds;
aView->GetBounds(oldBounds);
nsIViewManager* vm = aView->GetViewManager();
// If the frame has child frames that stick outside the content
// area, then size the view large enough to include those child
@ -783,8 +760,7 @@ nsContainerFrame::SyncFrameViewProperties(nsIPresContext* aPresContext,
return;
}
nsCOMPtr<nsIViewManager> vm;
aView->GetViewManager(*getter_AddRefs(vm));
nsIViewManager* vm = aView->GetViewManager();
if (nsnull == aStyleContext) {
aStyleContext = aFrame->GetStyleContext();
@ -812,8 +788,7 @@ nsContainerFrame::SyncFrameViewProperties(nsIPresContext* aPresContext,
viewIsVisible = PR_FALSE;
} else {
// if the view is for a popup, don't show the view if the popup is closed
nsCOMPtr<nsIWidget> widget;
aView->GetWidget(*getter_AddRefs(widget));
nsIWidget* widget = aView->GetWidget();
if (widget) {
nsWindowType windowType;
widget->GetWindowType(windowType);

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

@ -169,10 +169,13 @@ nsFirstLetterFrame::SetSelected(nsIPresContext* aPresContext, nsIDOMRange *aRang
return NS_OK;
nsIFrame *child;
nsresult result = FirstChild(aPresContext, nsnull, &child);
while (NS_SUCCEEDED(result) && child)
if (NS_FAILED(result))
return NS_OK;
while (child)
{
child->SetSelected(aPresContext,aRange, aSelected,aSpread);//dont worry about result. there are more frames to come
result = child->GetNextSibling(&child);
child->SetSelected(aPresContext, aRange, aSelected, aSpread);
// don't worry about result. there are more frames to come
child = child->GetNextSibling();
}
return NS_OK;
}
@ -252,8 +255,7 @@ nsFirstLetterFrame::Reflow(nsIPresContext* aPresContext,
}
// Place and size the child and update the output metrics
kid->MoveTo(aPresContext, bp.left, bp.top);
kid->SizeTo(aPresContext, aMetrics.width, aMetrics.height);
kid->SetRect(nsRect(bp.left, bp.top, aMetrics.width, aMetrics.height));
kid->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
aMetrics.width += lr;
aMetrics.height += tb;
@ -268,11 +270,10 @@ nsFirstLetterFrame::Reflow(nsIPresContext* aPresContext,
if (NS_FRAME_IS_COMPLETE(aReflowStatus)) {
nsIFrame* kidNextInFlow;
kid->GetNextInFlow(&kidNextInFlow);
if (nsnull != kidNextInFlow) {
if (kidNextInFlow) {
// Remove all of the childs next-in-flows
nsContainerFrame* parent;
kidNextInFlow->GetParent((nsIFrame**)&parent);
parent->DeleteNextInFlowChild(aPresContext, kidNextInFlow);
NS_STATIC_CAST(nsContainerFrame*, kidNextInFlow->GetParent())
->DeleteNextInFlowChild(aPresContext, kidNextInFlow);
}
}
else {
@ -290,8 +291,7 @@ nsFirstLetterFrame::Reflow(nsIPresContext* aPresContext,
SetOverflowFrames(aPresContext, nextInFlow);
}
else {
nsIFrame* nextSib;
kid->GetNextSibling(&nextSib);
nsIFrame* nextSib = kid->GetNextSibling();
if (nextSib) {
kid->SetNextSibling(nsnull);
SetOverflowFrames(aPresContext, nextSib);
@ -328,7 +328,7 @@ nsFirstLetterFrame::DrainOverflowFrames(nsIPresContext* aPresContext)
nsIFrame* f = overflowFrames;
while (f) {
nsHTMLContainerFrame::ReparentFrameView(aPresContext, f, prevInFlow, this);
f->GetNextSibling(&f);
f = f->GetNextSibling();
}
mFrames.InsertFrames(this, nsnull, overflowFrames);
}
@ -347,8 +347,7 @@ nsFirstLetterFrame::DrainOverflowFrames(nsIPresContext* aPresContext)
nsIFrame* kid = mFrames.FirstChild();
if (kid) {
nsRefPtr<nsStyleContext> sc;
nsCOMPtr<nsIContent> kidContent;
kid->GetContent(getter_AddRefs(kidContent));
nsIContent* kidContent = kid->GetContent();
if (kidContent) {
NS_ASSERTION(kidContent->IsContentOfType(nsIContent::eTEXT),
"should contain only text nodes");

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

@ -528,8 +528,7 @@ nsFrame::Init(nsIPresContext* aPresContext,
if (aPrevInFlow) {
// Make sure the general flags bits are the same
nsFrameState state;
aPrevInFlow->GetFrameState(&state);
nsFrameState state = aPrevInFlow->GetStateBits();
// Make bits that are currently on (see constructor) the same:
mState &= state | ~(NS_FRAME_SYNC_FRAME_AND_VIEW);
@ -541,8 +540,7 @@ nsFrame::Init(nsIPresContext* aPresContext,
NS_FRAME_IS_SPECIAL);
}
if (mParent) {
nsFrameState state;
mParent->GetFrameState(&state);
nsFrameState state = mParent->GetStateBits();
// Make bits that are currently off (see constructor) the same:
mState |= state & (NS_FRAME_INDEPENDENT_SELECTION |
@ -617,7 +615,7 @@ nsFrame::Destroy(nsIPresContext* aPresContext)
// Get the view pointer now before the frame properties disappear
// when we call NotifyDestroyingFrame()
nsIView* view = GetView(aPresContext);
nsIView* view = GetView();
// XXX Rather than always doing this it would be better if it was part of
// a frame observer mechanism and the pres shell could register as an
@ -774,17 +772,14 @@ nsFrame::SetOverflowClipRect(nsIRenderingContext& aRenderingContext)
*********************************************************/
static void RefreshAllContentFrames(nsIPresContext* aPresContext, nsIFrame * aFrame, nsIContent * aContent)
{
nsIContent* frameContent;
aFrame->GetContent(&frameContent);
if (frameContent == aContent) {
if (aFrame->GetContent() == aContent) {
ForceDrawFrame(aPresContext, (nsFrame *)aFrame);
}
NS_IF_RELEASE(frameContent);
aFrame->FirstChild(aPresContext, nsnull, &aFrame);
while (aFrame) {
RefreshAllContentFrames(aPresContext, aFrame, aContent);
aFrame->GetNextSibling(&aFrame);
aFrame = aFrame->GetNextSibling();
}
}
@ -797,26 +792,22 @@ static void RefreshAllContentFrames(nsIPresContext* aPresContext, nsIFrame * aFr
*/
void ForceDrawFrame(nsIPresContext* aPresContext, nsFrame * aFrame)//, PRBool)
{
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, 0);
NS_RELEASE(viewMgr);
}
//viewMgr->UpdateView(view, rect, NS_VMREFRESH_DOUBLE_BUFFER | NS_VMREFRESH_IMMEDIATE);
}
}
@ -850,9 +841,7 @@ nsFrame::Paint(nsIPresContext* aPresContext,
//check frame selection state
PRBool isSelected;
nsFrameState frameState;
GetFrameState(&frameState);
isSelected = (frameState & NS_FRAME_SELECTED_CONTENT) == NS_FRAME_SELECTED_CONTENT;
isSelected = (GetStateBits() & NS_FRAME_SELECTED_CONTENT) == NS_FRAME_SELECTED_CONTENT;
//if not selected then return
if (!isSelected)
return NS_OK; //nothing to do
@ -897,8 +886,7 @@ nsFrame::Paint(nsIPresContext* aPresContext,
if (details)
{
nsRect rect;
GetRect(rect);
nsRect rect = GetRect();
rect.width-=2;
rect.height-=2;
rect.x=1; //we are in the coordinate system of the frame now with regards to the rendering context.
@ -974,7 +962,9 @@ nsFrame::GetContentForEvent(nsIPresContext* aPresContext,
nsEvent* aEvent,
nsIContent** aContent)
{
return GetContent(aContent);
*aContent = GetContent();
NS_IF_ADDREF(*aContent);
return NS_OK;
}
/**
@ -1094,24 +1084,18 @@ nsFrame::GetDataForTableSelection(nsIFrameSelection *aFrameSelection,
// or select column when along top edge?
break;
} else {
result = frame->GetParent(&frame);
frame = frame->GetParent();
result = NS_OK;
// Stop if we have hit the selection's limiting content node
if (frame)
{
nsIContent* frameContent;
frame->GetContent(&frameContent);
if (frameContent == limiter.get())
break;
}
if (frame && frame->GetContent() == limiter.get())
break;
}
}
}
// We aren't in a cell or table
if (!foundCell && !foundTable) return NS_OK;
nsCOMPtr<nsIContent> tableOrCellContent;
result = frame->GetContent(getter_AddRefs(tableOrCellContent));
if (NS_FAILED(result)) return result;
nsIContent* tableOrCellContent = frame->GetContent();
if (!tableOrCellContent) return NS_ERROR_FAILURE;
nsCOMPtr<nsIContent> parentContent;
@ -1160,7 +1144,7 @@ nsFrame::FrameOrParentHasSpecialSelectionStyle(PRUint8 aSelectionStyle, nsIFrame
return NS_OK;
}
thisFrame->GetParent(&thisFrame);
thisFrame = thisFrame->GetParent();
}
*foundFrame = nsnull;
@ -1191,11 +1175,10 @@ nsFrame::IsSelectable(PRBool* aSelectable, PRUint8* aSelectStyle) const
// _MOZ_ALL -> TEXT -> AUTO -> AUTO, the returned value is _MOZ_ALL
// AUTO -> CELL -> TEXT -> AUTO, the returned value is TEXT
//
nsresult result = NS_OK;
PRUint8 selectStyle = NS_STYLE_USER_SELECT_AUTO;
nsIFrame* frame = (nsIFrame*)this;
while (frame && NS_SUCCEEDED(result)) {
while (frame) {
const nsStyleUIReset* userinterface = frame->GetStyleUIReset();
switch (userinterface->mUserSelect) {
case NS_STYLE_USER_SELECT_ALL:
@ -1211,7 +1194,7 @@ nsFrame::IsSelectable(PRBool* aSelectable, PRUint8* aSelectStyle) const
}
break;
}
result = frame->GetParent(&frame);
frame = frame->GetParent();
}
// convert internal values to standard values
@ -1250,7 +1233,6 @@ ContentContainsPoint(nsIPresContext *aPresContext,
if (NS_FAILED(rv) || !frame) return PR_FALSE;
nsIView *frameView = nsnull;
nsRect frameRect;
nsPoint offsetPoint;
// Get the view that contains the content's frame.
@ -1270,16 +1252,9 @@ ContentContainsPoint(nsIPresContext *aPresContext,
// of aRelativeView and walk up the view hierarchy calculating what
// the actual point is, relative to frameView.
nsPoint viewOffset(0, 0);
while (aRelativeView && aRelativeView != frameView) {
aRelativeView->GetPosition(&viewOffset.x, &viewOffset.y);
point.x += viewOffset.x;
point.y += viewOffset.y;
rv = aRelativeView->GetParent(aRelativeView);
if (NS_FAILED(rv)) return PR_FALSE;
point += aRelativeView->GetPosition();
aRelativeView = aRelativeView->GetParent();
}
// At this point the point should be in the correct
@ -1295,7 +1270,7 @@ ContentContainsPoint(nsIPresContext *aPresContext,
// Get the frame's rect and make it relative to the
// upper left corner of it's parent view.
frame->GetRect(frameRect);
nsRect frameRect = frame->GetRect();
frameRect.x = offsetPoint.x;
frameRect.y = offsetPoint.y;