1998-04-14 00:24:54 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.0 (the "NPL"); you may not use this file except in
|
|
|
|
* compliance with the NPL. You may obtain a copy of the NPL at
|
|
|
|
* http://www.mozilla.org/NPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* NPL.
|
|
|
|
*
|
|
|
|
* The Initial Developer of this code under the NPL is Netscape
|
|
|
|
* Communications Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
|
|
|
* Reserved.
|
|
|
|
*/
|
|
|
|
#include "nsHTMLContainerFrame.h"
|
|
|
|
#include "nsIRenderingContext.h"
|
|
|
|
#include "nsIPresContext.h"
|
1998-05-03 07:51:48 +04:00
|
|
|
#include "nsIPresShell.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
#include "nsIStyleContext.h"
|
|
|
|
#include "nsStyleConsts.h"
|
|
|
|
#include "nsCSSRendering.h"
|
|
|
|
#include "nsIContent.h"
|
|
|
|
#include "nsHTMLAtoms.h"
|
|
|
|
#include "nsIWidget.h"
|
|
|
|
#include "nsILinkHandler.h"
|
|
|
|
#include "nsHTMLValue.h"
|
|
|
|
#include "nsGUIEvent.h"
|
|
|
|
#include "nsIDocument.h"
|
|
|
|
#include "nsIURL.h"
|
1998-05-05 08:47:53 +04:00
|
|
|
#include "nsIPtr.h"
|
|
|
|
#include "nsPlaceholderFrame.h"
|
1998-05-29 06:13:25 +04:00
|
|
|
#include "nsIHTMLContent.h"
|
|
|
|
#include "nsHTMLParts.h"
|
1998-06-04 21:50:19 +04:00
|
|
|
#include "nsIView.h"
|
1998-09-23 06:29:31 +04:00
|
|
|
#include "nsIViewManager.h"
|
|
|
|
#include "nsViewsCID.h"
|
1998-06-09 08:51:44 +04:00
|
|
|
#include "nsIReflowCommand.h"
|
1998-10-07 01:01:41 +04:00
|
|
|
#include "nsHTMLIIDs.h"
|
|
|
|
#include "nsDOMEvent.h"
|
1998-12-18 08:25:36 +03:00
|
|
|
#include "nsIScrollableView.h"
|
1999-01-28 20:14:13 +03:00
|
|
|
#include "nsWidgetsCID.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-12-18 08:25:36 +03:00
|
|
|
static NS_DEFINE_IID(kScrollViewIID, NS_ISCROLLABLEVIEW_IID);
|
1999-01-28 20:14:13 +03:00
|
|
|
static NS_DEFINE_IID(kCChildCID, NS_CHILD_CID);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-10-07 01:01:41 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHTMLContainerFrame::Paint(nsIPresContext& aPresContext,
|
|
|
|
nsIRenderingContext& aRenderingContext,
|
1998-12-18 18:54:23 +03:00
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsFramePaintLayer aWhichLayer)
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
1998-12-18 18:54:23 +03:00
|
|
|
if (eFramePaintLayer_Underlay == aWhichLayer) {
|
|
|
|
const nsStyleDisplay* disp = (const nsStyleDisplay*)
|
|
|
|
mStyleContext->GetStyleData(eStyleStruct_Display);
|
|
|
|
if (disp->mVisible && mRect.width && mRect.height) {
|
|
|
|
// Paint our background and border
|
|
|
|
PRIntn skipSides = GetSkipSides();
|
|
|
|
const nsStyleColor* color = (const nsStyleColor*)
|
|
|
|
mStyleContext->GetStyleData(eStyleStruct_Color);
|
|
|
|
const nsStyleSpacing* spacing = (const nsStyleSpacing*)
|
|
|
|
mStyleContext->GetStyleData(eStyleStruct_Spacing);
|
1998-10-07 01:01:41 +04:00
|
|
|
|
1998-12-18 18:54:23 +03:00
|
|
|
nsRect rect(0, 0, mRect.width, mRect.height);
|
|
|
|
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
1999-01-15 21:25:58 +03:00
|
|
|
aDirtyRect, rect, *color, *spacing, 0, 0);
|
1998-12-18 18:54:23 +03:00
|
|
|
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
1999-01-23 01:25:58 +03:00
|
|
|
aDirtyRect, rect, *spacing, mStyleContext, skipSides);
|
1998-10-07 01:01:41 +04:00
|
|
|
}
|
1998-04-14 00:24:54 +04:00
|
|
|
}
|
1998-11-19 06:52:29 +03:00
|
|
|
|
|
|
|
// Now paint the kids. Note that child elements have the opportunity to
|
|
|
|
// override the visibility property and display even if their parent is
|
|
|
|
// hidden
|
1998-12-18 18:54:23 +03:00
|
|
|
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
|
1998-04-17 05:41:24 +04:00
|
|
|
return NS_OK;
|
1998-04-14 00:24:54 +04:00
|
|
|
}
|
|
|
|
|
1998-09-15 04:19:49 +04:00
|
|
|
nsPlaceholderFrame*
|
1998-09-23 06:29:31 +04:00
|
|
|
nsHTMLContainerFrame::CreatePlaceholderFrame(nsIPresContext& aPresContext,
|
1998-09-15 04:19:49 +04:00
|
|
|
nsIFrame* aFloatedFrame)
|
|
|
|
{
|
|
|
|
nsIContent* content;
|
1999-02-10 03:42:56 +03:00
|
|
|
aFloatedFrame->GetContent(&content);
|
1998-09-15 04:19:49 +04:00
|
|
|
|
1999-01-02 23:51:43 +03:00
|
|
|
nsPlaceholderFrame* placeholder;
|
|
|
|
NS_NewPlaceholderFrame((nsIFrame**)&placeholder);
|
|
|
|
|
|
|
|
// The placeholder frame gets a pseudo style context
|
1998-09-15 04:19:49 +04:00
|
|
|
nsIStyleContext* kidSC;
|
1999-02-10 03:42:56 +03:00
|
|
|
aFloatedFrame->GetStyleContext(&kidSC);
|
1999-01-02 23:51:43 +03:00
|
|
|
nsIStyleContext* placeholderPseudoStyle =
|
|
|
|
aPresContext.ResolvePseudoStyleContextFor(content,
|
|
|
|
nsHTMLAtoms::placeholderPseudo, kidSC);
|
|
|
|
NS_RELEASE(kidSC);
|
1999-01-14 08:16:23 +03:00
|
|
|
placeholder->Init(aPresContext, content, this, placeholderPseudoStyle);
|
1999-01-02 23:51:43 +03:00
|
|
|
NS_RELEASE(placeholderPseudoStyle);
|
|
|
|
NS_IF_RELEASE(content);
|
1998-12-03 09:31:43 +03:00
|
|
|
|
|
|
|
placeholder->SetAnchoredItem(aFloatedFrame);
|
1998-09-15 04:19:49 +04:00
|
|
|
return placeholder;
|
|
|
|
}
|
1998-09-23 06:29:31 +04:00
|
|
|
|
1998-10-15 00:10:36 +04:00
|
|
|
// XXX pass in aFrame's style context instead
|
1998-09-29 03:24:37 +04:00
|
|
|
PRBool
|
|
|
|
nsHTMLContainerFrame::MoveFrameOutOfFlow(nsIPresContext& aPresContext,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
const nsStyleDisplay* aDisplay,
|
|
|
|
const nsStylePosition* aPosition,
|
|
|
|
nsIFrame*& aPlaceholderFrame)
|
|
|
|
{
|
1998-09-29 08:47:59 +04:00
|
|
|
// Initialize OUT parameter
|
1998-09-29 03:24:37 +04:00
|
|
|
aPlaceholderFrame = nsnull;
|
|
|
|
|
1999-01-02 23:51:43 +03:00
|
|
|
// See if the element wants to be floated
|
|
|
|
PRBool isFloated = (NS_STYLE_FLOAT_LEFT == aDisplay->mFloats) ||
|
|
|
|
(NS_STYLE_FLOAT_RIGHT == aDisplay->mFloats);
|
1998-09-29 03:24:37 +04:00
|
|
|
|
1998-12-29 06:38:16 +03:00
|
|
|
if (isFloated) {
|
1998-09-29 08:47:59 +04:00
|
|
|
nsIFrame* nextSibling;
|
1998-09-29 03:24:37 +04:00
|
|
|
|
1998-09-29 08:47:59 +04:00
|
|
|
// Set aFrame's next sibling to nsnull, and remember the current next
|
|
|
|
// sibling pointer
|
1998-09-29 06:18:09 +04:00
|
|
|
aFrame->GetNextSibling(nextSibling);
|
|
|
|
aFrame->SetNextSibling(nsnull);
|
|
|
|
|
1998-12-29 06:38:16 +03:00
|
|
|
// Create a placeholder frame that will serve as the anchor point.
|
|
|
|
nsPlaceholderFrame* placeholder = CreatePlaceholderFrame(aPresContext, aFrame);
|
|
|
|
aPlaceholderFrame = placeholder;
|
1998-09-29 03:24:37 +04:00
|
|
|
|
1998-09-29 08:47:59 +04:00
|
|
|
// Set the placeholder's next sibling to what aFrame's next sibling was
|
1998-09-29 06:18:09 +04:00
|
|
|
aPlaceholderFrame->SetNextSibling(nextSibling);
|
|
|
|
return PR_TRUE;
|
|
|
|
}
|
1998-09-29 08:47:59 +04:00
|
|
|
|
|
|
|
return PR_FALSE;
|
1998-09-29 03:24:37 +04:00
|
|
|
}
|
|
|
|
|
1998-09-23 06:29:31 +04:00
|
|
|
/**
|
|
|
|
* Create a next-in-flow for aFrame. Will return the newly created
|
|
|
|
* frame in aNextInFlowResult <b>if and only if</b> a new frame is
|
|
|
|
* created; otherwise nsnull is returned in aNextInFlowResult.
|
|
|
|
*/
|
|
|
|
nsresult
|
|
|
|
nsHTMLContainerFrame::CreateNextInFlow(nsIPresContext& aPresContext,
|
|
|
|
nsIFrame* aOuterFrame,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
nsIFrame*& aNextInFlowResult)
|
|
|
|
{
|
|
|
|
aNextInFlowResult = nsnull;
|
|
|
|
|
|
|
|
nsIFrame* nextInFlow;
|
|
|
|
aFrame->GetNextInFlow(nextInFlow);
|
|
|
|
if (nsnull == nextInFlow) {
|
|
|
|
// Create a continuation frame for the child frame and insert it
|
|
|
|
// into our lines child list.
|
|
|
|
nsIFrame* nextFrame;
|
|
|
|
aFrame->GetNextSibling(nextFrame);
|
|
|
|
nsIStyleContext* kidSC;
|
1999-02-10 03:42:56 +03:00
|
|
|
aFrame->GetStyleContext(&kidSC);
|
1998-09-23 06:29:31 +04:00
|
|
|
aFrame->CreateContinuingFrame(aPresContext, aOuterFrame,
|
|
|
|
kidSC, nextInFlow);
|
|
|
|
NS_RELEASE(kidSC);
|
|
|
|
if (nsnull == nextInFlow) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
aFrame->SetNextSibling(nextInFlow);
|
|
|
|
nextInFlow->SetNextSibling(nextFrame);
|
|
|
|
|
|
|
|
NS_FRAME_LOG(NS_FRAME_TRACE_NEW_FRAMES,
|
|
|
|
("nsInlineReflow::MaybeCreateNextInFlow: frame=%p nextInFlow=%p",
|
|
|
|
aFrame, nextInFlow));
|
|
|
|
|
|
|
|
aNextInFlowResult = nextInFlow;
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext& aPresContext,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
nsIStyleContext* aStyleContext,
|
|
|
|
PRBool aForce)
|
|
|
|
{
|
|
|
|
nsIView* view;
|
1999-02-10 08:38:18 +03:00
|
|
|
aFrame->GetView(&view);
|
1998-12-04 22:03:44 +03:00
|
|
|
// If we don't yet have a view, see if we need a view
|
1998-09-23 06:29:31 +04:00
|
|
|
if (nsnull == view) {
|
1998-12-04 22:03:44 +03:00
|
|
|
PRInt32 zIndex = 0;
|
1998-10-23 21:54:23 +04:00
|
|
|
|
1998-12-04 22:03:44 +03:00
|
|
|
// Get nsStyleColor and nsStyleDisplay
|
|
|
|
const nsStyleColor* color = (const nsStyleColor*)
|
1998-10-15 01:31:41 +04:00
|
|
|
aStyleContext->GetStyleData(eStyleStruct_Color);
|
1998-12-04 22:03:44 +03:00
|
|
|
const nsStyleDisplay* display = (const nsStyleDisplay*)
|
|
|
|
aStyleContext->GetStyleData(eStyleStruct_Display);
|
1998-09-23 06:29:31 +04:00
|
|
|
|
1998-12-04 22:03:44 +03:00
|
|
|
if (color->mOpacity != 1.0f) {
|
1998-10-23 21:54:23 +04:00
|
|
|
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
|
|
|
|
("nsHTMLContainerFrame::CreateViewForFrame: frame=%p opacity=%g",
|
1998-12-04 22:03:44 +03:00
|
|
|
aFrame, color->mOpacity));
|
1998-10-23 21:54:23 +04:00
|
|
|
aForce = PR_TRUE;
|
1998-09-23 06:29:31 +04:00
|
|
|
}
|
|
|
|
|
1998-12-04 22:03:44 +03:00
|
|
|
// See if the frame is being relatively positioned or absolutely
|
|
|
|
// positioned
|
1998-09-23 06:29:31 +04:00
|
|
|
if (!aForce) {
|
|
|
|
const nsStylePosition* position = (const nsStylePosition*)
|
|
|
|
aStyleContext->GetStyleData(eStyleStruct_Position);
|
1998-12-04 22:03:44 +03:00
|
|
|
|
1998-09-23 06:29:31 +04:00
|
|
|
if (NS_STYLE_POSITION_RELATIVE == position->mPosition) {
|
|
|
|
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
|
|
|
|
("nsHTMLContainerFrame::CreateViewForFrame: frame=%p relatively positioned",
|
|
|
|
aFrame));
|
|
|
|
aForce = PR_TRUE;
|
1998-12-04 22:03:44 +03:00
|
|
|
|
1999-01-28 20:14:13 +03:00
|
|
|
} else if (position->IsAbsolutelyPositioned()) {
|
1998-12-04 22:03:44 +03:00
|
|
|
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
|
|
|
|
("nsHTMLContainerFrame::CreateViewForFrame: frame=%p relatively positioned",
|
|
|
|
aFrame));
|
|
|
|
aForce = PR_TRUE;
|
|
|
|
|
|
|
|
// Get the z-index to use. This only applies to positioned elements
|
|
|
|
if (position->mZIndex.GetUnit() == eStyleUnit_Integer) {
|
|
|
|
zIndex = position->mZIndex.GetIntValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
// XXX CSS2 says clip applies to block-level and replaced elements with
|
|
|
|
// overflow set to other than 'visible'. Where should this go?
|
|
|
|
#if 0
|
|
|
|
// Is there a clip rect specified?
|
|
|
|
nsViewClip clip = {0, 0, 0, 0};
|
|
|
|
PRUint8 clipType = (display->mClipFlags & NS_STYLE_CLIP_TYPE_MASK);
|
|
|
|
nsViewClip* pClip = nsnull;
|
|
|
|
|
|
|
|
if (NS_STYLE_CLIP_RECT == clipType) {
|
|
|
|
if ((NS_STYLE_CLIP_LEFT_AUTO & display->mClipFlags) == 0) {
|
|
|
|
clip.mLeft = display->mClip.left;
|
|
|
|
}
|
|
|
|
if ((NS_STYLE_CLIP_RIGHT_AUTO & display->mClipFlags) == 0) {
|
|
|
|
clip.mRight = display->mClip.right;
|
|
|
|
}
|
|
|
|
if ((NS_STYLE_CLIP_TOP_AUTO & display->mClipFlags) == 0) {
|
|
|
|
clip.mTop = display->mClip.top;
|
|
|
|
}
|
|
|
|
if ((NS_STYLE_CLIP_BOTTOM_AUTO & display->mClipFlags) == 0) {
|
|
|
|
clip.mBottom = display->mClip.bottom;
|
|
|
|
}
|
|
|
|
pClip = &clip;
|
|
|
|
}
|
|
|
|
else if (NS_STYLE_CLIP_INHERIT == clipType) {
|
|
|
|
// XXX need to handle clip inherit (get from parent style context)
|
|
|
|
NS_NOTYETIMPLEMENTED("clip inherit");
|
|
|
|
}
|
|
|
|
#endif
|
1998-09-23 06:29:31 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-12-04 08:56:06 +03:00
|
|
|
// See if the frame is a scrolled frame
|
|
|
|
if (!aForce) {
|
|
|
|
nsIAtom* pseudoTag;
|
|
|
|
aStyleContext->GetPseudoType(pseudoTag);
|
|
|
|
if (pseudoTag == nsHTMLAtoms::scrolledContentPseudo) {
|
1998-12-04 22:03:44 +03:00
|
|
|
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
|
|
|
|
("nsHTMLContainerFrame::CreateViewForFrame: scrolled frame=%p", aFrame));
|
1998-12-04 08:56:06 +03:00
|
|
|
aForce = PR_TRUE;
|
|
|
|
}
|
|
|
|
NS_IF_RELEASE(pseudoTag);
|
|
|
|
}
|
|
|
|
|
1998-09-23 06:29:31 +04:00
|
|
|
if (aForce) {
|
|
|
|
// Create a view
|
|
|
|
nsIFrame* parent;
|
|
|
|
nsIView* view;
|
|
|
|
|
1999-02-10 08:38:18 +03:00
|
|
|
aFrame->GetParentWithView(&parent);
|
1998-09-23 06:29:31 +04:00
|
|
|
NS_ASSERTION(parent, "GetParentWithView failed");
|
1998-12-18 08:25:36 +03:00
|
|
|
nsIView* parentView;
|
1998-09-23 06:29:31 +04:00
|
|
|
|
1999-02-10 08:38:18 +03:00
|
|
|
parent->GetView(&parentView);
|
1998-12-18 08:25:36 +03:00
|
|
|
NS_ASSERTION(parentView, "no parent with view");
|
1998-09-23 06:29:31 +04:00
|
|
|
|
|
|
|
// Create a view
|
|
|
|
static NS_DEFINE_IID(kViewCID, NS_VIEW_CID);
|
|
|
|
static NS_DEFINE_IID(kIViewIID, NS_IVIEW_IID);
|
|
|
|
|
|
|
|
nsresult result = nsRepository::CreateInstance(kViewCID,
|
|
|
|
nsnull,
|
|
|
|
kIViewIID,
|
|
|
|
(void **)&view);
|
|
|
|
if (NS_OK == result) {
|
|
|
|
nsIViewManager* viewManager;
|
1998-12-18 08:25:36 +03:00
|
|
|
parentView->GetViewManager(viewManager);
|
1998-09-23 06:29:31 +04:00
|
|
|
NS_ASSERTION(nsnull != viewManager, "null view manager");
|
|
|
|
|
1998-12-18 08:25:36 +03:00
|
|
|
// Initialize the view
|
1998-09-23 06:29:31 +04:00
|
|
|
nsRect bounds;
|
|
|
|
aFrame->GetRect(bounds);
|
1998-12-18 08:25:36 +03:00
|
|
|
view->Init(viewManager, bounds, parentView);
|
|
|
|
|
|
|
|
// Insert the view into the view hierarchy. If the parent view is a
|
|
|
|
// scrolling view we need to do this differently
|
|
|
|
nsIScrollableView* scrollingView;
|
|
|
|
if (NS_SUCCEEDED(parentView->QueryInterface(kScrollViewIID, (void**)&scrollingView))) {
|
|
|
|
scrollingView->SetScrolledView(view);
|
|
|
|
} else {
|
|
|
|
viewManager->InsertChild(parentView, view, zIndex);
|
|
|
|
}
|
|
|
|
|
1998-12-04 22:03:44 +03:00
|
|
|
// If the background color is transparent or the visibility is hidden
|
|
|
|
// then mark the view as having transparent content.
|
1998-10-15 01:31:41 +04:00
|
|
|
// XXX We could try and be smarter about this and check whether there's
|
|
|
|
// a background image. If there is a background image and the image is
|
|
|
|
// fully opaque then we don't need to mark the view as having transparent
|
|
|
|
// content...
|
1998-12-04 22:03:44 +03:00
|
|
|
if ((NS_STYLE_BG_COLOR_TRANSPARENT & color->mBackgroundFlags) ||
|
|
|
|
!display->mVisible) {
|
1998-10-15 01:31:41 +04:00
|
|
|
viewManager->SetViewContentTransparency(view, PR_TRUE);
|
|
|
|
}
|
1999-01-23 08:47:55 +03:00
|
|
|
// XXX If it's relatively positioned or absolutely positioned then we
|
|
|
|
// need to mark it as having transparent content, too. See bug #2502
|
|
|
|
const nsStylePosition* position = (const nsStylePosition*)
|
|
|
|
aStyleContext->GetStyleData(eStyleStruct_Position);
|
|
|
|
|
|
|
|
if ((NS_STYLE_POSITION_RELATIVE == position->mPosition) ||
|
|
|
|
(NS_STYLE_POSITION_ABSOLUTE == position->mPosition)) {
|
|
|
|
viewManager->SetViewContentTransparency(view, PR_TRUE);
|
|
|
|
}
|
|
|
|
|
1999-01-28 20:14:13 +03:00
|
|
|
// XXX If it's fixed positioned, then create a widget so it floats
|
|
|
|
// above the scrolling area
|
|
|
|
if (NS_STYLE_POSITION_FIXED == position->mPosition) {
|
|
|
|
view->CreateWidget(kCChildCID);
|
|
|
|
}
|
|
|
|
|
1998-12-04 22:03:44 +03:00
|
|
|
viewManager->SetViewOpacity(view, color->mOpacity);
|
1998-09-23 06:29:31 +04:00
|
|
|
NS_RELEASE(viewManager);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Remember our view
|
|
|
|
aFrame->SetView(view);
|
|
|
|
|
|
|
|
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
|
|
|
|
("nsHTMLContainerFrame::CreateViewForFrame: frame=%p view=%p",
|
|
|
|
aFrame));
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
1998-09-25 04:00:22 +04:00
|
|
|
|
1998-11-05 22:31:39 +03:00
|
|
|
void
|
|
|
|
nsHTMLContainerFrame::UpdateStyleContexts(nsIPresContext& aPresContext,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
nsIFrame* aOldParent,
|
|
|
|
nsIFrame* aNewParent)
|
|
|
|
{
|
|
|
|
nsIStyleContext* oldParentSC;
|
1999-02-10 03:42:56 +03:00
|
|
|
aOldParent->GetStyleContext(&oldParentSC);
|
1998-11-05 22:31:39 +03:00
|
|
|
nsIStyleContext* newParentSC;
|
1999-02-10 03:42:56 +03:00
|
|
|
aNewParent->GetStyleContext(&newParentSC);
|
1998-11-05 22:31:39 +03:00
|
|
|
if (oldParentSC != newParentSC) {
|
|
|
|
aFrame->ReResolveStyleContext(&aPresContext, newParentSC);
|
|
|
|
}
|
|
|
|
NS_RELEASE(oldParentSC);
|
|
|
|
NS_RELEASE(newParentSC);
|
|
|
|
}
|