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