зеркало из https://github.com/mozilla/gecko-dev.git
added content state changed
This commit is contained in:
Родитель
0864f69c78
Коммит
006004dd56
|
@ -201,6 +201,7 @@ public:
|
|||
NS_IMETHOD EndLoad() = 0;
|
||||
NS_IMETHOD ContentChanged(nsIContent* aContent,
|
||||
nsISupports* aSubContent) = 0;
|
||||
NS_IMETHOD ContentStateChanged(nsIContent* aContent) = 0;
|
||||
NS_IMETHOD AttributeChanged(nsIContent* aChild,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aHint) = 0; // See nsStyleConsts fot hint values
|
||||
|
|
|
@ -91,6 +91,25 @@ public:
|
|||
nsIContent* aContent,
|
||||
nsISupports* aSubContent) = 0;
|
||||
|
||||
/**
|
||||
* Notification that the state of a content node has changed.
|
||||
* (ie: gained or lost focus, became active or hovered over)
|
||||
* This method is called automatically by content objects
|
||||
* when their state is changed (therefore there is normally
|
||||
* no need to invoke this method directly). The notification
|
||||
* is passed to any IDocumentObservers. The notification is
|
||||
* passed on to all of the document observers. <p>
|
||||
*
|
||||
* This notification is not sent when a piece of content is
|
||||
* added/removed from the document or the content itself changed
|
||||
* (the other notifications are used for that).
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aContent the piece of content that changed
|
||||
*/
|
||||
NS_IMETHOD ContentStateChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent) = 0;
|
||||
|
||||
/**
|
||||
* Notification that the content model has changed. This method is called
|
||||
* automatically by content objects when an attribute's value has changed
|
||||
|
|
|
@ -72,6 +72,8 @@ public:
|
|||
NS_IMETHOD ContentChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
nsISupports* aSubContent) { return NS_OK; }
|
||||
NS_IMETHOD ContentStateChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent) { return NS_OK; }
|
||||
NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
nsIAtom* aAttribute,
|
||||
|
|
|
@ -123,6 +123,8 @@ public:
|
|||
NS_IMETHOD ContentChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
nsISupports* aSubContent) { return NS_OK; }
|
||||
NS_IMETHOD ContentStateChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent) { return NS_OK; }
|
||||
NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
nsIAtom* aAttribute,
|
||||
|
@ -1197,6 +1199,24 @@ nsDocument::ContentChanged(nsIContent* aContent,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::ContentStateChanged(nsIContent* aContent)
|
||||
{
|
||||
PRInt32 count = mObservers.Count();
|
||||
for (PRInt32 i = 0; i < count; i++) {
|
||||
nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i];
|
||||
observer->ContentStateChanged(this, aContent);
|
||||
// Make sure that the observer didn't remove itself during the
|
||||
// notification. If it did, update our index and count.
|
||||
if (observer != (nsIDocumentObserver*)mObservers[i]) {
|
||||
i--;
|
||||
count--;
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::ContentAppended(nsIContent* aContainer,
|
||||
PRInt32 aNewIndexInContainer)
|
||||
|
|
|
@ -209,6 +209,7 @@ public:
|
|||
NS_IMETHOD EndLoad();
|
||||
NS_IMETHOD ContentChanged(nsIContent* aContent,
|
||||
nsISupports* aSubContent);
|
||||
NS_IMETHOD ContentStateChanged(nsIContent* aContent);
|
||||
NS_IMETHOD AttributeChanged(nsIContent* aChild,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aHint);
|
||||
|
|
|
@ -391,6 +391,8 @@ public:
|
|||
NS_IMETHOD ContentChanged(nsIContent* aContent,
|
||||
nsISupports* aSubContent);
|
||||
|
||||
NS_IMETHOD ContentStateChanged(nsIContent* aContent);
|
||||
|
||||
NS_IMETHOD AttributeChanged(nsIContent* aChild,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aHint); // See nsStyleConsts fot hint values
|
||||
|
@ -1323,6 +1325,17 @@ XULDocumentImpl::ContentChanged(nsIContent* aContent,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
XULDocumentImpl::ContentStateChanged(nsIContent* aContent)
|
||||
{
|
||||
PRInt32 count = mObservers.Count();
|
||||
for (PRInt32 i = 0; i < count; i++) {
|
||||
nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i];
|
||||
observer->ContentStateChanged(this, aContent);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
XULDocumentImpl::AttributeChanged(nsIContent* aChild,
|
||||
nsIAtom* aAttribute,
|
||||
|
|
|
@ -3468,6 +3468,9 @@ ApplyRenderingChangeToTree(nsIPresContext* aPresContext,
|
|||
|
||||
// Trigger rendering updates by damaging this frame and any
|
||||
// continuations of this frame.
|
||||
|
||||
// XXX this needs to detect the need for a view due to an opacity change and deal with it...
|
||||
|
||||
while (nsnull != aFrame) {
|
||||
// Get the frame's bounding rect
|
||||
nsRect r;
|
||||
|
@ -3560,6 +3563,87 @@ nsCSSFrameConstructor::ContentChanged(nsIPresContext* aPresContext,
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCSSFrameConstructor::ContentStateChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
nsIFrame* frame;
|
||||
|
||||
shell->GetPrimaryFrameFor(aContent, &frame);
|
||||
|
||||
PRInt32 hint = NS_STYLE_HINT_NONE;
|
||||
PRBool reflow = PR_FALSE;
|
||||
PRBool reframe = PR_FALSE;
|
||||
PRBool render = PR_FALSE;
|
||||
PRBool notify = PR_FALSE;
|
||||
|
||||
#if 0
|
||||
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
|
||||
("HTMLStyleSheet::ContentStateChanged: content=%p[%s] frame=%p",
|
||||
aContent, ContentTag(aContent, 0), frame));
|
||||
#endif
|
||||
|
||||
if (frame) {
|
||||
nsIStyleContext* oldFrameContext;
|
||||
frame->GetStyleContext(&oldFrameContext);
|
||||
NS_ASSERTION(nsnull != oldFrameContext, "frame must have style context");
|
||||
if (oldFrameContext) {
|
||||
nsIStyleContext* parentContext = oldFrameContext->GetParent();
|
||||
frame->ReResolveStyleContext(aPresContext, parentContext);
|
||||
NS_IF_RELEASE(parentContext);
|
||||
nsIStyleContext* newFrameContext;
|
||||
frame->GetStyleContext(&newFrameContext);
|
||||
if (newFrameContext) {
|
||||
if (newFrameContext != oldFrameContext) {
|
||||
newFrameContext->CalcStyleDifference(oldFrameContext, hint);
|
||||
}
|
||||
NS_RELEASE(newFrameContext);
|
||||
}
|
||||
NS_RELEASE(oldFrameContext);
|
||||
}
|
||||
|
||||
switch (hint) {
|
||||
default:
|
||||
case NS_STYLE_HINT_UNKNOWN:
|
||||
case NS_STYLE_HINT_FRAMECHANGE:
|
||||
reframe = PR_TRUE;
|
||||
case NS_STYLE_HINT_REFLOW:
|
||||
reflow = PR_TRUE;
|
||||
case NS_STYLE_HINT_VISUAL:
|
||||
render = PR_TRUE;
|
||||
case NS_STYLE_HINT_CONTENT:
|
||||
notify = PR_TRUE;
|
||||
case NS_STYLE_HINT_AURAL:
|
||||
case NS_STYLE_HINT_NONE:
|
||||
break;
|
||||
}
|
||||
|
||||
// apply changes
|
||||
if (reframe) {
|
||||
result = RecreateFramesForContent(aPresContext, aContent);
|
||||
}
|
||||
else if (reflow) {
|
||||
StyleChangeReflow(aPresContext, frame, nsnull);
|
||||
}
|
||||
else if (render) {
|
||||
ApplyRenderingChangeToTree(aPresContext, frame);
|
||||
}
|
||||
else if (notify) {
|
||||
result = frame->ContentChanged(aPresContext, aContent, nsnull);
|
||||
}
|
||||
}
|
||||
else {
|
||||
result = RecreateFramesForContent(aPresContext, aContent);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
|
@ -3617,7 +3701,7 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext,
|
|||
|
||||
// apply changes
|
||||
if (PR_TRUE == reframe) {
|
||||
RecreateFramesOnAttributeChange(aPresContext, aContent, aAttribute);
|
||||
RecreateFramesForContent(aPresContext, aContent);
|
||||
}
|
||||
else if (PR_TRUE == restyle) {
|
||||
// If there is no frame then there is no point in re-styling it,
|
||||
|
@ -4155,9 +4239,8 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresContext* aPresContext,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsCSSFrameConstructor::RecreateFramesOnAttributeChange(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIAtom* aAttribute)
|
||||
nsCSSFrameConstructor::RecreateFramesForContent(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
|
|
|
@ -78,6 +78,8 @@ public:
|
|||
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsISupports* aSubContent);
|
||||
NS_IMETHOD ContentStateChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent);
|
||||
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIAtom* aAttribute,
|
||||
|
@ -369,9 +371,9 @@ protected:
|
|||
PRBool aIsFixedPositioned,
|
||||
PRBool aCreateBlock);
|
||||
|
||||
nsresult RecreateFramesOnAttributeChange(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIAtom* aAttribute);
|
||||
nsresult RecreateFramesForContent(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent);
|
||||
|
||||
|
||||
nsresult CreateContinuingOuterTableFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
|
|
|
@ -205,6 +205,8 @@ public:
|
|||
NS_IMETHOD ContentChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
nsISupports* aSubContent);
|
||||
NS_IMETHOD ContentStateChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent);
|
||||
NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
nsIAtom* aAttribute,
|
||||
|
@ -1482,6 +1484,22 @@ PresShell::ContentChanged(nsIDocument *aDocument,
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::ContentStateChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != mRootFrame, "null root frame");
|
||||
|
||||
EnterReflowLock();
|
||||
nsresult rv = mStyleSet->ContentStateChanged(mPresContext, aContent);
|
||||
ExitReflowLock();
|
||||
if (mSelection)
|
||||
mSelection->ResetSelection(this, mRootFrame);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::AttributeChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
|
|
|
@ -201,6 +201,7 @@ public:
|
|||
NS_IMETHOD EndLoad() = 0;
|
||||
NS_IMETHOD ContentChanged(nsIContent* aContent,
|
||||
nsISupports* aSubContent) = 0;
|
||||
NS_IMETHOD ContentStateChanged(nsIContent* aContent) = 0;
|
||||
NS_IMETHOD AttributeChanged(nsIContent* aChild,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aHint) = 0; // See nsStyleConsts fot hint values
|
||||
|
|
|
@ -91,6 +91,25 @@ public:
|
|||
nsIContent* aContent,
|
||||
nsISupports* aSubContent) = 0;
|
||||
|
||||
/**
|
||||
* Notification that the state of a content node has changed.
|
||||
* (ie: gained or lost focus, became active or hovered over)
|
||||
* This method is called automatically by content objects
|
||||
* when their state is changed (therefore there is normally
|
||||
* no need to invoke this method directly). The notification
|
||||
* is passed to any IDocumentObservers. The notification is
|
||||
* passed on to all of the document observers. <p>
|
||||
*
|
||||
* This notification is not sent when a piece of content is
|
||||
* added/removed from the document or the content itself changed
|
||||
* (the other notifications are used for that).
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aContent the piece of content that changed
|
||||
*/
|
||||
NS_IMETHOD ContentStateChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent) = 0;
|
||||
|
||||
/**
|
||||
* Notification that the content model has changed. This method is called
|
||||
* automatically by content objects when an attribute's value has changed
|
||||
|
|
|
@ -73,6 +73,9 @@ public:
|
|||
nsIContent* aContent,
|
||||
nsISupports* aSubContent) = 0;
|
||||
|
||||
NS_IMETHOD ContentStateChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent) = 0;
|
||||
|
||||
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIAtom* aAttribute,
|
||||
|
|
|
@ -120,6 +120,8 @@ public:
|
|||
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsISupports* aSubContent) = 0;
|
||||
NS_IMETHOD ContentStateChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent) = 0;
|
||||
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aChild,
|
||||
nsIAtom* aAttribute,
|
||||
|
|
|
@ -72,6 +72,8 @@ public:
|
|||
NS_IMETHOD ContentChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
nsISupports* aSubContent) { return NS_OK; }
|
||||
NS_IMETHOD ContentStateChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent) { return NS_OK; }
|
||||
NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
nsIAtom* aAttribute,
|
||||
|
|
|
@ -123,6 +123,8 @@ public:
|
|||
NS_IMETHOD ContentChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
nsISupports* aSubContent) { return NS_OK; }
|
||||
NS_IMETHOD ContentStateChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent) { return NS_OK; }
|
||||
NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
nsIAtom* aAttribute,
|
||||
|
@ -1197,6 +1199,24 @@ nsDocument::ContentChanged(nsIContent* aContent,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::ContentStateChanged(nsIContent* aContent)
|
||||
{
|
||||
PRInt32 count = mObservers.Count();
|
||||
for (PRInt32 i = 0; i < count; i++) {
|
||||
nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i];
|
||||
observer->ContentStateChanged(this, aContent);
|
||||
// Make sure that the observer didn't remove itself during the
|
||||
// notification. If it did, update our index and count.
|
||||
if (observer != (nsIDocumentObserver*)mObservers[i]) {
|
||||
i--;
|
||||
count--;
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::ContentAppended(nsIContent* aContainer,
|
||||
PRInt32 aNewIndexInContainer)
|
||||
|
|
|
@ -209,6 +209,7 @@ public:
|
|||
NS_IMETHOD EndLoad();
|
||||
NS_IMETHOD ContentChanged(nsIContent* aContent,
|
||||
nsISupports* aSubContent);
|
||||
NS_IMETHOD ContentStateChanged(nsIContent* aContent);
|
||||
NS_IMETHOD AttributeChanged(nsIContent* aChild,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aHint);
|
||||
|
|
|
@ -901,6 +901,14 @@ nsImageMap::ContentChanged(nsIDocument *aDocument,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImageMap::ContentStateChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImageMap::AttributeChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
|
|
|
@ -74,6 +74,8 @@ public:
|
|||
NS_IMETHOD ContentChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
nsISupports* aSubContent);
|
||||
NS_IMETHOD ContentStateChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent);
|
||||
NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
nsIAtom* aAttribute,
|
||||
|
|
|
@ -901,6 +901,14 @@ nsImageMap::ContentChanged(nsIDocument *aDocument,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImageMap::ContentStateChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImageMap::AttributeChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
|
|
|
@ -74,6 +74,8 @@ public:
|
|||
NS_IMETHOD ContentChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
nsISupports* aSubContent);
|
||||
NS_IMETHOD ContentStateChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent);
|
||||
NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
nsIAtom* aAttribute,
|
||||
|
|
|
@ -205,6 +205,8 @@ public:
|
|||
NS_IMETHOD ContentChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
nsISupports* aSubContent);
|
||||
NS_IMETHOD ContentStateChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent);
|
||||
NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
nsIAtom* aAttribute,
|
||||
|
@ -1482,6 +1484,22 @@ PresShell::ContentChanged(nsIDocument *aDocument,
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::ContentStateChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != mRootFrame, "null root frame");
|
||||
|
||||
EnterReflowLock();
|
||||
nsresult rv = mStyleSet->ContentStateChanged(mPresContext, aContent);
|
||||
ExitReflowLock();
|
||||
if (mSelection)
|
||||
mSelection->ResetSelection(this, mRootFrame);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::AttributeChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
|
|
|
@ -3468,6 +3468,9 @@ ApplyRenderingChangeToTree(nsIPresContext* aPresContext,
|
|||
|
||||
// Trigger rendering updates by damaging this frame and any
|
||||
// continuations of this frame.
|
||||
|
||||
// XXX this needs to detect the need for a view due to an opacity change and deal with it...
|
||||
|
||||
while (nsnull != aFrame) {
|
||||
// Get the frame's bounding rect
|
||||
nsRect r;
|
||||
|
@ -3560,6 +3563,87 @@ nsCSSFrameConstructor::ContentChanged(nsIPresContext* aPresContext,
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCSSFrameConstructor::ContentStateChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
nsIFrame* frame;
|
||||
|
||||
shell->GetPrimaryFrameFor(aContent, &frame);
|
||||
|
||||
PRInt32 hint = NS_STYLE_HINT_NONE;
|
||||
PRBool reflow = PR_FALSE;
|
||||
PRBool reframe = PR_FALSE;
|
||||
PRBool render = PR_FALSE;
|
||||
PRBool notify = PR_FALSE;
|
||||
|
||||
#if 0
|
||||
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
|
||||
("HTMLStyleSheet::ContentStateChanged: content=%p[%s] frame=%p",
|
||||
aContent, ContentTag(aContent, 0), frame));
|
||||
#endif
|
||||
|
||||
if (frame) {
|
||||
nsIStyleContext* oldFrameContext;
|
||||
frame->GetStyleContext(&oldFrameContext);
|
||||
NS_ASSERTION(nsnull != oldFrameContext, "frame must have style context");
|
||||
if (oldFrameContext) {
|
||||
nsIStyleContext* parentContext = oldFrameContext->GetParent();
|
||||
frame->ReResolveStyleContext(aPresContext, parentContext);
|
||||
NS_IF_RELEASE(parentContext);
|
||||
nsIStyleContext* newFrameContext;
|
||||
frame->GetStyleContext(&newFrameContext);
|
||||
if (newFrameContext) {
|
||||
if (newFrameContext != oldFrameContext) {
|
||||
newFrameContext->CalcStyleDifference(oldFrameContext, hint);
|
||||
}
|
||||
NS_RELEASE(newFrameContext);
|
||||
}
|
||||
NS_RELEASE(oldFrameContext);
|
||||
}
|
||||
|
||||
switch (hint) {
|
||||
default:
|
||||
case NS_STYLE_HINT_UNKNOWN:
|
||||
case NS_STYLE_HINT_FRAMECHANGE:
|
||||
reframe = PR_TRUE;
|
||||
case NS_STYLE_HINT_REFLOW:
|
||||
reflow = PR_TRUE;
|
||||
case NS_STYLE_HINT_VISUAL:
|
||||
render = PR_TRUE;
|
||||
case NS_STYLE_HINT_CONTENT:
|
||||
notify = PR_TRUE;
|
||||
case NS_STYLE_HINT_AURAL:
|
||||
case NS_STYLE_HINT_NONE:
|
||||
break;
|
||||
}
|
||||
|
||||
// apply changes
|
||||
if (reframe) {
|
||||
result = RecreateFramesForContent(aPresContext, aContent);
|
||||
}
|
||||
else if (reflow) {
|
||||
StyleChangeReflow(aPresContext, frame, nsnull);
|
||||
}
|
||||
else if (render) {
|
||||
ApplyRenderingChangeToTree(aPresContext, frame);
|
||||
}
|
||||
else if (notify) {
|
||||
result = frame->ContentChanged(aPresContext, aContent, nsnull);
|
||||
}
|
||||
}
|
||||
else {
|
||||
result = RecreateFramesForContent(aPresContext, aContent);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
|
@ -3617,7 +3701,7 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext,
|
|||
|
||||
// apply changes
|
||||
if (PR_TRUE == reframe) {
|
||||
RecreateFramesOnAttributeChange(aPresContext, aContent, aAttribute);
|
||||
RecreateFramesForContent(aPresContext, aContent);
|
||||
}
|
||||
else if (PR_TRUE == restyle) {
|
||||
// If there is no frame then there is no point in re-styling it,
|
||||
|
@ -4155,9 +4239,8 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresContext* aPresContext,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsCSSFrameConstructor::RecreateFramesOnAttributeChange(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIAtom* aAttribute)
|
||||
nsCSSFrameConstructor::RecreateFramesForContent(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
|
|
|
@ -78,6 +78,8 @@ public:
|
|||
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsISupports* aSubContent);
|
||||
NS_IMETHOD ContentStateChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent);
|
||||
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIAtom* aAttribute,
|
||||
|
@ -369,9 +371,9 @@ protected:
|
|||
PRBool aIsFixedPositioned,
|
||||
PRBool aCreateBlock);
|
||||
|
||||
nsresult RecreateFramesOnAttributeChange(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIAtom* aAttribute);
|
||||
nsresult RecreateFramesForContent(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent);
|
||||
|
||||
|
||||
nsresult CreateContinuingOuterTableFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
|
|
|
@ -391,6 +391,8 @@ public:
|
|||
NS_IMETHOD ContentChanged(nsIContent* aContent,
|
||||
nsISupports* aSubContent);
|
||||
|
||||
NS_IMETHOD ContentStateChanged(nsIContent* aContent);
|
||||
|
||||
NS_IMETHOD AttributeChanged(nsIContent* aChild,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aHint); // See nsStyleConsts fot hint values
|
||||
|
@ -1323,6 +1325,17 @@ XULDocumentImpl::ContentChanged(nsIContent* aContent,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
XULDocumentImpl::ContentStateChanged(nsIContent* aContent)
|
||||
{
|
||||
PRInt32 count = mObservers.Count();
|
||||
for (PRInt32 i = 0; i < count; i++) {
|
||||
nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i];
|
||||
observer->ContentStateChanged(this, aContent);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
XULDocumentImpl::AttributeChanged(nsIContent* aChild,
|
||||
nsIAtom* aAttribute,
|
||||
|
|
Загрузка…
Ссылка в новой задаче