moved attribute change code to style sheete

cleaned up content change api


git-svn-id: svn://10.0.0.236/trunk@11490 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
peterl%netscape.com 1998-09-29 23:48:07 +00:00
parent cae2faa839
commit 9b94d90eca
21 changed files with 82 additions and 480 deletions

View File

@ -412,141 +412,4 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext& aPresContext,
return NS_OK;
}
NS_IMETHODIMP
nsHTMLContainerFrame::AttributeChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute)
{
if (nsHTMLAtoms::style == aAttribute) {
ApplyStyleChangeToTree(*aPresContext, this);
StyleChangeReflow(*aPresContext, this);
}
return NS_OK;
}
static void
RemapStyleInTree(nsIPresContext* aPresContext,
nsIFrame* aFrame)
{
nsIStyleContext* sc;
aFrame->GetStyleContext(nsnull, sc);
if (nsnull != sc) {
sc->RemapStyle(aPresContext);
// Update the children too...
nsIFrame* kid;
aFrame->FirstChild(kid);
while (nsnull != kid) {
RemapStyleInTree(aPresContext, kid);
kid->GetNextSibling(kid);
}
}
}
void
nsHTMLContainerFrame::ApplyStyleChangeToTree(nsIPresContext& aPresContext,
nsIFrame* aFrame)
{
nsIContent* content;
nsIFrame* geometricParent;
aFrame->GetGeometricParent(geometricParent);
aFrame->GetContent(content);
if (nsnull != content) {
PRBool onlyRemap = PR_FALSE;
nsIStyleContext* oldSC;
aFrame->GetStyleContext(nsnull, oldSC);
nsIStyleContext* newSC =
aPresContext.ResolveStyleContextFor(content, geometricParent);
if (newSC == oldSC) {
// Force cached style data to be recomputed
newSC->RemapStyle(&aPresContext);
onlyRemap = PR_TRUE;
}
else {
// Switch to new style context
aFrame->SetStyleContext(&aPresContext, newSC);
}
NS_IF_RELEASE(oldSC);
NS_RELEASE(newSC);
NS_RELEASE(content);
// Update the children too...
nsIFrame* kid;
aFrame->FirstChild(kid);
if (onlyRemap) {
while (nsnull != kid) {
RemapStyleInTree(&aPresContext, kid);
kid->GetNextSibling(kid);
}
}
else {
while (nsnull != kid) {
ApplyStyleChangeToTree(aPresContext, kid);
kid->GetNextSibling(kid);
}
}
}
}
void
nsHTMLContainerFrame::ApplyRenderingChangeToTree(nsIPresContext& aPresContext,
nsIFrame* aFrame)
{
nsIViewManager* viewManager = nsnull;
// Trigger rendering updates by damaging this frame and any
// continuations of this frame.
while (nsnull != aFrame) {
// Get the frame's bounding rect
nsRect r;
aFrame->GetRect(r);
r.x = 0;
r.y = 0;
// Get view if this frame has one and trigger an update. If the
// frame doesn't have a view, find the nearest containing view
// (adjusting r's coordinate system to reflect the nesting) and
// update there.
nsIView* view;
aFrame->GetView(view);
if (nsnull != view) {
} else {
nsPoint offset;
aFrame->GetOffsetFromView(offset, view);
NS_ASSERTION(nsnull != view, "no view");
r += offset;
}
if (nsnull == viewManager) {
view->GetViewManager(viewManager);
}
viewManager->UpdateView(view, r, NS_VMREFRESH_NO_SYNC);
aFrame->GetNextInFlow(aFrame);
}
if (nsnull != viewManager) {
viewManager->Composite();
NS_RELEASE(viewManager);
}
}
void
nsHTMLContainerFrame::StyleChangeReflow(nsIPresContext& aPresContext,
nsIFrame* aFrame)
{
nsIPresShell* shell;
shell = aPresContext.GetShell();
nsIReflowCommand* reflowCmd;
nsresult rv = NS_NewHTMLReflowCommand(&reflowCmd, aFrame,
nsIReflowCommand::StyleChanged);
if (NS_SUCCEEDED(rv)) {
shell->AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
NS_RELEASE(shell);
}

View File

@ -44,11 +44,6 @@ public:
nsIContent** aContent,
PRInt32& aCursor);
NS_IMETHOD AttributeChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute);
nsPlaceholderFrame* CreatePlaceholderFrame(nsIPresContext& aPresContext,
nsIFrame* aFloatedFrame);
nsAbsoluteFrame* CreateAbsolutePlaceholderFrame(nsIPresContext& aPresContext,
@ -81,14 +76,6 @@ public:
nsIStyleContext* aStyleContext,
PRBool aForce);
// Helper methods for handling attribute changes
static void ApplyStyleChangeToTree(nsIPresContext& aPresContext,
nsIFrame* aFrame);
static void ApplyRenderingChangeToTree(nsIPresContext& aPresContext,
nsIFrame* aFrame);
static void StyleChangeReflow(nsIPresContext& aPresContext,
nsIFrame* aFrame);
protected:
virtual ~nsHTMLContainerFrame();

