| 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 } | 198 } |
| 199 #endif | 199 #endif |
| 200 | 200 |
| 201 if (PropertySetCSSStyleDeclaration* cssomWrapper = inlineStyleCSSOMWrapper()
) | 201 if (PropertySetCSSStyleDeclaration* cssomWrapper = inlineStyleCSSOMWrapper()
) |
| 202 cssomWrapper->clearParentElement(); | 202 cssomWrapper->clearParentElement(); |
| 203 | 203 |
| 204 if (hasRareData()) { | 204 if (hasRareData()) { |
| 205 ElementRareData* data = elementRareData(); | 205 ElementRareData* data = elementRareData(); |
| 206 data->setPseudoElement(BEFORE, 0); | 206 data->setPseudoElement(BEFORE, 0); |
| 207 data->setPseudoElement(AFTER, 0); | 207 data->setPseudoElement(AFTER, 0); |
| 208 data->setPseudoElement(BACKDROP, 0); |
| 208 data->clearShadow(); | 209 data->clearShadow(); |
| 209 } | 210 } |
| 210 | 211 |
| 211 if (isCustomElement() && document() && document()->registry()) { | 212 if (isCustomElement() && document() && document()->registry()) { |
| 212 document()->registry()->customElementWasDestroyed(this); | 213 document()->registry()->customElementWasDestroyed(this); |
| 213 } | 214 } |
| 214 | 215 |
| 215 if (hasSyntheticAttrChildNodes()) | 216 if (hasSyntheticAttrChildNodes()) |
| 216 detachAllAttrNodesFromElement(); | 217 detachAllAttrNodesFromElement(); |
| 217 | 218 |
| (...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1285 void Element::removedFrom(ContainerNode* insertionPoint) | 1286 void Element::removedFrom(ContainerNode* insertionPoint) |
| 1286 { | 1287 { |
| 1287 bool wasInDocument = insertionPoint->document(); | 1288 bool wasInDocument = insertionPoint->document(); |
| 1288 | 1289 |
| 1289 if (Element* before = pseudoElement(BEFORE)) | 1290 if (Element* before = pseudoElement(BEFORE)) |
| 1290 before->removedFrom(insertionPoint); | 1291 before->removedFrom(insertionPoint); |
| 1291 | 1292 |
| 1292 if (Element* after = pseudoElement(AFTER)) | 1293 if (Element* after = pseudoElement(AFTER)) |
| 1293 after->removedFrom(insertionPoint); | 1294 after->removedFrom(insertionPoint); |
| 1294 | 1295 |
| 1296 if (Element* backdrop = pseudoElement(BACKDROP)) |
| 1297 backdrop->removedFrom(insertionPoint); |
| 1295 document()->removeFromTopLayer(this); | 1298 document()->removeFromTopLayer(this); |
| 1299 |
| 1296 if (containsFullScreenElement()) | 1300 if (containsFullScreenElement()) |
| 1297 setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(false); | 1301 setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(false); |
| 1298 | 1302 |
| 1299 if (document()->page()) | 1303 if (document()->page()) |
| 1300 document()->page()->pointerLockController()->elementRemoved(this); | 1304 document()->page()->pointerLockController()->elementRemoved(this); |
| 1301 | 1305 |
| 1302 setSavedLayerScrollOffset(IntSize()); | 1306 setSavedLayerScrollOffset(IntSize()); |
| 1303 | 1307 |
| 1304 if (insertionPoint->isInTreeScope() && treeScope() == document()) { | 1308 if (insertionPoint->isInTreeScope() && treeScope() == document()) { |
| 1305 const AtomicString& idValue = getIdAttribute(); | 1309 const AtomicString& idValue = getIdAttribute(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1343 // When a shadow root exists, it does the work of attaching the children. | 1347 // When a shadow root exists, it does the work of attaching the children. |
| 1344 if (ElementShadow* shadow = this->shadow()) { | 1348 if (ElementShadow* shadow = this->shadow()) { |
| 1345 parentPusher.push(); | 1349 parentPusher.push(); |
| 1346 shadow->attach(context); | 1350 shadow->attach(context); |
| 1347 } else if (firstChild()) | 1351 } else if (firstChild()) |
| 1348 parentPusher.push(); | 1352 parentPusher.push(); |
| 1349 | 1353 |
| 1350 ContainerNode::attach(context); | 1354 ContainerNode::attach(context); |
| 1351 | 1355 |
| 1352 createPseudoElementIfNeeded(AFTER); | 1356 createPseudoElementIfNeeded(AFTER); |
| 1357 createPseudoElementIfNeeded(BACKDROP); |
| 1353 | 1358 |
| 1354 if (hasRareData()) { | 1359 if (hasRareData()) { |
| 1355 ElementRareData* data = elementRareData(); | 1360 ElementRareData* data = elementRareData(); |
| 1356 if (data->needsFocusAppearanceUpdateSoonAfterAttach()) { | 1361 if (data->needsFocusAppearanceUpdateSoonAfterAttach()) { |
| 1357 if (isFocusable() && document()->focusedNode() == this) | 1362 if (isFocusable() && document()->focusedNode() == this) |
| 1358 document()->updateFocusAppearanceSoon(false /* don't restore sel
ection */); | 1363 document()->updateFocusAppearanceSoon(false /* don't restore sel
ection */); |
| 1359 data->setNeedsFocusAppearanceUpdateSoonAfterAttach(false); | 1364 data->setNeedsFocusAppearanceUpdateSoonAfterAttach(false); |
| 1360 } | 1365 } |
| 1361 } | 1366 } |
| 1362 | 1367 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1375 | 1380 |
| 1376 void Element::detach(const AttachContext& context) | 1381 void Element::detach(const AttachContext& context) |
| 1377 { | 1382 { |
| 1378 WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates; | 1383 WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates; |
| 1379 unregisterNamedFlowContentNode(); | 1384 unregisterNamedFlowContentNode(); |
| 1380 cancelFocusAppearanceUpdate(); | 1385 cancelFocusAppearanceUpdate(); |
| 1381 if (hasRareData()) { | 1386 if (hasRareData()) { |
| 1382 ElementRareData* data = elementRareData(); | 1387 ElementRareData* data = elementRareData(); |
| 1383 data->setPseudoElement(BEFORE, 0); | 1388 data->setPseudoElement(BEFORE, 0); |
| 1384 data->setPseudoElement(AFTER, 0); | 1389 data->setPseudoElement(AFTER, 0); |
| 1390 data->setPseudoElement(BACKDROP, 0); |
| 1385 data->setIsInCanvasSubtree(false); | 1391 data->setIsInCanvasSubtree(false); |
| 1386 data->resetComputedStyle(); | 1392 data->resetComputedStyle(); |
| 1387 data->resetDynamicRestyleObservations(); | 1393 data->resetDynamicRestyleObservations(); |
| 1388 data->setIsInsideRegion(false); | 1394 data->setIsInsideRegion(false); |
| 1389 } | 1395 } |
| 1390 if (ElementShadow* shadow = this->shadow()) | 1396 if (ElementShadow* shadow = this->shadow()) |
| 1391 shadow->detach(context); | 1397 shadow->detach(context); |
| 1392 ContainerNode::detach(context); | 1398 ContainerNode::detach(context); |
| 1393 } | 1399 } |
| 1394 | 1400 |
| (...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2411 // when RenderObject::isChildAllowed on our parent returns false for the | 2417 // when RenderObject::isChildAllowed on our parent returns false for the |
| 2412 // PseudoElement's renderer for each style recalc. | 2418 // PseudoElement's renderer for each style recalc. |
| 2413 if (!renderer() || !pseudoElementRendererIsNeeded(renderer()->getCachedP
seudoStyle(pseudoId))) | 2419 if (!renderer() || !pseudoElementRendererIsNeeded(renderer()->getCachedP
seudoStyle(pseudoId))) |
| 2414 elementRareData()->setPseudoElement(pseudoId, 0); | 2420 elementRareData()->setPseudoElement(pseudoId, 0); |
| 2415 } else if (change >= Inherit || needsStyleRecalc()) | 2421 } else if (change >= Inherit || needsStyleRecalc()) |
| 2416 createPseudoElementIfNeeded(pseudoId); | 2422 createPseudoElementIfNeeded(pseudoId); |
| 2417 } | 2423 } |
| 2418 | 2424 |
| 2419 void Element::createPseudoElementIfNeeded(PseudoId pseudoId) | 2425 void Element::createPseudoElementIfNeeded(PseudoId pseudoId) |
| 2420 { | 2426 { |
| 2421 if (!document()->styleSheetCollection()->usesBeforeAfterRules()) | 2427 if ((pseudoId == BEFORE || pseudoId == AFTER) && !document()->styleSheetColl
ection()->usesBeforeAfterRules()) |
| 2428 return; |
| 2429 |
| 2430 if (pseudoId == BACKDROP && !isInTopLayer()) |
| 2422 return; | 2431 return; |
| 2423 | 2432 |
| 2424 if (!renderer() || !pseudoElementRendererIsNeeded(renderer()->getCachedPseud
oStyle(pseudoId))) | 2433 if (!renderer() || !pseudoElementRendererIsNeeded(renderer()->getCachedPseud
oStyle(pseudoId))) |
| 2425 return; | 2434 return; |
| 2426 | 2435 |
| 2427 if (!renderer()->canHaveGeneratedChildren()) | 2436 if (!renderer()->canHaveGeneratedChildren()) |
| 2428 return; | 2437 return; |
| 2429 | 2438 |
| 2430 ASSERT(!isPseudoElement()); | 2439 ASSERT(!isPseudoElement()); |
| 2431 RefPtr<PseudoElement> element = PseudoElement::create(this, pseudoId); | 2440 RefPtr<PseudoElement> element = PseudoElement::create(this, pseudoId); |
| 2441 if (pseudoId == BACKDROP) |
| 2442 document()->addToTopLayer(element.get(), this); |
| 2432 element->attach(); | 2443 element->attach(); |
| 2444 |
| 2433 ensureElementRareData()->setPseudoElement(pseudoId, element.release()); | 2445 ensureElementRareData()->setPseudoElement(pseudoId, element.release()); |
| 2434 } | 2446 } |
| 2435 | 2447 |
| 2436 PseudoElement* Element::pseudoElement(PseudoId pseudoId) const | 2448 PseudoElement* Element::pseudoElement(PseudoId pseudoId) const |
| 2437 { | 2449 { |
| 2438 return hasRareData() ? elementRareData()->pseudoElement(pseudoId) : 0; | 2450 return hasRareData() ? elementRareData()->pseudoElement(pseudoId) : 0; |
| 2439 } | 2451 } |
| 2440 | 2452 |
| 2441 RenderObject* Element::pseudoElementRenderer(PseudoId pseudoId) const | 2453 RenderObject* Element::pseudoElementRenderer(PseudoId pseudoId) const |
| 2442 { | 2454 { |
| (...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3615 return 0; | 3627 return 0; |
| 3616 } | 3628 } |
| 3617 | 3629 |
| 3618 Attribute* UniqueElementData::attributeItem(unsigned index) | 3630 Attribute* UniqueElementData::attributeItem(unsigned index) |
| 3619 { | 3631 { |
| 3620 ASSERT_WITH_SECURITY_IMPLICATION(index < length()); | 3632 ASSERT_WITH_SECURITY_IMPLICATION(index < length()); |
| 3621 return &m_attributeVector.at(index); | 3633 return &m_attributeVector.at(index); |
| 3622 } | 3634 } |
| 3623 | 3635 |
| 3624 } // namespace WebCore | 3636 } // namespace WebCore |
| OLD | NEW |