CheckForVisibilityChangeOnRecalcStyle(Element* element, const RenderStyle* currentStyle) : m_element(element) , m_previousDisplay(currentStyle ? currentStyle->display() : NONE) , m_previousVisibility(currentStyle ? currentStyle->visibility() : HIDDEN) , m_previousImplicitVisibility(WKObservingContentChanges() && WKObservedContentChange() != WKContentVisibilityChange ? elementImplicitVisibility(element) : VISIBLE) { }
CheckForVisibilityChange::CheckForVisibilityChange(const Element& element) : m_element(element) , m_previousDisplay(element.renderStyle() ? element.renderStyle()->display() : NONE) , m_previousVisibility(element.renderStyle() ? element.renderStyle()->visibility() : HIDDEN) , m_previousImplicitVisibility(WKObservingContentChanges() && WKObservedContentChange() != WKContentVisibilityChange ? elementImplicitVisibility(element) : VISIBLE) { }
~CheckForVisibilityChangeOnRecalcStyle() { if (!WKObservingContentChanges()) return; RenderStyle* style = m_element->renderStyle(); if (!style) return; if ((m_previousDisplay == NONE && style->display() != NONE) || (m_previousVisibility == HIDDEN && style->visibility() != HIDDEN) || (m_previousImplicitVisibility == HIDDEN && elementImplicitVisibility(m_element.get()) == VISIBLE)) WKSetObservedContentChange(WKContentVisibilityChange); }
CheckForVisibilityChange::~CheckForVisibilityChange() { if (!WKObservingContentChanges()) return; if (m_element.isInUserAgentShadowTree()) return; auto* style = m_element.renderStyle(); if (!style) return; if ((m_previousDisplay == NONE && style->display() != NONE) || (m_previousVisibility == HIDDEN && style->visibility() != HIDDEN) || (m_previousImplicitVisibility == HIDDEN && elementImplicitVisibility(m_element) == VISIBLE)) WKSetObservedContentChange(WKContentVisibilityChange); }