| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 #include "core/html/HTMLFrameOwnerElement.h" | 83 #include "core/html/HTMLFrameOwnerElement.h" |
| 84 #include "core/html/HTMLLabelElement.h" | 84 #include "core/html/HTMLLabelElement.h" |
| 85 #include "core/html/HTMLOptionsCollection.h" | 85 #include "core/html/HTMLOptionsCollection.h" |
| 86 #include "core/html/HTMLTableRowsCollection.h" | 86 #include "core/html/HTMLTableRowsCollection.h" |
| 87 #include "core/html/HTMLTemplateElement.h" | 87 #include "core/html/HTMLTemplateElement.h" |
| 88 #include "core/html/parser/HTMLParserIdioms.h" | 88 #include "core/html/parser/HTMLParserIdioms.h" |
| 89 #include "core/inspector/InspectorInstrumentation.h" | 89 #include "core/inspector/InspectorInstrumentation.h" |
| 90 #include "core/page/FocusController.h" | 90 #include "core/page/FocusController.h" |
| 91 #include "core/page/Page.h" | 91 #include "core/page/Page.h" |
| 92 #include "core/page/PointerLockController.h" | 92 #include "core/page/PointerLockController.h" |
| 93 #include "core/rendering/FlowThreadController.h" | |
| 94 #include "core/rendering/RenderLayer.h" | 93 #include "core/rendering/RenderLayer.h" |
| 95 #include "core/rendering/RenderNamedFlowFragment.h" | |
| 96 #include "core/rendering/RenderView.h" | 94 #include "core/rendering/RenderView.h" |
| 97 #include "core/rendering/RenderWidget.h" | 95 #include "core/rendering/RenderWidget.h" |
| 98 #include "core/svg/SVGDocumentExtensions.h" | 96 #include "core/svg/SVGDocumentExtensions.h" |
| 99 #include "core/svg/SVGElement.h" | 97 #include "core/svg/SVGElement.h" |
| 100 #include "platform/scroll/ScrollableArea.h" | 98 #include "platform/scroll/ScrollableArea.h" |
| 101 #include "wtf/BitVector.h" | 99 #include "wtf/BitVector.h" |
| 102 #include "wtf/HashFunctions.h" | 100 #include "wtf/HashFunctions.h" |
| 103 #include "wtf/text/CString.h" | 101 #include "wtf/text/CString.h" |
| 104 #include "wtf/text/StringBuilder.h" | 102 #include "wtf/text/StringBuilder.h" |
| 105 #include "wtf/text/TextPosition.h" | 103 #include "wtf/text/TextPosition.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 return 0; | 188 return 0; |
| 191 } | 189 } |
| 192 | 190 |
| 193 PassRefPtr<Element> Element::create(const QualifiedName& tagName, Document* docu
ment) | 191 PassRefPtr<Element> Element::create(const QualifiedName& tagName, Document* docu
ment) |
| 194 { | 192 { |
| 195 return adoptRef(new Element(tagName, document, CreateElement)); | 193 return adoptRef(new Element(tagName, document, CreateElement)); |
| 196 } | 194 } |
| 197 | 195 |
| 198 Element::~Element() | 196 Element::~Element() |
| 199 { | 197 { |
| 200 // When the document is not destroyed, an element that was part of a named f
low | |
| 201 // content nodes should have been removed from the content nodes collection | |
| 202 // and the inNamedFlow flag reset. | |
| 203 ASSERT(!document().renderView() || !inNamedFlow()); | |
| 204 ASSERT(needsAttach()); | 198 ASSERT(needsAttach()); |
| 205 | 199 |
| 206 if (hasRareData()) | 200 if (hasRareData()) |
| 207 elementRareData()->clearShadow(); | 201 elementRareData()->clearShadow(); |
| 208 | 202 |
| 209 if (isCustomElement()) | 203 if (isCustomElement()) |
| 210 CustomElement::wasDestroyed(this); | 204 CustomElement::wasDestroyed(this); |
| 211 | 205 |
| 212 if (hasSyntheticAttrChildNodes()) | 206 if (hasSyntheticAttrChildNodes()) |
| 213 detachAllAttrNodesFromElement(); | 207 detachAllAttrNodesFromElement(); |
| (...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1436 if (ActiveAnimations* activeAnimations = data->activeAnimations()) { | 1430 if (ActiveAnimations* activeAnimations = data->activeAnimations()) { |
| 1437 activeAnimations->cssAnimations().cancel(); | 1431 activeAnimations->cssAnimations().cancel(); |
| 1438 activeAnimations->setAnimationStyleChange(false); | 1432 activeAnimations->setAnimationStyleChange(false); |
| 1439 } | 1433 } |
| 1440 } | 1434 } |
| 1441 } | 1435 } |
| 1442 | 1436 |
| 1443 InspectorInstrumentation::didRecalculateStyleForElement(this); | 1437 InspectorInstrumentation::didRecalculateStyleForElement(this); |
| 1444 } | 1438 } |
| 1445 | 1439 |
| 1446 void Element::unregisterNamedFlowContentNode() | |
| 1447 { | |
| 1448 if (RuntimeEnabledFeatures::cssRegionsEnabled() && inNamedFlow() && document
().renderView()) | |
| 1449 document().renderView()->flowThreadController()->unregisterNamedFlowCont
entNode(this); | |
| 1450 } | |
| 1451 | |
| 1452 void Element::detach(const AttachContext& context) | 1440 void Element::detach(const AttachContext& context) |
| 1453 { | 1441 { |
| 1454 RenderWidget::UpdateSuspendScope suspendWidgetHierarchyUpdates; | 1442 RenderWidget::UpdateSuspendScope suspendWidgetHierarchyUpdates; |
| 1455 unregisterNamedFlowContentNode(); | |
| 1456 cancelFocusAppearanceUpdate(); | 1443 cancelFocusAppearanceUpdate(); |
| 1457 removeCallbackSelectors(); | 1444 removeCallbackSelectors(); |
| 1458 if (hasRareData()) { | 1445 if (hasRareData()) { |
| 1459 ElementRareData* data = elementRareData(); | 1446 ElementRareData* data = elementRareData(); |
| 1460 data->clearPseudoElements(); | 1447 data->clearPseudoElements(); |
| 1461 data->setIsInsideRegion(false); | |
| 1462 | 1448 |
| 1463 // attach() will perform the below steps for us when inside recalcStyle. | 1449 // attach() will perform the below steps for us when inside recalcStyle. |
| 1464 if (!document().inStyleRecalc()) { | 1450 if (!document().inStyleRecalc()) { |
| 1465 data->resetStyleState(); | 1451 data->resetStyleState(); |
| 1466 data->clearComputedStyle(); | 1452 data->clearComputedStyle(); |
| 1467 data->resetDynamicRestyleObservations(); | 1453 data->resetDynamicRestyleObservations(); |
| 1468 } | 1454 } |
| 1469 | 1455 |
| 1470 if (RuntimeEnabledFeatures::webAnimationsCSSEnabled()) { | 1456 if (RuntimeEnabledFeatures::webAnimationsCSSEnabled()) { |
| 1471 if (ActiveAnimations* activeAnimations = data->activeAnimations()) { | 1457 if (ActiveAnimations* activeAnimations = data->activeAnimations()) { |
| (...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2687 void Element::setIsInCanvasSubtree(bool isInCanvasSubtree) | 2673 void Element::setIsInCanvasSubtree(bool isInCanvasSubtree) |
| 2688 { | 2674 { |
| 2689 ensureElementRareData().setIsInCanvasSubtree(isInCanvasSubtree); | 2675 ensureElementRareData().setIsInCanvasSubtree(isInCanvasSubtree); |
| 2690 } | 2676 } |
| 2691 | 2677 |
| 2692 bool Element::isInCanvasSubtree() const | 2678 bool Element::isInCanvasSubtree() const |
| 2693 { | 2679 { |
| 2694 return hasRareData() && elementRareData()->isInCanvasSubtree(); | 2680 return hasRareData() && elementRareData()->isInCanvasSubtree(); |
| 2695 } | 2681 } |
| 2696 | 2682 |
| 2697 void Element::setIsInsideRegion(bool value) | |
| 2698 { | |
| 2699 if (value == isInsideRegion()) | |
| 2700 return; | |
| 2701 | |
| 2702 ensureElementRareData().setIsInsideRegion(value); | |
| 2703 } | |
| 2704 | |
| 2705 bool Element::isInsideRegion() const | |
| 2706 { | |
| 2707 return hasRareData() ? elementRareData()->isInsideRegion() : false; | |
| 2708 } | |
| 2709 | |
| 2710 void Element::setRegionOversetState(RegionOversetState state) | |
| 2711 { | |
| 2712 ensureElementRareData().setRegionOversetState(state); | |
| 2713 } | |
| 2714 | |
| 2715 RegionOversetState Element::regionOversetState() const | |
| 2716 { | |
| 2717 return hasRareData() ? elementRareData()->regionOversetState() : RegionUndef
ined; | |
| 2718 } | |
| 2719 | |
| 2720 AtomicString Element::computeInheritedLanguage() const | 2683 AtomicString Element::computeInheritedLanguage() const |
| 2721 { | 2684 { |
| 2722 const Node* n = this; | 2685 const Node* n = this; |
| 2723 AtomicString value; | 2686 AtomicString value; |
| 2724 // The language property is inherited, so we iterate over the parents to fin
d the first language. | 2687 // The language property is inherited, so we iterate over the parents to fin
d the first language. |
| 2725 do { | 2688 do { |
| 2726 if (n->isElementNode()) { | 2689 if (n->isElementNode()) { |
| 2727 if (const ElementData* elementData = toElement(n)->elementData()) { | 2690 if (const ElementData* elementData = toElement(n)->elementData()) { |
| 2728 // Spec: xml:lang takes precedence -- http://www.w3.org/TR/xhtml
1/#C_7 | 2691 // Spec: xml:lang takes precedence -- http://www.w3.org/TR/xhtml
1/#C_7 |
| 2729 if (const Attribute* attribute = elementData->getAttributeItem(X
MLNames::langAttr)) | 2692 if (const Attribute* attribute = elementData->getAttributeItem(X
MLNames::langAttr)) |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2985 case SpellcheckAttributeFalse: | 2948 case SpellcheckAttributeFalse: |
| 2986 return false; | 2949 return false; |
| 2987 case SpellcheckAttributeDefault: | 2950 case SpellcheckAttributeDefault: |
| 2988 break; | 2951 break; |
| 2989 } | 2952 } |
| 2990 } | 2953 } |
| 2991 | 2954 |
| 2992 return true; | 2955 return true; |
| 2993 } | 2956 } |
| 2994 | 2957 |
| 2995 RenderRegion* Element::renderRegion() const | |
| 2996 { | |
| 2997 if (renderer() && renderer()->isRenderNamedFlowFragmentContainer()) | |
| 2998 return toRenderBlockFlow(renderer())->renderNamedFlowFragment(); | |
| 2999 | |
| 3000 return 0; | |
| 3001 } | |
| 3002 | |
| 3003 const AtomicString& Element::webkitRegionOverset() const | |
| 3004 { | |
| 3005 DEFINE_STATIC_LOCAL(AtomicString, undefinedState, ("undefined", AtomicString
::ConstructFromLiteral)); | |
| 3006 if (!RuntimeEnabledFeatures::cssRegionsEnabled()) | |
| 3007 return undefinedState; | |
| 3008 | |
| 3009 document().updateLayoutIgnorePendingStylesheets(); | |
| 3010 | |
| 3011 if (!renderRegion()) | |
| 3012 return undefinedState; | |
| 3013 | |
| 3014 switch (renderRegion()->regionOversetState()) { | |
| 3015 case RegionFit: { | |
| 3016 DEFINE_STATIC_LOCAL(AtomicString, fitState, ("fit", AtomicString::Constr
uctFromLiteral)); | |
| 3017 return fitState; | |
| 3018 } | |
| 3019 case RegionEmpty: { | |
| 3020 DEFINE_STATIC_LOCAL(AtomicString, emptyState, ("empty", AtomicString::Co
nstructFromLiteral)); | |
| 3021 return emptyState; | |
| 3022 } | |
| 3023 case RegionOverset: { | |
| 3024 DEFINE_STATIC_LOCAL(AtomicString, overflowState, ("overset", AtomicStrin
g::ConstructFromLiteral)); | |
| 3025 return overflowState; | |
| 3026 } | |
| 3027 case RegionUndefined: | |
| 3028 return undefinedState; | |
| 3029 } | |
| 3030 | |
| 3031 ASSERT_NOT_REACHED(); | |
| 3032 return undefinedState; | |
| 3033 } | |
| 3034 | |
| 3035 Vector<RefPtr<Range> > Element::webkitGetRegionFlowRanges() const | |
| 3036 { | |
| 3037 Vector<RefPtr<Range> > rangeObjects; | |
| 3038 if (!RuntimeEnabledFeatures::cssRegionsEnabled()) | |
| 3039 return rangeObjects; | |
| 3040 | |
| 3041 document().updateLayoutIgnorePendingStylesheets(); | |
| 3042 | |
| 3043 if (renderer() && renderer()->isRenderNamedFlowFragmentContainer()) { | |
| 3044 RenderNamedFlowFragment* region = toRenderBlockFlow(renderer())->renderN
amedFlowFragment(); | |
| 3045 if (region->isValid()) | |
| 3046 region->getRanges(rangeObjects); | |
| 3047 } | |
| 3048 | |
| 3049 return rangeObjects; | |
| 3050 } | |
| 3051 | |
| 3052 #ifndef NDEBUG | 2958 #ifndef NDEBUG |
| 3053 bool Element::fastAttributeLookupAllowed(const QualifiedName& name) const | 2959 bool Element::fastAttributeLookupAllowed(const QualifiedName& name) const |
| 3054 { | 2960 { |
| 3055 if (name == HTMLNames::styleAttr) | 2961 if (name == HTMLNames::styleAttr) |
| 3056 return false; | 2962 return false; |
| 3057 | 2963 |
| 3058 if (isSVGElement()) | 2964 if (isSVGElement()) |
| 3059 return !toSVGElement(this)->isAnimatableAttribute(name); | 2965 return !toSVGElement(this)->isAnimatableAttribute(name); |
| 3060 | 2966 |
| 3061 return true; | 2967 return true; |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3629 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi
stItems | 3535 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi
stItems |
| 3630 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg
i?id=88405 | 3536 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg
i?id=88405 |
| 3631 if (hasTagName(optionTag) || hasTagName(optgroupTag)) | 3537 if (hasTagName(optionTag) || hasTagName(optgroupTag)) |
| 3632 return false; | 3538 return false; |
| 3633 if (FullscreenElementStack::isActiveFullScreenElement(this)) | 3539 if (FullscreenElementStack::isActiveFullScreenElement(this)) |
| 3634 return false; | 3540 return false; |
| 3635 return true; | 3541 return true; |
| 3636 } | 3542 } |
| 3637 | 3543 |
| 3638 } // namespace WebCore | 3544 } // namespace WebCore |
| OLD | NEW |