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 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1433 if (ActiveAnimations* activeAnimations = data->activeAnimations()) { | 1427 if (ActiveAnimations* activeAnimations = data->activeAnimations()) { |
1434 activeAnimations->cssAnimations().cancel(); | 1428 activeAnimations->cssAnimations().cancel(); |
1435 activeAnimations->setAnimationStyleChange(false); | 1429 activeAnimations->setAnimationStyleChange(false); |
1436 } | 1430 } |
1437 } | 1431 } |
1438 } | 1432 } |
1439 | 1433 |
1440 InspectorInstrumentation::didRecalculateStyleForElement(this); | 1434 InspectorInstrumentation::didRecalculateStyleForElement(this); |
1441 } | 1435 } |
1442 | 1436 |
1443 void Element::unregisterNamedFlowContentNode() | |
1444 { | |
1445 if (RuntimeEnabledFeatures::cssRegionsEnabled() && inNamedFlow() && document
().renderView()) | |
1446 document().renderView()->flowThreadController()->unregisterNamedFlowCont
entNode(this); | |
1447 } | |
1448 | |
1449 void Element::detach(const AttachContext& context) | 1437 void Element::detach(const AttachContext& context) |
1450 { | 1438 { |
1451 RenderWidget::UpdateSuspendScope suspendWidgetHierarchyUpdates; | 1439 RenderWidget::UpdateSuspendScope suspendWidgetHierarchyUpdates; |
1452 unregisterNamedFlowContentNode(); | |
1453 cancelFocusAppearanceUpdate(); | 1440 cancelFocusAppearanceUpdate(); |
1454 removeCallbackSelectors(); | 1441 removeCallbackSelectors(); |
1455 if (hasRareData()) { | 1442 if (hasRareData()) { |
1456 ElementRareData* data = elementRareData(); | 1443 ElementRareData* data = elementRareData(); |
1457 data->clearPseudoElements(); | 1444 data->clearPseudoElements(); |
1458 data->setIsInsideRegion(false); | |
1459 | 1445 |
1460 // attach() will perform the below steps for us when inside recalcStyle. | 1446 // attach() will perform the below steps for us when inside recalcStyle. |
1461 if (!document().inStyleRecalc()) { | 1447 if (!document().inStyleRecalc()) { |
1462 data->resetStyleState(); | 1448 data->resetStyleState(); |
1463 data->clearComputedStyle(); | 1449 data->clearComputedStyle(); |
1464 data->resetDynamicRestyleObservations(); | 1450 data->resetDynamicRestyleObservations(); |
1465 } | 1451 } |
1466 | 1452 |
1467 if (ActiveAnimations* activeAnimations = data->activeAnimations()) { | 1453 if (ActiveAnimations* activeAnimations = data->activeAnimations()) { |
1468 if (context.performingReattach) { | 1454 if (context.performingReattach) { |
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2682 void Element::setIsInCanvasSubtree(bool isInCanvasSubtree) | 2668 void Element::setIsInCanvasSubtree(bool isInCanvasSubtree) |
2683 { | 2669 { |
2684 ensureElementRareData().setIsInCanvasSubtree(isInCanvasSubtree); | 2670 ensureElementRareData().setIsInCanvasSubtree(isInCanvasSubtree); |
2685 } | 2671 } |
2686 | 2672 |
2687 bool Element::isInCanvasSubtree() const | 2673 bool Element::isInCanvasSubtree() const |
2688 { | 2674 { |
2689 return hasRareData() && elementRareData()->isInCanvasSubtree(); | 2675 return hasRareData() && elementRareData()->isInCanvasSubtree(); |
2690 } | 2676 } |
2691 | 2677 |
2692 void Element::setIsInsideRegion(bool value) | |
2693 { | |
2694 if (value == isInsideRegion()) | |
2695 return; | |
2696 | |
2697 ensureElementRareData().setIsInsideRegion(value); | |
2698 } | |
2699 | |
2700 bool Element::isInsideRegion() const | |
2701 { | |
2702 return hasRareData() ? elementRareData()->isInsideRegion() : false; | |
2703 } | |
2704 | |
2705 void Element::setRegionOversetState(RegionOversetState state) | |
2706 { | |
2707 ensureElementRareData().setRegionOversetState(state); | |
2708 } | |
2709 | |
2710 RegionOversetState Element::regionOversetState() const | |
2711 { | |
2712 return hasRareData() ? elementRareData()->regionOversetState() : RegionUndef
ined; | |
2713 } | |
2714 | |
2715 AtomicString Element::computeInheritedLanguage() const | 2678 AtomicString Element::computeInheritedLanguage() const |
2716 { | 2679 { |
2717 const Node* n = this; | 2680 const Node* n = this; |
2718 AtomicString value; | 2681 AtomicString value; |
2719 // The language property is inherited, so we iterate over the parents to fin
d the first language. | 2682 // The language property is inherited, so we iterate over the parents to fin
d the first language. |
2720 do { | 2683 do { |
2721 if (n->isElementNode()) { | 2684 if (n->isElementNode()) { |
2722 if (const ElementData* elementData = toElement(n)->elementData()) { | 2685 if (const ElementData* elementData = toElement(n)->elementData()) { |
2723 // Spec: xml:lang takes precedence -- http://www.w3.org/TR/xhtml
1/#C_7 | 2686 // Spec: xml:lang takes precedence -- http://www.w3.org/TR/xhtml
1/#C_7 |
2724 if (const Attribute* attribute = elementData->getAttributeItem(X
MLNames::langAttr)) | 2687 if (const Attribute* attribute = elementData->getAttributeItem(X
MLNames::langAttr)) |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2980 case SpellcheckAttributeFalse: | 2943 case SpellcheckAttributeFalse: |
2981 return false; | 2944 return false; |
2982 case SpellcheckAttributeDefault: | 2945 case SpellcheckAttributeDefault: |
2983 break; | 2946 break; |
2984 } | 2947 } |
2985 } | 2948 } |
2986 | 2949 |
2987 return true; | 2950 return true; |
2988 } | 2951 } |
2989 | 2952 |
2990 RenderRegion* Element::renderRegion() const | |
2991 { | |
2992 if (renderer() && renderer()->isRenderNamedFlowFragmentContainer()) | |
2993 return toRenderBlockFlow(renderer())->renderNamedFlowFragment(); | |
2994 | |
2995 return 0; | |
2996 } | |
2997 | |
2998 const AtomicString& Element::webkitRegionOverset() const | |
2999 { | |
3000 DEFINE_STATIC_LOCAL(AtomicString, undefinedState, ("undefined", AtomicString
::ConstructFromLiteral)); | |
3001 if (!RuntimeEnabledFeatures::cssRegionsEnabled()) | |
3002 return undefinedState; | |
3003 | |
3004 document().updateLayoutIgnorePendingStylesheets(); | |
3005 | |
3006 if (!renderRegion()) | |
3007 return undefinedState; | |
3008 | |
3009 switch (renderRegion()->regionOversetState()) { | |
3010 case RegionFit: { | |
3011 DEFINE_STATIC_LOCAL(AtomicString, fitState, ("fit", AtomicString::Constr
uctFromLiteral)); | |
3012 return fitState; | |
3013 } | |
3014 case RegionEmpty: { | |
3015 DEFINE_STATIC_LOCAL(AtomicString, emptyState, ("empty", AtomicString::Co
nstructFromLiteral)); | |
3016 return emptyState; | |
3017 } | |
3018 case RegionOverset: { | |
3019 DEFINE_STATIC_LOCAL(AtomicString, overflowState, ("overset", AtomicStrin
g::ConstructFromLiteral)); | |
3020 return overflowState; | |
3021 } | |
3022 case RegionUndefined: | |
3023 return undefinedState; | |
3024 } | |
3025 | |
3026 ASSERT_NOT_REACHED(); | |
3027 return undefinedState; | |
3028 } | |
3029 | |
3030 Vector<RefPtr<Range> > Element::webkitGetRegionFlowRanges() const | |
3031 { | |
3032 Vector<RefPtr<Range> > rangeObjects; | |
3033 if (!RuntimeEnabledFeatures::cssRegionsEnabled()) | |
3034 return rangeObjects; | |
3035 | |
3036 document().updateLayoutIgnorePendingStylesheets(); | |
3037 | |
3038 if (renderer() && renderer()->isRenderNamedFlowFragmentContainer()) { | |
3039 RenderNamedFlowFragment* region = toRenderBlockFlow(renderer())->renderN
amedFlowFragment(); | |
3040 if (region->isValid()) | |
3041 region->getRanges(rangeObjects); | |
3042 } | |
3043 | |
3044 return rangeObjects; | |
3045 } | |
3046 | |
3047 #ifndef NDEBUG | 2953 #ifndef NDEBUG |
3048 bool Element::fastAttributeLookupAllowed(const QualifiedName& name) const | 2954 bool Element::fastAttributeLookupAllowed(const QualifiedName& name) const |
3049 { | 2955 { |
3050 if (name == HTMLNames::styleAttr) | 2956 if (name == HTMLNames::styleAttr) |
3051 return false; | 2957 return false; |
3052 | 2958 |
3053 if (isSVGElement()) | 2959 if (isSVGElement()) |
3054 return !toSVGElement(this)->isAnimatableAttribute(name); | 2960 return !toSVGElement(this)->isAnimatableAttribute(name); |
3055 | 2961 |
3056 return true; | 2962 return true; |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3624 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi
stItems | 3530 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi
stItems |
3625 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg
i?id=88405 | 3531 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg
i?id=88405 |
3626 if (hasTagName(optionTag) || hasTagName(optgroupTag)) | 3532 if (hasTagName(optionTag) || hasTagName(optgroupTag)) |
3627 return false; | 3533 return false; |
3628 if (FullscreenElementStack::isActiveFullScreenElement(this)) | 3534 if (FullscreenElementStack::isActiveFullScreenElement(this)) |
3629 return false; | 3535 return false; |
3630 return true; | 3536 return true; |
3631 } | 3537 } |
3632 | 3538 |
3633 } // namespace WebCore | 3539 } // namespace WebCore |
OLD | NEW |