View File

@ -71,10 +71,10 @@ public:
nsIFrame** aFrame,
nsIContent** aContent,
PRInt32& aCursor);
NS_IMETHOD AttributeChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute);
nsIAtom* aAttribute,
PRInt32 aHint);
protected:
virtual ~ImageFrame();
@ -894,22 +894,17 @@ ImageFrame::GetCursorAndContentAt(nsIPresContext& aPresContext,
}
NS_IMETHODIMP
ImageFrame::AttributeChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
ImageFrame::AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute)
nsIAtom* aAttribute,
PRInt32 aHint)
{
nsresult rv = nsLeafFrame::AttributeChanged(aShell, aPresContext, aChild,
aAttribute);
nsresult rv = nsLeafFrame::AttributeChanged(aPresContext, aChild,
aAttribute, aHint);
if (NS_OK != rv) {
return rv;
}
if ((nsHTMLAtoms::width == aAttribute) ||
(nsHTMLAtoms::height == aAttribute)) {
nsHTMLContainerFrame::ApplyStyleChangeToTree(*aPresContext, this);
nsHTMLContainerFrame::StyleChangeReflow(*aPresContext, this);
}
else if (nsHTMLAtoms::src == aAttribute) {
if (nsHTMLAtoms::src == aAttribute) {
nsAutoString oldSRC;
mImageLoader.GetURL(oldSRC);
nsAutoString newSRC;

View File

@ -69,10 +69,6 @@ public:
nsIFrame* aParent,
nsIStyleContext* aStyleContext,
nsIFrame*& aContinuingFrame);
NS_IMETHOD AttributeChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute);
// nsIInlineReflow
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
@ -245,29 +241,6 @@ nsInlineFrame::CreateContinuingFrame(nsIPresContext& aCX,
return NS_OK;
}
NS_IMETHODIMP
nsInlineFrame::AttributeChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute)
{
nsresult result = nsHTMLContainerFrame::AttributeChanged(aShell,
aPresContext,
aChild,
aAttribute);
if (NS_OK != result) {
return result;
}
if (nsHTMLAtoms::color == aAttribute) {
ApplyStyleChangeToTree(*aPresContext, this);
ApplyRenderingChangeToTree(*aPresContext, this);
}
else if (nsHTMLAtoms::face == aAttribute) {
ApplyStyleChangeToTree(*aPresContext, this);
StyleChangeReflow(*aPresContext, this);
}
return NS_OK;
}
NS_IMETHODIMP
nsInlineFrame::FindTextRuns(nsLineLayout& aLineLayout,

View File

@ -21,6 +21,7 @@
#include "nsHTMLParts.h"
#include "nsHTMLAtoms.h"
#include "nsIPresShell.h"
#include "nsIPresContext.h"
#include "nsIStyleContext.h"
nsLeafFrame::nsLeafFrame(nsIContent* aContent, nsIFrame* aParentFrame)
@ -105,8 +106,7 @@ void nsLeafFrame::GetInnerArea(nsIPresContext* aPresContext,
(borderPadding.top + borderPadding.bottom);
}
NS_METHOD nsLeafFrame::ContentChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
NS_METHOD nsLeafFrame::ContentChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsISupports* aSubContent)
{
@ -116,22 +116,12 @@ NS_METHOD nsLeafFrame::ContentChanged(nsIPresShell* aShell,
result = NS_NewHTMLReflowCommand(&cmd, this, nsIReflowCommand::ContentChanged);
if (NS_OK == result) {
aShell->AppendReflowCommand(cmd);
nsIPresShell* shell = aPresContext->GetShell();
shell->AppendReflowCommand(cmd);
NS_RELEASE(shell);
NS_RELEASE(cmd);
}
return result;
}
NS_IMETHODIMP
nsLeafFrame::AttributeChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute)
{
if (nsHTMLAtoms::style == aAttribute) {
nsHTMLContainerFrame::ApplyStyleChangeToTree(*aPresContext, this);
nsHTMLContainerFrame::StyleChangeReflow(*aPresContext, this);
}
return NS_OK;
}

