diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index e8170d7a2d2c..b5fe80ff25b8 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -1694,6 +1694,16 @@ nsDOMWindowUtils::FindElementWithViewId(nsViewID aID, return content ? CallQueryInterface(content, aResult) : NS_OK; } +NS_IMETHODIMP +nsDOMWindowUtils::GetViewId(nsIDOMElement* aElement, nsViewID* aResult) +{ + nsCOMPtr content = do_QueryInterface(aElement); + if (content && nsLayoutUtils::FindIDFor(content, aResult)) { + return NS_OK; + } + return NS_ERROR_NOT_AVAILABLE; +} + NS_IMETHODIMP nsDOMWindowUtils::GetScreenPixelsPerCSSPixel(float* aScreenPixels) { diff --git a/dom/interfaces/base/nsIDOMWindowUtils.idl b/dom/interfaces/base/nsIDOMWindowUtils.idl index 5f397fda534f..dffb0f9dfd94 100644 --- a/dom/interfaces/base/nsIDOMWindowUtils.idl +++ b/dom/interfaces/base/nsIDOMWindowUtils.idl @@ -42,7 +42,7 @@ interface nsIURI; interface nsIDOMEventTarget; interface nsIRunnable; -[scriptable, uuid(ff1cec22-b183-40d3-8b42-b81a2f0ba4e6)] +[scriptable, uuid(d6e733ef-492b-4e67-b723-28571c2959f0)] interface nsIDOMWindowUtils : nsISupports { /** @@ -1177,6 +1177,12 @@ interface nsIDOMWindowUtils : nsISupports { */ nsIDOMElement findElementWithViewId(in nsViewID aId); + /** + * Find the view ID for a given element. This is the reverse of + * findElementWithViewId(). + */ + nsViewID getViewId(in nsIDOMElement aElement); + /** * Checks the layer tree for this window and returns true * if all layers have transforms that are translations by integers,