Added AttributeChanged() member function for communicating attribute value

changes to the frame
This commit is contained in:
troy%netscape.com 1998-09-18 19:53:27 +00:00
parent df2bf2f6c5
commit 6d20aa0438
9 changed files with 121 additions and 19 deletions

View File

@ -88,6 +88,20 @@ public:
nsIContent* aContent,
nsISupports* aSubContent) = 0;
/**
* Notification that the content model has changed. This method is called
* automatically by content objects when an attribute's value has changed
* (therefore there is normally no need to invoke this method directly). The
* notification is passed to any IDocumentObservers document observers. <p>
*
* @param aDocument The document being observed
* @param aContent the piece of content whose attribute changed
* @param aAttribute the atom name of the attribute
*/
NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent,
nsIAtom* aAttribute) = 0;
/**
* Notifcation that the content model has had data appended to the
* given content object. This method is called automatically by the

View File

@ -62,30 +62,33 @@ public:
NS_IMETHOD BeginLoad(nsIDocument *aDocument) { return NS_OK; }
NS_IMETHOD EndLoad(nsIDocument *aDocument) { return NS_OK; }
NS_IMETHOD BeginReflow(nsIDocument *aDocument,
nsIPresShell* aShell) { return NS_OK; }
nsIPresShell* aShell) { return NS_OK; }
NS_IMETHOD EndReflow(nsIDocument *aDocument,
nsIPresShell* aShell) { return NS_OK; }
nsIPresShell* aShell) { return NS_OK; }
NS_IMETHOD ContentChanged(nsIDocument *aDocument,
nsIContent* aContent,
nsIContent* aContent,
nsISupports* aSubContent) { return NS_OK; }
NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent,
nsIAtom* aAttribute) { return NS_OK; }
NS_IMETHOD ContentAppended(nsIDocument *aDocument,
nsIContent* aContainer,
PRInt32 aNewIndexInContainer);
nsIContent* aContainer,
PRInt32 aNewIndexInContainer);
NS_IMETHOD ContentInserted(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer);
NS_IMETHOD ContentReplaced(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aContainer,
nsIContent* aOldChild,
nsIContent* aNewChild,
PRInt32 aIndexInContainer);
NS_IMETHOD ContentWillBeRemoved(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer) { return NS_OK; }
NS_IMETHOD ContentHasBeenRemoved(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer);
NS_IMETHOD StyleSheetAdded(nsIDocument *aDocument,

View File

@ -88,6 +88,20 @@ public:
nsIContent* aContent,
nsISupports* aSubContent) = 0;
/**
* Notification that the content model has changed. This method is called
* automatically by content objects when an attribute's value has changed
* (therefore there is normally no need to invoke this method directly). The
* notification is passed to any IDocumentObservers document observers. <p>
*
* @param aDocument The document being observed
* @param aContent the piece of content whose attribute changed
* @param aAttribute the atom name of the attribute
*/
NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent,
nsIAtom* aAttribute) = 0;
/**
* Notifcation that the content model has had data appended to the
* given content object. This method is called automatically by the

View File

@ -25,6 +25,7 @@
#include "nsGUIEvent.h"
#include "nsStyleStruct.h"
class nsIAtom;
class nsIContent;
class nsIFrame;
class nsIPresContext;
@ -568,6 +569,19 @@ public:
nsIContent* aChild,
nsISupports* aSubContent) = 0;
/**
* This call is invoked when the value of a content objects's attribute
* is changed. * The first frame that maps that content is asked to deal
* with the change by generating an incremental reflow command.
*
* @param aChild the content object
* @param aAttribute the attribute whose value changed
*/
NS_IMETHOD AttributeChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute) = 0;
/**
* Return the reflow metrics for this frame. If the frame is a
* container then the values for ascent and descent are computed

View File

@ -62,30 +62,33 @@ public:
NS_IMETHOD BeginLoad(nsIDocument *aDocument) { return NS_OK; }
NS_IMETHOD EndLoad(nsIDocument *aDocument) { return NS_OK; }
NS_IMETHOD BeginReflow(nsIDocument *aDocument,
nsIPresShell* aShell) { return NS_OK; }
nsIPresShell* aShell) { return NS_OK; }
NS_IMETHOD EndReflow(nsIDocument *aDocument,
nsIPresShell* aShell) { return NS_OK; }
nsIPresShell* aShell) { return NS_OK; }
NS_IMETHOD ContentChanged(nsIDocument *aDocument,
nsIContent* aContent,
nsIContent* aContent,
nsISupports* aSubContent) { return NS_OK; }
NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent,
nsIAtom* aAttribute) { return NS_OK; }
NS_IMETHOD ContentAppended(nsIDocument *aDocument,
nsIContent* aContainer,
PRInt32 aNewIndexInContainer);
nsIContent* aContainer,
PRInt32 aNewIndexInContainer);
NS_IMETHOD ContentInserted(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer);
NS_IMETHOD ContentReplaced(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aContainer,
nsIContent* aOldChild,
nsIContent* aNewChild,
PRInt32 aIndexInContainer);
NS_IMETHOD ContentWillBeRemoved(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer) { return NS_OK; }
NS_IMETHOD ContentHasBeenRemoved(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer);
NS_IMETHOD StyleSheetAdded(nsIDocument *aDocument,

View File

@ -1228,6 +1228,14 @@ NS_METHOD nsFrame::ContentChanged(nsIPresShell* aShell,
return NS_OK;
}
NS_IMETHODIMP nsFrame::AttributeChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute)
{
return NS_OK;
}
NS_METHOD nsFrame::GetReflowMetrics(nsIPresContext& aPresContext,
nsReflowMetrics& aMetrics)
{

View File

@ -179,6 +179,10 @@ public:
nsIPresContext* aPresContext,
nsIContent* aChild,
nsISupports* aSubContent);
NS_IMETHOD AttributeChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute);
NS_IMETHOD GetReflowMetrics(nsIPresContext& aPresContext,
nsReflowMetrics& aMetrics);
NS_IMETHOD IsSplittable(nsSplittableType& aIsSplittable) const;

View File

@ -162,6 +162,9 @@ public:
NS_IMETHOD ContentChanged(nsIDocument *aDocument,
nsIContent* aContent,
nsISupports* aSubContent);
NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent,
nsIAtom* aAttribute);
NS_IMETHOD ContentAppended(nsIDocument *aDocument,
nsIContent* aContainer,
PRInt32 aNewIndexInContainer);
@ -692,7 +695,7 @@ PresShell::ContentChanged(nsIDocument *aDocument,
nsIFrame* frame = FindFrameWithContent(aContent);
// It's possible the frame whose content changed isn't inserted into the
// frame hierarchy yet. This sometimes happens with images inside tables
// frame hierarchy yet, or that there is no frame that maps the content
if (nsnull != frame) {
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
("PresShell::ContentChanged: content=%p[%s] subcontent=%p frame=%p",
@ -705,6 +708,31 @@ PresShell::ContentChanged(nsIDocument *aDocument,
return NS_OK;
}
NS_IMETHODIMP
PresShell::AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent,
nsIAtom* aAttribute)
{
NS_PRECONDITION(nsnull != mRootFrame, "null root frame");
EnterReflowLock();
// Notify the first frame that maps the content. It will generate a reflow
// command, if necessary
nsIFrame* frame = FindFrameWithContent(aContent);
// Note: There may not be a frame that maps the content
if (nsnull != frame) {
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
("PresShell::AttributeChanged: content=%p[%s] frame=%p",
aContent, ContentTag(aContent, 0), frame));
frame->AttributeChanged(this, mPresContext, aContent, aAttribute);
}
ExitReflowLock();
return NS_OK;
}
NS_IMETHODIMP
PresShell::ContentAppended(nsIDocument *aDocument,
nsIContent* aContainer,

View File

@ -25,6 +25,7 @@
#include "nsGUIEvent.h"
#include "nsStyleStruct.h"
class nsIAtom;
class nsIContent;
class nsIFrame;
class nsIPresContext;
@ -568,6 +569,19 @@ public:
nsIContent* aChild,
nsISupports* aSubContent) = 0;
/**
* This call is invoked when the value of a content objects's attribute
* is changed. * The first frame that maps that content is asked to deal
* with the change by generating an incremental reflow command.
*
* @param aChild the content object
* @param aAttribute the attribute whose value changed
*/
NS_IMETHOD AttributeChanged(nsIPresShell* aShell,
nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute) = 0;
/**
* Return the reflow metrics for this frame. If the frame is a
* container then the values for ascent and descent are computed