View File

@ -37,14 +37,9 @@ public:
nsReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
NS_IMETHOD ContentChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsISupports* aSubContent);
NS_IMETHOD AttributeChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute);
protected:
nsLeafFrame(nsIContent* aContent, nsIFrame* aParentFrame);

View File

@ -139,8 +139,7 @@ nsPlaceholderFrame::Paint(nsIPresContext& aPresContext,
return NS_OK;
}
NS_IMETHODIMP nsPlaceholderFrame::ContentChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
NS_IMETHODIMP nsPlaceholderFrame::ContentChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsISupports* aSubContent)
{
@ -148,21 +147,21 @@ NS_IMETHODIMP nsPlaceholderFrame::ContentChanged(nsIPresShell* aShell,
// Forward the notification to the floater
if (nsnull != mAnchoredItem) {
return mAnchoredItem->ContentChanged(aShell, aPresContext, aChild, aSubContent);
return mAnchoredItem->ContentChanged(aPresContext, aChild, aSubContent);
}
return NS_OK;
}
NS_IMETHODIMP
nsPlaceholderFrame::AttributeChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
nsPlaceholderFrame::AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute)
nsIAtom* aAttribute,
PRInt32 aHint)
{
// Forward the notification to the floater
if (nsnull != mAnchoredItem) {
return mAnchoredItem->AttributeChanged(aShell, aPresContext, aChild, aAttribute);
return mAnchoredItem->AttributeChanged(aPresContext, aChild, aAttribute, aHint);
}
return NS_OK;

View File

@ -50,15 +50,14 @@ public:
nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect);
NS_IMETHOD ContentChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsISupports* aSubContent);
NS_IMETHOD AttributeChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute);
nsIAtom* aAttribute,
PRInt32 aHint);
NS_IMETHOD ListTag(FILE* out = stdout) const;

View File

@ -133,8 +133,7 @@ public:
nsIContent** aContent,
PRInt32& aCursor);
NS_IMETHOD ContentChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsISupports* aSubContent);
@ -408,8 +407,7 @@ TextFrame::CreateContinuingFrame(nsIPresContext& aCX,
}
NS_IMETHODIMP
TextFrame::ContentChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
TextFrame::ContentChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsISupports* aSubContent)
{
@ -419,7 +417,9 @@ TextFrame::ContentChanged(nsIPresShell* aShell,
result = NS_NewHTMLReflowCommand(&cmd, this, nsIReflowCommand::ContentChanged);
if (NS_OK == result) {
aShell->AppendReflowCommand(cmd);
nsIPresShell* shell = aPresContext->GetShell();
shell->AppendReflowCommand(cmd);
NS_RELEASE(shell);
NS_RELEASE(cmd);
}

View File

@ -80,8 +80,7 @@ NS_IMETHODIMP nsAbsoluteFrame::Reflow(nsIPresContext& aPresContext,
return nsFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
}
NS_IMETHODIMP nsAbsoluteFrame::ContentChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
NS_IMETHODIMP nsAbsoluteFrame::ContentChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsISupports* aSubContent)
{
@ -89,12 +88,27 @@ NS_IMETHODIMP nsAbsoluteFrame::ContentChanged(nsIPresShell* aShell,
// Forward the notification to the absolutely positioned frame
if (nsnull != mFrame) {
return mFrame->ContentChanged(aShell, aPresContext, aChild, aSubContent);
return mFrame->ContentChanged(aPresContext, aChild, aSubContent);
}
return NS_OK;
}
NS_IMETHODIMP nsAbsoluteFrame::AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute,
PRInt32 aHint)
{
NS_ASSERTION(mContent == aChild, "bad content-changed target");
// Forward the notification to the absolutely positioned frame
if (nsnull != mFrame) {
return mFrame->AttributeChanged(aPresContext, aChild, aAttribute, aHint);
}
return NS_OK;
}
nsIFrame* nsAbsoluteFrame::GetContainingBlock() const
{
// Look for a containing frame that is absolutely positioned. If we don't

View File

@ -45,10 +45,13 @@ public:
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
NS_IMETHOD ContentChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsISupports* aSubContent);
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute,
PRInt32 aHint);
NS_IMETHOD ListTag(FILE* out = stdout) const;

