Don't call methods that may flush in nsRange::GetInnerTextNoFlush.

Follow-up to 0059ff300306742bd0a78899566f056704e9039b
This commit is contained in:
Pale Moon
2017-04-21 23:16:52 +02:00
committed by roytam1
parent 0ab115fe75
commit 981237edb6
+5 -4
View File
@@ -3187,13 +3187,14 @@ IsVisibleAndNotInReplacedElement(nsIFrame* aFrame)
}
static bool
ElementIsVisible(Element* aElement)
ElementIsVisibleNoFlush(Element* aElement)
{
if (!aElement) {
return false;
}
nsRefPtr<nsStyleContext> sc = nsComputedDOMStyle::GetStyleContextForElement(
aElement, nullptr, nullptr);
nsRefPtr<nsStyleContext> sc =
nsComputedDOMStyle::GetStyleContextForElementNoFlush(aElement, nullptr,
nullptr);
return sc && sc->StyleVisibility()->IsVisible();
}
@@ -3321,7 +3322,7 @@ nsRange::GetInnerTextNoFlush(DOMString& aValue, ErrorResult& aError,
if (currentState == AT_NODE) {
bool isText = currentNode->IsNodeOfType(nsINode::eTEXT);
if (isText && currentNode->GetParent()->IsHTML(nsGkAtoms::rp) &&
ElementIsVisible(currentNode->GetParent()->AsElement())) {
ElementIsVisibleNoFlush(currentNode->GetParent()->AsElement())) {
nsAutoString str;
currentNode->GetTextContent(str, aError);
result.Append(str);