| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2  * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 
| 3  *           (C) 1999 Antti Koivisto (koivisto@kde.org) | 3  *           (C) 1999 Antti Koivisto (koivisto@kde.org) | 
| 4  *           (C) 2001 Peter Kelly (pmk@post.com) | 4  *           (C) 2001 Peter Kelly (pmk@post.com) | 
| 5  *           (C) 2001 Dirk Mueller (mueller@kde.org) | 5  *           (C) 2001 Dirk Mueller (mueller@kde.org) | 
| 6  *           (C) 2007 David Smith (catfish.man@gmail.com) | 6  *           (C) 2007 David Smith (catfish.man@gmail.com) | 
| 7  * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
       All rights reserved. | 7  * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
       All rights reserved. | 
| 8  *           (C) 2007 Eric Seidel (eric@webkit.org) | 8  *           (C) 2007 Eric Seidel (eric@webkit.org) | 
| 9  * | 9  * | 
| 10  * This library is free software; you can redistribute it and/or | 10  * This library is free software; you can redistribute it and/or | 
| (...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1304             document().accessSVGExtensions()->removeElementFromPendingResources(
      this); | 1304             document().accessSVGExtensions()->removeElementFromPendingResources(
      this); | 
| 1305 | 1305 | 
| 1306         if (isUpgradedCustomElement()) | 1306         if (isUpgradedCustomElement()) | 
| 1307             CustomElement::didLeaveDocument(this, insertionPoint->document()); | 1307             CustomElement::didLeaveDocument(this, insertionPoint->document()); | 
| 1308     } | 1308     } | 
| 1309 | 1309 | 
| 1310     if (hasRareData()) | 1310     if (hasRareData()) | 
| 1311         elementRareData()->setIsInCanvasSubtree(false); | 1311         elementRareData()->setIsInCanvasSubtree(false); | 
| 1312 } | 1312 } | 
| 1313 | 1313 | 
| 1314 void Element::attach(const AttachContext& context) | 1314 void Element::createRenderTree(const AttachContext& context) | 
| 1315 { | 1315 { | 
| 1316     ASSERT(document().inStyleRecalc()); | 1316     ASSERT(document().inStyleRecalc()); | 
| 1317 | 1317 | 
| 1318     StyleResolverParentPusher parentPusher(this); | 1318     StyleResolverParentPusher parentPusher(this); | 
| 1319 | 1319 | 
| 1320     // We've already been through detach when doing a lazyAttach, but we might | 1320     // We've already been through detach when doing a scheduleRenderTreeCreation
      , but we might | 
| 1321     // need to clear any state that's been added since then. | 1321     // need to clear any state that's been added since then. | 
| 1322     if (hasRareData() && styleChangeType() == LazyAttachStyleChange) { | 1322     if (hasRareData() && styleChangeType() == DeferredRenderTreeCreationStyleCha
      nge) { | 
| 1323         ElementRareData* data = elementRareData(); | 1323         ElementRareData* data = elementRareData(); | 
| 1324         data->clearComputedStyle(); | 1324         data->clearComputedStyle(); | 
| 1325         data->resetDynamicRestyleObservations(); | 1325         data->resetDynamicRestyleObservations(); | 
| 1326         if (!context.resolvedStyle) | 1326         if (!context.resolvedStyle) | 
| 1327             data->resetStyleState(); | 1327             data->resetStyleState(); | 
| 1328     } | 1328     } | 
| 1329 | 1329 | 
| 1330     NodeRenderingContext(this, context.resolvedStyle).createRendererForElementIf
      Needed(); | 1330     NodeRenderingContext(this, context.resolvedStyle).createRendererForElementIf
      Needed(); | 
| 1331 | 1331 | 
| 1332     createPseudoElementIfNeeded(BEFORE); | 1332     createPseudoElementIfNeeded(BEFORE); | 
| 1333 | 1333 | 
| 1334     // When a shadow root exists, it does the work of attaching the children. | 1334     // When a shadow root exists, it does the work of attaching the children. | 
| 1335     if (ElementShadow* shadow = this->shadow()) { | 1335     if (ElementShadow* shadow = this->shadow()) { | 
| 1336         parentPusher.push(); | 1336         parentPusher.push(); | 
| 1337         shadow->attach(context); | 1337         shadow->createRenderTree(context); | 
| 1338     } else if (firstChild()) | 1338     } else if (firstChild()) | 
| 1339         parentPusher.push(); | 1339         parentPusher.push(); | 
| 1340 | 1340 | 
| 1341     ContainerNode::attach(context); | 1341     ContainerNode::createRenderTree(context); | 
| 1342 | 1342 | 
| 1343     createPseudoElementIfNeeded(AFTER); | 1343     createPseudoElementIfNeeded(AFTER); | 
| 1344     createPseudoElementIfNeeded(BACKDROP); | 1344     createPseudoElementIfNeeded(BACKDROP); | 
| 1345 | 1345 | 
| 1346     if (hasRareData()) { | 1346     if (hasRareData()) { | 
| 1347         ElementRareData* data = elementRareData(); | 1347         ElementRareData* data = elementRareData(); | 
| 1348         if (data->needsFocusAppearanceUpdateSoonAfterAttach()) { | 1348         if (data->needsFocusAppearanceUpdateSoonAfterAttach()) { | 
| 1349             if (isFocusable() && document().focusedElement() == this) | 1349             if (isFocusable() && document().focusedElement() == this) | 
| 1350                 document().updateFocusAppearanceSoon(false /* don't restore sele
      ction */); | 1350                 document().updateFocusAppearanceSoon(false /* don't restore sele
      ction */); | 
| 1351             data->setNeedsFocusAppearanceUpdateSoonAfterAttach(false); | 1351             data->setNeedsFocusAppearanceUpdateSoonAfterAttach(false); | 
| 1352         } | 1352         } | 
| 1353     } | 1353     } | 
| 1354 | 1354 | 
| 1355     InspectorInstrumentation::didRecalculateStyleForElement(this); | 1355     InspectorInstrumentation::didRecalculateStyleForElement(this); | 
| 1356 } | 1356 } | 
| 1357 | 1357 | 
| 1358 void Element::unregisterNamedFlowContentNode() | 1358 void Element::unregisterNamedFlowContentNode() | 
| 1359 { | 1359 { | 
| 1360     if (RuntimeEnabledFeatures::cssRegionsEnabled() && inNamedFlow() && document
      ().renderView()) | 1360     if (RuntimeEnabledFeatures::cssRegionsEnabled() && inNamedFlow() && document
      ().renderView()) | 
| 1361         document().renderView()->flowThreadController()->unregisterNamedFlowCont
      entNode(this); | 1361         document().renderView()->flowThreadController()->unregisterNamedFlowCont
      entNode(this); | 
| 1362 } | 1362 } | 
| 1363 | 1363 | 
| 1364 void Element::detach(const AttachContext& context) | 1364 void Element::destroyRenderTree(const AttachContext& context) | 
| 1365 { | 1365 { | 
| 1366     WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates; | 1366     WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates; | 
| 1367     unregisterNamedFlowContentNode(); | 1367     unregisterNamedFlowContentNode(); | 
| 1368     cancelFocusAppearanceUpdate(); | 1368     cancelFocusAppearanceUpdate(); | 
| 1369     if (hasRareData()) { | 1369     if (hasRareData()) { | 
| 1370         ElementRareData* data = elementRareData(); | 1370         ElementRareData* data = elementRareData(); | 
| 1371         data->setPseudoElement(BEFORE, 0); | 1371         data->setPseudoElement(BEFORE, 0); | 
| 1372         data->setPseudoElement(AFTER, 0); | 1372         data->setPseudoElement(AFTER, 0); | 
| 1373         data->setPseudoElement(BACKDROP, 0); | 1373         data->setPseudoElement(BACKDROP, 0); | 
| 1374         data->clearComputedStyle(); | 1374         data->clearComputedStyle(); | 
| 1375         data->resetDynamicRestyleObservations(); | 1375         data->resetDynamicRestyleObservations(); | 
| 1376         data->setIsInsideRegion(false); | 1376         data->setIsInsideRegion(false); | 
| 1377 | 1377 | 
| 1378         // Only clear the style state if we're not going to reuse the style from
       recalcStyle. | 1378         // Only clear the style state if we're not going to reuse the style from
       recalcStyle. | 
| 1379         if (!context.resolvedStyle) | 1379         if (!context.resolvedStyle) | 
| 1380             data->resetStyleState(); | 1380             data->resetStyleState(); | 
| 1381 | 1381 | 
| 1382         if (RuntimeEnabledFeatures::webAnimationsCSSEnabled() && !context.perfor
      mingReattach) { | 1382         if (RuntimeEnabledFeatures::webAnimationsCSSEnabled() && !context.recons
      tructingRenderTree) { | 
| 1383             if (ActiveAnimations* activeAnimations = data->activeAnimations()) | 1383             if (ActiveAnimations* activeAnimations = data->activeAnimations()) | 
| 1384                 activeAnimations->cssAnimations()->cancel(); | 1384                 activeAnimations->cssAnimations()->cancel(); | 
| 1385         } | 1385         } | 
| 1386     } | 1386     } | 
| 1387     if (ElementShadow* shadow = this->shadow()) | 1387     if (ElementShadow* shadow = this->shadow()) | 
| 1388         shadow->detach(context); | 1388         shadow->destroyRenderTree(context); | 
| 1389     ContainerNode::detach(context); | 1389     ContainerNode::destroyRenderTree(context); | 
| 1390 } | 1390 } | 
| 1391 | 1391 | 
| 1392 bool Element::pseudoStyleCacheIsInvalid(const RenderStyle* currentStyle, RenderS
      tyle* newStyle) | 1392 bool Element::pseudoStyleCacheIsInvalid(const RenderStyle* currentStyle, RenderS
      tyle* newStyle) | 