View File

@ -50,10 +50,6 @@ public:
NS_IMETHOD Paint(nsIPresContext& aPresContext,
nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect);
NS_IMETHOD AttributeChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute);
protected:
virtual ~HRuleFrame();
@ -90,19 +86,6 @@ HRuleFrame::~HRuleFrame()
{
}
NS_IMETHODIMP
HRuleFrame::AttributeChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute)
{
if (nsHTMLAtoms::noshade == aAttribute) {
// Trigger an immediate rendering
Invalidate(nsRect(0, 0, mRect.width, mRect.height), PR_TRUE);
}
return NS_OK;
}
NS_METHOD
HRuleFrame::Paint(nsIPresContext& aPresContext,
nsIRenderingContext& aRenderingContext,

View File

@ -412,141 +412,4 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext& aPresContext,
return NS_OK;
}
NS_IMETHODIMP
nsHTMLContainerFrame::AttributeChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute)
{
if (nsHTMLAtoms::style == aAttribute) {
ApplyStyleChangeToTree(*aPresContext, this);
StyleChangeReflow(*aPresContext, this);
}
return NS_OK;
}
static void
RemapStyleInTree(nsIPresContext* aPresContext,
nsIFrame* aFrame)
{
nsIStyleContext* sc;
aFrame->GetStyleContext(nsnull, sc);
if (nsnull != sc) {
sc->RemapStyle(aPresContext);
// Update the children too...
nsIFrame* kid;
aFrame->FirstChild(kid);
while (nsnull != kid) {
RemapStyleInTree(aPresContext, kid);
kid->GetNextSibling(kid);
}
}
}
void
nsHTMLContainerFrame::ApplyStyleChangeToTree(nsIPresContext& aPresContext,
nsIFrame* aFrame)
{
nsIContent* content;
nsIFrame* geometricParent;
aFrame->GetGeometricParent(geometricParent);
aFrame->GetContent(content);
if (nsnull != content) {
PRBool onlyRemap = PR_FALSE;
nsIStyleContext* oldSC;
aFrame->GetStyleContext(nsnull, oldSC);
nsIStyleContext* newSC =
aPresContext.ResolveStyleContextFor(content, geometricParent);
if (newSC == oldSC) {
// Force cached style data to be recomputed
newSC->RemapStyle(&aPresContext);
onlyRemap = PR_TRUE;
}
else {
// Switch to new style context
aFrame->SetStyleContext(&aPresContext, newSC);
}
NS_IF_RELEASE(oldSC);
NS_RELEASE(newSC);
NS_RELEASE(content);
// Update the children too...
nsIFrame* kid;
aFrame->FirstChild(kid);
if (onlyRemap) {
while (nsnull != kid) {
RemapStyleInTree(&aPresContext, kid);
kid->GetNextSibling(kid);
}
}
else {
while (nsnull != kid) {
ApplyStyleChangeToTree(aPresContext, kid);
kid->GetNextSibling(kid);
}
}
}
}
void
nsHTMLContainerFrame::ApplyRenderingChangeToTree(nsIPresContext& aPresContext,
nsIFrame* aFrame)
{
nsIViewManager* viewManager = nsnull;
// Trigger rendering updates by damaging this frame and any
// continuations of this frame.
while (nsnull != aFrame) {
// Get the frame's bounding rect
nsRect r;
aFrame->GetRect(r);
r.x = 0;
r.y = 0;
// Get view if this frame has one and trigger an update. If the
// frame doesn't have a view, find the nearest containing view
// (adjusting r's coordinate system to reflect the nesting) and
// update there.
nsIView* view;
aFrame->GetView(view);
if (nsnull != view) {
} else {
nsPoint offset;
aFrame->GetOffsetFromView(offset, view);
NS_ASSERTION(nsnull != view, "no view");
r += offset;
}
if (nsnull == viewManager) {
view->GetViewManager(viewManager);
}
viewManager->UpdateView(view, r, NS_VMREFRESH_NO_SYNC);
aFrame->GetNextInFlow(aFrame);
}
if (nsnull != viewManager) {
viewManager->Composite();
NS_RELEASE(viewManager);
}
}
void
nsHTMLContainerFrame::StyleChangeReflow(nsIPresContext& aPresContext,
nsIFrame* aFrame)
{
nsIPresShell* shell;
shell = aPresContext.GetShell();
nsIReflowCommand* reflowCmd;
nsresult rv = NS_NewHTMLReflowCommand(&reflowCmd, aFrame,
nsIReflowCommand::StyleChanged);
if (NS_SUCCEEDED(rv)) {
shell->AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
NS_RELEASE(shell);
}

View File

@ -44,11 +44,6 @@ public:
nsIContent** aContent,
PRInt32& aCursor);
NS_IMETHOD AttributeChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute);
nsPlaceholderFrame* CreatePlaceholderFrame(nsIPresContext& aPresContext,
nsIFrame* aFloatedFrame);
nsAbsoluteFrame* CreateAbsolutePlaceholderFrame(nsIPresContext& aPresContext,
@ -81,14 +76,6 @@ public:
nsIStyleContext* aStyleContext,
PRBool aForce);
// Helper methods for handling attribute changes
static void ApplyStyleChangeToTree(nsIPresContext& aPresContext,
nsIFrame* aFrame);
static void ApplyRenderingChangeToTree(nsIPresContext& aPresContext,
nsIFrame* aFrame);
static void StyleChangeReflow(nsIPresContext& aPresContext,
nsIFrame* aFrame);
protected:
virtual ~nsHTMLContainerFrame();

