Bug 1367306 part 1 - Add an attribute in nsIDOMWindowUtils to check whether the document is styled by stylo. r?bholley
MozReview-Commit-ID: 6ed78DkzmT8
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -4337,16 +4337,24 @@ nsDOMWindowUtils::GetDirectionFromText(c
break;
case eDir_Auto:
MOZ_ASSERT_UNREACHABLE("GetDirectionFromText should never return this value");
return NS_ERROR_FAILURE;
}
return NS_OK;
}
+NS_IMETHODIMP
+nsDOMWindowUtils::GetIsStyledByServo(bool* aStyledByServo)
+{
+ nsIDocument* doc = GetDocument();
+ *aStyledByServo = doc && doc->IsStyledByServo();
+ return NS_OK;
+}
+
NS_INTERFACE_MAP_BEGIN(nsTranslationNodeList)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRY(nsITranslationNodeList)
NS_INTERFACE_MAP_END
NS_IMPL_ADDREF(nsTranslationNodeList)
NS_IMPL_RELEASE(nsTranslationNodeList)
--- a/dom/interfaces/base/nsIDOMWindowUtils.idl
+++ b/dom/interfaces/base/nsIDOMWindowUtils.idl
@@ -2021,16 +2021,23 @@ interface nsIDOMWindowUtils : nsISupport
* algorithm defined in http://unicode.org/reports/tr9/#P2.
*
* @param aString the string to retrieve the direction for.
* @return one of DIRECTION_LTR, DIRECTION_RTL or DIRECTION_NOT_SET depending
* on the first-strong character found in the string.
*/
long getDirectionFromText(in AString aString);
+ /**
+ * Whether the current document is styled by Servo's style engine.
+ *
+ * This calls nsIDocument::IsStyledByServo().
+ */
+ readonly attribute boolean isStyledByServo;
+
// These consts are only for testing purposes.
const long DEFAULT_MOUSE_POINTER_ID = 0;
const long DEFAULT_PEN_POINTER_ID = 1;
const long DEFAULT_TOUCH_POINTER_ID = 2;
// Match WidgetMouseEventBase::buttonType.
const long MOUSE_BUTTON_LEFT_BUTTON = 0;
const long MOUSE_BUTTON_MIDDLE_BUTTON = 1;