Ongoing deCOMtamination. r+sr=dbaron

This commit is contained in:
roc+%cs.cmu.edu 2003-06-30 10:46:59 +00:00
parent f79771a4ef
commit 5d55c4535e
19 changed files with 614 additions and 1057 deletions

View File

@ -902,7 +902,7 @@ IncrementalReflow::Dispatch(nsIPresContext *aPresContext,
if (first == root)
size = aMaxSize;
else
first->GetSize(size);
size = first->GetSize();
nsHTMLReflowState reflowState(aPresContext, first, path,
&aRendContext, size);
@ -916,11 +916,9 @@ IncrementalReflow::Dispatch(nsIPresContext *aPresContext,
(aDesiredSize.width == size.width && aDesiredSize.height == size.height),
"non-root frame's desired size changed during an incremental reflow");
first->SizeTo(aPresContext, aDesiredSize.width, aDesiredSize.height);
first->SetSize(nsSize(aDesiredSize.width, aDesiredSize.height));
nsIView* view = first->GetView(aPresContext);
if (view)
nsContainerFrame::SyncFrameViewAfterReflow(aPresContext, first, view, nsnull);
nsContainerFrame::SyncFrameViewAfterReflow(aPresContext, first, first->GetView(), nsnull);
first->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
}
@ -938,12 +936,10 @@ IncrementalReflow::AddCommand(nsIPresContext *aPresContext,
// parent chain until we reach either a `reflow root' or the root
// frame in the frame hierarchy.
nsAutoVoidArray path;
nsFrameState state;
do {
path.AppendElement(frame);
frame->GetFrameState(&state);
} while (!(state & NS_FRAME_REFLOW_ROOT) &&
(frame->GetParent(&frame), frame != nsnull));
} while (!(frame->GetStateBits() & NS_FRAME_REFLOW_ROOT) &&
(frame = frame->GetParent()) != nsnull);
// Pop off the root, add it to the set if it's not there already.
PRInt32 lastIndex = path.Count() - 1;
@ -1046,6 +1042,7 @@ public:
NS_IMETHOD GetDocument(nsIDocument** aResult);
NS_IMETHOD GetPresContext(nsIPresContext** aResult);
NS_IMETHOD GetViewManager(nsIViewManager** aResult);
nsIViewManager* GetViewManager() { return mViewManager; }
NS_IMETHOD GetStyleSet(nsIStyleSet** aResult);
NS_IMETHOD GetActiveAlternateStyleSheet(nsString& aSheetTitle);
NS_IMETHOD SelectAlternateStyleSheet(const nsString& aSheetTitle);
@ -2869,14 +2866,11 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
rootFrame->WillReflow(mPresContext);
nsContainerFrame::PositionFrameView(mPresContext, rootFrame);
rootFrame->Reflow(mPresContext, desiredSize, reflowState, status);
rootFrame->SizeTo(mPresContext, desiredSize.width, desiredSize.height);
rootFrame->SetSize(nsSize(desiredSize.width, desiredSize.height));
mPresContext->SetVisibleArea(nsRect(0,0,desiredSize.width,desiredSize.height));
nsIView* view = rootFrame->GetView(mPresContext);
if (view) {
nsContainerFrame::SyncFrameViewAfterReflow(mPresContext, rootFrame, view,
nsnull);
}
nsContainerFrame::SyncFrameViewAfterReflow(mPresContext, rootFrame, rootFrame->GetView(),
nsnull);
rootFrame->DidReflow(mPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
#ifdef NS_DEBUG
@ -3014,11 +3008,8 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight)
rootFrame->SizeTo(mPresContext, desiredSize.width, desiredSize.height);
mPresContext->SetVisibleArea(nsRect(0,0,desiredSize.width,desiredSize.height));
nsIView* view = rootFrame->GetView(mPresContext);
if (view) {
nsContainerFrame::SyncFrameViewAfterReflow(mPresContext, rootFrame, view,
nsnull);
}
nsContainerFrame::SyncFrameViewAfterReflow(mPresContext, rootFrame, rootFrame->GetView(),
nsnull);
rootFrame->DidReflow(mPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
#ifdef NS_DEBUG
if (nsIFrameDebug::GetVerifyTreeEnable()) {
@ -3272,11 +3263,8 @@ NS_IMETHODIMP
PresShell::PageMove(PRBool aForward, PRBool aExtend)
{
nsresult result;
nsCOMPtr<nsIViewManager> viewManager;
nsIViewManager* viewManager = GetViewManager();
nsIScrollableView *scrollableView;
result = GetViewManager(getter_AddRefs(viewManager));
if (NS_FAILED(result))
return result;
if (!viewManager)
return NS_ERROR_UNEXPECTED;
result = viewManager->GetRootScrollableView(&scrollableView);
@ -3296,9 +3284,9 @@ PresShell::PageMove(PRBool aForward, PRBool aExtend)
NS_IMETHODIMP
PresShell::ScrollPage(PRBool aForward)
{
nsCOMPtr<nsIViewManager> viewManager;
nsresult result = GetViewManager(getter_AddRefs(viewManager));
if (NS_SUCCEEDED(result) && viewManager)
nsIViewManager* viewManager = GetViewManager();
nsresult result = NS_OK;
if (viewManager)
{
nsIScrollableView *scrollView;
result = viewManager->GetRootScrollableView(&scrollView);
@ -3313,9 +3301,9 @@ PresShell::ScrollPage(PRBool aForward)
NS_IMETHODIMP
PresShell::ScrollLine(PRBool aForward)
{
nsCOMPtr<nsIViewManager> viewManager;
nsresult result = GetViewManager(getter_AddRefs(viewManager));
if (NS_SUCCEEDED(result) && viewManager)
nsIViewManager* viewManager = GetViewManager();
nsresult result = NS_OK;
if (viewManager)
{
nsIScrollableView *scrollView;
result = viewManager->GetRootScrollableView(&scrollView);
@ -3345,9 +3333,9 @@ PresShell::ScrollLine(PRBool aForward)
NS_IMETHODIMP
PresShell::ScrollHorizontal(PRBool aLeft)
{
nsCOMPtr<nsIViewManager> viewManager;
nsresult result = GetViewManager(getter_AddRefs(viewManager));
if (NS_SUCCEEDED(result) && viewManager)
nsIViewManager* viewManager = GetViewManager();
nsresult result = NS_OK;
if (viewManager)
{
nsIScrollableView *scrollView;
result = viewManager->GetRootScrollableView(&scrollView);
@ -3370,9 +3358,9 @@ PresShell::ScrollHorizontal(PRBool aLeft)
NS_IMETHODIMP
PresShell::CompleteScroll(PRBool aForward)
{
nsCOMPtr<nsIViewManager> viewManager;
nsresult result = GetViewManager(getter_AddRefs(viewManager));
if (NS_SUCCEEDED(result) && viewManager)
nsIViewManager* viewManager = GetViewManager();
nsresult result = NS_OK;
if (viewManager)
{
nsIScrollableView *scrollView;
result = viewManager->GetRootScrollableView(&scrollView);
@ -3398,9 +3386,7 @@ PresShell::CompleteMove(PRBool aForward, PRBool aExtend)
nsIView *scrolledView;
result = scrollableView->GetScrolledView(scrolledView);
// get a frame
void *clientData;
scrolledView->GetClientData(clientData);
nsIFrame *frame = (nsIFrame *)clientData;
nsIFrame *frame = (nsIFrame*)scrolledView->GetClientData();
if (!frame)
return NS_ERROR_FAILURE;
//we need to get to the area frame.
@ -3430,9 +3416,7 @@ PresShell::CompleteMove(PRBool aForward, PRBool aExtend)
if (aForward)
{
outsideLimit = 1;//search from end
nsRect rect;
frame->GetRect(rect);
pos.mDesiredX = rect.width * 2;//search way off to right of line
pos.mDesiredX = frame->GetRect().width * 2;//search way off to right of line
pos.mDirection = eDirPrevious; //seach backwards from the end
}
else
@ -3498,24 +3482,19 @@ PresShell::CheckVisibility(nsIDOMNode *node, PRInt16 startOffset, PRInt16 EndOff
static void UpdateViewProperties(nsIPresContext* aPresContext, nsIViewManager* aVM,
nsIView* aView) {
nsCOMPtr<nsIViewManager> thisVM;
aView->GetViewManager(*getter_AddRefs(thisVM));
nsIViewManager* thisVM = aView->GetViewManager();
if (thisVM != aVM) {
return;
}
void* clientData;
aView->GetClientData(clientData);
nsIFrame* frame = NS_STATIC_CAST(nsIFrame*, clientData);
nsIFrame* frame = NS_STATIC_CAST(nsIFrame*, aView->GetClientData());
if (frame) {
nsContainerFrame::SyncFrameViewProperties(aPresContext, frame, nsnull, aView);
}
nsIView* child;
aView->GetFirstChild(child);
while (child) {
for (nsIView* child = aView->GetFirstChild(); child;
child = child->GetNextSibling()) {
UpdateViewProperties(aPresContext, aVM, child);
child->GetNextSibling(child);
}
}
@ -3561,13 +3540,11 @@ PresShell::StyleChangeReflow()
rootFrame->WillReflow(mPresContext);
nsContainerFrame::PositionFrameView(mPresContext, rootFrame);
rootFrame->Reflow(mPresContext, desiredSize, reflowState, status);
rootFrame->SizeTo(mPresContext, desiredSize.width, desiredSize.height);
rootFrame->SetSize(nsSize(desiredSize.width, desiredSize.height));
mPresContext->SetVisibleArea(nsRect(0,0,desiredSize.width,desiredSize.height));
nsIView* view = rootFrame->GetView(mPresContext);
if (view) {
nsContainerFrame::SyncFrameViewAfterReflow(mPresContext, rootFrame, view,
nsnull);
}
nsIView* view = rootFrame->GetView();
nsContainerFrame::SyncFrameViewAfterReflow(mPresContext, rootFrame, view,
nsnull);
rootFrame->DidReflow(mPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
#ifdef NS_DEBUG
if (nsIFrameDebug::GetVerifyTreeEnable()) {
@ -3958,7 +3935,8 @@ PresShell::ClearFrameRefs(nsIFrame* aFrame)
}
if (aFrame == mCurrentEventFrame) {
aFrame->GetContent(&mCurrentEventContent);
mCurrentEventContent = aFrame->GetContent();
NS_IF_ADDREF(mCurrentEventContent);
mCurrentEventFrame = nsnull;
}
@ -3966,8 +3944,8 @@ PresShell::ClearFrameRefs(nsIFrame* aFrame)
if (aFrame == (nsIFrame*)mCurrentEventFrameStack.ElementAt(i)) {
//One of our stack frames was deleted. Get its content so that when we
//pop it we can still get its new frame from its content
nsIContent *currentEventContent;
aFrame->GetContent(&currentEventContent);
nsIContent *currentEventContent = aFrame->GetContent();
NS_IF_ADDREF(currentEventContent);
mCurrentEventContentStack.ReplaceElementAt((void*)currentEventContent, i);
mCurrentEventFrameStack.ReplaceElementAt(nsnull, i);
}
@ -3985,16 +3963,13 @@ PresShell::CreateRenderingContext(nsIFrame *aFrame,
return NS_ERROR_NULL_POINTER;
}
nsPoint pt;
nsresult rv;
nsIView *view = aFrame->GetClosestView(mPresContext);
nsIView *view = aFrame->GetClosestView();
nsCOMPtr<nsIWidget> widget;
if (nsnull != view) {
nsCOMPtr<nsIViewManager> vm;
view->GetViewManager(*getter_AddRefs(vm));
vm->GetWidgetForView(view, getter_AddRefs(widget));
if (view) {
view->GetViewManager()->GetWidgetForView(view, getter_AddRefs(widget));
}
nsCOMPtr<nsIDeviceContext> dx;
@ -4255,10 +4230,9 @@ static void ScrollViewToShowRect(nsIScrollableView* aScrollingView,
// Determine the visible rect in the scrolling view's coordinate space.
// The size of the visible area is the clip view size
const nsIView* clipView;
nsRect visibleRect;
aScrollingView->GetClipView(&clipView);
clipView->GetBounds(visibleRect); // get width and height
nsRect visibleRect = clipView->GetBounds(); // get width and height
aScrollingView->GetScrollPosition(visibleRect.x, visibleRect.y);
// The actual scroll offsets
@ -4363,9 +4337,8 @@ PresShell::ScrollFrameIntoView(nsIFrame *aFrame,
// is not for the anchor link to scroll back into view. That is what
// this check is preventing.
// XXX: The dependency on the command dispatcher needs to be fixed.
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
if(content) {
nsIContent* content = aFrame->GetContent();
if (content) {
nsCOMPtr<nsIDocument> document;
content->GetDocument(getter_AddRefs(document));
if(document){
@ -4391,8 +4364,7 @@ PresShell::ScrollFrameIntoView(nsIFrame *aFrame,
// Step 2: Walk the views that are parents of the frame and scroll them
// appropriately.
nsRect frameBounds;
aFrame->GetRect(frameBounds);
nsRect frameBounds = aFrame->GetRect();
nsPoint offset;
nsIView* closestView;
aFrame->GetOffsetFromView(mPresContext, offset, &closestView);
@ -4407,7 +4379,7 @@ PresShell::ScrollFrameIntoView(nsIFrame *aFrame,
while (frame && (frame->GetFrameType(getter_AddRefs(frameType)),
frameType == nsLayoutAtoms::inlineFrame)) {
prevFrame = frame;
prevFrame->GetParent(&frame);
frame = prevFrame->GetParent();
}
if (frame != aFrame &&
@ -4458,17 +4430,14 @@ PresShell::ScrollFrameIntoView(nsIFrame *aFrame,
// make sure to get the scrolled view's position after it has been scrolled.
nsIScrollableView* scrollingView = nsnull;
while (closestView) {
nsIView* parent;
closestView->GetParent(parent);
nsIView* parent = closestView->GetParent();
if (parent) {
CallQueryInterface(parent, &scrollingView);
if (scrollingView) {
ScrollViewToShowRect(scrollingView, frameBounds, aVPercent, aHPercent);
}
}
nscoord x, y;
closestView->GetPosition(&x, &y);
frameBounds.MoveBy(x, y);
frameBounds += closestView->GetPosition();;
closestView = parent;
}
@ -4968,8 +4937,7 @@ PresShell::UnsuppressAndInvalidate()
nsIFrame* rootFrame;
mFrameManager->GetRootFrame(&rootFrame);
if (rootFrame) {
nsRect rect;
rootFrame->GetRect(rect);
nsRect rect = rootFrame->GetRect();
if (!rect.IsEmpty()) {
((nsFrame*)rootFrame)->Invalidate(mPresContext, rect, PR_FALSE);
}
@ -5226,9 +5194,8 @@ PresShell::IsSafeToFlush(PRBool& aIsSafeToFlush)
aIsSafeToFlush = PR_FALSE;
} else {
// Not safe if we are painting
nsCOMPtr<nsIViewManager> viewManager;
nsresult rv = GetViewManager(getter_AddRefs(viewManager));
if (NS_SUCCEEDED(rv) && (nsnull != viewManager)) {
nsIViewManager* viewManager = GetViewManager();
if (viewManager) {
PRBool isPainting = PR_FALSE;
viewManager->IsPainting(isPainting);
if (isPainting) {
@ -5468,8 +5435,7 @@ BuildFramechangeList(nsIFrame *aFrame, void *aClosure)
// Ok, get our binding information.
if (!aFrame->GetStyleDisplay()->mBinding.IsEmpty()) {
// We had a binding.
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
nsIContent* content = aFrame->GetContent();
nsCOMPtr<nsIDocument> doc;
content->GetDocument(getter_AddRefs(doc));
if (doc) {
@ -5528,9 +5494,7 @@ WalkFramesThroughPlaceholders(nsIPresContext *aPresContext, nsIFrame *aFrame,
nsIFrame *child = nsnull;
aFrame->FirstChild(aPresContext, childList, &child);
while (child) {
nsFrameState state;
child->GetFrameState(&state);
if (!(state & NS_FRAME_OUT_OF_FLOW)) {
if (!(child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
// only do frames that are in flow
nsCOMPtr<nsIAtom> frameType;
child->GetFrameType(getter_AddRefs(frameType));
@ -5545,7 +5509,7 @@ WalkFramesThroughPlaceholders(nsIPresContext *aPresContext, nsIFrame *aFrame,
else
WalkFramesThroughPlaceholders(aPresContext, child, aFunc, aClosure);
}
child->GetNextSibling(&child);
child = child->GetNextSibling();
}
aFrame->GetAdditionalChildListName(listIndex++, getter_AddRefs(childList));
@ -5803,10 +5767,9 @@ static PRBool ComputeClipRect(nsIFrame* aFrame, nsRect& aResult) {
// element: border, padding, and content areas, and even scrollbars if
// there are any.
if (display->IsAbsolutelyPositioned() && (display->mClipFlags & NS_STYLE_CLIP_RECT)) {
nsSize size;
nsSize size = aFrame->GetSize();
// Start with the 'auto' values and then factor in user specified values
aFrame->GetSize(size);
nsRect clipRect(0, 0, size.width, size.height);
if (display->mClipFlags & NS_STYLE_CLIP_RECT) {
@ -5869,7 +5832,6 @@ PresShell::Paint(nsIView *aView,
nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect)
{
void* clientData;
nsIFrame* frame;
nsresult rv = NS_OK;
@ -5880,8 +5842,7 @@ PresShell::Paint(nsIView *aView,
NS_ASSERTION(!(nsnull == aView), "null view");
aView->GetClientData(clientData);
frame = (nsIFrame *)clientData;
frame = NS_STATIC_CAST(nsIFrame*, aView->GetClientData());
if (nsnull != frame)
{
@ -5907,8 +5868,7 @@ PresShell::Paint(nsIView *aView,
#ifdef NS_DEBUG
// Draw a border around the frame
if (nsIFrameDebug::GetShowFrameBorders()) {
nsRect r;
frame->GetRect(r);
nsRect r = frame->GetRect();
aRenderingContext.SetColor(NS_RGB(0,0,255));
aRenderingContext.DrawRect(0, 0, r.width, r.height);
}
@ -6100,8 +6060,8 @@ PresShell::HandleEvent(nsIView *aView,
// Check for a system color change up front, since the frame type is
// irrelevant
if ((aEvent->message == NS_SYSCOLORCHANGED) && mPresContext) {
nsCOMPtr<nsIViewManager> vm;
if ((NS_SUCCEEDED(GetViewManager(getter_AddRefs(vm)))) && vm) {
nsIViewManager* vm = GetViewManager();
if (vm) {
// Only dispatch system color change when the message originates from
// from the root views widget. This is necessary to prevent us from
// dispatching the SysColorChanged notification for each child window
@ -6117,9 +6077,7 @@ PresShell::HandleEvent(nsIView *aView,
return NS_OK;
}
void* clientData;
aView->GetClientData(clientData);
nsIFrame* frame = (nsIFrame *)clientData;
nsIFrame* frame = NS_STATIC_CAST(nsIFrame*, aView->GetClientData());
nsresult rv = NS_OK;
@ -6195,8 +6153,7 @@ PresShell::HandleEvent(nsIView *aView,
// GetFrameForPoint() work. The assumption here is that frame->GetView()
// will return aView, and frame's parent view is aView's parent.
nsPoint eventPoint;
frame->GetOrigin(eventPoint);
nsPoint eventPoint = frame->GetPosition();
eventPoint += aEvent->point;
nsPoint originOffset;
@ -6281,8 +6238,8 @@ PresShell::HandleEvent(nsIView *aView,
nsIView *oldView = mCurrentTargetView;
nsPoint offset(0,0);
nsRect oldTargetRect(mCurrentTargetRect);
mCurrentEventFrame->GetRect(mCurrentTargetRect);
mCurrentTargetView = mCurrentEventFrame->GetView(mPresContext);
mCurrentTargetRect = mCurrentEventFrame->GetRect();
mCurrentTargetView = mCurrentEventFrame->GetView();
if (!mCurrentTargetView ) {
mCurrentEventFrame->GetOffsetFromView(mPresContext, offset,
&mCurrentTargetView);
@ -6294,8 +6251,8 @@ PresShell::HandleEvent(nsIView *aView,
if ((mCurrentTargetRect != oldTargetRect) ||
(mCurrentTargetView != oldView)) {
nsCOMPtr<nsIViewManager> vm;
if ((NS_SUCCEEDED(GetViewManager(getter_AddRefs(vm)))) && vm) {
nsIViewManager* vm = GetViewManager();
if (vm) {
vm->UpdateView(mCurrentTargetView,mCurrentTargetRect,0);
if (oldView)
vm->UpdateView(oldView,oldTargetRect,0);
@ -6481,10 +6438,9 @@ struct ReflowEvent : public PLEvent {
ps->ClearReflowEventStatus();
ps->GetReflowBatchingStatus(&isBatching);
if (!isBatching) {
nsCOMPtr<nsIViewManager> viewManager;
// Set a kung fu death grip on the view manager associated with the pres shell
// before processing that pres shell's reflow commands. Fixes bug 54868.
presShell->GetViewManager(getter_AddRefs(viewManager));
nsCOMPtr<nsIViewManager> viewManager = presShell->GetViewManager();
ps->ProcessReflowCommands(PR_TRUE);
// Now, explicitly release the pres shell before the view manager
@ -6580,8 +6536,7 @@ PresShell::ProcessReflowCommands(PRBool aInterruptible)
nsIRenderingContext* rcx;
nsIFrame* rootFrame;
mFrameManager->GetRootFrame(&rootFrame);
nsSize maxSize;
rootFrame->GetSize(maxSize);
nsSize maxSize = rootFrame->GetSize();
nsresult rv=CreateRenderingContext(rootFrame, &rcx);
if (NS_FAILED(rv)) return rv;
@ -7006,8 +6961,6 @@ CompareTrees(nsIPresContext* aFirstPresContext, nsIFrame* aFirstFrame,
nsRect r1, r2;
nsIView* v1, *v2;
nsCOMPtr<nsIWidget> w1;
nsCOMPtr<nsIWidget> w2;
for (;;) {
if (((nsnull == k1) && (nsnull != k2)) ||
((nsnull != k1) && (nsnull == k2))) {
@ -7017,33 +6970,29 @@ CompareTrees(nsIPresContext* aFirstPresContext, nsIFrame* aFirstFrame,
}
else if (nsnull != k1) {
// Verify that the frames are the same size
k1->GetRect(r1);
k2->GetRect(r2);
if (r1 != r2) {
if (k1->GetRect() != k2->GetRect()) {
ok = PR_FALSE;
LogVerifyMessage(k1, k2, "(frame rects)", r1, r2);
LogVerifyMessage(k1, k2, "(frame rects)", k1->GetRect(), k2->GetRect());
}
// Make sure either both have views or neither have views; if they
// do have views, make sure the views are the same size. If the
// views have widgets, make sure they both do or neither does. If
// they do, make sure the widgets are the same size.
v1 = k1->GetView(aFirstPresContext);
v2 = k2->GetView(aSecondPresContext);
v1 = k1->GetView();
v2 = k2->GetView();
if (((nsnull == v1) && (nsnull != v2)) ||
((nsnull != v1) && (nsnull == v2))) {
ok = PR_FALSE;
LogVerifyMessage(k1, k2, "child views are not matched\n");
}
else if (nsnull != v1) {
v1->GetBounds(r1);
v2->GetBounds(r2);
if (r1 != r2) {
LogVerifyMessage(k1, k2, "(view rects)", r1, r2);
if (v1->GetBounds() != v2->GetBounds()) {
LogVerifyMessage(k1, k2, "(view rects)", v1->GetBounds(), v2->GetBounds());
}
v1->GetWidget(*getter_AddRefs(w1));
v2->GetWidget(*getter_AddRefs(w2));
nsIWidget* w1 = v1->GetWidget();
nsIWidget* w2 = v2->GetWidget();
if (((nsnull == w1) && (nsnull != w2)) ||
((nsnull != w1) && (nsnull == w2))) {
ok = PR_FALSE;
@ -7179,8 +7128,8 @@ CompareTrees(nsIPresContext* aFirstPresContext, nsIFrame* aFirstFrame,
}
// Advance to next sibling
k1->GetNextSibling(&k1);
k2->GetNextSibling(&k2);
k1 = k1->GetNextSibling();
k2 = k2->GetNextSibling();
}
else {
break;
@ -7232,18 +7181,15 @@ CompareTrees(nsIPresContext* aFirstPresContext, nsIFrame* aFirstFrame,
static nsIFrame*
FindTopFrame(nsIFrame* aRoot)
{
if (nsnull != aRoot) {
nsIContent* content;
aRoot->GetContent(&content);
if (nsnull != content) {
if (aRoot) {
nsIContent* content = aRoot->GetContent();
if (content) {
nsIAtom* tag;
content->GetTag(tag);
if (nsnull != tag) {
NS_RELEASE(tag);
NS_RELEASE(content);
return aRoot;
}
NS_RELEASE(content);
}
// Try one of the children
@ -7254,7 +7200,7 @@ FindTopFrame(nsIFrame* aRoot)
if (nsnull != result) {
return result;
}
kid->GetNextSibling(&kid);
kid = kid->GetNextSibling();
}
}
return nsnull;
@ -7318,9 +7264,7 @@ PresShell::VerifyIncrementalReflow()
if (NS_SUCCEEDED (rv)) {
scrollView->GetScrollPreference(scrolling);
}
nsCOMPtr<nsIWidget> rootWidget;
rootView->GetWidget(*getter_AddRefs(rootWidget));
void* nativeParentWidget = rootWidget->GetNativeData(NS_NATIVE_WIDGET);
void* nativeParentWidget = rootView->GetWidget()->GetNativeData(NS_NATIVE_WIDGET);
// Create a new view manager.
rv = nsComponentManager::CreateInstance(kViewManagerCID, nsnull,
@ -7836,9 +7780,6 @@ void ReflowCountMgr::PaintCount(const char * aName,
fm->GetHeight(height);
fm->GetMaxAscent(y);
nsRect r;
aFrame->GetRect(r);
PRUint32 color;
PRUint32 color2;
if (aColor != 0) {
@ -7977,7 +7918,7 @@ static void RecurseIndiTotals(nsIPresContext* aPresContext,
aParentFrame->FirstChild(aPresContext, nsnull, &child);
while (child) {
RecurseIndiTotals(aPresContext, aHT, child, aLevel+1);
child->GetNextSibling(&child);
child = child->GetNextSibling();
}
}

View File

@ -94,14 +94,11 @@ nsSelectsAreaFrame::IsOptionElement(nsIContent* aContent)
PRBool
nsSelectsAreaFrame::IsOptionElementFrame(nsIFrame *aFrame)
{
nsIContent *content = nsnull;
aFrame->GetContent(&content);
PRBool result = PR_FALSE;
if (nsnull != content) {
result = IsOptionElement(content);
NS_RELEASE(content);
nsIContent *content = aFrame->GetContent();
if (content) {
return IsOptionElement(content);
}
return(result);
return PR_FALSE;
}
//---------------------------------------------------------
@ -122,10 +119,10 @@ nsSelectsAreaFrame::GetFrameForPoint(nsIPresContext* aPresContext,
if (result == NS_OK) {
nsIFrame* selectedFrame = *aFrame;
while ((nsnull != selectedFrame) && (PR_FALSE == IsOptionElementFrame(selectedFrame))) {
selectedFrame->GetParent(&selectedFrame);
while (selectedFrame && !IsOptionElementFrame(selectedFrame)) {
selectedFrame = selectedFrame->GetParent();
}
if (nsnull != selectedFrame) {
if (selectedFrame) {
*aFrame = selectedFrame;
}
// else, keep the original result as *aFrame, which could be this frame
@ -141,11 +138,11 @@ nsSelectsAreaFrame::Paint(nsIPresContext* aPresContext,
nsFramePaintLayer aWhichLayer,
PRUint32 aFlags)
{
nsresult rv = nsAreaFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer, aFlags);
nsAreaFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer, aFlags);
nsIFrame* frame = this;
while (frame) {
frame->GetParent(&frame);
frame = frame->GetParent();
nsCOMPtr<nsIAtom> type;
frame->GetFrameType(getter_AddRefs(type));
if (type == nsLayoutAtoms::listControlFrame) {

View File

@ -177,7 +177,7 @@ nsInlineFrame::IsEmpty(nsCompatibility aCompatMode, PRBool aIsPre,
}
*aResult = PR_TRUE;
for (nsIFrame *kid = mFrames.FirstChild(); kid; kid->GetNextSibling(&kid)) {
for (nsIFrame *kid = mFrames.FirstChild(); kid; kid = kid->GetNextSibling()) {
kid->IsEmpty(aCompatMode, aIsPre, aResult);
if (! *aResult)
break;
@ -254,17 +254,14 @@ nsInlineFrame::RemoveFrame(nsIPresContext* aPresContext,
if (frameType == nsLayoutAtoms::brFrame)
generateReflowCommand = PR_TRUE;
nsIFrame* oldFrameParent;
aOldFrame->GetParent(&oldFrameParent);
nsInlineFrame* parent = (nsInlineFrame*) oldFrameParent;
while (nsnull != aOldFrame) {
nsInlineFrame* parent = NS_STATIC_CAST(nsInlineFrame*, aOldFrame->GetParent());
while (aOldFrame) {
#ifdef IBMBIDI
if (nsLayoutAtoms::nextBidi != aListName) {
#endif
// If the frame being removed has zero size then don't bother
// generating a reflow command, otherwise make sure we do.
nsRect bbox;
aOldFrame->GetRect(bbox);
nsRect bbox = aOldFrame->GetRect();
if (bbox.width || bbox.height) {
generateReflowCommand = PR_TRUE;
}
@ -279,8 +276,8 @@ nsInlineFrame::RemoveFrame(nsIPresContext* aPresContext,
aOldFrame->GetNextInFlow(&oldFrameNextInFlow);
parent->mFrames.DestroyFrame(aPresContext, aOldFrame);
aOldFrame = oldFrameNextInFlow;
if (nsnull != aOldFrame) {
aOldFrame->GetParent((nsIFrame**) &parent);
if (aOldFrame) {
parent = NS_STATIC_CAST(nsInlineFrame*, aOldFrame->GetParent());
}
}
@ -416,9 +413,7 @@ nsInlineFrame::Reflow(nsIPresContext* aPresContext,
// our prev-in-flow's overflow list, it's possible that we have not set
// the parent pointer for these frames. Check the first frame to see, and
// if we haven't set the parent pointer then set it now
nsIFrame* parent;
overflowFrames->GetParent(&parent);
mFrames.AppendFrames(parent == this ? nsnull : this, overflowFrames);
mFrames.AppendFrames(overflowFrames->GetParent() == this ? nsnull : this, overflowFrames);
}
}
@ -553,7 +548,7 @@ nsInlineFrame::ReflowFrames(nsIPresContext* aPresContext,
break;
}
irs.mPrevFrame = frame;
frame->GetNextSibling(&frame);
frame = frame->GetNextSibling();
}
// Attempt to pull frames from our next-in-flow until we can't
@ -686,9 +681,7 @@ nsInlineFrame::ReflowFrames(nsIPresContext* aPresContext,
static
void SetContainsPercentAwareChild(nsIFrame *aFrame)
{
nsFrameState myFrameState;
aFrame->GetFrameState(&myFrameState);
aFrame->SetFrameState(myFrameState | NS_INLINE_FRAME_CONTAINS_PERCENT_AWARE_CHILD);
aFrame->AddStateBits(NS_INLINE_FRAME_CONTAINS_PERCENT_AWARE_CHILD);
}
static
@ -696,9 +689,7 @@ void MarkPercentAwareFrame(nsIPresContext *aPresContext,
nsInlineFrame *aInline,
nsIFrame *aFrame)
{
nsFrameState childFrameState;
aFrame->GetFrameState(&childFrameState);
if (childFrameState & NS_FRAME_REPLACED_ELEMENT)
if (aFrame->GetStateBits() & NS_FRAME_REPLACED_ELEMENT)
{ // aFrame is a replaced element, check it's style
if (nsLineLayout::IsPercentageAwareReplacedElement(aPresContext, aFrame)) {
SetContainsPercentAwareChild(aInline);
@ -710,7 +701,7 @@ void MarkPercentAwareFrame(nsIPresContext *aPresContext,
aFrame->FirstChild(aPresContext, nsnull, &child);
if (child)
{ // aFrame is an inline container frame, check my frame state
if (childFrameState & NS_INLINE_FRAME_CONTAINS_PERCENT_AWARE_CHILD) {
if (child->GetStateBits() & NS_INLINE_FRAME_CONTAINS_PERCENT_AWARE_CHILD) {
SetContainsPercentAwareChild(aInline); // if a child container is effected, so am I
}
}
@ -760,11 +751,8 @@ nsInlineFrame::ReflowInlineFrame(nsIPresContext* aPresContext,
// remaining child frames in our child list with the wrong parent
// frame pointer...
if (irs.mSetParentPointer) {
nsIFrame* f;
aFrame->GetNextSibling(&f);
while (f) {
for (nsIFrame* f = aFrame->GetNextSibling(); f; f = f->GetNextSibling()) {
f->SetParent(this);
f->GetNextSibling(&f);
}
}
}
@ -778,9 +766,8 @@ nsInlineFrame::ReflowInlineFrame(nsIPresContext* aPresContext,
return rv;
}
}
nsIFrame* nextFrame;
aFrame->GetNextSibling(&nextFrame);
if (nsnull != nextFrame) {
nsIFrame* nextFrame = aFrame->GetNextSibling();
if (nextFrame) {
aStatus |= NS_FRAME_NOT_COMPLETE;
PushFrames(aPresContext, nextFrame, aFrame);
}
@ -812,9 +799,8 @@ nsInlineFrame::ReflowInlineFrame(nsIPresContext* aPresContext,
return rv;
}
if (!reflowingFirstLetter) {
nsIFrame* nextFrame;
aFrame->GetNextSibling(&nextFrame);
if (nsnull != nextFrame) {
nsIFrame* nextFrame = aFrame->GetNextSibling();
if (nextFrame) {
PushFrames(aPresContext, nextFrame, aFrame);
}
}
@ -854,11 +840,7 @@ nsInlineFrame::PushFrames(nsIPresContext* aPresContext,
{
NS_PRECONDITION(nsnull != aFromChild, "null pointer");
NS_PRECONDITION(nsnull != aPrevSibling, "pushing first child");
#ifdef DEBUG
nsIFrame* prevNextSibling;
aPrevSibling->GetNextSibling(&prevNextSibling);
NS_PRECONDITION(prevNextSibling == aFromChild, "bad prev sibling");
#endif
NS_PRECONDITION(aPrevSibling->GetNextSibling() == aFromChild, "bad prev sibling");
#ifdef NOISY_PUSHING
printf("%p pushing aFromChild %p, disconnecting from prev sib %p\n",
@ -943,10 +925,9 @@ ReParentChildListStyle(nsIPresContext* aPresContext,
nsStyleContext* aParentStyleContext,
nsFrameList& aFrameList)
{
nsIFrame* kid = aFrameList.FirstChild();
while (nsnull != kid) {
for (nsIFrame* kid = aFrameList.FirstChild(); kid;
kid = kid->GetNextSibling()) {
aPresContext->ReParentStyleContext(kid, aParentStyleContext);
kid->GetNextSibling(&kid);
}
}
@ -1085,9 +1066,7 @@ nsFirstLineFrame::Reflow(nsIPresContext* aPresContext,
if (mStyleContext == first->mStyleContext) {
// Fixup our style context and our children. First get the
// proper parent context.
nsIFrame* parentFrame;
first->GetParent(&parentFrame);
nsStyleContext* parentContext = parentFrame->GetStyleContext();
nsStyleContext* parentContext = first->GetParent()->GetStyleContext();
if (parentContext) {
// Create a new style context that is a child of the parent
// style context thus removing the :first-line style. This way

View File

@ -227,7 +227,7 @@ nsLineBox::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const
if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) {
frameDebug->List(aPresContext, out, aIndent + 1);
}
frame->GetNextSibling(&frame);
frame = frame->GetNextSibling();
}
for (i = aIndent; --i >= 0; ) fputs(" ", out);
@ -246,7 +246,7 @@ nsLineBox::LastChild() const
nsIFrame* frame = mFirstChild;
PRInt32 n = GetChildCount() - 1;
while (--n >= 0) {
frame->GetNextSibling(&frame);
frame = frame->GetNextSibling();
}
return frame;
}
@ -267,7 +267,7 @@ nsLineBox::IndexOf(nsIFrame* aFrame) const
if (frame == aFrame) {
return i;
}
frame->GetNextSibling(&frame);
frame = frame->GetNextSibling();
}
return -1;
}
@ -284,7 +284,7 @@ nsLineBox::IsEmpty(nsCompatibility aCompatMode, PRBool aParentIsPre,
nsIFrame *kid;
for (n = GetChildCount(), kid = mFirstChild;
n > 0;
--n, kid->GetNextSibling(&kid))
--n, kid = kid->GetNextSibling())
{
kid->IsEmpty(aCompatMode, aParentIsPre, aResult);
if (! *aResult)
@ -301,8 +301,7 @@ nsLineBox::DeleteLineList(nsIPresContext* aPresContext, nsLineList& aLines)
// we do all of this before our base class releases it's hold on the
// view.
for (nsIFrame* child = aLines.front()->mFirstChild; child; ) {
nsIFrame* nextChild;
child->GetNextSibling(&nextChild);
nsIFrame* nextChild = child->GetNextSibling();
child->Destroy(aPresContext);
child = nextChild;
}
@ -660,7 +659,6 @@ nsLineIterator::CheckLineOrder(PRInt32 aLine,
nsIFrame **aFirstVisual,
nsIFrame **aLastVisual)
{
nsRect checkRect;
PRInt32 currentLine, saveLine, testLine;
nscoord saveX;
nsIFrame *checkFrame;
@ -689,16 +687,13 @@ nsLineIterator::CheckLineOrder(PRInt32 aLine,
checkFrame = line->mFirstChild;
checkFrame->GetRect(checkRect);
result = FindLineContaining(checkFrame, &saveLine);
if (NS_FAILED(result))
return result;
saveX = checkRect.x;
saveX = checkFrame->GetRect().x;
lineFrameCount = line->GetChildCount();
for (; checkFrame; result = checkFrame->GetNextSibling(&checkFrame)) {
if (NS_FAILED(result))
break;
for (; checkFrame; checkFrame = checkFrame->GetNextSibling()) {
result = FindLineContaining(checkFrame, &testLine);
if (NS_FAILED(result))
return result;
@ -707,7 +702,7 @@ nsLineIterator::CheckLineOrder(PRInt32 aLine,
break;
}
checkFrame->GetRect(checkRect);
nsRect checkRect = checkFrame->GetRect();
// If the origin of any frame is less than the previous frame, the line is reordered
if (checkRect.x < saveX) {
*aIsReordered = PR_TRUE;
@ -731,19 +726,12 @@ nsLineIterator::CheckLineOrder(PRInt32 aLine,
return result;
leftmostFrame = rightmostFrame = firstFrame;
firstFrame->GetRect(checkRect);
maxX = checkRect.x;
minX = checkRect.x;
maxX = minX = firstFrame->GetRect().x;
for (;lineFrameCount > 1;lineFrameCount--) {
result = firstFrame->GetNextSibling(&firstFrame);
firstFrame = firstFrame->GetNextSibling();
if (NS_FAILED(result)){
NS_ASSERTION(0,"should not be reached nsLineBox\n");
return NS_ERROR_FAILURE;
}
firstFrame->GetRect(checkRect);
nsRect checkRect = firstFrame->GetRect();
if (checkRect.x > maxX) {
maxX = checkRect.x;
rightmostFrame = firstFrame;
@ -796,7 +784,6 @@ nsLineIterator::FindFrameAt(PRInt32 aLineNumber,
if (line->mBounds.width == 0)
return NS_ERROR_FAILURE;
nsRect r1, r2;
nsIFrame *stoppingFrame = nsnull;
if (aX < line->mBounds.x) {
@ -807,8 +794,7 @@ nsLineIterator::FindFrameAt(PRInt32 aLineNumber,
else {
frame = line->mFirstChild;
}
frame->GetRect(r1);
if (r1.width > 0)
if (frame->GetRect().width > 0)
{
*aFrameFound = frame;
*aXIsBeforeFirstFrame = PR_TRUE;
@ -828,8 +814,7 @@ nsLineIterator::FindFrameAt(PRInt32 aLineNumber,
else {
frame = line->LastChild();
}
frame->GetRect(r1);
if (r1.width > 0)
if (frame->GetRect().width > 0)
{
*aFrameFound = frame;
*aXIsBeforeFirstFrame = PR_FALSE;
@ -868,37 +853,36 @@ nsLineIterator::FindFrameAt(PRInt32 aLineNumber,
if (isReordered) {
nscoord maxX, limX;
PRInt32 testLine;
nsRect tempRect;
nsIFrame* tempFrame;
maxX = -0x7fffffff;
frame->GetRect(tempRect);
limX = tempRect.x;
limX = frame->GetRect().x;
tempFrame = line->mFirstChild;
nextFrame = nsnull;
while (tempFrame) {
if (NS_SUCCEEDED(FindLineContaining(tempFrame, &testLine))
&& testLine == aLineNumber) {
tempFrame->GetRect(tempRect);
nsRect tempRect = tempFrame->GetRect();
if (tempRect.x > maxX && tempRect.x < limX) { // we are looking for the highest value less than the current one
maxX = tempRect.x;
nextFrame = tempFrame;
}
}
tempFrame->GetNextSibling(&tempFrame);
tempFrame = tempFrame->GetNextSibling();
}
}
else
#endif // IBMBIDI
frame->GetNextSibling(&nextFrame);
frame->GetRect(r1);
nextFrame = frame->GetNextSibling();
nsRect r1 = frame->GetRect();
if (r1.width && aX > r1.x) {
break;
}
if (nextFrame) {
nextFrame->GetRect(r2);
nsRect r2 = nextFrame->GetRect();
if (r2.width && aX > r2.XMost()) {
nscoord rightEdge = r2.XMost();
nscoord delta = r1.x - rightEdge;
@ -923,39 +907,38 @@ nsLineIterator::FindFrameAt(PRInt32 aLineNumber,
if (!frame)
break;
if (isReordered) {
nsRect tempRect;
nsIFrame* tempFrame;
nscoord minX, limX;
PRInt32 testLine;
minX = 0x7fffffff;
frame->GetRect(tempRect);
limX = tempRect.x;
limX = frame->GetRect().x;
tempFrame = line->mFirstChild;
nextFrame = nsnull;
while (tempFrame) {
if (NS_SUCCEEDED(FindLineContaining(tempFrame, &testLine))
&& testLine == aLineNumber) {
tempFrame->GetRect(tempRect);
nsRect tempRect = tempFrame->GetRect();
if (tempRect.width && tempRect.x < minX && tempRect.x > limX) { // we are looking for the lowest value greater than the current one
minX = tempRect.x;
nextFrame = tempFrame;
}
}
tempFrame->GetNextSibling(&tempFrame);
tempFrame = tempFrame->GetNextSibling();
}
}
else
#endif // IBMBIDI
frame->GetNextSibling(&nextFrame);
frame->GetRect(r1);
nextFrame = frame->GetNextSibling();
nsRect r1 = frame->GetRect();
if (r1.width && aX < r1.XMost()) {
break;
}
if (nextFrame) {
nextFrame->GetRect(r2);
nsRect r2 = nextFrame->GetRect();
if (r2.width && aX < r2.x) {
nscoord rightEdge = r1.XMost();
nscoord delta = r2.x - rightEdge;
@ -981,7 +964,8 @@ nsLineIterator::FindFrameAt(PRInt32 aLineNumber,
NS_IMETHODIMP
nsLineIterator::GetNextSiblingOnLine(nsIFrame*& aFrame, PRInt32 aLineNumber)
{
return aFrame->GetNextSibling(&aFrame);
aFrame = aFrame->GetNextSibling();
return NS_OK;
}
//----------------------------------------------------------------------

View File

@ -97,19 +97,17 @@ static nscoord AccumulateImageSizes(nsIPresContext& aPresContext, nsIFrame& aFra
nsCOMPtr<nsIAtom> type;
aFrame.GetFrameType(getter_AddRefs(type));
if(type.get() == nsLayoutAtoms::imageFrame) {
nsSize size;
aFrame.GetSize(size);
sizes += NS_STATIC_CAST(nscoord,size.width);
sizes += NS_STATIC_CAST(nscoord, aFrame.GetSize().width);
} else {
// see if there are children to process
nsIFrame* child = nsnull;
// XXX: process alternate child lists?
aFrame.FirstChild(&aPresContext,nsnull,&child);
while(child) {
while (child) {
// recurse: note that we already know we are in a child frame, so no need to track further
sizes += AccumulateImageSizes(aPresContext, *child);
// now next sibling
child->GetNextSibling(&child);
child = child->GetNextSibling();
}
}
@ -879,9 +877,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
// the frame state.
const nsHTMLReflowState* rs = psd->mReflowState;
nsReflowReason reason = eReflowReason_Resize;
nsFrameState state;
aFrame->GetFrameState(&state);
if (NS_FRAME_FIRST_REFLOW & state) {
if (NS_FRAME_FIRST_REFLOW & aFrame->GetStateBits()) {
reason = eReflowReason_Initial;
}
else if (rs->reason == eReflowReason_Incremental) { // XXX
@ -914,7 +910,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
}
}
else if (type == eReflowType_ReflowDirty &&
(state & NS_FRAME_IS_DIRTY) &&
(aFrame->GetStateBits() & NS_FRAME_IS_DIRTY) &&
!frameIsOnReflowPath) {
reason = eReflowReason_Dirty;
}
@ -924,7 +920,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
reason = eReflowReason_StyleChange;
}
else if (rs->reason == eReflowReason_Dirty) {
if (state & NS_FRAME_IS_DIRTY)
if (aFrame->GetStateBits() & NS_FRAME_IS_DIRTY)
reason = eReflowReason_Dirty;
}
@ -1019,7 +1015,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
PRInt32 start, end;
if (bidiEnabled) {
if (state & NS_FRAME_IS_BIDI) {
if (aFrame->GetStateBits() & NS_FRAME_IS_BIDI) {
aFrame->GetOffsets(start, end);
}
}
@ -1045,10 +1041,9 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
// for the text frame's initial reflow (once in the text frame's lifetime)
// and we don't make any expensive calls.
// Doing it this way shields us from knowing anything about the frame structure inside a text control.
nsIFrame *parentFrame;
aFrame->GetParent(&parentFrame);
PRBool inTextControl = PR_FALSE;
while (parentFrame)
for (nsIFrame *parentFrame = aFrame->GetParent(); parentFrame;
parentFrame = parentFrame->GetParent())
{
nsCOMPtr<nsIAtom> parentFrameType;
parentFrame->GetFrameType(getter_AddRefs(parentFrameType));
@ -1060,7 +1055,6 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
break;
}
}
parentFrame->GetParent(&parentFrame); // advance the loop up the frame tree
}
if (inTextControl)
{
@ -1115,9 +1109,9 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
// to have zero width.
if (metrics.width) {
pfd->SetFlag(PFD_ISNONEMPTYTEXTFRAME, PR_TRUE);
nsCOMPtr<nsIContent> content;
nsresult result = pfd->mFrame->GetContent(getter_AddRefs(content));
if ((NS_SUCCEEDED(result)) && content) {
nsIContent* content = pfd->mFrame->GetContent();
if (content) {
nsresult result;
nsCOMPtr<nsITextContent> textContent
= do_QueryInterface(content, &result);
if ((NS_SUCCEEDED(result)) && textContent) {
@ -1210,8 +1204,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
}
#endif
aFrame->GetFrameState(&state);
if (NS_FRAME_OUTSIDE_CHILDREN & state) {
if (NS_FRAME_OUTSIDE_CHILDREN & aFrame->GetStateBits()) {
pfd->mCombinedArea = metrics.mOverflowArea;
}
else {
@ -1227,11 +1220,10 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
}
// Size the frame and size its view (if it has one)
aFrame->SizeTo(mPresContext, metrics.width, metrics.height);
aFrame->SetSize(nsSize(metrics.width, metrics.height));
if (aFrame->HasView()) {
nsIView* view = aFrame->GetView(mPresContext);
nsIViewManager *vm;
view->GetViewManager(vm);
nsIView* view = aFrame->GetView();
nsIViewManager *vm = view->GetViewManager();
#if 0 // XXX This is the correct code. We'll turn it on later to mitigate risk.
vm->ResizeView(view, pfd->mCombinedArea);
@ -1239,7 +1231,6 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
nsRect r(0, 0, metrics.width, metrics.height);
vm->ResizeView(view, r);
#endif
NS_RELEASE(vm);
}
// Tell the frame that we're done reflowing it
@ -1261,8 +1252,8 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
// Remove all of the childs next-in-flows. Make sure that we ask
// the right parent to do the removal (it's possible that the
// parent is not this because we are executing pullup code)
nsHTMLContainerFrame* parent;
kidNextInFlow->GetParent((nsIFrame**) &parent);
nsHTMLContainerFrame* parent = NS_STATIC_CAST(nsHTMLContainerFrame*,
kidNextInFlow->GetParent());
parent->DeleteNextInFlowChild(mPresContext, kidNextInFlow);
}
}
@ -1299,7 +1290,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
printf(" status=%x\n", aReflowStatus);
#endif
if (state & NS_FRAME_IS_BIDI) {
if (aFrame->GetStateBits() & NS_FRAME_IS_BIDI) {
// Since aReflowStatus may change, check it at the end
if (NS_INLINE_IS_BREAK_BEFORE(aReflowStatus) ) {
aFrame->AdjustOffsetsForBidi(start, end);
@ -1643,7 +1634,7 @@ nsLineLayout::AddBulletFrame(nsIFrame* aFrame,
pfd->mDescent = aMetrics.descent;
// Note: y value will be updated during vertical alignment
aFrame->GetRect(pfd->mBounds);
pfd->mBounds = aFrame->GetRect();
pfd->mCombinedArea = aMetrics.mOverflowArea;
if (mComputeMaxElementWidth) {
pfd->mMaxElementWidth = aMetrics.width;
@ -1690,9 +1681,7 @@ PRBool
nsLineLayout::IsPercentageAwareReplacedElement(nsIPresContext *aPresContext,
nsIFrame* aFrame)
{
nsFrameState frameState;
aFrame->GetFrameState(&frameState);
if (frameState & NS_FRAME_REPLACED_ELEMENT)
if (aFrame->GetStateBits() & NS_FRAME_REPLACED_ELEMENT)
{
nsCOMPtr<nsIAtom> frameType;
aFrame->GetFrameType(getter_AddRefs(frameType));
@ -1732,9 +1721,7 @@ nsLineLayout::IsPercentageAwareReplacedElement(nsIPresContext *aPresContext,
PRBool IsPercentageAwareFrame(nsIPresContext *aPresContext, nsIFrame *aFrame)
{
nsFrameState childFrameState;
aFrame->GetFrameState(&childFrameState);
if (childFrameState & NS_FRAME_REPLACED_ELEMENT) {
if (aFrame->GetStateBits() & NS_FRAME_REPLACED_ELEMENT) {
if (nsLineLayout::IsPercentageAwareReplacedElement(aPresContext, aFrame)) {
return PR_TRUE;
}
@ -1745,7 +1732,7 @@ PRBool IsPercentageAwareFrame(nsIPresContext *aPresContext, nsIFrame *aFrame)
aFrame->FirstChild(aPresContext, nsnull, &child);
if (child)
{ // aFrame is an inline container frame, check my frame state
if (childFrameState & NS_INLINE_FRAME_CONTAINS_PERCENT_AWARE_CHILD) {
if (aFrame->GetStateBits() & NS_INLINE_FRAME_CONTAINS_PERCENT_AWARE_CHILD) {
return PR_TRUE;
}
}
@ -1936,7 +1923,7 @@ nsLineLayout::VerticalAlignLine(nsLineBox* aLineBox,
pfd->mBounds.y += baselineY;
break;
}
pfd->mFrame->SetRect(mPresContext, pfd->mBounds);
pfd->mFrame->SetRect(pfd->mBounds);
#ifdef NOISY_VERTICAL_ALIGN
printf(" [child of line]");
nsFrame::ListTag(stdout, pfd->mFrame);
@ -1999,7 +1986,7 @@ nsLineLayout::PlaceTopBottomFrames(PerSpanData* psd,
else {
pfd->mBounds.y = -aDistanceFromTop + pfd->mMargin.top;
}
pfd->mFrame->SetRect(mPresContext, pfd->mBounds);
pfd->mFrame->SetRect(pfd->mBounds);
#ifdef NOISY_VERTICAL_ALIGN
printf(" ");
nsFrame::ListTag(stdout, pfd->mFrame);
@ -2020,7 +2007,7 @@ nsLineLayout::PlaceTopBottomFrames(PerSpanData* psd,
pfd->mBounds.y = -aDistanceFromTop + aLineHeight -
pfd->mMargin.bottom - pfd->mBounds.height;
}
pfd->mFrame->SetRect(mPresContext, pfd->mBounds);
pfd->mFrame->SetRect(pfd->mBounds);
#ifdef NOISY_VERTICAL_ALIGN
printf(" ");
nsFrame::ListTag(stdout, pfd->mFrame);
@ -2514,7 +2501,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
#endif
}
if (psd != mRootSpan) {
frame->SetRect(mPresContext, pfd->mBounds);
frame->SetRect(pfd->mBounds);
}
}
pfd = pfd->mNext;
@ -2543,11 +2530,10 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
// be checking for any particular content tag type, but rather should
// be checking for the existence of a bullet frame to determine if it's a list element or not.
if (!applyMinLH && (isFirstLine || isLastLine)) {
nsCOMPtr<nsIContent> blockContent;
nsresult result = mRootSpan->mFrame->mFrame->GetContent(getter_AddRefs(blockContent));
if ( NS_SUCCEEDED(result) && blockContent) {
nsIContent* blockContent = mRootSpan->mFrame->mFrame->GetContent();
if (blockContent) {
nsCOMPtr<nsIAtom> blockTagAtom;
result = blockContent->GetTag(getter_AddRefs(blockTagAtom));
nsresult result = blockContent->GetTag(getter_AddRefs(blockTagAtom));
if ( NS_SUCCEEDED(result) && blockTagAtom) {
// (2) above, if the first line of LI
if (isFirstLine && blockTagAtom.get() == nsHTMLAtoms::li) {
@ -2648,7 +2634,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
pfd = psd->mFirstFrame;
while (nsnull != pfd) {
pfd->mBounds.y -= minY; // move all the children back up
pfd->mFrame->SetRect(mPresContext, pfd->mBounds);
pfd->mFrame->SetRect(pfd->mBounds);
pfd = pfd->mNext;
}
maxY -= minY; // since minY is in the frame's own coordinate system
@ -2724,11 +2710,10 @@ nsLineLayout::TrimTrailingWhiteSpaceIn(PerSpanData* psd,
// that are direct children of the block will be updated
// later, however, because the VerticalAlignFrames method
// will be run after this method.
nsRect r;
nsIFrame* f = pfd->mFrame;
f->GetRect(r);
nsRect r = f->GetRect();
r.width -= deltaWidth;
f->SetRect(mPresContext, r);
f->SetRect(r);
}
// Adjust the right edge of the span that contains the child span
@ -2780,7 +2765,7 @@ nsLineLayout::TrimTrailingWhiteSpaceIn(PerSpanData* psd,
if (psd != mRootSpan) {
// The frame was already placed during psd's
// reflow. Update the frames rectangle now.
pfd->mFrame->SetRect(mPresContext, pfd->mBounds);
pfd->mFrame->SetRect(pfd->mBounds);
}
// Adjust containing span's right edge
@ -2898,7 +2883,7 @@ nsLineLayout::ApplyFrameJustification(PerSpanData* aPSD, FrameJustificationState
pfd->mBounds.width += dw;
deltaX += dw;
pfd->mFrame->SetRect(mPresContext, pfd->mBounds);
pfd->mFrame->SetRect(pfd->mBounds);
}
}
return deltaX;
@ -2949,8 +2934,7 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds,
// than the frame type due to the changes for bug 141054.)
if (!InStrictMode()) {
if (psd->mFirstFrame && psd->mFirstFrame->mFrame) {
nsCOMPtr<nsIContent> content;
psd->mFirstFrame->mFrame->GetContent(getter_AddRefs(content));
nsIContent* content = psd->mFirstFrame->mFrame->GetContent();
if (content) {
nsCOMPtr<nsIAtom> tag;
content->GetTag(getter_AddRefs(tag));
@ -2967,7 +2951,7 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds,
// of its children.
nsIFrame *child;
for (hrFrame->FirstChild(mPresContext, nsnull, &child);
child; child->GetNextSibling(&child)) {
child; child = child->GetNextSibling()) {
child->GetFrameType(getter_AddRefs(frameType));
if (frameType == nsLayoutAtoms::hrFrame) {
hrFrame = child;
@ -3075,7 +3059,7 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds,
if (bulletPfd) {
bulletPfd->mBounds.x += maxX;
bulletPfd->mFrame->SetRect(mPresContext, bulletPfd->mBounds);
bulletPfd->mFrame->SetRect(bulletPfd->mBounds);
}
}
if ( (0 != dx) || (visualRTL) )
@ -3101,7 +3085,7 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds,
maxX = pfd->mBounds.x = maxX - (pfd->mMargin.left + pfd->mBounds.width + pfd->mMargin.right);
}
#endif // IBMBIDI
pfd->mFrame->SetRect(mPresContext, pfd->mBounds);
pfd->mFrame->SetRect(pfd->mBounds);
}
aLineBounds.x += dx;
}
@ -3118,7 +3102,7 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds,
PRUint32 maxX = psd->mRightEdge;
while (nsnull != pfd) {
pfd->mBounds.x = maxX - (pfd->mMargin.left + pfd->mBounds.width + pfd->mMargin.right);
pfd->mFrame->SetRect(mPresContext, pfd->mBounds);
pfd->mFrame->SetRect(pfd->mBounds);
maxX = pfd->mBounds.x;
pfd = pfd->mNext;
}
@ -3138,7 +3122,6 @@ nsLineLayout::RelativePositionFrames(nsRect& aCombinedArea)
void
nsLineLayout::RelativePositionFrames(PerSpanData* psd, nsRect& aCombinedArea)
{
nsPoint origin;
nsRect spanCombinedArea;
PerFrameData* pfd;
@ -3172,11 +3155,10 @@ nsLineLayout::RelativePositionFrames(PerSpanData* psd, nsRect& aCombinedArea)
// Adjust the origin of the frame
if (pfd->GetFlag(PFD_RELATIVEPOS)) {
nsIFrame* frame = pfd->mFrame;
frame->GetOrigin(origin);
// XXX what about right and bottom?
nscoord dx = pfd->mOffsets.left;
nscoord dy = pfd->mOffsets.top;
frame->MoveTo(mPresContext, origin.x + dx, origin.y + dy);
frame->SetPosition(frame->GetPosition() + nsPoint(dx, dy));
x += dx;
y += dy;
}
@ -3244,18 +3226,14 @@ nsLineLayout::RelativePositionFrames(PerSpanData* psd, nsRect& aCombinedArea)
// If we just computed a spans combined area, we need to update its
// NS_FRAME_OUTSIDE_CHILDREN bit..
if (nsnull != psd->mFrame) {
if (psd->mFrame) {
pfd = psd->mFrame;
nsIFrame* frame = pfd->mFrame;
nsFrameState oldState;
frame->GetFrameState(&oldState);
nsFrameState newState = oldState & ~NS_FRAME_OUTSIDE_CHILDREN;
if ((minX < 0) || (minY < 0) ||
(maxX > pfd->mBounds.width) || (maxY > pfd->mBounds.height)) {
newState |= NS_FRAME_OUTSIDE_CHILDREN;
}
if (newState != oldState) {
frame->SetFrameState(newState);
frame->AddStateBits(NS_FRAME_OUTSIDE_CHILDREN);
} else {
frame->RemoveStateBits(NS_FRAME_OUTSIDE_CHILDREN);
}
}
}
@ -3291,9 +3269,9 @@ nsLineLayout::FindNextText(nsIPresContext* aPresContext, nsIFrame* aFrame)
for (;;) {
stack.InsertElementAt(aFrame, 0);
aFrame->GetParent(&aFrame);
aFrame = aFrame->GetParent();
NS_ASSERTION(aFrame != nsnull, "wow, no block frame found");
NS_ASSERTION(aFrame, "wow, no block frame found");
if (! aFrame)
break;
@ -3315,8 +3293,7 @@ nsLineLayout::FindNextText(nsIPresContext* aPresContext, nsIFrame* aFrame)
return nsnull;
// Advance to top's next sibling
nsIFrame* next;
top->GetNextSibling(&next);
nsIFrame* next = top->GetNextSibling();
if (! next) {
// No more siblings. Pop the top element to walk back up the
@ -3327,9 +3304,7 @@ nsLineLayout::FindNextText(nsIPresContext* aPresContext, nsIFrame* aFrame)
// We know top's parent is good, but next's might not be. So let's
// set it to be sure.
nsIFrame* parent;
top->GetParent(&parent);
next->SetParent(parent);
next->SetParent(top->GetParent());
// Save next at the top of the stack...
stack.ReplaceElementAt(next, lastIndex);

View File

@ -792,65 +792,57 @@ nsObjectFrame::CreateWidget(nsIPresContext* aPresContext,
if (NS_OK != result) {
return result;
}
nsCOMPtr<nsIViewManager> viewMan;
nsRect boundBox(0, 0, aWidth, aHeight);
nsIFrame* parWithView;
nsIView *parView = GetAncestorWithView()->GetView();
nsIViewManager* viewMan = parView->GetViewManager();
GetParentWithView(aPresContext, &parWithView);
nsIView *parView = parWithView->GetView(aPresContext);
if (NS_SUCCEEDED(parView->GetViewManager(*getter_AddRefs(viewMan))))
{
// nsWidgetInitData* initData = GetWidgetInitData(aPresContext); // needs to be deleted
// initialize the view as hidden since we don't know the (x,y) until Paint
result = view->Init(viewMan, boundBox, parView, nsViewVisibility_kHide);
result = view->Init(viewMan, boundBox, parView, nsViewVisibility_kHide);
// if (nsnull != initData) {
// delete(initData);
// }
if (NS_FAILED(result)) {
return NS_OK; //XXX why OK? MMP
}
if (NS_FAILED(result)) {
return NS_OK; //XXX why OK? MMP
}
#if 0
// set the content's widget, so it can get content modified by the widget
nsIWidget *widget;
result = GetWidget(view, &widget);
if (NS_OK == result) {
nsInput* content = (nsInput *)mContent; // change this cast to QueryInterface
content->SetWidget(widget);
NS_IF_RELEASE(widget);
} else {
NS_ASSERTION(0, "could not get widget");
}
// set the content's widget, so it can get content modified by the widget
nsIWidget *widget = view->GetWidget();
if (widget) {
nsInput* content = (nsInput *)mContent; // change this cast to QueryInterface
content->SetWidget(widget);
} else {
NS_ASSERTION(0, "could not get widget");
}
#endif
// Turn off double buffering on the Mac. This depends on bug 49743 and partially
// fixes 32327, 19931 amd 51787
// Turn off double buffering on the Mac. This depends on bug 49743 and partially
// fixes 32327, 19931 amd 51787
#if defined(XP_MAC) || defined(XP_MACOSX)
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));
PRBool doubleBuffer = PR_FALSE;
if (prefBranch) {
prefBranch->GetBoolPref("plugin.enable_double_buffer", &doubleBuffer);
}
viewMan->AllowDoubleBuffering(doubleBuffer);
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));
PRBool doubleBuffer = PR_FALSE;
if (prefBranch) {
prefBranch->GetBoolPref("plugin.enable_double_buffer", &doubleBuffer);
}
viewMan->AllowDoubleBuffering(doubleBuffer);
#endif
// XXX Put this last in document order
// XXX Should we be setting the z-index here?
viewMan->InsertChild(parView, view, nsnull, PR_TRUE);
if(aViewOnly != PR_TRUE) {
// Bug 179822: Create widget and allow non-unicode SubClass
nsWidgetInitData initData;
initData.mUnicode = PR_FALSE;
result = view->CreateWidget(kWidgetCID, &initData);
if (NS_FAILED(result)) {
return NS_OK; //XXX why OK? MMP
}
// XXX Put this last in document order
// XXX Should we be setting the z-index here?
viewMan->InsertChild(parView, view, nsnull, PR_TRUE);
if(aViewOnly != PR_TRUE) {
// Bug 179822: Create widget and allow non-unicode SubClass
nsWidgetInitData initData;
initData.mUnicode = PR_FALSE;
result = view->CreateWidget(kWidgetCID, &initData);
if (NS_FAILED(result)) {
return NS_OK; //XXX why OK? MMP
}
}
@ -859,11 +851,10 @@ nsObjectFrame::CreateWidget(nsIPresContext* aPresContext,
// the child window background color when painting. If it's not set, it may default to gray
// Sometimes, a frame doesn't have a background color or is transparent. In this
// case, walk up the frame tree until we do find a frame with a background color
for (nsIFrame* frame = this; frame; frame->GetParent(&frame)) {
for (nsIFrame* frame = this; frame; frame = frame->GetParent()) {
const nsStyleBackground* background = frame->GetStyleBackground();
if (!background->IsTransparent()) { // make sure we got an actual color
nsCOMPtr<nsIWidget> win;
view->GetWidget(*getter_AddRefs(win));
nsIWidget* win = view->GetWidget();
if (win)
win->SetBackgroundColor(background->mBackgroundColor);
break;
@ -885,7 +876,7 @@ nsObjectFrame::CreateWidget(nsIPresContext* aPresContext,
viewMan->MoveViewTo(view, origin.x, origin.y);
}
SetView(aPresContext, view);
SetView(view);
return result;
}
@ -1490,23 +1481,17 @@ nsresult nsObjectFrame::GetWindowOriginInPixels(nsIPresContext * aPresContext, P
// if it's windowless, let's make sure we have our origin set right
// it may need to be corrected, like after scrolling
if (aWindowless && parentWithView) {
nsPoint correction(0,0);
nsCOMPtr<nsIViewManager> parentVM;
parentWithView->GetViewManager(*getter_AddRefs(parentVM));
nsIViewManager* parentVM = parentWithView->GetViewManager();
// Walk up all the views and add up their positions. This will give us our
// absolute position which is what we want to give the plugin
nsIView* theView = parentWithView;
while (theView) {
nsCOMPtr<nsIViewManager> vm;
theView->GetViewManager(*getter_AddRefs(vm));
if (vm != parentVM)
if (theView->GetViewManager() != parentVM)
break;
theView->GetPosition(&correction.x, &correction.y);
origin += correction;
theView->GetParent(theView);
origin += theView->GetPosition();
theView = theView->GetParent();
}
}
@ -1533,9 +1518,8 @@ nsObjectFrame::DidReflow(nsIPresContext* aPresContext,
PRBool bHidden = IsHidden();
if (HasView()) {
nsIView* view = GetView(aPresContext);
nsCOMPtr<nsIViewManager> vm;
view->GetViewManager(*getter_AddRefs(vm));
nsIView* view = GetView();
nsIViewManager* vm = view->GetViewManager();
if (vm)
vm->SetViewVisibility(view, bHidden ? nsViewVisibility_kHide : nsViewVisibility_kShow);
}
@ -1807,17 +1791,12 @@ nsObjectFrame::Paint(nsIPresContext* aPresContext,
#ifdef XP_WIN // Windowless plugins on windows need a special event to update their location, see bug 135737
// first, lets find out how big the window is, in pixels
nsCOMPtr<nsIPresShell> shell;
nsCOMPtr<nsIViewManager> vm;
aPresContext->GetShell(getter_AddRefs(shell));
if (shell) {
shell->GetViewManager(getter_AddRefs(vm));
if (vm) {
nsIViewManager* vm = aPresContext->GetViewManager();
if (vm) {
nsIView* view;
vm->GetRootView(view);
if (view) {
nsCOMPtr<nsIWidget> win;
view->GetWidget(*getter_AddRefs(win));
nsIWidget* win = view->GetWidget();
if (win) {
nsRect visibleRect;
win->GetBounds(visibleRect);
@ -1851,7 +1830,6 @@ nsObjectFrame::Paint(nsIPresContext* aPresContext,
}
}
}
}
#endif
inst->SetWindow(window);
@ -1881,8 +1859,7 @@ nsObjectFrame::HandleEvent(nsIPresContext* aPresContext,
if (anEvent->message == NS_PLUGIN_ACTIVATE)
{
nsCOMPtr<nsIContent> content;
GetContent(getter_AddRefs(content));
nsIContent* content = GetContent();
if (content)
{
content->SetFocus(aPresContext);
@ -2004,7 +1981,7 @@ nsObjectFrame::GetNextObjectFrame(nsIPresContext* aPresContext,
nsIFrame * child;
aRoot->FirstChild(aPresContext, nsnull, &child);
while (child != nsnull) {
while (child) {
*outFrame = nsnull;
CallQueryInterface(child, outFrame);
if (nsnull != *outFrame) {
@ -2014,7 +1991,7 @@ nsObjectFrame::GetNextObjectFrame(nsIPresContext* aPresContext,
}
GetNextObjectFrame(aPresContext, child, outFrame);
child->GetNextSibling(&child);
child = child->GetNextSibling();
}
return NS_ERROR_FAILURE;
@ -2050,8 +2027,7 @@ NS_IMPL_ISUPPORTS2(nsPluginDOMContextMenuListener, nsIDOMContextMenuListener, ns
nsresult nsPluginDOMContextMenuListener::Init(nsObjectFrame *aFrame)
{
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
nsIContent* content = aFrame->GetContent();
// Register context menu listener
if (content) {
@ -2071,8 +2047,7 @@ nsresult nsPluginDOMContextMenuListener::Init(nsObjectFrame *aFrame)
nsresult nsPluginDOMContextMenuListener::Destroy(nsObjectFrame *aFrame)
{
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
nsIContent* content = aFrame->GetContent();
// Unregister context menu listener
if (content) {
@ -2272,14 +2247,10 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetDOMElement(nsIDOMElement* *result)
if (nsnull != mOwner)
{
nsIContent *cont;
mOwner->GetContent(&cont);
if (nsnull != cont)
nsIContent* cont = mOwner->GetContent();
if (cont)
{
rv = cont->QueryInterface(NS_GET_IID(nsIDOMElement), (void **)result);
NS_RELEASE(cont);
}
}
@ -2328,8 +2299,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL(const char *aURL, const char *aTarge
rv = NS_NewURI(getter_AddRefs(uri), aURL, baseURL);
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
nsCOMPtr<nsIContent> content;
mOwner->GetContent(getter_AddRefs(content));
nsIContent* content = mOwner->GetContent();
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
nsCOMPtr<nsIInputStream> postDataStream;
@ -2425,7 +2395,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::InvalidateRect(nsPluginRect *invalidRect)
if(invalidRect)
{
//no reference count on view
nsIView* view = mOwner->GetView(mContext);
nsIView* view = mOwner->GetView();
if (view)
{
@ -2437,15 +2407,8 @@ NS_IMETHODIMP nsPluginInstanceOwner::InvalidateRect(nsPluginRect *invalidRect)
(int)(ptot * (invalidRect->right - invalidRect->left)),
(int)(ptot * (invalidRect->bottom - invalidRect->top)));
nsIViewManager* manager;
rv = view->GetViewManager(manager);
//set flags to not do a synchronous update, force update does the redraw
if((rv == NS_OK) && manager)
{
rv = manager->UpdateView(view, rect, NS_VMREFRESH_NO_SYNC);
NS_RELEASE(manager);
}
view->GetViewManager()->UpdateView(view, rect, NS_VMREFRESH_NO_SYNC);
}
}
@ -2459,23 +2422,13 @@ NS_IMETHODIMP nsPluginInstanceOwner::InvalidateRegion(nsPluginRegion invalidRegi
NS_IMETHODIMP nsPluginInstanceOwner::ForceRedraw()
{
nsresult rv = NS_OK;
//no reference count on view
nsIView* view = mOwner->GetView(mContext);
nsIView* view = mOwner->GetView();
if (view)
{
nsIViewManager* manager;
rv = view->GetViewManager(manager);
if((rv == NS_OK) && manager)
{
rv = manager->Composite();
NS_RELEASE(manager);
}
return view->GetViewManager()->Composite();
}
return rv;
return NS_OK;
}
NS_IMETHODIMP nsPluginInstanceOwner::GetValue(nsPluginInstancePeerVariable variable, void *value)
@ -2490,11 +2443,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetValue(nsPluginInstancePeerVariable varia
// get the view manager from the pres shell, not from the view!
// we may not have a view if we are hidden
if (mContext) {
nsCOMPtr<nsIPresShell> shell;
mContext->GetShell(getter_AddRefs(shell));
if (shell) {
nsCOMPtr<nsIViewManager> vm;
shell->GetViewManager(getter_AddRefs(vm));
nsIViewManager* vm = mContext->GetViewManager();
if (vm) {
nsCOMPtr<nsIWidget> widget;
rv = vm->GetWidget(getter_AddRefs(widget));
@ -2505,7 +2454,6 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetValue(nsPluginInstancePeerVariable varia
} else NS_ASSERTION(widget, "couldn't get doc's widget in getting doc's window handle");
} else NS_ASSERTION(vm, "couldn't get view manager in getting doc's window handle");
} else NS_ASSERTION(shell, "couldn't get pres shell in getting doc's window handle");
} else NS_ASSERTION(mContext, "plugin owner has no pres context in getting doc's window handle");
break;
@ -2522,13 +2470,10 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetTagType(nsPluginTagType *result)
*result = nsPluginTagType_Unknown;
if (nsnull != mOwner)
if (mOwner)
{
nsIContent *cont;
mOwner->GetContent(&cont);
if (nsnull != cont)
nsIContent* cont = mOwner->GetContent();
if (cont)
{
nsCOMPtr<nsIAtom> atom;
cont->GetTag(getter_AddRefs(atom));
@ -2544,8 +2489,6 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetTagType(nsPluginTagType *result)
rv = NS_OK;
}
NS_RELEASE(cont);
}
}
@ -2557,10 +2500,8 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetTagText(const char* *result)
NS_ENSURE_ARG_POINTER(result);
if (nsnull == mTagText) {
nsresult rv;
nsCOMPtr<nsIContent> content;
rv = mOwner->GetContent(getter_AddRefs(content));
if (NS_FAILED(rv))
return rv;
nsIContent* content = mOwner->GetContent();
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(content, &rv));
if (NS_FAILED(rv))
return rv;
@ -2936,8 +2877,8 @@ nsresult nsPluginInstanceOwner::EnsureCachedAttrParamArrays()
// arrays count up attributes
mNumCachedAttrs = 0;
nsCOMPtr<nsIContent> content;
nsresult rv = mOwner->GetContent(getter_AddRefs(content));
nsIContent* content = mOwner->GetContent();
nsresult rv = NS_OK;
NS_ENSURE_TRUE(content, rv);
PRInt32 cattrs;
@ -3159,8 +3100,7 @@ void nsPluginInstanceOwner::GUItoMacEvent(const nsGUIEvent& anEvent, EventRecord
case NS_FOCUS_EVENT_START: // this is the same as NS_FOCUS_CONTENT
aMacEvent.what = nsPluginEventType_GetFocusEvent;
if (mOwner && mOwner->mPresContext) {
nsCOMPtr<nsIContent> content;
mOwner->GetContent(getter_AddRefs(content));
nsIContent* content = mOwner->GetContent();
if (content)
content->SetFocus(mOwner->mPresContext);
}
@ -3169,8 +3109,7 @@ void nsPluginInstanceOwner::GUItoMacEvent(const nsGUIEvent& anEvent, EventRecord
case NS_BLUR_CONTENT:
aMacEvent.what = nsPluginEventType_LoseFocusEvent;
if (mOwner && mOwner->mPresContext) {
nsCOMPtr<nsIContent> content;
mOwner->GetContent(getter_AddRefs(content));
nsIContent* content = mOwner->GetContent();
if (content)
content->RemoveFocus(mOwner->mPresContext);
}
@ -3537,8 +3476,7 @@ nsPluginInstanceOwner::MouseDown(nsIDOMEvent* aMouseEvent)
// if the plugin is windowless, we need to set focus ourselves
// otherwise, we might not get key events
if (mPluginWindow && mPluginWindow->type == nsPluginWindowType_Drawable) {
nsCOMPtr<nsIContent> content;
mOwner->GetContent(getter_AddRefs(content));
nsIContent* content = mOwner->GetContent();
if (content)
content->SetFocus(mContext);
}
@ -3691,8 +3629,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
nsresult
nsPluginInstanceOwner::Destroy()
{
nsCOMPtr<nsIContent> content;
mOwner->GetContent(getter_AddRefs(content));
nsIContent* content = mOwner->GetContent();
// stop the timer explicitly to reduce reference count.
CancelTimer();
@ -3732,19 +3669,15 @@ nsPluginInstanceOwner::Destroy()
}
// Unregister scroll position listener
nsIFrame* parentWithView;
mOwner->GetParentWithView(mContext, &parentWithView);
nsIView* curView = nsnull;
if (parentWithView)
curView = parentWithView->GetView(mContext);
nsIFrame* parentWithView = mOwner->GetAncestorWithView();
nsIView* curView = parentWithView ? parentWithView->GetView() : nsnull;
while (curView)
{
nsIScrollableView* scrollingView;
if (NS_SUCCEEDED(CallQueryInterface(curView, &scrollingView)))
scrollingView->RemoveScrollPositionListener((nsIScrollPositionListener *)this);
curView->GetParent(curView);
curView = curView->GetParent();
}
mOwner = nsnull; // break relationship between frame and plugin instance owner
@ -3888,8 +3821,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::Init(nsIPresContext* aPresContext, nsObject
mContext = aPresContext;
mOwner = aFrame;
nsCOMPtr<nsIContent> content;
mOwner->GetContent(getter_AddRefs(content));
nsIContent* content = mOwner->GetContent();
// Some plugins require a specific sequence of shutdown and startup when
// a page is reloaded. Shutdown happens usually when the last instance
@ -3960,18 +3892,15 @@ NS_IMETHODIMP nsPluginInstanceOwner::Init(nsIPresContext* aPresContext, nsObject
// Register scroll position listener
// We need to register a scroll pos listener on every scrollable
// view up to the top
nsIFrame* parentWithView;
mOwner->GetParentWithView(mContext, &parentWithView);
nsIView* curView = nsnull;
if (parentWithView)
curView = parentWithView->GetView(mContext);
nsIFrame* parentWithView = mOwner->GetAncestorWithView();
nsIView* curView = parentWithView ? parentWithView->GetView() : nsnull;
while (curView)
{
nsIScrollableView* scrollingView;
if (NS_SUCCEEDED(CallQueryInterface(curView, &scrollingView)))
scrollingView->AddScrollPositionListener((nsIScrollPositionListener *)this);
curView->GetParent(curView);
curView = curView->GetParent();
}
return NS_OK;
@ -4017,7 +3946,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void)
{
// Create view if necessary
view = mOwner->GetView(mContext);
view = mOwner->GetView();
if (!view || !mWidget)
{
@ -4033,18 +3962,14 @@ NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void)
windowless);
if (NS_OK == rv)
{
view = mOwner->GetView(mContext);
view = mOwner->GetView();
if (view)
{
view->GetWidget(*getter_AddRefs(mWidget));
mWidget = view->GetWidget();
PRBool fTransparent = PR_FALSE;
mInstance->GetValue(nsPluginInstanceVariable_TransparentBool, (void *)&fTransparent);
nsCOMPtr<nsIViewManager> vm;
view->GetViewManager(*getter_AddRefs(vm));
if (vm) {
vm->SetViewContentTransparency(view, fTransparent);
}
view->GetViewManager()->SetViewContentTransparency(view, fTransparent);
}
if (PR_TRUE == windowless)
@ -4100,34 +4025,32 @@ static void ConvertTwipsToPixels(nsIPresContext& aPresContext, nsRect& aTwipsRec
#ifdef DO_DIRTY_INTERSECT
// Convert from a frame relative coordinate to a coordinate relative to its
// containing window
static void ConvertRelativeToWindowAbsolute(nsIFrame* aFrame, nsIPresContext* aPresContext, nsPoint& aRel, nsPoint& aAbs, nsIWidget *&
aContainerWidget)
static void ConvertRelativeToWindowAbsolute(nsIFrame* aFrame,
nsIPresContext* aPresContext, nsPoint& aRel, nsPoint& aAbs,
nsIWidget *& aContainerWidget)
{
aAbs.x = 0;
aAbs.y = 0;
// See if this frame has a view
nsIView *view = aFrame->GetView(aPresContext);
if (nsnull == view) {
// Calculate frames offset from its nearest view
aFrame->GetOffsetFromView(aPresContext,
nsIView *view = aFrame->GetView();
if (!view) {
aAbs.x = 0;
aAbs.y = 0;
// Calculate frames offset from its nearest view
aFrame->GetOffsetFromView(aPresContext,
aAbs,
&view);
} else {
// Store frames offset from its view.
nsRect rect;
aFrame->GetRect(rect);
aAbs.x = rect.x;
aAbs.y = rect.y;
// Store frames offset from its view.
aAbs = aFrame->GetPosition();
}
if (view != nsnull) {
if (view) {
// Caclulate the views offset from its nearest widget
nscoord viewx = 0;
nscoord viewy = 0;
view->GetWidget(aContainerWidget);
if (nsnull == aContainerWidget) {
aContainerWidget = view->GetWidget();
NS_IF_ADDREF(aContainerWidget);
if (!aContainerWidget) {
view->GetOffsetFromWidget(&viewx, &viewy, aContainerWidget/**getter_AddRefs(widget)*/);
aAbs.x += viewx;
aAbs.y += viewy;
@ -4135,10 +4058,7 @@ aContainerWidget)
// GetOffsetFromWidget does not include the views offset, so we need to add
// that in.
nscoord x, y;
view->GetPosition(&x, &y);
aAbs.x += x;
aAbs.y += y;
aAbs += view->GetPosition();
}
nsRect widgetBounds;
@ -4163,10 +4083,8 @@ nsPluginPort* nsPluginInstanceOwner::FixUpPluginWindow(PRInt32 inPaintState)
return nsnull;
// first, check our view for CSS visibility style
nsIView *view = mOwner->GetView(mContext);
nsViewVisibility vis;
view->GetVisibility(vis);
PRBool isVisible = (vis == nsViewVisibility_kShow) ? PR_TRUE : PR_FALSE;
PRBool isVisible =
mOwner->GetView()->GetVisibility() == nsViewVisibility_kShow;
nsCOMPtr<nsIPluginWidget> pluginWidget = do_QueryInterface(mWidget);
@ -4174,7 +4092,8 @@ nsPluginPort* nsPluginInstanceOwner::FixUpPluginWindow(PRInt32 inPaintState)
nsRect widgetClip;
PRBool widgetVisible;
pluginWidget->GetPluginClipRect(widgetClip, pluginOrigin, widgetVisible);
isVisible &= widgetVisible;
if (!widgetVisible)
isVisible = FALSE;
if (!isVisible)
widgetClip.Empty();
@ -4221,17 +4140,9 @@ nsPluginPort* nsPluginInstanceOwner::FixUpPluginWindow(PRInt32 inPaintState)
void nsPluginInstanceOwner::Composite()
{
//no reference count on view
nsIView* view = mOwner->GetView(mContext);
nsIView* view = mOwner->GetView();
if (view) {
nsIViewManager* manager;
nsresult rv = view->GetViewManager(manager);
//set flags to not do a synchronous update, force update does the redraw
if (NS_SUCCEEDED(rv) && manager) {
rv = manager->UpdateView(view, NS_VMREFRESH_IMMEDIATE);
NS_RELEASE(manager);
}
view->GetViewManager()->UpdateView(view, NS_VMREFRESH_IMMEDIATE);
}
}

View File

@ -100,17 +100,15 @@ NS_IMETHODIMP nsPageContentFrame::Reflow(nsIPresContext* aPresContext,
// absolutely positioned elements
nsMargin border(0,0,0,0);
nsMargin padding(0,0,0,0);
nsFrameState kidState;
// Ignore the return values for these
// Typically they are zero and if they fail
// we should keep going anyway, there impact is small
kidReflowState.mStyleBorder->GetBorder(border);
kidReflowState.mStylePadding->GetPadding(padding);
frame->GetFrameState(&kidState);
// First check the combined area
if (NS_FRAME_OUTSIDE_CHILDREN & kidState) {
if (NS_FRAME_OUTSIDE_CHILDREN & frame->GetStateBits()) {
// The background covers the content area and padding area, so check
// for children sticking outside the child frame's padding edge
nscoord paddingEdgeX = aDesiredSize.width - border.right - padding.right;
@ -133,12 +131,11 @@ NS_IMETHODIMP nsPageContentFrame::Reflow(nsIPresContext* aPresContext,
#endif
#ifdef DEBUG_PRINTING
nsRect r;
frame->GetRect(r);
nsRect r = frame->GetRect();
printf("PCF: Area Frame %p Bounds: %5d,%5d,%5d,%5d\n", frame, r.x, r.y, r.width, r.height);
nsIView* view = frame->GetView(aPresContext);
nsIView* view = frame->GetView();
if (view) {
view->GetBounds(r);
r = view->GetBounds();
printf("PCF: Area Frame View Bounds: %5d,%5d,%5d,%5d\n", r.x, r.y, r.width, r.height);
} else {
printf("PCF: Area Frame View Bounds: NO VIEW\n");

View File

@ -125,8 +125,8 @@ nsPageFrame::SetInitialChildList(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{
nsIView* view = aChildList->GetView(aPresContext);
if (view != nsnull && mDoCreateWidget) {
nsIView* view = aChildList->GetView();
if (view && mDoCreateWidget) {
nscoord dx, dy;
nsCOMPtr<nsIWidget> widget;
view->GetOffsetFromWidget(&dx, &dy, *getter_AddRefs(widget));
@ -227,13 +227,11 @@ NS_IMETHODIMP nsPageFrame::Reflow(nsIPresContext* aPresContext,
aDesiredSize.height = aReflowState.availableHeight;
}
nsIView* view = frame->GetView(aPresContext);
nsIView* view = frame->GetView();
if (view) {
nsCOMPtr<nsIViewManager> vm;
view->GetViewManager(*getter_AddRefs(vm));
nsRegion region;
region.Copy(nsRect(0, 0, aDesiredSize.width, aDesiredSize.height));
vm->SetViewChildClipRegion(view, &region);
view->GetViewManager()->SetViewChildClipRegion(view, &region);
}
#ifdef NS_DEBUG
@ -742,13 +740,11 @@ nsPageFrame::DrawBackground(nsIPresContext* aPresContext,
nsIFrame* pageContentFrame = mFrames.FirstChild();
NS_ASSERTION(pageContentFrame, "Must always be there.");
nsRect rect;
pageContentFrame->GetRect(rect);
const nsStyleBorder* border = GetStyleBorder();
const nsStylePadding* padding = GetStylePadding();
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
aDirtyRect, rect, *border, *padding,
aDirtyRect, pageContentFrame->GetRect(), *border, *padding,
PR_TRUE);
}
}

View File

@ -142,7 +142,7 @@ nsPlaceholderFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aInden
fprintf(out, " [parent=%p]", NS_STATIC_CAST(void*, mParent));
#endif
if (HasView()) {
fprintf(out, " [view=%p]", (void*)GetView(aPresContext));
fprintf(out, " [view=%p]", (void*)GetView());
}
fprintf(out, " {%d,%d,%d,%d}", mRect.x, mRect.y, mRect.width, mRect.height);
if (0 != mState) {

View File

@ -177,7 +177,7 @@ nsInlineFrame::IsEmpty(nsCompatibility aCompatMode, PRBool aIsPre,
}
*aResult = PR_TRUE;
for (nsIFrame *kid = mFrames.FirstChild(); kid; kid->GetNextSibling(&kid)) {
for (nsIFrame *kid = mFrames.FirstChild(); kid; kid = kid->GetNextSibling()) {
kid->IsEmpty(aCompatMode, aIsPre, aResult);
if (! *aResult)
break;
@ -254,17 +254,14 @@ nsInlineFrame::RemoveFrame(nsIPresContext* aPresContext,
if (frameType == nsLayoutAtoms::brFrame)
generateReflowCommand = PR_TRUE;
nsIFrame* oldFrameParent;
aOldFrame->GetParent(&oldFrameParent);
nsInlineFrame* parent = (nsInlineFrame*) oldFrameParent;
while (nsnull != aOldFrame) {
nsInlineFrame* parent = NS_STATIC_CAST(nsInlineFrame*, aOldFrame->GetParent());
while (aOldFrame) {
#ifdef IBMBIDI
if (nsLayoutAtoms::nextBidi != aListName) {
#endif
// If the frame being removed has zero size then don't bother
// generating a reflow command, otherwise make sure we do.
nsRect bbox;
aOldFrame->GetRect(bbox);
nsRect bbox = aOldFrame->GetRect();
if (bbox.width || bbox.height) {
generateReflowCommand = PR_TRUE;
}
@ -279,8 +276,8 @@ nsInlineFrame::RemoveFrame(nsIPresContext* aPresContext,
aOldFrame->GetNextInFlow(&oldFrameNextInFlow);
parent->mFrames.DestroyFrame(aPresContext, aOldFrame);
aOldFrame = oldFrameNextInFlow;
if (nsnull != aOldFrame) {
aOldFrame->GetParent((nsIFrame**) &parent);
if (aOldFrame) {
parent = NS_STATIC_CAST(nsInlineFrame*, aOldFrame->GetParent());
}
}
@ -416,9 +413,7 @@ nsInlineFrame::Reflow(nsIPresContext* aPresContext,
// our prev-in-flow's overflow list, it's possible that we have not set
// the parent pointer for these frames. Check the first frame to see, and
// if we haven't set the parent pointer then set it now
nsIFrame* parent;
overflowFrames->GetParent(&parent);
mFrames.AppendFrames(parent == this ? nsnull : this, overflowFrames);
mFrames.AppendFrames(overflowFrames->GetParent() == this ? nsnull : this, overflowFrames);
}
}
@ -553,7 +548,7 @@ nsInlineFrame::ReflowFrames(nsIPresContext* aPresContext,
break;
}
irs.mPrevFrame = frame;
frame->GetNextSibling(&frame);
frame = frame->GetNextSibling();
}
// Attempt to pull frames from our next-in-flow until we can't
@ -686,9 +681,7 @@ nsInlineFrame::ReflowFrames(nsIPresContext* aPresContext,
static
void SetContainsPercentAwareChild(nsIFrame *aFrame)
{
nsFrameState myFrameState;
aFrame->GetFrameState(&myFrameState);
aFrame->SetFrameState(myFrameState | NS_INLINE_FRAME_CONTAINS_PERCENT_AWARE_CHILD);
aFrame->AddStateBits(NS_INLINE_FRAME_CONTAINS_PERCENT_AWARE_CHILD);
}
static
@ -696,9 +689,7 @@ void MarkPercentAwareFrame(nsIPresContext *aPresContext,
nsInlineFrame *aInline,
nsIFrame *aFrame)
{
nsFrameState childFrameState;
aFrame->GetFrameState(&childFrameState);
if (childFrameState & NS_FRAME_REPLACED_ELEMENT)
if (aFrame->GetStateBits() & NS_FRAME_REPLACED_ELEMENT)
{ // aFrame is a replaced element, check it's style
if (nsLineLayout::IsPercentageAwareReplacedElement(aPresContext, aFrame)) {
SetContainsPercentAwareChild(aInline);
@ -710,7 +701,7 @@ void MarkPercentAwareFrame(nsIPresContext *aPresContext,
aFrame->FirstChild(aPresContext, nsnull, &child);
if (child)
{ // aFrame is an inline container frame, check my frame state
if (childFrameState & NS_INLINE_FRAME_CONTAINS_PERCENT_AWARE_CHILD) {
if (child->GetStateBits() & NS_INLINE_FRAME_CONTAINS_PERCENT_AWARE_CHILD) {
SetContainsPercentAwareChild(aInline); // if a child container is effected, so am I
}
}
@ -760,11 +751,8 @@ nsInlineFrame::ReflowInlineFrame(nsIPresContext* aPresContext,
// remaining child frames in our child list with the wrong parent
// frame pointer...
if (irs.mSetParentPointer) {
nsIFrame* f;
aFrame->GetNextSibling(&f);
while (f) {
for (nsIFrame* f = aFrame->GetNextSibling(); f; f = f->GetNextSibling()) {
f->SetParent(this);
f->GetNextSibling(&f);
}
}
}
@ -778,9 +766,8 @@ nsInlineFrame::ReflowInlineFrame(nsIPresContext* aPresContext,
return rv;
}
}
nsIFrame* nextFrame;
aFrame->GetNextSibling(&nextFrame);
if (nsnull != nextFrame) {
nsIFrame* nextFrame = aFrame->GetNextSibling();
if (nextFrame) {
aStatus |= NS_FRAME_NOT_COMPLETE;
PushFrames(aPresContext, nextFrame, aFrame);
}
@ -812,9 +799,8 @@ nsInlineFrame::ReflowInlineFrame(nsIPresContext* aPresContext,
return rv;
}
if (!reflowingFirstLetter) {
nsIFrame* nextFrame;
aFrame->GetNextSibling(&nextFrame);
if (nsnull != nextFrame) {
nsIFrame* nextFrame = aFrame->GetNextSibling();
if (nextFrame) {
PushFrames(aPresContext, nextFrame, aFrame);
}
}
@ -854,11 +840,7 @@ nsInlineFrame::PushFrames(nsIPresContext* aPresContext,
{
NS_PRECONDITION(nsnull != aFromChild, "null pointer");
NS_PRECONDITION(nsnull != aPrevSibling, "pushing first child");
#ifdef DEBUG
nsIFrame* prevNextSibling;
aPrevSibling->GetNextSibling(&prevNextSibling);
NS_PRECONDITION(prevNextSibling == aFromChild, "bad prev sibling");
#endif
NS_PRECONDITION(aPrevSibling->GetNextSibling() == aFromChild, "bad prev sibling");
#ifdef NOISY_PUSHING
printf("%p pushing aFromChild %p, disconnecting from prev sib %p\n",
@ -943,10 +925,9 @@ ReParentChildListStyle(nsIPresContext* aPresContext,
nsStyleContext* aParentStyleContext,
nsFrameList& aFrameList)
{
nsIFrame* kid = aFrameList.FirstChild();
while (nsnull != kid) {
for (nsIFrame* kid = aFrameList.FirstChild(); kid;
kid = kid->GetNextSibling()) {
aPresContext->ReParentStyleContext(kid, aParentStyleContext);
kid->GetNextSibling(&kid);
}
}
@ -1085,9 +1066,7 @@ nsFirstLineFrame::Reflow(nsIPresContext* aPresContext,
if (mStyleContext == first->mStyleContext) {
// Fixup our style context and our children. First get the
// proper parent context.
nsIFrame* parentFrame;
first->GetParent(&parentFrame);
nsStyleContext* parentContext = parentFrame->GetStyleContext();
nsStyleContext* parentContext = first->GetParent()->GetStyleContext();
if (parentContext) {
// Create a new style context that is a child of the parent
// style context thus removing the :first-line style. This way

View File

@ -227,7 +227,7 @@ nsLineBox::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const
if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) {
frameDebug->List(aPresContext, out, aIndent + 1);
}
frame->GetNextSibling(&frame);
frame = frame->GetNextSibling();
}
for (i = aIndent; --i >= 0; ) fputs(" ", out);
@ -246,7 +246,7 @@ nsLineBox::LastChild() const
nsIFrame* frame = mFirstChild;
PRInt32 n = GetChildCount() - 1;
while (--n >= 0) {
frame->GetNextSibling(&frame);
frame = frame->GetNextSibling();
}
return frame;
}
@ -267,7 +267,7 @@ nsLineBox::IndexOf(nsIFrame* aFrame) const
if (frame == aFrame) {
return i;
}
frame->GetNextSibling(&frame);
frame = frame->GetNextSibling();
}
return -1;
}
@ -284,7 +284,7 @@ nsLineBox::IsEmpty(nsCompatibility aCompatMode, PRBool aParentIsPre,
nsIFrame *kid;
for (n = GetChildCount(), kid = mFirstChild;
n > 0;
--n, kid->GetNextSibling(&kid))
--n, kid = kid->GetNextSibling())
{
kid->IsEmpty(aCompatMode, aParentIsPre, aResult);
if (! *aResult)
@ -301,8 +301,7 @@ nsLineBox::DeleteLineList(nsIPresContext* aPresContext, nsLineList& aLines)
// we do all of this before our base class releases it's hold on the
// view.
for (nsIFrame* child = aLines.front()->mFirstChild; child; ) {
nsIFrame* nextChild;
child->GetNextSibling(&nextChild);
nsIFrame* nextChild = child->GetNextSibling();
child->Destroy(aPresContext);
child = nextChild;
}
@ -660,7 +659,6 @@ nsLineIterator::CheckLineOrder(PRInt32 aLine,
nsIFrame **aFirstVisual,
nsIFrame **aLastVisual)
{
nsRect checkRect;
PRInt32 currentLine, saveLine, testLine;
nscoord saveX;
nsIFrame *checkFrame;
@ -689,16 +687,13 @@ nsLineIterator::CheckLineOrder(PRInt32 aLine,
checkFrame = line->mFirstChild;
checkFrame->GetRect(checkRect);
result = FindLineContaining(checkFrame, &saveLine);
if (NS_FAILED(result))
return result;
saveX = checkRect.x;
saveX = checkFrame->GetRect().x;
lineFrameCount = line->GetChildCount();
for (; checkFrame; result = checkFrame->GetNextSibling(&checkFrame)) {
if (NS_FAILED(result))
break;
for (; checkFrame; checkFrame = checkFrame->GetNextSibling()) {
result = FindLineContaining(checkFrame, &testLine);
if (NS_FAILED(result))
return result;
@ -707,7 +702,7 @@ nsLineIterator::CheckLineOrder(PRInt32 aLine,
break;
}
checkFrame->GetRect(checkRect);
nsRect checkRect = checkFrame->GetRect();
// If the origin of any frame is less than the previous frame, the line is reordered
if (checkRect.x < saveX) {
*aIsReordered = PR_TRUE;
@ -731,19 +726,12 @@ nsLineIterator::CheckLineOrder(PRInt32 aLine,
return result;
leftmostFrame = rightmostFrame = firstFrame;
firstFrame->GetRect(checkRect);
maxX = checkRect.x;
minX = checkRect.x;
maxX = minX = firstFrame->GetRect().x;
for (;lineFrameCount > 1;lineFrameCount--) {
result = firstFrame->GetNextSibling(&firstFrame);
firstFrame = firstFrame->GetNextSibling();
if (NS_FAILED(result)){
NS_ASSERTION(0,"should not be reached nsLineBox\n");
return NS_ERROR_FAILURE;
}
firstFrame->GetRect(checkRect);
nsRect checkRect = firstFrame->GetRect();
if (checkRect.x > maxX) {
maxX = checkRect.x;
rightmostFrame = firstFrame;
@ -796,7 +784,6 @@ nsLineIterator::FindFrameAt(PRInt32 aLineNumber,
if (line->mBounds.width == 0)
return NS_ERROR_FAILURE;
nsRect r1, r2;
nsIFrame *stoppingFrame = nsnull;
if (aX < line->mBounds.x) {
@ -807,8 +794,7 @@ nsLineIterator::FindFrameAt(PRInt32 aLineNumber,
else {
frame = line->mFirstChild;
}
frame->GetRect(r1);
if (r1.width > 0)
if (frame->GetRect().width > 0)
{
*aFrameFound = frame;
*aXIsBeforeFirstFrame = PR_TRUE;
@ -828,8 +814,7 @@ nsLineIterator::FindFrameAt(PRInt32 aLineNumber,
else {
frame = line->LastChild();
}
frame->GetRect(r1);
if (r1.width > 0)
if (frame->GetRect().width > 0)
{
*aFrameFound = frame;
*aXIsBeforeFirstFrame = PR_FALSE;
@ -868,37 +853,36 @@ nsLineIterator::FindFrameAt(PRInt32 aLineNumber,
if (isReordered) {
nscoord maxX, limX;
PRInt32 testLine;
nsRect tempRect;
nsIFrame* tempFrame;
maxX = -0x7fffffff;
frame->GetRect(tempRect);
limX = tempRect.x;
limX = frame->GetRect().x;
tempFrame = line->mFirstChild;
nextFrame = nsnull;
while (tempFrame) {
if (NS_SUCCEEDED(FindLineContaining(tempFrame, &testLine))
&& testLine == aLineNumber) {
tempFrame->GetRect(tempRect);
nsRect tempRect = tempFrame->GetRect();
if (tempRect.x > maxX && tempRect.x < limX) { // we are looking for the highest value less than the current one
maxX = tempRect.x;
nextFrame = tempFrame;
}
}
tempFrame->GetNextSibling(&tempFrame);
tempFrame = tempFrame->GetNextSibling();
}
}
else
#endif // IBMBIDI
frame->GetNextSibling(&nextFrame);
frame->GetRect(r1);
nextFrame = frame->GetNextSibling();
nsRect r1 = frame->GetRect();
if (r1.width && aX > r1.x) {
break;
}
if (nextFrame) {
nextFrame->GetRect(r2);
nsRect r2 = nextFrame->GetRect();
if (r2.width && aX > r2.XMost()) {
nscoord rightEdge = r2.XMost();
nscoord delta = r1.x - rightEdge;
@ -923,39 +907,38 @@ nsLineIterator::FindFrameAt(PRInt32 aLineNumber,
if (!frame)
break;
if (isReordered) {
nsRect tempRect;
nsIFrame* tempFrame;
nscoord minX, limX;
PRInt32 testLine;
minX = 0x7fffffff;
frame->GetRect(tempRect);
limX = tempRect.x;
limX = frame->GetRect().x;
tempFrame = line->mFirstChild;
nextFrame = nsnull;
while (tempFrame) {
if (NS_SUCCEEDED(FindLineContaining(tempFrame, &testLine))
&& testLine == aLineNumber) {
tempFrame->GetRect(tempRect);
nsRect tempRect = tempFrame->GetRect();
if (tempRect.width && tempRect.x < minX && tempRect.x > limX) { // we are looking for the lowest value greater than the current one
minX = tempRect.x;
nextFrame = tempFrame;
}
}
tempFrame->GetNextSibling(&tempFrame);
tempFrame = tempFrame->GetNextSibling();
}
}
else
#endif // IBMBIDI
frame->GetNextSibling(&nextFrame);
frame->GetRect(r1);
nextFrame = frame->GetNextSibling();
nsRect r1 = frame->GetRect();
if (r1.width && aX < r1.XMost()) {
break;
}
if (nextFrame) {
nextFrame->GetRect(r2);
nsRect r2 = nextFrame->GetRect();
if (r2.width && aX < r2.x) {
nscoord rightEdge = r1.XMost();
nscoord delta = r2.x - rightEdge;
@ -981,7 +964,8 @@ nsLineIterator::FindFrameAt(PRInt32 aLineNumber,
NS_IMETHODIMP
nsLineIterator::GetNextSiblingOnLine(nsIFrame*& aFrame, PRInt32 aLineNumber)
{
return aFrame->GetNextSibling(&aFrame);
aFrame = aFrame->GetNextSibling();
return NS_OK;
}
//----------------------------------------------------------------------

View File

@ -97,19 +97,17 @@ static nscoord AccumulateImageSizes(nsIPresContext& aPresContext, nsIFrame& aFra
nsCOMPtr<nsIAtom> type;
aFrame.GetFrameType(getter_AddRefs(type));
if(type.get() == nsLayoutAtoms::imageFrame) {
nsSize size;
aFrame.GetSize(size);
sizes += NS_STATIC_CAST(nscoord,size.width);
sizes += NS_STATIC_CAST(nscoord, aFrame.GetSize().width);
} else {
// see if there are children to process
nsIFrame* child = nsnull;
// XXX: process alternate child lists?
aFrame.FirstChild(&aPresContext,nsnull,&child);
while(child) {
while (child) {
// recurse: note that we already know we are in a child frame, so no need to track further
sizes += AccumulateImageSizes(aPresContext, *child);
// now next sibling
child->GetNextSibling(&child);
child = child->GetNextSibling();
}
}
@ -879,9 +877,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
// the frame state.
const nsHTMLReflowState* rs = psd->mReflowState;
nsReflowReason reason = eReflowReason_Resize;
nsFrameState state;
aFrame->GetFrameState(&state);
if (NS_FRAME_FIRST_REFLOW & state) {
if (NS_FRAME_FIRST_REFLOW & aFrame->GetStateBits()) {
reason = eReflowReason_Initial;
}
else if (rs->reason == eReflowReason_Incremental) { // XXX
@ -914,7 +910,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
}
}
else if (type == eReflowType_ReflowDirty &&
(state & NS_FRAME_IS_DIRTY) &&
(aFrame->GetStateBits() & NS_FRAME_IS_DIRTY) &&
!frameIsOnReflowPath) {
reason = eReflowReason_Dirty;
}
@ -924,7 +920,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
reason = eReflowReason_StyleChange;
}
else if (rs->reason == eReflowReason_Dirty) {
if (state & NS_FRAME_IS_DIRTY)
if (aFrame->GetStateBits() & NS_FRAME_IS_DIRTY)
reason = eReflowReason_Dirty;
}
@ -1019,7 +1015,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
PRInt32 start, end;
if (bidiEnabled) {
if (state & NS_FRAME_IS_BIDI) {
if (aFrame->GetStateBits() & NS_FRAME_IS_BIDI) {
aFrame->GetOffsets(start, end);
}
}
@ -1045,10 +1041,9 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
// for the text frame's initial reflow (once in the text frame's lifetime)
// and we don't make any expensive calls.
// Doing it this way shields us from knowing anything about the frame structure inside a text control.
nsIFrame *parentFrame;
aFrame->GetParent(&parentFrame);
PRBool inTextControl = PR_FALSE;
while (parentFrame)
for (nsIFrame *parentFrame = aFrame->GetParent(); parentFrame;
parentFrame = parentFrame->GetParent())
{
nsCOMPtr<nsIAtom> parentFrameType;
parentFrame->GetFrameType(getter_AddRefs(parentFrameType));
@ -1060,7 +1055,6 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
break;
}
}
parentFrame->GetParent(&parentFrame); // advance the loop up the frame tree
}
if (inTextControl)
{
@ -1115,9 +1109,9 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
// to have zero width.
if (metrics.width) {
pfd->SetFlag(PFD_ISNONEMPTYTEXTFRAME, PR_TRUE);
nsCOMPtr<nsIContent> content;
nsresult result = pfd->mFrame->GetContent(getter_AddRefs(content));
if ((NS_SUCCEEDED(result)) && content) {
nsIContent* content = pfd->mFrame->GetContent();
if (content) {
nsresult result;
nsCOMPtr<nsITextContent> textContent
= do_QueryInterface(content, &result);
if ((NS_SUCCEEDED(result)) && textContent) {
@ -1210,8 +1204,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
}
#endif
aFrame->GetFrameState(&state);
if (NS_FRAME_OUTSIDE_CHILDREN & state) {
if (NS_FRAME_OUTSIDE_CHILDREN & aFrame->GetStateBits()) {
pfd->mCombinedArea = metrics.mOverflowArea;
}
else {
@ -1227,11 +1220,10 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
}
// Size the frame and size its view (if it has one)
aFrame->SizeTo(mPresContext, metrics.width, metrics.height);
aFrame->SetSize(nsSize(metrics.width, metrics.height));
if (aFrame->HasView()) {
nsIView* view = aFrame->GetView(mPresContext);
nsIViewManager *vm;
view->GetViewManager(vm);
nsIView* view = aFrame->GetView();
nsIViewManager *vm = view->GetViewManager();
#if 0 // XXX This is the correct code. We'll turn it on later to mitigate risk.
vm->ResizeView(view, pfd->mCombinedArea);
@ -1239,7 +1231,6 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
nsRect r(0, 0, metrics.width, metrics.height);
vm->ResizeView(view, r);
#endif
NS_RELEASE(vm);
}
// Tell the frame that we're done reflowing it
@ -1261,8 +1252,8 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
// Remove all of the childs next-in-flows. Make sure that we ask
// the right parent to do the removal (it's possible that the
// parent is not this because we are executing pullup code)
nsHTMLContainerFrame* parent;
kidNextInFlow->GetParent((nsIFrame**) &parent);
nsHTMLContainerFrame* parent = NS_STATIC_CAST(nsHTMLContainerFrame*,
kidNextInFlow->GetParent());
parent->DeleteNextInFlowChild(mPresContext, kidNextInFlow);
}
}
@ -1299,7 +1290,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
printf(" status=%x\n", aReflowStatus);
#endif
if (state & NS_FRAME_IS_BIDI) {
if (aFrame->GetStateBits() & NS_FRAME_IS_BIDI) {
// Since aReflowStatus may change, check it at the end
if (NS_INLINE_IS_BREAK_BEFORE(aReflowStatus) ) {
aFrame->AdjustOffsetsForBidi(start, end);
@ -1643,7 +1634,7 @@ nsLineLayout::AddBulletFrame(nsIFrame* aFrame,
pfd->mDescent = aMetrics.descent;
// Note: y value will be updated during vertical alignment
aFrame->GetRect(pfd->mBounds);
pfd->mBounds = aFrame->GetRect();
pfd->mCombinedArea = aMetrics.mOverflowArea;
if (mComputeMaxElementWidth) {
pfd->mMaxElementWidth = aMetrics.width;
@ -1690,9 +1681,7 @@ PRBool
nsLineLayout::IsPercentageAwareReplacedElement(nsIPresContext *aPresContext,
nsIFrame* aFrame)
{
nsFrameState frameState;
aFrame->GetFrameState(&frameState);
if (frameState & NS_FRAME_REPLACED_ELEMENT)
if (aFrame->GetStateBits() & NS_FRAME_REPLACED_ELEMENT)
{
nsCOMPtr<nsIAtom> frameType;
aFrame->GetFrameType(getter_AddRefs(frameType));
@ -1732,9 +1721,7 @@ nsLineLayout::IsPercentageAwareReplacedElement(nsIPresContext *aPresContext,
PRBool IsPercentageAwareFrame(nsIPresContext *aPresContext, nsIFrame *aFrame)
{
nsFrameState childFrameState;
aFrame->GetFrameState(&childFrameState);
if (childFrameState & NS_FRAME_REPLACED_ELEMENT) {
if (aFrame->GetStateBits() & NS_FRAME_REPLACED_ELEMENT) {
if (nsLineLayout::IsPercentageAwareReplacedElement(aPresContext, aFrame)) {
return PR_TRUE;
}
@ -1745,7 +1732,7 @@ PRBool IsPercentageAwareFrame(nsIPresContext *aPresContext, nsIFrame *aFrame)
aFrame->FirstChild(aPresContext, nsnull, &child);
if (child)
{ // aFrame is an inline container frame, check my frame state
if (childFrameState & NS_INLINE_FRAME_CONTAINS_PERCENT_AWARE_CHILD) {
if (aFrame->GetStateBits() & NS_INLINE_FRAME_CONTAINS_PERCENT_AWARE_CHILD) {
return PR_TRUE;
}
}
@ -1936,7 +1923,7 @@ nsLineLayout::VerticalAlignLine(nsLineBox* aLineBox,
pfd->mBounds.y += baselineY;
break;
}
pfd->mFrame->SetRect(mPresContext, pfd->mBounds);
pfd->mFrame->SetRect(pfd->mBounds);
#ifdef NOISY_VERTICAL_ALIGN
printf(" [child of line]");
nsFrame::ListTag(stdout, pfd->mFrame);
@ -1999,7 +1986,7 @@ nsLineLayout::PlaceTopBottomFrames(PerSpanData* psd,
else {
pfd->mBounds.y = -aDistanceFromTop + pfd->mMargin.top;
}
pfd->mFrame->SetRect(mPresContext, pfd->mBounds);
pfd->mFrame->SetRect(pfd->mBounds);
#ifdef NOISY_VERTICAL_ALIGN
printf(" ");
nsFrame::ListTag(stdout, pfd->mFrame);
@ -2020,7 +2007,7 @@ nsLineLayout::PlaceTopBottomFrames(PerSpanData* psd,
pfd->mBounds.y = -aDistanceFromTop + aLineHeight -
pfd->mMargin.bottom - pfd->mBounds.height;
}
pfd->mFrame->SetRect(mPresContext, pfd->mBounds);
pfd->mFrame->SetRect(pfd->mBounds);
#ifdef NOISY_VERTICAL_ALIGN
printf(" ");
nsFrame::ListTag(stdout, pfd->mFrame);
@ -2514,7 +2501,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
#endif
}
if (psd != mRootSpan) {
frame->SetRect(mPresContext, pfd->mBounds);
frame->SetRect(pfd->mBounds);
}
}
pfd = pfd->mNext;
@ -2543,11 +2530,10 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
// be checking for any particular content tag type, but rather should
// be checking for the existence of a bullet frame to determine if it's a list element or not.
if (!applyMinLH && (isFirstLine || isLastLine)) {
nsCOMPtr<nsIContent> blockContent;
nsresult result = mRootSpan->mFrame->mFrame->GetContent(getter_AddRefs(blockContent));
if ( NS_SUCCEEDED(result) && blockContent) {
nsIContent* blockContent = mRootSpan->mFrame->mFrame->GetContent();
if (blockContent) {
nsCOMPtr<nsIAtom> blockTagAtom;
result = blockContent->GetTag(getter_AddRefs(blockTagAtom));
nsresult result = blockContent->GetTag(getter_AddRefs(blockTagAtom));
if ( NS_SUCCEEDED(result) && blockTagAtom) {
// (2) above, if the first line of LI
if (isFirstLine && blockTagAtom.get() == nsHTMLAtoms::li) {
@ -2648,7 +2634,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
pfd = psd->mFirstFrame;
while (nsnull != pfd) {
pfd->mBounds.y -= minY; // move all the children back up
pfd->mFrame->SetRect(mPresContext, pfd->mBounds);
pfd->mFrame->SetRect(pfd->mBounds);
pfd = pfd->mNext;
}
maxY -= minY; // since minY is in the frame's own coordinate system
@ -2724,11 +2710,10 @@ nsLineLayout::TrimTrailingWhiteSpaceIn(PerSpanData* psd,
// that are direct children of the block will be updated
// later, however, because the VerticalAlignFrames method
// will be run after this method.
nsRect r;
nsIFrame* f = pfd->mFrame;
f->GetRect(r);
nsRect r = f->GetRect();
r.width -= deltaWidth;
f->SetRect(mPresContext, r);
f->SetRect(r);
}
// Adjust the right edge of the span that contains the child span
@ -2780,7 +2765,7 @@ nsLineLayout::TrimTrailingWhiteSpaceIn(PerSpanData* psd,
if (psd != mRootSpan) {
// The frame was already placed during psd's
// reflow. Update the frames rectangle now.
pfd->mFrame->SetRect(mPresContext, pfd->mBounds);
pfd->mFrame->SetRect(pfd->mBounds);
}
// Adjust containing span's right edge
@ -2898,7 +2883,7 @@ nsLineLayout::ApplyFrameJustification(PerSpanData* aPSD, FrameJustificationState
pfd->mBounds.width += dw;
deltaX += dw;
pfd->mFrame->SetRect(mPresContext, pfd->mBounds);
pfd->mFrame->SetRect(pfd->mBounds);
}
}
return deltaX;
@ -2949,8 +2934,7 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds,
// than the frame type due to the changes for bug 141054.)
if (!InStrictMode()) {
if (psd->mFirstFrame && psd->mFirstFrame->mFrame) {
nsCOMPtr<nsIContent> content;
psd->mFirstFrame->mFrame->GetContent(getter_AddRefs(content));
nsIContent* content = psd->mFirstFrame->mFrame->GetContent();
if (content) {
nsCOMPtr<nsIAtom> tag;
content->GetTag(getter_AddRefs(tag));
@ -2967,7 +2951,7 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds,
// of its children.
nsIFrame *child;
for (hrFrame->FirstChild(mPresContext, nsnull, &child);
child; child->GetNextSibling(&child)) {
child; child = child->GetNextSibling()) {
child->GetFrameType(getter_AddRefs(frameType));
if (frameType == nsLayoutAtoms::hrFrame) {
hrFrame = child;
@ -3075,7 +3059,7 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds,
if (bulletPfd) {
bulletPfd->mBounds.x += maxX;
bulletPfd->mFrame->SetRect(mPresContext, bulletPfd->mBounds);
bulletPfd->mFrame->SetRect(bulletPfd->mBounds);
}
}
if ( (0 != dx) || (visualRTL) )
@ -3101,7 +3085,7 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds,
maxX = pfd->mBounds.x = maxX - (pfd->mMargin.left + pfd->mBounds.width + pfd->mMargin.right);
}
#endif // IBMBIDI
pfd->mFrame->SetRect(mPresContext, pfd->mBounds);
pfd->mFrame->SetRect(pfd->mBounds);
}
aLineBounds.x += dx;
}
@ -3118,7 +3102,7 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds,
PRUint32 maxX = psd->mRightEdge;
while (nsnull != pfd) {
pfd->mBounds.x = maxX - (pfd->mMargin.left + pfd->mBounds.width + pfd->mMargin.right);
pfd->mFrame->SetRect(mPresContext, pfd->mBounds);
pfd->mFrame->SetRect(pfd->mBounds);
maxX = pfd->mBounds.x;
pfd = pfd->mNext;
}
@ -3138,7 +3122,6 @@ nsLineLayout::RelativePositionFrames(nsRect& aCombinedArea)
void
nsLineLayout::RelativePositionFrames(PerSpanData* psd, nsRect& aCombinedArea)
{
nsPoint origin;
nsRect spanCombinedArea;
PerFrameData* pfd;
@ -3172,11 +3155,10 @@ nsLineLayout::RelativePositionFrames(PerSpanData* psd, nsRect& aCombinedArea)
// Adjust the origin of the frame
if (pfd->GetFlag(PFD_RELATIVEPOS)) {
nsIFrame* frame = pfd->mFrame;
frame->GetOrigin(origin);
// XXX what about right and bottom?
nscoord dx = pfd->mOffsets.left;
nscoord dy = pfd->mOffsets.top;
frame->MoveTo(mPresContext, origin.x + dx, origin.y + dy);
frame->SetPosition(frame->GetPosition() + nsPoint(dx, dy));
x += dx;
y += dy;
}
@ -3244,18 +3226,14 @@ nsLineLayout::RelativePositionFrames(PerSpanData* psd, nsRect& aCombinedArea)
// If we just computed a spans combined area, we need to update its
// NS_FRAME_OUTSIDE_CHILDREN bit..
if (nsnull != psd->mFrame) {
if (psd->mFrame) {
pfd = psd->mFrame;
nsIFrame* frame = pfd->mFrame;
nsFrameState oldState;
frame->GetFrameState(&oldState);
nsFrameState newState = oldState & ~NS_FRAME_OUTSIDE_CHILDREN;
if ((minX < 0) || (minY < 0) ||
(maxX > pfd->mBounds.width) || (maxY > pfd->mBounds.height)) {
newState |= NS_FRAME_OUTSIDE_CHILDREN;
}
if (newState != oldState) {
frame->SetFrameState(newState);
frame->AddStateBits(NS_FRAME_OUTSIDE_CHILDREN);
} else {
frame->RemoveStateBits(NS_FRAME_OUTSIDE_CHILDREN);
}
}
}
@ -3291,9 +3269,9 @@ nsLineLayout::FindNextText(nsIPresContext* aPresContext, nsIFrame* aFrame)
for (;;) {
stack.InsertElementAt(aFrame, 0);
aFrame->GetParent(&aFrame);
aFrame = aFrame->GetParent();
NS_ASSERTION(aFrame != nsnull, "wow, no block frame found");
NS_ASSERTION(aFrame, "wow, no block frame found");
if (! aFrame)
break;
@ -3315,8 +3293,7 @@ nsLineLayout::FindNextText(nsIPresContext* aPresContext, nsIFrame* aFrame)
return nsnull;
// Advance to top's next sibling
nsIFrame* next;
top->GetNextSibling(&next);
nsIFrame* next = top->GetNextSibling();
if (! next) {
// No more siblings. Pop the top element to walk back up the
@ -3327,9 +3304,7 @@ nsLineLayout::FindNextText(nsIPresContext* aPresContext, nsIFrame* aFrame)
// We know top's parent is good, but next's might not be. So let's
// set it to be sure.
nsIFrame* parent;
top->GetParent(&parent);
next->SetParent(parent);
next->SetParent(top->GetParent());
// Save next at the top of the stack...
stack.ReplaceElementAt(next, lastIndex);

View File

@ -792,65 +792,57 @@ nsObjectFrame::CreateWidget(nsIPresContext* aPresContext,
if (NS_OK != result) {
return result;
}
nsCOMPtr<nsIViewManager> viewMan;
nsRect boundBox(0, 0, aWidth, aHeight);
nsIFrame* parWithView;
nsIView *parView = GetAncestorWithView()->GetView();
nsIViewManager* viewMan = parView->GetViewManager();
GetParentWithView(aPresContext, &parWithView);
nsIView *parView = parWithView->GetView(aPresContext);
if (NS_SUCCEEDED(parView->GetViewManager(*getter_AddRefs(viewMan))))
{
// nsWidgetInitData* initData = GetWidgetInitData(aPresContext); // needs to be deleted
// initialize the view as hidden since we don't know the (x,y) until Paint
result = view->Init(viewMan, boundBox, parView, nsViewVisibility_kHide);
result = view->Init(viewMan, boundBox, parView, nsViewVisibility_kHide);
// if (nsnull != initData) {
// delete(initData);
// }
if (NS_FAILED(result)) {
return NS_OK; //XXX why OK? MMP
}
if (NS_FAILED(result)) {
return NS_OK; //XXX why OK? MMP
}
#if 0
// set the content's widget, so it can get content modified by the widget
nsIWidget *widget;
result = GetWidget(view, &widget);
if (NS_OK == result) {
nsInput* content = (nsInput *)mContent; // change this cast to QueryInterface
content->SetWidget(widget);
NS_IF_RELEASE(widget);
} else {
NS_ASSERTION(0, "could not get widget");
}
// set the content's widget, so it can get content modified by the widget
nsIWidget *widget = view->GetWidget();
if (widget) {
nsInput* content = (nsInput *)mContent; // change this cast to QueryInterface
content->SetWidget(widget);
} else {
NS_ASSERTION(0, "could not get widget");
}
#endif
// Turn off double buffering on the Mac. This depends on bug 49743 and partially
// fixes 32327, 19931 amd 51787
// Turn off double buffering on the Mac. This depends on bug 49743 and partially
// fixes 32327, 19931 amd 51787
#if defined(XP_MAC) || defined(XP_MACOSX)
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));
PRBool doubleBuffer = PR_FALSE;
if (prefBranch) {
prefBranch->GetBoolPref("plugin.enable_double_buffer", &doubleBuffer);
}
viewMan->AllowDoubleBuffering(doubleBuffer);
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));
PRBool doubleBuffer = PR_FALSE;
if (prefBranch) {
prefBranch->GetBoolPref("plugin.enable_double_buffer", &doubleBuffer);
}
viewMan->AllowDoubleBuffering(doubleBuffer);
#endif
// XXX Put this last in document order
// XXX Should we be setting the z-index here?
viewMan->InsertChild(parView, view, nsnull, PR_TRUE);
if(aViewOnly != PR_TRUE) {
// Bug 179822: Create widget and allow non-unicode SubClass
nsWidgetInitData initData;
initData.mUnicode = PR_FALSE;
result = view->CreateWidget(kWidgetCID, &initData);
if (NS_FAILED(result)) {
return NS_OK; //XXX why OK? MMP
}
// XXX Put this last in document order
// XXX Should we be setting the z-index here?
viewMan->InsertChild(parView, view, nsnull, PR_TRUE);
if(aViewOnly != PR_TRUE) {
// Bug 179822: Create widget and allow non-unicode SubClass
nsWidgetInitData initData;
initData.mUnicode = PR_FALSE;
result = view->CreateWidget(kWidgetCID, &initData);
if (NS_FAILED(result)) {
return NS_OK; //XXX why OK? MMP
}
}
@ -859,11 +851,10 @@ nsObjectFrame::CreateWidget(nsIPresContext* aPresContext,
// the child window background color when painting. If it's not set, it may default to gray
// Sometimes, a frame doesn't have a background color or is transparent. In this
// case, walk up the frame tree until we do find a frame with a background color
for (nsIFrame* frame = this; frame; frame->GetParent(&frame)) {
for (nsIFrame* frame = this; frame; frame = frame->GetParent()) {
const nsStyleBackground* background = frame->GetStyleBackground();
if (!background->IsTransparent()) { // make sure we got an actual color
nsCOMPtr<nsIWidget> win;
view->GetWidget(*getter_AddRefs(win));
nsIWidget* win = view->GetWidget();
if (win)
win->SetBackgroundColor(background->mBackgroundColor);
break;
@ -885,7 +876,7 @@ nsObjectFrame::CreateWidget(nsIPresContext* aPresContext,
viewMan->MoveViewTo(view, origin.x, origin.y);
}
SetView(aPresContext, view);
SetView(view);
return result;
}
@ -1490,23 +1481,17 @@ nsresult nsObjectFrame::GetWindowOriginInPixels(nsIPresContext * aPresContext, P
// if it's windowless, let's make sure we have our origin set right
// it may need to be corrected, like after scrolling
if (aWindowless && parentWithView) {
nsPoint correction(0,0);
nsCOMPtr<nsIViewManager> parentVM;
parentWithView->GetViewManager(*getter_AddRefs(parentVM));
nsIViewManager* parentVM = parentWithView->GetViewManager();
// Walk up all the views and add up their positions. This will give us our
// absolute position which is what we want to give the plugin
nsIView* theView = parentWithView;
while (theView) {
nsCOMPtr<nsIViewManager> vm;
theView->GetViewManager(*getter_AddRefs(vm));
if (vm != parentVM)
if (theView->GetViewManager() != parentVM)
break;
theView->GetPosition(&correction.x, &correction.y);
origin += correction;
theView->GetParent(theView);
origin += theView->GetPosition();
theView = theView->GetParent();
}
}
@ -1533,9 +1518,8 @@ nsObjectFrame::DidReflow(nsIPresContext* aPresContext,
PRBool bHidden = IsHidden();
if (HasView()) {
nsIView* view = GetView(aPresContext);
nsCOMPtr<nsIViewManager> vm;
view->GetViewManager(*getter_AddRefs(vm));
nsIView* view = GetView();
nsIViewManager* vm = view->GetViewManager();
if (vm)
vm->SetViewVisibility(view, bHidden ? nsViewVisibility_kHide : nsViewVisibility_kShow);
}
@ -1807,17 +1791,12 @@ nsObjectFrame::Paint(nsIPresContext* aPresContext,
#ifdef XP_WIN // Windowless plugins on windows need a special event to update their location, see bug 135737
// first, lets find out how big the window is, in pixels
nsCOMPtr<nsIPresShell> shell;
nsCOMPtr<nsIViewManager> vm;
aPresContext->GetShell(getter_AddRefs(shell));
if (shell) {
shell->GetViewManager(getter_AddRefs(vm));
if (vm) {
nsIViewManager* vm = aPresContext->GetViewManager();
if (vm) {
nsIView* view;
vm->GetRootView(view);
if (view) {
nsCOMPtr<nsIWidget> win;
view->GetWidget(*getter_AddRefs(win));
nsIWidget* win = view->GetWidget();
if (win) {
nsRect visibleRect;
win->GetBounds(visibleRect);
@ -1851,7 +1830,6 @@ nsObjectFrame::Paint(nsIPresContext* aPresContext,
}
}
}
}
#endif
inst->SetWindow(window);
@ -1881,8 +1859,7 @@ nsObjectFrame::HandleEvent(nsIPresContext* aPresContext,
if (anEvent->message == NS_PLUGIN_ACTIVATE)
{
nsCOMPtr<nsIContent> content;
GetContent(getter_AddRefs(content));
nsIContent* content = GetContent();
if (content)
{
content->SetFocus(aPresContext);
@ -2004,7 +1981,7 @@ nsObjectFrame::GetNextObjectFrame(nsIPresContext* aPresContext,
nsIFrame * child;
aRoot->FirstChild(aPresContext, nsnull, &child);
while (child != nsnull) {
while (child) {
*outFrame = nsnull;
CallQueryInterface(child, outFrame);
if (nsnull != *outFrame) {
@ -2014,7 +1991,7 @@ nsObjectFrame::GetNextObjectFrame(nsIPresContext* aPresContext,
}
GetNextObjectFrame(aPresContext, child, outFrame);
child->GetNextSibling(&child);
child = child->GetNextSibling();
}
return NS_ERROR_FAILURE;
@ -2050,8 +2027,7 @@ NS_IMPL_ISUPPORTS2(nsPluginDOMContextMenuListener, nsIDOMContextMenuListener, ns
nsresult nsPluginDOMContextMenuListener::Init(nsObjectFrame *aFrame)
{
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
nsIContent* content = aFrame->GetContent();
// Register context menu listener
if (content) {
@ -2071,8 +2047,7 @@ nsresult nsPluginDOMContextMenuListener::Init(nsObjectFrame *aFrame)
nsresult nsPluginDOMContextMenuListener::Destroy(nsObjectFrame *aFrame)
{
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
nsIContent* content = aFrame->GetContent();
// Unregister context menu listener
if (content) {
@ -2272,14 +2247,10 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetDOMElement(nsIDOMElement* *result)
if (nsnull != mOwner)
{
nsIContent *cont;
mOwner->GetContent(&cont);
if (nsnull != cont)
nsIContent* cont = mOwner->GetContent();
if (cont)
{
rv = cont->QueryInterface(NS_GET_IID(nsIDOMElement), (void **)result);
NS_RELEASE(cont);
}
}
@ -2328,8 +2299,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL(const char *aURL, const char *aTarge
rv = NS_NewURI(getter_AddRefs(uri), aURL, baseURL);
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
nsCOMPtr<nsIContent> content;
mOwner->GetContent(getter_AddRefs(content));
nsIContent* content = mOwner->GetContent();
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
nsCOMPtr<nsIInputStream> postDataStream;
@ -2425,7 +2395,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::InvalidateRect(nsPluginRect *invalidRect)
if(invalidRect)
{
//no reference count on view
nsIView* view = mOwner->GetView(mContext);
nsIView* view = mOwner->GetView();
if (view)
{
@ -2437,15 +2407,8 @@ NS_IMETHODIMP nsPluginInstanceOwner::InvalidateRect(nsPluginRect *invalidRect)
(int)(ptot * (invalidRect->right - invalidRect->left)),
(int)(ptot * (invalidRect->bottom - invalidRect->top)));
nsIViewManager* manager;
rv = view->GetViewManager(manager);
//set flags to not do a synchronous update, force update does the redraw
if((rv == NS_OK) && manager)
{
rv = manager->UpdateView(view, rect, NS_VMREFRESH_NO_SYNC);
NS_RELEASE(manager);
}
view->GetViewManager()->UpdateView(view, rect, NS_VMREFRESH_NO_SYNC);
}
}
@ -2459,23 +2422,13 @@ NS_IMETHODIMP nsPluginInstanceOwner::InvalidateRegion(nsPluginRegion invalidRegi
NS_IMETHODIMP nsPluginInstanceOwner::ForceRedraw()
{
nsresult rv = NS_OK;
//no reference count on view
nsIView* view = mOwner->GetView(mContext);
nsIView* view = mOwner->GetView();
if (view)
{
nsIViewManager* manager;
rv = view->GetViewManager(manager);
if((rv == NS_OK) && manager)
{
rv = manager->Composite();
NS_RELEASE(manager);
}
return view->GetViewManager()->Composite();
}
return rv;
return NS_OK;
}
NS_IMETHODIMP nsPluginInstanceOwner::GetValue(nsPluginInstancePeerVariable variable, void *value)
@ -2490,11 +2443,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetValue(nsPluginInstancePeerVariable varia
// get the view manager from the pres shell, not from the view!
// we may not have a view if we are hidden
if (mContext) {
nsCOMPtr<nsIPresShell> shell;
mContext->GetShell(getter_AddRefs(shell));
if (shell) {
nsCOMPtr<nsIViewManager> vm;
shell->GetViewManager(getter_AddRefs(vm));
nsIViewManager* vm = mContext->GetViewManager();
if (vm) {
nsCOMPtr<nsIWidget> widget;
rv = vm->GetWidget(getter_AddRefs(widget));
@ -2505,7 +2454,6 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetValue(nsPluginInstancePeerVariable varia
} else NS_ASSERTION(widget, "couldn't get doc's widget in getting doc's window handle");
} else NS_ASSERTION(vm, "couldn't get view manager in getting doc's window handle");
} else NS_ASSERTION(shell, "couldn't get pres shell in getting doc's window handle");
} else NS_ASSERTION(mContext, "plugin owner has no pres context in getting doc's window handle");
break;
@ -2522,13 +2470,10 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetTagType(nsPluginTagType *result)
*result = nsPluginTagType_Unknown;
if (nsnull != mOwner)
if (mOwner)
{
nsIContent *cont;
mOwner->GetContent(&cont);
if (nsnull != cont)
nsIContent* cont = mOwner->GetContent();
if (cont)
{
nsCOMPtr<nsIAtom> atom;
cont->GetTag(getter_AddRefs(atom));
@ -2544,8 +2489,6 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetTagType(nsPluginTagType *result)
rv = NS_OK;
}
NS_RELEASE(cont);
}
}
@ -2557,10 +2500,8 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetTagText(const char* *result)
NS_ENSURE_ARG_POINTER(result);
if (nsnull == mTagText) {
nsresult rv;
nsCOMPtr<nsIContent> content;
rv = mOwner->GetContent(getter_AddRefs(content));
if (NS_FAILED(rv))
return rv;
nsIContent* content = mOwner->GetContent();
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(content, &rv));
if (NS_FAILED(rv))
return rv;
@ -2936,8 +2877,8 @@ nsresult nsPluginInstanceOwner::EnsureCachedAttrParamArrays()
// arrays count up attributes
mNumCachedAttrs = 0;
nsCOMPtr<nsIContent> content;
nsresult rv = mOwner->GetContent(getter_AddRefs(content));
nsIContent* content = mOwner->GetContent();
nsresult rv = NS_OK;
NS_ENSURE_TRUE(content, rv);
PRInt32 cattrs;
@ -3159,8 +3100,7 @@ void nsPluginInstanceOwner::GUItoMacEvent(const nsGUIEvent& anEvent, EventRecord
case NS_FOCUS_EVENT_START: // this is the same as NS_FOCUS_CONTENT
aMacEvent.what = nsPluginEventType_GetFocusEvent;
if (mOwner && mOwner->mPresContext) {
nsCOMPtr<nsIContent> content;
mOwner->GetContent(getter_AddRefs(content));
nsIContent* content = mOwner->GetContent();
if (content)
content->SetFocus(mOwner->mPresContext);
}
@ -3169,8 +3109,7 @@ void nsPluginInstanceOwner::GUItoMacEvent(const nsGUIEvent& anEvent, EventRecord
case NS_BLUR_CONTENT:
aMacEvent.what = nsPluginEventType_LoseFocusEvent;
if (mOwner && mOwner->mPresContext) {
nsCOMPtr<nsIContent> content;
mOwner->GetContent(getter_AddRefs(content));
nsIContent* content = mOwner->GetContent();
if (content)
content->RemoveFocus(mOwner->mPresContext);
}
@ -3537,8 +3476,7 @@ nsPluginInstanceOwner::MouseDown(nsIDOMEvent* aMouseEvent)
// if the plugin is windowless, we need to set focus ourselves
// otherwise, we might not get key events
if (mPluginWindow && mPluginWindow->type == nsPluginWindowType_Drawable) {
nsCOMPtr<nsIContent> content;
mOwner->GetContent(getter_AddRefs(content));
nsIContent* content = mOwner->GetContent();
if (content)
content->SetFocus(mContext);
}
@ -3691,8 +3629,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
nsresult
nsPluginInstanceOwner::Destroy()
{
nsCOMPtr<nsIContent> content;
mOwner->GetContent(getter_AddRefs(content));
nsIContent* content = mOwner->GetContent();
// stop the timer explicitly to reduce reference count.
CancelTimer();
@ -3732,19 +3669,15 @@ nsPluginInstanceOwner::Destroy()
}
// Unregister scroll position listener
nsIFrame* parentWithView;
mOwner->GetParentWithView(mContext, &parentWithView);
nsIView* curView = nsnull;
if (parentWithView)
curView = parentWithView->GetView(mContext);
nsIFrame* parentWithView = mOwner->GetAncestorWithView();
nsIView* curView = parentWithView ? parentWithView->GetView() : nsnull;
while (curView)
{
nsIScrollableView* scrollingView;
if (NS_SUCCEEDED(CallQueryInterface(curView, &scrollingView)))
scrollingView->RemoveScrollPositionListener((nsIScrollPositionListener *)this);
curView->GetParent(curView);
curView = curView->GetParent();
}
mOwner = nsnull; // break relationship between frame and plugin instance owner
@ -3888,8 +3821,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::Init(nsIPresContext* aPresContext, nsObject
mContext = aPresContext;
mOwner = aFrame;
nsCOMPtr<nsIContent> content;
mOwner->GetContent(getter_AddRefs(content));
nsIContent* content = mOwner->GetContent();
// Some plugins require a specific sequence of shutdown and startup when
// a page is reloaded. Shutdown happens usually when the last instance
@ -3960,18 +3892,15 @@ NS_IMETHODIMP nsPluginInstanceOwner::Init(nsIPresContext* aPresContext, nsObject
// Register scroll position listener
// We need to register a scroll pos listener on every scrollable
// view up to the top
nsIFrame* parentWithView;
mOwner->GetParentWithView(mContext, &parentWithView);
nsIView* curView = nsnull;
if (parentWithView)
curView = parentWithView->GetView(mContext);
nsIFrame* parentWithView = mOwner->GetAncestorWithView();
nsIView* curView = parentWithView ? parentWithView->GetView() : nsnull;
while (curView)
{
nsIScrollableView* scrollingView;
if (NS_SUCCEEDED(CallQueryInterface(curView, &scrollingView)))
scrollingView->AddScrollPositionListener((nsIScrollPositionListener *)this);
curView->GetParent(curView);
curView = curView->GetParent();
}
return NS_OK;
@ -4017,7 +3946,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void)
{
// Create view if necessary
view = mOwner->GetView(mContext);
view = mOwner->GetView();
if (!view || !mWidget)
{
@ -4033,18 +3962,14 @@ NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void)
windowless);
if (NS_OK == rv)
{
view = mOwner->GetView(mContext);
view = mOwner->GetView();
if (view)
{
view->GetWidget(*getter_AddRefs(mWidget));
mWidget = view->GetWidget();
PRBool fTransparent = PR_FALSE;
mInstance->GetValue(nsPluginInstanceVariable_TransparentBool, (void *)&fTransparent);
nsCOMPtr<nsIViewManager> vm;
view->GetViewManager(*getter_AddRefs(vm));
if (vm) {
vm->SetViewContentTransparency(view, fTransparent);
}
view->GetViewManager()->SetViewContentTransparency(view, fTransparent);
}
if (PR_TRUE == windowless)
@ -4100,34 +4025,32 @@ static void ConvertTwipsToPixels(nsIPresContext& aPresContext, nsRect& aTwipsRec
#ifdef DO_DIRTY_INTERSECT
// Convert from a frame relative coordinate to a coordinate relative to its
// containing window
static void ConvertRelativeToWindowAbsolute(nsIFrame* aFrame, nsIPresContext* aPresContext, nsPoint& aRel, nsPoint& aAbs, nsIWidget *&
aContainerWidget)
static void ConvertRelativeToWindowAbsolute(nsIFrame* aFrame,
nsIPresContext* aPresContext, nsPoint& aRel, nsPoint& aAbs,
nsIWidget *& aContainerWidget)
{
aAbs.x = 0;
aAbs.y = 0;
// See if this frame has a view
nsIView *view = aFrame->GetView(aPresContext);
if (nsnull == view) {
// Calculate frames offset from its nearest view
aFrame->GetOffsetFromView(aPresContext,
nsIView *view = aFrame->GetView();
if (!view) {
aAbs.x = 0;
aAbs.y = 0;
// Calculate frames offset from its nearest view
aFrame->GetOffsetFromView(aPresContext,
aAbs,
&view);
} else {
// Store frames offset from its view.
nsRect rect;
aFrame->GetRect(rect);
aAbs.x = rect.x;
aAbs.y = rect.y;
// Store frames offset from its view.
aAbs = aFrame->GetPosition();
}
if (view != nsnull) {
if (view) {
// Caclulate the views offset from its nearest widget
nscoord viewx = 0;
nscoord viewy = 0;
view->GetWidget(aContainerWidget);
if (nsnull == aContainerWidget) {
aContainerWidget = view->GetWidget();
NS_IF_ADDREF(aContainerWidget);
if (!aContainerWidget) {
view->GetOffsetFromWidget(&viewx, &viewy, aContainerWidget/**getter_AddRefs(widget)*/);
aAbs.x += viewx;
aAbs.y += viewy;
@ -4135,10 +4058,7 @@ aContainerWidget)
// GetOffsetFromWidget does not include the views offset, so we need to add
// that in.
nscoord x, y;
view->GetPosition(&x, &y);
aAbs.x += x;
aAbs.y += y;
aAbs += view->GetPosition();
}
nsRect widgetBounds;
@ -4163,10 +4083,8 @@ nsPluginPort* nsPluginInstanceOwner::FixUpPluginWindow(PRInt32 inPaintState)
return nsnull;
// first, check our view for CSS visibility style
nsIView *view = mOwner->GetView(mContext);
nsViewVisibility vis;
view->GetVisibility(vis);
PRBool isVisible = (vis == nsViewVisibility_kShow) ? PR_TRUE : PR_FALSE;
PRBool isVisible =
mOwner->GetView()->GetVisibility() == nsViewVisibility_kShow;
nsCOMPtr<nsIPluginWidget> pluginWidget = do_QueryInterface(mWidget);
@ -4174,7 +4092,8 @@ nsPluginPort* nsPluginInstanceOwner::FixUpPluginWindow(PRInt32 inPaintState)
nsRect widgetClip;
PRBool widgetVisible;
pluginWidget->GetPluginClipRect(widgetClip, pluginOrigin, widgetVisible);
isVisible &= widgetVisible;
if (!widgetVisible)
isVisible = FALSE;
if (!isVisible)
widgetClip.Empty();
@ -4221,17 +4140,9 @@ nsPluginPort* nsPluginInstanceOwner::FixUpPluginWindow(PRInt32 inPaintState)
void nsPluginInstanceOwner::Composite()
{
//no reference count on view
nsIView* view = mOwner->GetView(mContext);
nsIView* view = mOwner->GetView();
if (view) {
nsIViewManager* manager;
nsresult rv = view->GetViewManager(manager);
//set flags to not do a synchronous update, force update does the redraw
if (NS_SUCCEEDED(rv) && manager) {
rv = manager->UpdateView(view, NS_VMREFRESH_IMMEDIATE);
NS_RELEASE(manager);
}
view->GetViewManager()->UpdateView(view, NS_VMREFRESH_IMMEDIATE);
}
}

View File

@ -100,17 +100,15 @@ NS_IMETHODIMP nsPageContentFrame::Reflow(nsIPresContext* aPresContext,
// absolutely positioned elements
nsMargin border(0,0,0,0);
nsMargin padding(0,0,0,0);
nsFrameState kidState;
// Ignore the return values for these
// Typically they are zero and if they fail
// we should keep going anyway, there impact is small
kidReflowState.mStyleBorder->GetBorder(border);
kidReflowState.mStylePadding->GetPadding(padding);
frame->GetFrameState(&kidState);
// First check the combined area
if (NS_FRAME_OUTSIDE_CHILDREN & kidState) {
if (NS_FRAME_OUTSIDE_CHILDREN & frame->GetStateBits()) {
// The background covers the content area and padding area, so check
// for children sticking outside the child frame's padding edge
nscoord paddingEdgeX = aDesiredSize.width - border.right - padding.right;
@ -133,12 +131,11 @@ NS_IMETHODIMP nsPageContentFrame::Reflow(nsIPresContext* aPresContext,
#endif
#ifdef DEBUG_PRINTING
nsRect r;
frame->GetRect(r);
nsRect r = frame->GetRect();
printf("PCF: Area Frame %p Bounds: %5d,%5d,%5d,%5d\n", frame, r.x, r.y, r.width, r.height);
nsIView* view = frame->GetView(aPresContext);
nsIView* view = frame->GetView();
if (view) {
view->GetBounds(r);
r = view->GetBounds();
printf("PCF: Area Frame View Bounds: %5d,%5d,%5d,%5d\n", r.x, r.y, r.width, r.height);
} else {
printf("PCF: Area Frame View Bounds: NO VIEW\n");

View File

@ -125,8 +125,8 @@ nsPageFrame::SetInitialChildList(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{
nsIView* view = aChildList->GetView(aPresContext);
if (view != nsnull && mDoCreateWidget) {
nsIView* view = aChildList->GetView();
if (view && mDoCreateWidget) {
nscoord dx, dy;
nsCOMPtr<nsIWidget> widget;
view->GetOffsetFromWidget(&dx, &dy, *getter_AddRefs(widget));
@ -227,13 +227,11 @@ NS_IMETHODIMP nsPageFrame::Reflow(nsIPresContext* aPresContext,
aDesiredSize.height = aReflowState.availableHeight;
}
nsIView* view = frame->GetView(aPresContext);
nsIView* view = frame->GetView();
if (view) {
nsCOMPtr<nsIViewManager> vm;
view->GetViewManager(*getter_AddRefs(vm));
nsRegion region;
region.Copy(nsRect(0, 0, aDesiredSize.width, aDesiredSize.height));
vm->SetViewChildClipRegion(view, &region);
view->GetViewManager()->SetViewChildClipRegion(view, &region);
}
#ifdef NS_DEBUG
@ -742,13 +740,11 @@ nsPageFrame::DrawBackground(nsIPresContext* aPresContext,
nsIFrame* pageContentFrame = mFrames.FirstChild();
NS_ASSERTION(pageContentFrame, "Must always be there.");
nsRect rect;
pageContentFrame->GetRect(rect);
const nsStyleBorder* border = GetStyleBorder();
const nsStylePadding* padding = GetStylePadding();
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
aDirtyRect, rect, *border, *padding,
aDirtyRect, pageContentFrame->GetRect(), *border, *padding,
PR_TRUE);
}
}

View File

@ -142,7 +142,7 @@ nsPlaceholderFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aInden
fprintf(out, " [parent=%p]", NS_STATIC_CAST(void*, mParent));
#endif
if (HasView()) {
fprintf(out, " [view=%p]", (void*)GetView(aPresContext));
fprintf(out, " [view=%p]", (void*)GetView());
}
fprintf(out, " {%d,%d,%d,%d}", mRect.x, mRect.y, mRect.width, mRect.height);
if (0 != mState) {

View File

@ -902,7 +902,7 @@ IncrementalReflow::Dispatch(nsIPresContext *aPresContext,
if (first == root)
size = aMaxSize;
else
first->GetSize(size);
size = first->GetSize();
nsHTMLReflowState reflowState(aPresContext, first, path,
&aRendContext, size);
@ -916,11 +916,9 @@ IncrementalReflow::Dispatch(nsIPresContext *aPresContext,
(aDesiredSize.width == size.width && aDesiredSize.height == size.height),
"non-root frame's desired size changed during an incremental reflow");
first->SizeTo(aPresContext, aDesiredSize.width, aDesiredSize.height);
first->SetSize(nsSize(aDesiredSize.width, aDesiredSize.height));
nsIView* view = first->GetView(aPresContext);
if (view)
nsContainerFrame::SyncFrameViewAfterReflow(aPresContext, first, view, nsnull);
nsContainerFrame::SyncFrameViewAfterReflow(aPresContext, first, first->GetView(), nsnull);
first->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
}
@ -938,12 +936,10 @@ IncrementalReflow::AddCommand(nsIPresContext *aPresContext,
// parent chain until we reach either a `reflow root' or the root
// frame in the frame hierarchy.
nsAutoVoidArray path;
nsFrameState state;
do {
path.AppendElement(frame);
frame->GetFrameState(&state);
} while (!(state & NS_FRAME_REFLOW_ROOT) &&
(frame->GetParent(&frame), frame != nsnull));
} while (!(frame->GetStateBits() & NS_FRAME_REFLOW_ROOT) &&
(frame = frame->GetParent()) != nsnull);
// Pop off the root, add it to the set if it's not there already.
PRInt32 lastIndex = path.Count() - 1;
@ -1046,6 +1042,7 @@ public:
NS_IMETHOD GetDocument(nsIDocument** aResult);
NS_IMETHOD GetPresContext(nsIPresContext** aResult);
NS_IMETHOD GetViewManager(nsIViewManager** aResult);
nsIViewManager* GetViewManager() { return mViewManager; }
NS_IMETHOD GetStyleSet(nsIStyleSet** aResult);
NS_IMETHOD GetActiveAlternateStyleSheet(nsString& aSheetTitle);
NS_IMETHOD SelectAlternateStyleSheet(const nsString& aSheetTitle);
@ -2869,14 +2866,11 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
rootFrame->WillReflow(mPresContext);
nsContainerFrame::PositionFrameView(mPresContext, rootFrame);
rootFrame->Reflow(mPresContext, desiredSize, reflowState, status);
rootFrame->SizeTo(mPresContext, desiredSize.width, desiredSize.height);
rootFrame->SetSize(nsSize(desiredSize.width, desiredSize.height));
mPresContext->SetVisibleArea(nsRect(0,0,desiredSize.width,desiredSize.height));
nsIView* view = rootFrame->GetView(mPresContext);
if (view) {
nsContainerFrame::SyncFrameViewAfterReflow(mPresContext, rootFrame, view,
nsnull);
}
nsContainerFrame::SyncFrameViewAfterReflow(mPresContext, rootFrame, rootFrame->GetView(),
nsnull);
rootFrame->DidReflow(mPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
#ifdef NS_DEBUG
@ -3014,11 +3008,8 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight)
rootFrame->SizeTo(mPresContext, desiredSize.width, desiredSize.height);
mPresContext->SetVisibleArea(nsRect(0,0,desiredSize.width,desiredSize.height));
nsIView* view = rootFrame->GetView(mPresContext);
if (view) {
nsContainerFrame::SyncFrameViewAfterReflow(mPresContext, rootFrame, view,
nsnull);
}
nsContainerFrame::SyncFrameViewAfterReflow(mPresContext, rootFrame, rootFrame->GetView(),
nsnull);
rootFrame->DidReflow(mPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
#ifdef NS_DEBUG
if (nsIFrameDebug::GetVerifyTreeEnable()) {
@ -3272,11 +3263,8 @@ NS_IMETHODIMP
PresShell::PageMove(PRBool aForward, PRBool aExtend)
{
nsresult result;
nsCOMPtr<nsIViewManager> viewManager;
nsIViewManager* viewManager = GetViewManager();
nsIScrollableView *scrollableView;
result = GetViewManager(getter_AddRefs(viewManager));
if (NS_FAILED(result))
return result;
if (!viewManager)
return NS_ERROR_UNEXPECTED;
result = viewManager->GetRootScrollableView(&scrollableView);
@ -3296,9 +3284,9 @@ PresShell::PageMove(PRBool aForward, PRBool aExtend)
NS_IMETHODIMP
PresShell::ScrollPage(PRBool aForward)
{
nsCOMPtr<nsIViewManager> viewManager;
nsresult result = GetViewManager(getter_AddRefs(viewManager));
if (NS_SUCCEEDED(result) && viewManager)
nsIViewManager* viewManager = GetViewManager();
nsresult result = NS_OK;
if (viewManager)
{
nsIScrollableView *scrollView;
result = viewManager->GetRootScrollableView(&scrollView);
@ -3313,9 +3301,9 @@ PresShell::ScrollPage(PRBool aForward)
NS_IMETHODIMP
PresShell::ScrollLine(PRBool aForward)
{
nsCOMPtr<nsIViewManager> viewManager;
nsresult result = GetViewManager(getter_AddRefs(viewManager));
if (NS_SUCCEEDED(result) && viewManager)
nsIViewManager* viewManager = GetViewManager();
nsresult result = NS_OK;
if (viewManager)
{
nsIScrollableView *scrollView;
result = viewManager->GetRootScrollableView(&scrollView);
@ -3345,9 +3333,9 @@ PresShell::ScrollLine(PRBool aForward)
NS_IMETHODIMP
PresShell::ScrollHorizontal(PRBool aLeft)
{
nsCOMPtr<nsIViewManager> viewManager;
nsresult result = GetViewManager(getter_AddRefs(viewManager));
if (NS_SUCCEEDED(result) && viewManager)
nsIViewManager* viewManager = GetViewManager();
nsresult result = NS_OK;
if (viewManager)
{
nsIScrollableView *scrollView;
result = viewManager->GetRootScrollableView(&scrollView);
@ -3370,9 +3358,9 @@ PresShell::ScrollHorizontal(PRBool aLeft)
NS_IMETHODIMP
PresShell::CompleteScroll(PRBool aForward)
{
nsCOMPtr<nsIViewManager> viewManager;
nsresult result = GetViewManager(getter_AddRefs(viewManager));
if (NS_SUCCEEDED(result) && viewManager)
nsIViewManager* viewManager = GetViewManager();
nsresult result = NS_OK;
if (viewManager)
{
nsIScrollableView *scrollView;
result = viewManager->GetRootScrollableView(&scrollView);
@ -3398,9 +3386,7 @@ PresShell::CompleteMove(PRBool aForward, PRBool aExtend)
nsIView *scrolledView;
result = scrollableView->GetScrolledView(scrolledView);
// get a frame
void *clientData;
scrolledView->GetClientData(clientData);
nsIFrame *frame = (nsIFrame *)clientData;
nsIFrame *frame = (nsIFrame*)scrolledView->GetClientData();
if (!frame)
return NS_ERROR_FAILURE;
//we need to get to the area frame.
@ -3430,9 +3416,7 @@ PresShell::CompleteMove(PRBool aForward, PRBool aExtend)
if (aForward)
{
outsideLimit = 1;//search from end
nsRect rect;
frame->GetRect(rect);
pos.mDesiredX = rect.width * 2;//search way off to right of line
pos.mDesiredX = frame->GetRect().width * 2;//search way off to right of line
pos.mDirection = eDirPrevious; //seach backwards from the end
}
else
@ -3498,24 +3482,19 @@ PresShell::CheckVisibility(nsIDOMNode *node, PRInt16 startOffset, PRInt16 EndOff
static void UpdateViewProperties(nsIPresContext* aPresContext, nsIViewManager* aVM,
nsIView* aView) {
nsCOMPtr<nsIViewManager> thisVM;
aView->GetViewManager(*getter_AddRefs(thisVM));
nsIViewManager* thisVM = aView->GetViewManager();
if (thisVM != aVM) {
return;
}
void* clientData;
aView->GetClientData(clientData);
nsIFrame* frame = NS_STATIC_CAST(nsIFrame*, clientData);
nsIFrame* frame = NS_STATIC_CAST(nsIFrame*, aView->GetClientData());
if (frame) {
nsContainerFrame::SyncFrameViewProperties(aPresContext, frame, nsnull, aView);
}
nsIView* child;
aView->GetFirstChild(child);
while (child) {
for (nsIView* child = aView->GetFirstChild(); child;
child = child->GetNextSibling()) {
UpdateViewProperties(aPresContext, aVM, child);
child->GetNextSibling(child);
}
}
@ -3561,13 +3540,11 @@ PresShell::StyleChangeReflow()
rootFrame->WillReflow(mPresContext);
nsContainerFrame::PositionFrameView(mPresContext, rootFrame);
rootFrame->Reflow(mPresContext, desiredSize, reflowState, status);
rootFrame->SizeTo(mPresContext, desiredSize.width, desiredSize.height);
rootFrame->SetSize(nsSize(desiredSize.width, desiredSize.height));
mPresContext->SetVisibleArea(nsRect(0,0,desiredSize.width,desiredSize.height));
nsIView* view = rootFrame->GetView(mPresContext);
if (view) {
nsContainerFrame::SyncFrameViewAfterReflow(mPresContext, rootFrame, view,
nsnull);
}
nsIView* view = rootFrame->GetView();
nsContainerFrame::SyncFrameViewAfterReflow(mPresContext, rootFrame, view,
nsnull);
rootFrame->DidReflow(mPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
#ifdef NS_DEBUG
if (nsIFrameDebug::GetVerifyTreeEnable()) {
@ -3958,7 +3935,8 @@ PresShell::ClearFrameRefs(nsIFrame* aFrame)
}
if (aFrame == mCurrentEventFrame) {
aFrame->GetContent(&mCurrentEventContent);
mCurrentEventContent = aFrame->GetContent();
NS_IF_ADDREF(mCurrentEventContent);
mCurrentEventFrame = nsnull;
}
@ -3966,8 +3944,8 @@ PresShell::ClearFrameRefs(nsIFrame* aFrame)
if (aFrame == (nsIFrame*)mCurrentEventFrameStack.ElementAt(i)) {
//One of our stack frames was deleted. Get its content so that when we
//pop it we can still get its new frame from its content
nsIContent *currentEventContent;
aFrame->GetContent(&currentEventContent);
nsIContent *currentEventContent = aFrame->GetContent();
NS_IF_ADDREF(currentEventContent);
mCurrentEventContentStack.ReplaceElementAt((void*)currentEventContent, i);
mCurrentEventFrameStack.ReplaceElementAt(nsnull, i);
}
@ -3985,16 +3963,13 @@ PresShell::CreateRenderingContext(nsIFrame *aFrame,
return NS_ERROR_NULL_POINTER;
}
nsPoint pt;
nsresult rv;
nsIView *view = aFrame->GetClosestView(mPresContext);
nsIView *view = aFrame->GetClosestView();
nsCOMPtr<nsIWidget> widget;
if (nsnull != view) {
nsCOMPtr<nsIViewManager> vm;
view->GetViewManager(*getter_AddRefs(vm));
vm->GetWidgetForView(view, getter_AddRefs(widget));
if (view) {
view->GetViewManager()->GetWidgetForView(view, getter_AddRefs(widget));
}
nsCOMPtr<nsIDeviceContext> dx;
@ -4255,10 +4230,9 @@ static void ScrollViewToShowRect(nsIScrollableView* aScrollingView,
// Determine the visible rect in the scrolling view's coordinate space.
// The size of the visible area is the clip view size
const nsIView* clipView;
nsRect visibleRect;
aScrollingView->GetClipView(&clipView);
clipView->GetBounds(visibleRect); // get width and height
nsRect visibleRect = clipView->GetBounds(); // get width and height
aScrollingView->GetScrollPosition(visibleRect.x, visibleRect.y);
// The actual scroll offsets
@ -4363,9 +4337,8 @@ PresShell::ScrollFrameIntoView(nsIFrame *aFrame,
// is not for the anchor link to scroll back into view. That is what
// this check is preventing.
// XXX: The dependency on the command dispatcher needs to be fixed.
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
if(content) {
nsIContent* content = aFrame->GetContent();
if (content) {
nsCOMPtr<nsIDocument> document;
content->GetDocument(getter_AddRefs(document));
if(document){
@ -4391,8 +4364,7 @@ PresShell::ScrollFrameIntoView(nsIFrame *aFrame,
// Step 2: Walk the views that are parents of the frame and scroll them
// appropriately.
nsRect frameBounds;
aFrame->GetRect(frameBounds);
nsRect frameBounds = aFrame->GetRect();
nsPoint offset;
nsIView* closestView;
aFrame->GetOffsetFromView(mPresContext, offset, &closestView);
@ -4407,7 +4379,7 @@ PresShell::ScrollFrameIntoView(nsIFrame *aFrame,
while (frame && (frame->GetFrameType(getter_AddRefs(frameType)),
frameType == nsLayoutAtoms::inlineFrame)) {
prevFrame = frame;
prevFrame->GetParent(&frame);
frame = prevFrame->GetParent();
}
if (frame != aFrame &&
@ -4458,17 +4430,14 @@ PresShell::ScrollFrameIntoView(nsIFrame *aFrame,
// make sure to get the scrolled view's position after it has been scrolled.
nsIScrollableView* scrollingView = nsnull;
while (closestView) {
nsIView* parent;
closestView->GetParent(parent);
nsIView* parent = closestView->GetParent();
if (parent) {
CallQueryInterface(parent, &scrollingView);
if (scrollingView) {
ScrollViewToShowRect(scrollingView, frameBounds, aVPercent, aHPercent);
}
}
nscoord x, y;
closestView->GetPosition(&x, &y);
frameBounds.MoveBy(x, y);
frameBounds += closestView->GetPosition();;
closestView = parent;
}
@ -4968,8 +4937,7 @@ PresShell::UnsuppressAndInvalidate()
nsIFrame* rootFrame;
mFrameManager->GetRootFrame(&rootFrame);
if (rootFrame) {
nsRect rect;
rootFrame->GetRect(rect);
nsRect rect = rootFrame->GetRect();
if (!rect.IsEmpty()) {
((nsFrame*)rootFrame)->Invalidate(mPresContext, rect, PR_FALSE);
}
@ -5226,9 +5194,8 @@ PresShell::IsSafeToFlush(PRBool& aIsSafeToFlush)
aIsSafeToFlush = PR_FALSE;
} else {
// Not safe if we are painting
nsCOMPtr<nsIViewManager> viewManager;
nsresult rv = GetViewManager(getter_AddRefs(viewManager));
if (NS_SUCCEEDED(rv) && (nsnull != viewManager)) {
nsIViewManager* viewManager = GetViewManager();
if (viewManager) {
PRBool isPainting = PR_FALSE;
viewManager->IsPainting(isPainting);
if (isPainting) {
@ -5468,8 +5435,7 @@ BuildFramechangeList(nsIFrame *aFrame, void *aClosure)
// Ok, get our binding information.
if (!aFrame->GetStyleDisplay()->mBinding.IsEmpty()) {
// We had a binding.
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
nsIContent* content = aFrame->GetContent();
nsCOMPtr<nsIDocument> doc;
content->GetDocument(getter_AddRefs(doc));
if (doc) {
@ -5528,9 +5494,7 @@ WalkFramesThroughPlaceholders(nsIPresContext *aPresContext, nsIFrame *aFrame,
nsIFrame *child = nsnull;
aFrame->FirstChild(aPresContext, childList, &child);
while (child) {
nsFrameState state;
child->GetFrameState(&state);
if (!(state & NS_FRAME_OUT_OF_FLOW)) {
if (!(child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
// only do frames that are in flow
nsCOMPtr<nsIAtom> frameType;
child->GetFrameType(getter_AddRefs(frameType));
@ -5545,7 +5509,7 @@ WalkFramesThroughPlaceholders(nsIPresContext *aPresContext, nsIFrame *aFrame,
else
WalkFramesThroughPlaceholders(aPresContext, child, aFunc, aClosure);
}
child->GetNextSibling(&child);
child = child->GetNextSibling();
}
aFrame->GetAdditionalChildListName(listIndex++, getter_AddRefs(childList));
@ -5803,10 +5767,9 @@ static PRBool ComputeClipRect(nsIFrame* aFrame, nsRect& aResult) {
// element: border, padding, and content areas, and even scrollbars if
// there are any.
if (display->IsAbsolutelyPositioned() && (display->mClipFlags & NS_STYLE_CLIP_RECT)) {
nsSize size;
nsSize size = aFrame->GetSize();
// Start with the 'auto' values and then factor in user specified values
aFrame->GetSize(size);
nsRect clipRect(0, 0, size.width, size.height);
if (display->mClipFlags & NS_STYLE_CLIP_RECT) {
@ -5869,7 +5832,6 @@ PresShell::Paint(nsIView *aView,
nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect)
{
void* clientData;
nsIFrame* frame;
nsresult rv = NS_OK;
@ -5880,8 +5842,7 @@ PresShell::Paint(nsIView *aView,
NS_ASSERTION(!(nsnull == aView), "null view");
aView->GetClientData(clientData);
frame = (nsIFrame *)clientData;
frame = NS_STATIC_CAST(nsIFrame*, aView->GetClientData());
if (nsnull != frame)
{
@ -5907,8 +5868,7 @@ PresShell::Paint(nsIView *aView,
#ifdef NS_DEBUG
// Draw a border around the frame
if (nsIFrameDebug::GetShowFrameBorders()) {
nsRect r;
frame->GetRect(r);
nsRect r = frame->GetRect();
aRenderingContext.SetColor(NS_RGB(0,0,255));
aRenderingContext.DrawRect(0, 0, r.width, r.height);
}
@ -6100,8 +6060,8 @@ PresShell::HandleEvent(nsIView *aView,
// Check for a system color change up front, since the frame type is
// irrelevant
if ((aEvent->message == NS_SYSCOLORCHANGED) && mPresContext) {
nsCOMPtr<nsIViewManager> vm;
if ((NS_SUCCEEDED(GetViewManager(getter_AddRefs(vm)))) && vm) {
nsIViewManager* vm = GetViewManager();
if (vm) {
// Only dispatch system color change when the message originates from
// from the root views widget. This is necessary to prevent us from
// dispatching the SysColorChanged notification for each child window
@ -6117,9 +6077,7 @@ PresShell::HandleEvent(nsIView *aView,
return NS_OK;
}
void* clientData;
aView->GetClientData(clientData);
nsIFrame* frame = (nsIFrame *)clientData;
nsIFrame* frame = NS_STATIC_CAST(nsIFrame*, aView->GetClientData());
nsresult rv = NS_OK;
@ -6195,8 +6153,7 @@ PresShell::HandleEvent(nsIView *aView,
// GetFrameForPoint() work. The assumption here is that frame->GetView()
// will return aView, and frame's parent view is aView's parent.
nsPoint eventPoint;
frame->GetOrigin(eventPoint);
nsPoint eventPoint = frame->GetPosition();
eventPoint += aEvent->point;
nsPoint originOffset;
@ -6281,8 +6238,8 @@ PresShell::HandleEvent(nsIView *aView,
nsIView *oldView = mCurrentTargetView;
nsPoint offset(0,0);
nsRect oldTargetRect(mCurrentTargetRect);
mCurrentEventFrame->GetRect(mCurrentTargetRect);
mCurrentTargetView = mCurrentEventFrame->GetView(mPresContext);
mCurrentTargetRect = mCurrentEventFrame->GetRect();
mCurrentTargetView = mCurrentEventFrame->GetView();
if (!mCurrentTargetView ) {
mCurrentEventFrame->GetOffsetFromView(mPresContext, offset,
&mCurrentTargetView);
@ -6294,8 +6251,8 @@ PresShell::HandleEvent(nsIView *aView,
if ((mCurrentTargetRect != oldTargetRect) ||
(mCurrentTargetView != oldView)) {
nsCOMPtr<nsIViewManager> vm;
if ((NS_SUCCEEDED(GetViewManager(getter_AddRefs(vm)))) && vm) {
nsIViewManager* vm = GetViewManager();
if (vm) {
vm->UpdateView(mCurrentTargetView,mCurrentTargetRect,0);
if (oldView)
vm->UpdateView(oldView,oldTargetRect,0);
@ -6481,10 +6438,9 @@ struct ReflowEvent : public PLEvent {
ps->ClearReflowEventStatus();
ps->GetReflowBatchingStatus(&isBatching);
if (!isBatching) {
nsCOMPtr<nsIViewManager> viewManager;
// Set a kung fu death grip on the view manager associated with the pres shell
// before processing that pres shell's reflow commands. Fixes bug 54868.
presShell->GetViewManager(getter_AddRefs(viewManager));
nsCOMPtr<nsIViewManager> viewManager = presShell->GetViewManager();
ps->ProcessReflowCommands(PR_TRUE);
// Now, explicitly release the pres shell before the view manager
@ -6580,8 +6536,7 @@ PresShell::ProcessReflowCommands(PRBool aInterruptible)
nsIRenderingContext* rcx;
nsIFrame* rootFrame;
mFrameManager->GetRootFrame(&rootFrame);
nsSize maxSize;
rootFrame->GetSize(maxSize);
nsSize maxSize = rootFrame->GetSize();
nsresult rv=CreateRenderingContext(rootFrame, &rcx);
if (NS_FAILED(rv)) return rv;
@ -7006,8 +6961,6 @@ CompareTrees(nsIPresContext* aFirstPresContext, nsIFrame* aFirstFrame,
nsRect r1, r2;
nsIView* v1, *v2;
nsCOMPtr<nsIWidget> w1;
nsCOMPtr<nsIWidget> w2;
for (;;) {
if (((nsnull == k1) && (nsnull != k2)) ||
((nsnull != k1) && (nsnull == k2))) {
@ -7017,33 +6970,29 @@ CompareTrees(nsIPresContext* aFirstPresContext, nsIFrame* aFirstFrame,
}
else if (nsnull != k1) {
// Verify that the frames are the same size
k1->GetRect(r1);
k2->GetRect(r2);
if (r1 != r2) {
if (k1->GetRect() != k2->GetRect()) {
ok = PR_FALSE;
LogVerifyMessage(k1, k2, "(frame rects)", r1, r2);
LogVerifyMessage(k1, k2, "(frame rects)", k1->GetRect(), k2->GetRect());
}
// Make sure either both have views or neither have views; if they
// do have views, make sure the views are the same size. If the
// views have widgets, make sure they both do or neither does. If
// they do, make sure the widgets are the same size.
v1 = k1->GetView(aFirstPresContext);
v2 = k2->GetView(aSecondPresContext);
v1 = k1->GetView();
v2 = k2->GetView();
if (((nsnull == v1) && (nsnull != v2)) ||
((nsnull != v1) && (nsnull == v2))) {
ok = PR_FALSE;
LogVerifyMessage(k1, k2, "child views are not matched\n");
}
else if (nsnull != v1) {
v1->GetBounds(r1);
v2->GetBounds(r2);
if (r1 != r2) {
LogVerifyMessage(k1, k2, "(view rects)", r1, r2);
if (v1->GetBounds() != v2->GetBounds()) {
LogVerifyMessage(k1, k2, "(view rects)", v1->GetBounds(), v2->GetBounds());
}
v1->GetWidget(*getter_AddRefs(w1));
v2->GetWidget(*getter_AddRefs(w2));
nsIWidget* w1 = v1->GetWidget();
nsIWidget* w2 = v2->GetWidget();
if (((nsnull == w1) && (nsnull != w2)) ||
((nsnull != w1) && (nsnull == w2))) {
ok = PR_FALSE;
@ -7179,8 +7128,8 @@ CompareTrees(nsIPresContext* aFirstPresContext, nsIFrame* aFirstFrame,
}
// Advance to next sibling
k1->GetNextSibling(&k1);
k2->GetNextSibling(&k2);
k1 = k1->GetNextSibling();
k2 = k2->GetNextSibling();
}
else {
break;
@ -7232,18 +7181,15 @@ CompareTrees(nsIPresContext* aFirstPresContext, nsIFrame* aFirstFrame,
static nsIFrame*
FindTopFrame(nsIFrame* aRoot)
{
if (nsnull != aRoot) {
nsIContent* content;
aRoot->GetContent(&content);
if (nsnull != content) {
if (aRoot) {
nsIContent* content = aRoot->GetContent();
if (content) {
nsIAtom* tag;
content->GetTag(tag);
if (nsnull != tag) {
NS_RELEASE(tag);
NS_RELEASE(content);
return aRoot;
}
NS_RELEASE(content);
}
// Try one of the children
@ -7254,7 +7200,7 @@ FindTopFrame(nsIFrame* aRoot)
if (nsnull != result) {
return result;
}
kid->GetNextSibling(&kid);
kid = kid->GetNextSibling();
}
}
return nsnull;
@ -7318,9 +7264,7 @@ PresShell::VerifyIncrementalReflow()
if (NS_SUCCEEDED (rv)) {
scrollView->GetScrollPreference(scrolling);
}
nsCOMPtr<nsIWidget> rootWidget;
rootView->GetWidget(*getter_AddRefs(rootWidget));
void* nativeParentWidget = rootWidget->GetNativeData(NS_NATIVE_WIDGET);
void* nativeParentWidget = rootView->GetWidget()->GetNativeData(NS_NATIVE_WIDGET);
// Create a new view manager.
rv = nsComponentManager::CreateInstance(kViewManagerCID, nsnull,
@ -7836,9 +7780,6 @@ void ReflowCountMgr::PaintCount(const char * aName,
fm->GetHeight(height);
fm->GetMaxAscent(y);
nsRect r;
aFrame->GetRect(r);
PRUint32 color;
PRUint32 color2;
if (aColor != 0) {
@ -7977,7 +7918,7 @@ static void RecurseIndiTotals(nsIPresContext* aPresContext,
aParentFrame->FirstChild(aPresContext, nsnull, &child);
while (child) {
RecurseIndiTotals(aPresContext, aHT, child, aLevel+1);
child->GetNextSibling(&child);
child = child->GetNextSibling();
}
}

View File

@ -61,15 +61,12 @@ nsScrollPortFrame::NeedsClipWidget()
{
// XXX: This code will go away when a general solution for creating
// widgets only when needed is implemented.
nsIFrame* parentFrame;
GetParent(&parentFrame);
nsIFormControlFrame* fcFrame;
while (parentFrame) {
for (nsIFrame* parentFrame = GetParent(); parentFrame;
parentFrame = parentFrame->GetParent()) {
nsIFormControlFrame* fcFrame;
if ((NS_SUCCEEDED(parentFrame->QueryInterface(NS_GET_IID(nsIFormControlFrame), (void**)&fcFrame)))) {
return(PR_FALSE);
return PR_FALSE;
}
parentFrame->GetParent(&parentFrame);
}
return PR_TRUE;

View File

@ -94,14 +94,11 @@ nsSelectsAreaFrame::IsOptionElement(nsIContent* aContent)
PRBool
nsSelectsAreaFrame::IsOptionElementFrame(nsIFrame *aFrame)
{
nsIContent *content = nsnull;
aFrame->GetContent(&content);
PRBool result = PR_FALSE;
if (nsnull != content) {
result = IsOptionElement(content);
NS_RELEASE(content);
nsIContent *content = aFrame->GetContent();
if (content) {
return IsOptionElement(content);
}
return(result);
return PR_FALSE;
}
//---------------------------------------------------------
@ -122,10 +119,10 @@ nsSelectsAreaFrame::GetFrameForPoint(nsIPresContext* aPresContext,
if (result == NS_OK) {
nsIFrame* selectedFrame = *aFrame;
while ((nsnull != selectedFrame) && (PR_FALSE == IsOptionElementFrame(selectedFrame))) {
selectedFrame->GetParent(&selectedFrame);
while (selectedFrame && !IsOptionElementFrame(selectedFrame)) {
selectedFrame = selectedFrame->GetParent();
}
if (nsnull != selectedFrame) {
if (selectedFrame) {
*aFrame = selectedFrame;
}
// else, keep the original result as *aFrame, which could be this frame
@ -141,11 +138,11 @@ nsSelectsAreaFrame::Paint(nsIPresContext* aPresContext,
nsFramePaintLayer aWhichLayer,
PRUint32 aFlags)
{
nsresult rv = nsAreaFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer, aFlags);
nsAreaFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer, aFlags);
nsIFrame* frame = this;
while (frame) {
frame->GetParent(&frame);
frame = frame->GetParent();
nsCOMPtr<nsIAtom> type;
frame->GetFrameType(getter_AddRefs(type));
if (type == nsLayoutAtoms::listControlFrame) {