diff --git a/content/base/public/nsIDocument.h b/content/base/public/nsIDocument.h index 17ca2a93d70f..1bfc8a44d63c 100644 --- a/content/base/public/nsIDocument.h +++ b/content/base/public/nsIDocument.h @@ -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 diff --git a/content/base/public/nsIDocumentObserver.h b/content/base/public/nsIDocumentObserver.h index a27b9ac4d699..a7673766e48c 100644 --- a/content/base/public/nsIDocumentObserver.h +++ b/content/base/public/nsIDocumentObserver.h @@ -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.
+ *
+ * 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
diff --git a/content/base/src/nsContentList.h b/content/base/src/nsContentList.h
index 982f157762e2..beacdfc132e5 100644
--- a/content/base/src/nsContentList.h
+++ b/content/base/src/nsContentList.h
@@ -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,
diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp
index 595c46d1fbfa..cdcbc8a9647b 100644
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -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)
diff --git a/content/base/src/nsDocument.h b/content/base/src/nsDocument.h
index c9c8108f84c1..d8e47f28264d 100644
--- a/content/base/src/nsDocument.h
+++ b/content/base/src/nsDocument.h
@@ -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);
diff --git a/content/xul/document/src/nsXULDocument.cpp b/content/xul/document/src/nsXULDocument.cpp
index 00e6417e8c25..aab2d8dfab76 100644
--- a/content/xul/document/src/nsXULDocument.cpp
+++ b/content/xul/document/src/nsXULDocument.cpp
@@ -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,
diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp
index e12d284a368e..ca44328090d5 100644
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -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;
@@ -3559,6 +3562,87 @@ nsCSSFrameConstructor::ContentChanged(nsIPresContext* aPresContext,
return rv;
}
+
+NS_IMETHODIMP
+nsCSSFrameConstructor::ContentStateChanged(nsIPresContext* aPresContext,
+ nsIContent* aContent)
+{
+ nsresult result = NS_OK;
+
+ nsCOMPtr
+ *
+ * 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
diff --git a/layout/base/public/nsIStyleFrameConstruction.h b/layout/base/public/nsIStyleFrameConstruction.h
index a0a4f85945b9..91c087a596b8 100644
--- a/layout/base/public/nsIStyleFrameConstruction.h
+++ b/layout/base/public/nsIStyleFrameConstruction.h
@@ -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,
diff --git a/layout/base/public/nsIStyleSet.h b/layout/base/public/nsIStyleSet.h
index a44282a87e54..28ab51d11729 100644
--- a/layout/base/public/nsIStyleSet.h
+++ b/layout/base/public/nsIStyleSet.h
@@ -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,
diff --git a/layout/base/src/nsContentList.h b/layout/base/src/nsContentList.h
index 982f157762e2..beacdfc132e5 100644
--- a/layout/base/src/nsContentList.h
+++ b/layout/base/src/nsContentList.h
@@ -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,
diff --git a/layout/base/src/nsDocument.cpp b/layout/base/src/nsDocument.cpp
index 595c46d1fbfa..cdcbc8a9647b 100644
--- a/layout/base/src/nsDocument.cpp
+++ b/layout/base/src/nsDocument.cpp
@@ -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)
diff --git a/layout/base/src/nsDocument.h b/layout/base/src/nsDocument.h
index c9c8108f84c1..d8e47f28264d 100644
--- a/layout/base/src/nsDocument.h
+++ b/layout/base/src/nsDocument.h
@@ -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);
diff --git a/layout/generic/nsImageMap.cpp b/layout/generic/nsImageMap.cpp
index 7940cc59a1c9..8cbdef1b7cbb 100644
--- a/layout/generic/nsImageMap.cpp
+++ b/layout/generic/nsImageMap.cpp
@@ -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,
diff --git a/layout/generic/nsImageMap.h b/layout/generic/nsImageMap.h
index 8713c52f9ede..f8b63670e3e5 100644
--- a/layout/generic/nsImageMap.h
+++ b/layout/generic/nsImageMap.h
@@ -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,
diff --git a/layout/html/base/src/nsImageMap.cpp b/layout/html/base/src/nsImageMap.cpp
index 7940cc59a1c9..8cbdef1b7cbb 100644
--- a/layout/html/base/src/nsImageMap.cpp
+++ b/layout/html/base/src/nsImageMap.cpp
@@ -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,
diff --git a/layout/html/base/src/nsImageMap.h b/layout/html/base/src/nsImageMap.h
index 8713c52f9ede..f8b63670e3e5 100644
--- a/layout/html/base/src/nsImageMap.h
+++ b/layout/html/base/src/nsImageMap.h
@@ -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,
diff --git a/layout/html/base/src/nsPresShell.cpp b/layout/html/base/src/nsPresShell.cpp
index d4f8424a5eaf..967e2ea8e830 100644
--- a/layout/html/base/src/nsPresShell.cpp
+++ b/layout/html/base/src/nsPresShell.cpp
@@ -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,
diff --git a/layout/html/style/src/nsCSSFrameConstructor.cpp b/layout/html/style/src/nsCSSFrameConstructor.cpp
index e12d284a368e..ca44328090d5 100644
--- a/layout/html/style/src/nsCSSFrameConstructor.cpp
+++ b/layout/html/style/src/nsCSSFrameConstructor.cpp
@@ -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;
@@ -3559,6 +3562,87 @@ nsCSSFrameConstructor::ContentChanged(nsIPresContext* aPresContext,
return rv;
}
+
+NS_IMETHODIMP
+nsCSSFrameConstructor::ContentStateChanged(nsIPresContext* aPresContext,
+ nsIContent* aContent)
+{
+ nsresult result = NS_OK;
+
+ nsCOMPtr