Bug 1253476 - Move IsRendered to Element; r=emilio

And update the GitHub issue link at the same time since #3947 was duped to
#1837.

Differential Revision: https://phabricator.services.mozilla.com/D30326

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Brian Birtles 2019-05-20 05:22:27 +00:00
Родитель cb3c791020
Коммит 7980decbd6
2 изменённых файлов: 9 добавлений и 9 удалений

Просмотреть файл

@ -1407,6 +1407,14 @@ class Element : public FragmentOrElement {
return HasServoData() && Servo_Element_IsDisplayContents(this); return HasServoData() && Servo_Element_IsDisplayContents(this);
} }
/*
* https://html.spec.whatwg.org/#being-rendered
*
* With a gotcha for display contents:
* https://github.com/whatwg/html/issues/1837
*/
bool IsRendered() const { return GetPrimaryFrame() || IsDisplayContents(); }
const nsAttrValue* GetParsedAttr(const nsAtom* aAttr) const { const nsAttrValue* GetParsedAttr(const nsAtom* aAttr) const {
return mAttrs.GetAttr(aAttr); return mAttrs.GetAttr(aAttr);
} }

Просмотреть файл

@ -2653,14 +2653,6 @@ nsresult nsGenericHTMLElement::NewURIFromString(const nsAString& aURISpec,
return NS_OK; return NS_OK;
} }
// https://html.spec.whatwg.org/#being-rendered
//
// With a gotcha for display contents:
// https://github.com/whatwg/html/issues/3947
static bool IsRendered(const Element& aElement) {
return aElement.GetPrimaryFrame() || aElement.IsDisplayContents();
}
void nsGenericHTMLElement::GetInnerText(mozilla::dom::DOMString& aValue, void nsGenericHTMLElement::GetInnerText(mozilla::dom::DOMString& aValue,
mozilla::ErrorResult& aError) { mozilla::ErrorResult& aError) {
// innerText depends on layout. For example, white space processing is // innerText depends on layout. For example, white space processing is
@ -2715,7 +2707,7 @@ void nsGenericHTMLElement::GetInnerText(mozilla::dom::DOMString& aValue,
doc->FlushPendingNotifications(FlushType::Layout); doc->FlushPendingNotifications(FlushType::Layout);
} }
if (!IsRendered(*this)) { if (!IsRendered()) {
GetTextContentInternal(aValue, aError); GetTextContentInternal(aValue, aError);
} else { } else {
nsRange::GetInnerTextNoFlush(aValue, aError, this); nsRange::GetInnerTextNoFlush(aValue, aError, this);