Bug 1419221 - Introduce a new argument for getUnanimatedComputedStyle to be able to flush pending styles. r=birtles
Even with this patch, in Gecko getUnanimatedComputedStyle flushes pendings styles somehow. Also in Stylo the function flushes pending styles if the target element hasn't yet styled or Servo style data has cleared for some reasons (e.g. the element is in display:none subtree). MozReview-Commit-ID: HCizzM0JnFz
This commit is contained in:
@@ -2970,6 +2970,7 @@ NS_IMETHODIMP
|
||||
nsDOMWindowUtils::GetUnanimatedComputedStyle(nsIDOMElement* aElement,
|
||||
const nsAString& aPseudoElement,
|
||||
const nsAString& aProperty,
|
||||
int32_t aFlushType,
|
||||
nsAString& aResult)
|
||||
{
|
||||
nsCOMPtr<Element> element = do_QueryInterface(aElement);
|
||||
@@ -2984,6 +2985,20 @@ nsDOMWindowUtils::GetUnanimatedComputedStyle(nsIDOMElement* aElement,
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
switch (aFlushType) {
|
||||
case FLUSH_NONE:
|
||||
break;
|
||||
case FLUSH_STYLE: {
|
||||
nsIDocument* doc = element->GetComposedDoc();
|
||||
if (doc) {
|
||||
doc->FlushPendingNotifications(FlushType::Style);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
nsIPresShell* shell = GetPresShell();
|
||||
if (!shell) {
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
Reference in New Issue
Block a user