| 1393 { | 1393 { | 
| 1394     ASSERT(currentStyle == renderStyle()); | 1394     ASSERT(currentStyle == renderStyle()); | 
| 1395     ASSERT(renderer()); | 1395     ASSERT(renderer()); | 
| 1396 | 1396 | 
| 1397     if (!currentStyle) | 1397     if (!currentStyle) | 
| 1398         return false; | 1398         return false; | 
| 1399 | 1399 | 
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1477     ASSERT(document().inStyleRecalc()); | 1477     ASSERT(document().inStyleRecalc()); | 
| 1478 | 1478 | 
| 1479     CSSAnimationUpdateScope cssAnimationUpdateScope(this); | 1479     CSSAnimationUpdateScope cssAnimationUpdateScope(this); | 
| 1480     RefPtr<RenderStyle> oldStyle = renderStyle(); | 1480     RefPtr<RenderStyle> oldStyle = renderStyle(); | 
| 1481     RefPtr<RenderStyle> newStyle = styleForRenderer(); | 1481     RefPtr<RenderStyle> newStyle = styleForRenderer(); | 
| 1482     StyleRecalcChange localChange = RenderStyle::compare(oldStyle.get(), newStyl
      e.get()); | 1482     StyleRecalcChange localChange = RenderStyle::compare(oldStyle.get(), newStyl
      e.get()); | 
| 1483 | 1483 | 
| 1484     if (localChange == Reattach) { | 1484     if (localChange == Reattach) { | 
| 1485         AttachContext reattachContext; | 1485         AttachContext reattachContext; | 
| 1486         reattachContext.resolvedStyle = newStyle.get(); | 1486         reattachContext.resolvedStyle = newStyle.get(); | 
| 1487         reattach(reattachContext); | 1487         recreateRenderTree(reattachContext); | 
| 1488         return Reattach; | 1488         return Reattach; | 
| 1489     } | 1489     } | 
| 1490 | 1490 | 
| 1491     InspectorInstrumentation::didRecalculateStyleForElement(this); | 1491     InspectorInstrumentation::didRecalculateStyleForElement(this); | 
| 1492 | 1492 | 
| 1493     if (RenderObject* renderer = this->renderer()) { | 1493     if (RenderObject* renderer = this->renderer()) { | 
| 1494         if (localChange != NoChange || pseudoStyleCacheIsInvalid(oldStyle.get(),
       newStyle.get()) || (change == Force && renderer->requiresForcedStyleRecalcPropa
      gation()) || shouldNotifyRendererWithIdenticalStyles()) { | 1494         if (localChange != NoChange || pseudoStyleCacheIsInvalid(oldStyle.get(),
       newStyle.get()) || (change == Force && renderer->requiresForcedStyleRecalcPropa
      gation()) || shouldNotifyRendererWithIdenticalStyles()) { | 
| 1495             renderer->setAnimatableStyle(newStyle.get()); | 1495             renderer->setAnimatableStyle(newStyle.get()); | 
| 1496         } else if (needsStyleRecalc()) { | 1496         } else if (needsStyleRecalc()) { | 
| 1497             // Although no change occurred, we use the new style so that the cou
      sin style sharing code won't get | 1497             // Although no change occurred, we use the new style so that the cou
      sin style sharing code won't get | 
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1539     bool forceCheckOfAnyElementSibling = false; | 1539     bool forceCheckOfAnyElementSibling = false; | 
| 1540     bool forceReattachOfAnyWhitespaceSibling = false; | 1540     bool forceReattachOfAnyWhitespaceSibling = false; | 
| 1541     for (Node* child = firstChild(); child; child = child->nextSibling()) { | 1541     for (Node* child = firstChild(); child; child = child->nextSibling()) { | 
| 1542         bool didReattach = false; | 1542         bool didReattach = false; | 
| 1543 | 1543 | 
| 1544         if (child->renderer()) | 1544         if (child->renderer()) | 
| 1545             forceReattachOfAnyWhitespaceSibling = false; | 1545             forceReattachOfAnyWhitespaceSibling = false; | 
| 1546 | 1546 | 
| 1547         if (child->isTextNode()) { | 1547         if (child->isTextNode()) { | 
| 1548             if (forceReattachOfAnyWhitespaceSibling && toText(child)->containsOn
      lyWhitespace()) | 1548             if (forceReattachOfAnyWhitespaceSibling && toText(child)->containsOn
      lyWhitespace()) | 
| 1549                 child->reattach(); | 1549                 child->recreateRenderTree(); | 
| 1550             else | 1550             else | 
| 1551                 didReattach = toText(child)->recalcTextStyle(change); | 1551                 didReattach = toText(child)->recalcTextStyle(change); | 
| 1552         } else if (child->isElementNode()) { | 1552         } else if (child->isElementNode()) { | 
| 1553             Element* element = toElement(child); | 1553             Element* element = toElement(child); | 
| 1554 | 1554 | 
| 1555             bool childRulesChanged = element->needsStyleRecalc() && element->sty
      leChangeType() >= SubtreeStyleChange; | 1555             bool childRulesChanged = element->needsStyleRecalc() && element->sty
      leChangeType() >= SubtreeStyleChange; | 
| 1556 | 1556 | 
| 1557             if (forceCheckOfNextElementSibling || forceCheckOfAnyElementSibling) | 1557             if (forceCheckOfNextElementSibling || forceCheckOfAnyElementSibling) | 
| 1558                 element->setNeedsStyleRecalc(); | 1558                 element->setNeedsStyleRecalc(); | 
| 1559 | 1559 | 
| (...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2479     return true; | 2479     return true; | 
| 2480 } | 2480 } | 
| 2481 | 2481 | 
| 2482 void Element::createPseudoElement(PseudoId pseudoId) | 2482 void Element::createPseudoElement(PseudoId pseudoId) | 
| 2483 { | 2483 { | 
| 2484     ASSERT(needsPseudoElement(pseudoId)); | 2484     ASSERT(needsPseudoElement(pseudoId)); | 
| 2485     ASSERT(!isPseudoElement()); | 2485     ASSERT(!isPseudoElement()); | 
| 2486     RefPtr<PseudoElement> element = PseudoElement::create(this, pseudoId); | 2486     RefPtr<PseudoElement> element = PseudoElement::create(this, pseudoId); | 
| 2487     if (pseudoId == BACKDROP) | 2487     if (pseudoId == BACKDROP) | 
| 2488         document().addToTopLayer(element.get(), this); | 2488         document().addToTopLayer(element.get(), this); | 
| 2489     element->attach(); | 2489     element->createRenderTree(); | 
| 2490 | 2490 | 
| 2491     ensureElementRareData()->setPseudoElement(pseudoId, element.release()); | 2491     ensureElementRareData()->setPseudoElement(pseudoId, element.release()); | 
| 2492 } | 2492 } | 
| 2493 | 2493 | 
| 2494 PseudoElement* Element::pseudoElement(PseudoId pseudoId) const | 2494 PseudoElement* Element::pseudoElement(PseudoId pseudoId) const | 
| 2495 { | 2495 { | 
| 2496     return hasRareData() ? elementRareData()->pseudoElement(pseudoId) : 0; | 2496     return hasRareData() ? elementRareData()->pseudoElement(pseudoId) : 0; | 
| 2497 } | 2497 } | 
| 2498 | 2498 | 
| 2499 RenderObject* Element::pseudoElementRenderer(PseudoId pseudoId) const | 2499 RenderObject* Element::pseudoElementRenderer(PseudoId pseudoId) const | 
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2628 } | 2628 } | 
| 2629 | 2629 | 
| 2630 void Element::setIsInTopLayer(bool inTopLayer) | 2630 void Element::setIsInTopLayer(bool inTopLayer) | 
| 2631 { | 2631 { | 
| 2632     if (isInTopLayer() == inTopLayer) | 2632     if (isInTopLayer() == inTopLayer) | 
| 2633         return; | 2633         return; | 
| 2634     ensureElementRareData()->setIsInTopLayer(inTopLayer); | 2634     ensureElementRareData()->setIsInTopLayer(inTopLayer); | 
| 2635 | 2635 | 
| 2636     // We must ensure a reattach occurs so the renderer is inserted in the corre
      ct sibling order under RenderView according to its | 2636     // We must ensure a reattach occurs so the renderer is inserted in the corre
      ct sibling order under RenderView according to its | 
| 2637     // top layer position, or in its usual place if not in the top layer. | 2637     // top layer position, or in its usual place if not in the top layer. | 
| 2638     lazyReattachIfAttached(); | 2638     scheduleRenderTreeRecreationIfAttached(); | 
| 2639 } | 2639 } | 
| 2640 | 2640 | 
| 2641 void Element::webkitRequestPointerLock() | 2641 void Element::webkitRequestPointerLock() | 
| 2642 { | 2642 { | 
| 2643     if (document().page()) | 2643     if (document().page()) | 
| 2644         document().page()->pointerLockController().requestPointerLock(this); | 2644         document().page()->pointerLockController().requestPointerLock(this); | 
| 2645 } | 2645 } | 
| 2646 | 2646 | 
| 2647 SpellcheckAttributeState Element::spellcheckAttributeState() const | 2647 SpellcheckAttributeState Element::spellcheckAttributeState() const | 
| 2648 { | 2648 { | 
| (...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3642     return 0; | 3642     return 0; | 
| 3643 } | 3643 } | 
| 3644 | 3644 | 
| 3645 Attribute* UniqueElementData::attributeItem(unsigned index) | 3645 Attribute* UniqueElementData::attributeItem(unsigned index) | 
| 3646 { | 3646 { | 
| 3647     ASSERT_WITH_SECURITY_IMPLICATION(index < length()); | 3647     ASSERT_WITH_SECURITY_IMPLICATION(index < length()); | 
| 3648     return &m_attributeVector.at(index); | 3648     return &m_attributeVector.at(index); | 
| 3649 } | 3649 } | 
| 3650 | 3650 | 
| 3651 } // namespace WebCore | 3651 } // namespace WebCore | 
| OLD | NEW | 
|---|