View File

@ -71,10 +71,10 @@ public:
nsIFrame** aFrame,
nsIContent** aContent,
PRInt32& aCursor);
NS_IMETHOD AttributeChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute);
nsIAtom* aAttribute,
PRInt32 aHint);
protected:
virtual ~ImageFrame();
@ -894,22 +894,17 @@ ImageFrame::GetCursorAndContentAt(nsIPresContext& aPresContext,
}
NS_IMETHODIMP
ImageFrame::AttributeChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
ImageFrame::AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute)
nsIAtom* aAttribute,
PRInt32 aHint)
{
nsresult rv = nsLeafFrame::AttributeChanged(aShell, aPresContext, aChild,
aAttribute);
nsresult rv = nsLeafFrame::AttributeChanged(aPresContext, aChild,
aAttribute, aHint);
if (NS_OK != rv) {
return rv;
}
if ((nsHTMLAtoms::width == aAttribute) ||
(nsHTMLAtoms::height == aAttribute)) {
nsHTMLContainerFrame::ApplyStyleChangeToTree(*aPresContext, this);
nsHTMLContainerFrame::StyleChangeReflow(*aPresContext, this);
}
else if (nsHTMLAtoms::src == aAttribute) {
if (nsHTMLAtoms::src == aAttribute) {
nsAutoString oldSRC;
mImageLoader.GetURL(oldSRC);
nsAutoString newSRC;

View File

@ -69,10 +69,6 @@ public:
nsIFrame* aParent,
nsIStyleContext* aStyleContext,
nsIFrame*& aContinuingFrame);
NS_IMETHOD AttributeChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute);
// nsIInlineReflow
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
@ -245,29 +241,6 @@ nsInlineFrame::CreateContinuingFrame(nsIPresContext& aCX,
return NS_OK;
}
NS_IMETHODIMP
nsInlineFrame::AttributeChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute)
{
nsresult result = nsHTMLContainerFrame::AttributeChanged(aShell,
aPresContext,
aChild,
aAttribute);
if (NS_OK != result) {
return result;
}
if (nsHTMLAtoms::color == aAttribute) {
ApplyStyleChangeToTree(*aPresContext, this);
ApplyRenderingChangeToTree(*aPresContext, this);
}
else if (nsHTMLAtoms::face == aAttribute) {
ApplyStyleChangeToTree(*aPresContext, this);
StyleChangeReflow(*aPresContext, this);
}
return NS_OK;
}
NS_IMETHODIMP
nsInlineFrame::FindTextRuns(nsLineLayout& aLineLayout,

View File

@ -21,6 +21,7 @@
#include "nsHTMLParts.h"
#include "nsHTMLAtoms.h"
#include "nsIPresShell.h"
#include "nsIPresContext.h"
#include "nsIStyleContext.h"
nsLeafFrame::nsLeafFrame(nsIContent* aContent, nsIFrame* aParentFrame)
@ -105,8 +106,7 @@ void nsLeafFrame::GetInnerArea(nsIPresContext* aPresContext,
(borderPadding.top + borderPadding.bottom);
}
NS_METHOD nsLeafFrame::ContentChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
NS_METHOD nsLeafFrame::ContentChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsISupports* aSubContent)
{
@ -116,22 +116,12 @@ NS_METHOD nsLeafFrame::ContentChanged(nsIPresShell* aShell,
result = NS_NewHTMLReflowCommand(&cmd, this, nsIReflowCommand::ContentChanged);
if (NS_OK == result) {
aShell->AppendReflowCommand(cmd);
nsIPresShell* shell = aPresContext->GetShell();
shell->AppendReflowCommand(cmd);
NS_RELEASE(shell);
NS_RELEASE(cmd);
}
return result;
}
NS_IMETHODIMP
nsLeafFrame::AttributeChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute)
{
if (nsHTMLAtoms::style == aAttribute) {
nsHTMLContainerFrame::ApplyStyleChangeToTree(*aPresContext, this);
nsHTMLContainerFrame::StyleChangeReflow(*aPresContext, this);
}
return NS_OK;
}

