Bug 1357583: Add an API to get the restyle generation from the pres context. r?heycam
MozReview-Commit-ID: b7j0CpPimC
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -4029,16 +4029,28 @@ nsDOMWindowUtils::GetElementsRestyled(ui
return NS_ERROR_NOT_AVAILABLE;
}
*aResult = presContext->ElementsRestyledCount();
return NS_OK;
}
NS_IMETHODIMP
+nsDOMWindowUtils::GetRestyleGeneration(uint64_t* aResult)
+{
+ nsPresContext* presContext = GetPresContext();
+ if (!presContext) {
+ return NS_ERROR_NOT_AVAILABLE;
+ }
+
+ *aResult = presContext->GetRestyleGeneration();
+ return NS_OK;
+}
+
+NS_IMETHODIMP
nsDOMWindowUtils::GetFramesConstructed(uint64_t* aResult)
{
nsPresContext* presContext = GetPresContext();
if (!presContext) {
return NS_ERROR_NOT_AVAILABLE;
}
*aResult = presContext->FramesConstructedCount();
--- a/dom/interfaces/base/nsIDOMWindowUtils.idl
+++ b/dom/interfaces/base/nsIDOMWindowUtils.idl
@@ -1882,16 +1882,23 @@ interface nsIDOMWindowUtils : nsISupport
* than once (e.g., for an inline that contains blocks). This also
* counts restyling of pseudo-elements and anonymous boxes.
*
* May throw NS_ERROR_NOT_AVAILABLE.
*/
readonly attribute unsigned long long elementsRestyled;
/**
+ * Restyle generation for the current document.
+ *
+ * May throw NS_ERROR_NOT_AVAILABLE.
+ */
+ readonly attribute unsigned long long restyleGeneration;
+
+ /**
* Number of frames constructed (excluding breaking) for the curent
* document.
*
* May throw NS_ERROR_NOT_AVAILABLE.
*/
readonly attribute unsigned long long framesConstructed;
/**