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