View File

@ -37,14 +37,9 @@ public:
nsReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
NS_IMETHOD ContentChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsISupports* aSubContent);
NS_IMETHOD AttributeChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute);
protected:
nsLeafFrame(nsIContent* aContent, nsIFrame* aParentFrame);

View File

@ -139,8 +139,7 @@ nsPlaceholderFrame::Paint(nsIPresContext& aPresContext,
return NS_OK;
}
NS_IMETHODIMP nsPlaceholderFrame::ContentChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
NS_IMETHODIMP nsPlaceholderFrame::ContentChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsISupports* aSubContent)
{
@ -148,21 +147,21 @@ NS_IMETHODIMP nsPlaceholderFrame::ContentChanged(nsIPresShell* aShell,
// Forward the notification to the floater
if (nsnull != mAnchoredItem) {
return mAnchoredItem->ContentChanged(aShell, aPresContext, aChild, aSubContent);
return mAnchoredItem->ContentChanged(aPresContext, aChild, aSubContent);
}
return NS_OK;
}
NS_IMETHODIMP
nsPlaceholderFrame::AttributeChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
nsPlaceholderFrame::AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute)
nsIAtom* aAttribute,
PRInt32 aHint)
{
// Forward the notification to the floater
if (nsnull != mAnchoredItem) {
return mAnchoredItem->AttributeChanged(aShell, aPresContext, aChild, aAttribute);
return mAnchoredItem->AttributeChanged(aPresContext, aChild, aAttribute, aHint);
}
return NS_OK;

View File

@ -50,15 +50,14 @@ public:
nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect);
NS_IMETHOD ContentChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsISupports* aSubContent);
NS_IMETHOD AttributeChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute);
nsIAtom* aAttribute,
PRInt32 aHint);
NS_IMETHOD ListTag(FILE* out = stdout) const;

View File

@ -133,8 +133,7 @@ public:
nsIContent** aContent,
PRInt32& aCursor);
NS_IMETHOD ContentChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsISupports* aSubContent);
@ -408,8 +407,7 @@ TextFrame::CreateContinuingFrame(nsIPresContext& aCX,
}
NS_IMETHODIMP
TextFrame::ContentChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
TextFrame::ContentChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsISupports* aSubContent)
{
@ -419,7 +417,9 @@ TextFrame::ContentChanged(nsIPresShell* aShell,
result = NS_NewHTMLReflowCommand(&cmd, this, nsIReflowCommand::ContentChanged);
if (NS_OK == result) {
aShell->AppendReflowCommand(cmd);
nsIPresShell* shell = aPresContext->GetShell();
shell->AppendReflowCommand(cmd);
NS_RELEASE(shell);
NS_RELEASE(cmd);
}