void SVGUseElement::invalidateShadowTree() { if (!inActiveDocument() || m_needsShadowTreeRecreation) return; clearInstanceRoot(); scheduleShadowTreeRecreation(); invalidateDependentShadowTrees(); }
void ShadowRoot::insertedInto(ContainerNode* insertionPoint) { DocumentFragment::insertedInto(insertionPoint); if (inActiveDocument()) document().styleEngine()->addTreeScope(*this); if (ShadowRoot* root = host()->containingShadowRoot()) root->addChildShadowRoot(); }
void Element::willModifyAttribute(const QualifiedName& name, const AtomicString& oldValue, const AtomicString& newValue) { if (name == HTMLNames::idAttr) updateId(oldValue, newValue); if (inActiveDocument() && styleChangeType() < SubtreeStyleChange && affectedByAttributeSelector(name.localName())) setNeedsStyleRecalc(LocalStyleChange); if (OwnPtr<MutationObserverInterestGroup> recipients = MutationObserverInterestGroup::createForAttributesMutation(*this, name)) recipients->enqueueMutationRecord(MutationRecord::createAttributes(this, name, oldValue)); }
void Element::classAttributeChanged(const AtomicString& newClassString) { bool testShouldInvalidateStyle = inActiveDocument() && styleChangeType() < SubtreeStyleChange; ASSERT(elementData()); const SpaceSplitString oldClasses = elementData()->classNames(); elementData()->setClass(newClassString, false); const SpaceSplitString& newClasses = elementData()->classNames(); if (testShouldInvalidateStyle && classChangeNeedsStyleRecalc(oldClasses, newClasses)) setNeedsStyleRecalc(LocalStyleChange); if (!newClasses.size()) elementData()->clearClass(); }
void ShadowRoot::removedFrom(ContainerNode* insertionPoint) { ShadowRoot* root = host()->containingShadowRoot(); if (!root) root = insertionPoint->containingShadowRoot(); if (root) root->removeChildShadowRoot(); if (inActiveDocument()) document().styleEngine()->removeTreeScope(*this); DocumentFragment::removedFrom(insertionPoint); }
void Text::updateTextRenderer(unsigned offsetOfReplacedData, unsigned lengthOfReplacedData, RecalcStyleBehavior recalcStyleBehavior) { if (!inActiveDocument()) return; RenderText* textRenderer = renderer(); if (!textRenderer || !textRendererIsNeeded(*textRenderer->style(), *textRenderer->parent())) { lazyReattachIfAttached(); // FIXME: Editing should be updated so this is not neccesary. if (recalcStyleBehavior == DeprecatedRecalcStyleImmediatlelyForEditing) document().updateRenderTreeIfNeeded(); return; } textRenderer->setTextWithOffset(dataImpl(), offsetOfReplacedData, lengthOfReplacedData); }
void Text::updateTextLayoutObject(unsigned offsetOfReplacedData, unsigned lengthOfReplacedData, RecalcStyleBehavior recalcStyleBehavior) { if (!inActiveDocument()) return; LayoutText* textLayoutObject = layoutObject(); if (shouldUpdateLayoutByReattaching(*this, textLayoutObject)) { lazyReattachIfAttached(); // FIXME: Editing should be updated so this is not neccesary. if (recalcStyleBehavior == DeprecatedRecalcStyleImmediatlelyForEditing) document().updateLayoutTree(); return; } textLayoutObject->setTextWithOffset(dataImpl(), offsetOfReplacedData, lengthOfReplacedData); }
RenderStyle* Element::computedStyle() { // FIXME: Find and use the renderer from the pseudo element instead of the actual element so that the 'length' // properties, which are only known by the renderer because it did the layout, will be correct and so that the // values returned for the ":selection" pseudo-element will be correct. if (RenderStyle* usedStyle = renderStyle()) return usedStyle; if (!inActiveDocument()) // FIXME: Try to do better than this. Ensure that styleForElement() works for elements that are not in the // document tree and figure out when to destroy the computed style for such elements. return 0; ElementRareData& rareData = ensureElementRareData(); if (!rareData.computedStyle()) { RenderStyle* parentStyle = parentNode() ? parentNode()->computedStyle() : 0; rareData.setComputedStyle(document().styleResolver().styleForElement(this, parentStyle)); } return rareData.computedStyle(); }
void Element::attributeChanged(const QualifiedName& name, const AtomicString& newValue, AttributeModificationReason reason) { bool testShouldInvalidateStyle = inActiveDocument() && styleChangeType() < SubtreeStyleChange; if (isStyledElement() && name == HTMLNames::styleAttr) { styleAttributeChanged(newValue); } if (name == HTMLNames::idAttr) { AtomicString oldId = elementData()->idForStyleResolution(); AtomicString newId = newValue; if (newId != oldId) { elementData()->setIdForStyleResolution(newId); if (testShouldInvalidateStyle && (affectedByIdSelector(oldId) || affectedByIdSelector(newId))) setNeedsStyleRecalc(LocalStyleChange); } } else if (name == HTMLNames::classAttr) { classAttributeChanged(newValue); } }
bool HTMLFormControlElementWithState::shouldSaveAndRestoreFormControlState() const { // We don't save/restore control state in a form with autocomplete=off. return inActiveDocument() && shouldAutocomplete(); }