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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2013 Appl
e Inc. All rights reserved. | 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2013 Appl
e Inc. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 }; | 77 }; |
78 | 78 |
79 enum ElementFlags { | 79 enum ElementFlags { |
80 TabIndexWasSetExplicitly = 1 << 0, | 80 TabIndexWasSetExplicitly = 1 << 0, |
81 NeedsFocusAppearanceUpdateSoonAfterAttach = 1 << 1, | 81 NeedsFocusAppearanceUpdateSoonAfterAttach = 1 << 1, |
82 StyleAffectedByEmpty = 1 << 2, | 82 StyleAffectedByEmpty = 1 << 2, |
83 IsInCanvasSubtree = 1 << 3, | 83 IsInCanvasSubtree = 1 << 3, |
84 ContainsFullScreenElement = 1 << 4, | 84 ContainsFullScreenElement = 1 << 4, |
85 IsInTopLayer = 1 << 5, | 85 IsInTopLayer = 1 << 5, |
86 HasPendingResources = 1 << 6, | 86 HasPendingResources = 1 << 6, |
87 ChildrenAffectedByFocus = 1 << 7, | |
88 ChildrenAffectedByHover = 1 << 8, | |
89 ChildrenAffectedByActive = 1 << 9, | |
90 ChildrenAffectedByDrag = 1 << 10, | |
91 ChildrenAffectedByFirstChildRules = 1 << 11, | |
92 ChildrenAffectedByLastChildRules = 1 << 12, | |
93 ChildrenAffectedByDirectAdjacentRules = 1 << 13, | |
94 ChildrenAffectedByIndirectAdjacentRules = 1 << 14, | |
95 ChildrenAffectedByForwardPositionalRules = 1 << 15, | |
96 ChildrenAffectedByBackwardPositionalRules = 1 << 16, | |
97 | 87 |
98 NumberOfElementFlags = 17, // Required size of bitfield used to store the fl
ags. | 88 NumberOfElementFlags = 7, // Required size of bitfield used to store the fla
gs. |
99 | |
100 // If any of these flags are set we cannot share style. | |
101 ElementFlagsPreventingStyleSharing = | |
102 ChildrenAffectedByFocus | |
103 | ChildrenAffectedByHover | |
104 | ChildrenAffectedByActive | |
105 | ChildrenAffectedByDrag | |
106 | ChildrenAffectedByFirstChildRules | |
107 | ChildrenAffectedByLastChildRules | |
108 | ChildrenAffectedByDirectAdjacentRules | |
109 | ChildrenAffectedByIndirectAdjacentRules | |
110 | ChildrenAffectedByForwardPositionalRules | |
111 | ChildrenAffectedByBackwardPositionalRules, | |
112 }; | 89 }; |
113 | 90 |
114 class Element : public ContainerNode { | 91 class Element : public ContainerNode { |
115 public: | 92 public: |
116 static PassRefPtr<Element> create(const QualifiedName&, Document*); | 93 static PassRefPtr<Element> create(const QualifiedName&, Document*); |
117 virtual ~Element(); | 94 virtual ~Element(); |
118 | 95 |
119 DEFINE_ATTRIBUTE_EVENT_LISTENER(beforecopy); | 96 DEFINE_ATTRIBUTE_EVENT_LISTENER(beforecopy); |
120 DEFINE_ATTRIBUTE_EVENT_LISTENER(beforecut); | 97 DEFINE_ATTRIBUTE_EVENT_LISTENER(beforecut); |
121 DEFINE_ATTRIBUTE_EVENT_LISTENER(beforepaste); | 98 DEFINE_ATTRIBUTE_EVENT_LISTENER(beforepaste); |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 ShadowRoot* userAgentShadowRoot() const; | 337 ShadowRoot* userAgentShadowRoot() const; |
361 ShadowRoot& ensureUserAgentShadowRoot(); | 338 ShadowRoot& ensureUserAgentShadowRoot(); |
362 bool isInDescendantTreeOf(const Element* shadowHost) const; | 339 bool isInDescendantTreeOf(const Element* shadowHost) const; |
363 | 340 |
364 RenderStyle* computedStyle(PseudoId = NOPSEUDO); | 341 RenderStyle* computedStyle(PseudoId = NOPSEUDO); |
365 | 342 |
366 // Methods for indicating the style is affected by dynamic updates (e.g., ch
ildren changing, our position changing in our sibling list, etc.) | 343 // Methods for indicating the style is affected by dynamic updates (e.g., ch
ildren changing, our position changing in our sibling list, etc.) |
367 bool styleAffectedByEmpty() const { return hasElementFlag(StyleAffectedByEmp
ty); } | 344 bool styleAffectedByEmpty() const { return hasElementFlag(StyleAffectedByEmp
ty); } |
368 void setStyleAffectedByEmpty() { setElementFlag(StyleAffectedByEmpty); } | 345 void setStyleAffectedByEmpty() { setElementFlag(StyleAffectedByEmpty); } |
369 | 346 |
370 bool childrenAffectedByFocus() const { return hasElementFlag(ChildrenAffecte
dByFocus); } | |
371 void setChildrenAffectedByFocus() { setElementFlag(ChildrenAffectedByFocus);
} | |
372 | |
373 bool childrenAffectedByHover() const { return hasElementFlag(ChildrenAffecte
dByHover); } | |
374 void setChildrenAffectedByHover() { setElementFlag(ChildrenAffectedByHover);
} | |
375 | |
376 bool childrenAffectedByActive() const { return hasElementFlag(ChildrenAffect
edByActive); } | |
377 void setChildrenAffectedByActive() { setElementFlag(ChildrenAffectedByActive
); } | |
378 | |
379 bool childrenAffectedByDrag() const { return hasElementFlag(ChildrenAffected
ByDrag); } | |
380 void setChildrenAffectedByDrag() { setElementFlag(ChildrenAffectedByDrag); } | |
381 | |
382 bool childrenAffectedByPositionalRules() const { return hasElementFlag(Child
renAffectedByForwardPositionalRules) || hasElementFlag(ChildrenAffectedByBackwar
dPositionalRules); } | |
383 | |
384 bool childrenAffectedByFirstChildRules() const { return hasElementFlag(Child
renAffectedByFirstChildRules); } | |
385 void setChildrenAffectedByFirstChildRules() { setElementFlag(ChildrenAffecte
dByFirstChildRules); } | |
386 | |
387 bool childrenAffectedByLastChildRules() const { return hasElementFlag(Childr
enAffectedByLastChildRules); } | |
388 void setChildrenAffectedByLastChildRules() { setElementFlag(ChildrenAffected
ByLastChildRules); } | |
389 | |
390 bool childrenAffectedByDirectAdjacentRules() const { return hasElementFlag(C
hildrenAffectedByDirectAdjacentRules); } | |
391 void setChildrenAffectedByDirectAdjacentRules() { setElementFlag(ChildrenAff
ectedByDirectAdjacentRules); } | |
392 | |
393 bool childrenAffectedByIndirectAdjacentRules() const { return hasElementFlag
(ChildrenAffectedByIndirectAdjacentRules); } | |
394 void setChildrenAffectedByIndirectAdjacentRules() { setElementFlag(ChildrenA
ffectedByIndirectAdjacentRules); } | |
395 | |
396 bool childrenAffectedByForwardPositionalRules() const { return hasElementFla
g(ChildrenAffectedByForwardPositionalRules); } | |
397 void setChildrenAffectedByForwardPositionalRules() { setElementFlag(Children
AffectedByForwardPositionalRules); } | |
398 | |
399 bool childrenAffectedByBackwardPositionalRules() const { return hasElementFl
ag(ChildrenAffectedByBackwardPositionalRules); } | |
400 void setChildrenAffectedByBackwardPositionalRules() { setElementFlag(Childre
nAffectedByBackwardPositionalRules); } | |
401 | |
402 void setIsInCanvasSubtree(bool value) { setElementFlag(IsInCanvasSubtree, va
lue); } | 347 void setIsInCanvasSubtree(bool value) { setElementFlag(IsInCanvasSubtree, va
lue); } |
403 bool isInCanvasSubtree() const { return hasElementFlag(IsInCanvasSubtree); } | 348 bool isInCanvasSubtree() const { return hasElementFlag(IsInCanvasSubtree); } |
404 | 349 |
405 unsigned childIndex() const { return hasRareData() ? rareDataChildIndex() :
0; } | 350 unsigned childIndex() const { return hasRareData() ? rareDataChildIndex() :
0; } |
406 void setChildIndex(unsigned); | 351 void setChildIndex(unsigned); |
407 | 352 |
408 bool childrenSupportStyleSharing() const { return !hasElementFlag(ElementFla
gsPreventingStyleSharing); } | |
409 | |
410 bool isUpgradedCustomElement() { return customElementState() == Upgraded; } | 353 bool isUpgradedCustomElement() { return customElementState() == Upgraded; } |
411 bool isUnresolvedCustomElement() { return customElementState() == WaitingFor
Upgrade; } | 354 bool isUnresolvedCustomElement() { return customElementState() == WaitingFor
Upgrade; } |
412 | 355 |
413 AtomicString computeInheritedLanguage() const; | 356 AtomicString computeInheritedLanguage() const; |
414 Locale& locale() const; | 357 Locale& locale() const; |
415 | 358 |
416 virtual void accessKeyAction(bool /*sendToAnyEvent*/) { } | 359 virtual void accessKeyAction(bool /*sendToAnyEvent*/) { } |
417 | 360 |
418 virtual bool isURLAttribute(const Attribute&) const { return false; } | 361 virtual bool isURLAttribute(const Attribute&) const { return false; } |
419 virtual bool isHTMLContentAttribute(const Attribute&) const { return false;
} | 362 virtual bool isHTMLContentAttribute(const Attribute&) const { return false;
} |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 void setPseudo(const AtomicString& value) { setShadowPseudoId(value); } | 403 void setPseudo(const AtomicString& value) { setShadowPseudoId(value); } |
461 virtual const AtomicString& shadowPseudoId() const; | 404 virtual const AtomicString& shadowPseudoId() const; |
462 void setShadowPseudoId(const AtomicString&); | 405 void setShadowPseudoId(const AtomicString&); |
463 | 406 |
464 LayoutSize minimumSizeForResizing() const; | 407 LayoutSize minimumSizeForResizing() const; |
465 void setMinimumSizeForResizing(const LayoutSize&); | 408 void setMinimumSizeForResizing(const LayoutSize&); |
466 | 409 |
467 virtual void didBecomeFullscreenElement() { } | 410 virtual void didBecomeFullscreenElement() { } |
468 virtual void willStopBeingFullscreenElement() { } | 411 virtual void willStopBeingFullscreenElement() { } |
469 | 412 |
470 using Node::isFinishedParsingChildren; // make public for SelectorChecker | |
471 | |
472 // Called by the parser when this element's close tag is reached, | 413 // Called by the parser when this element's close tag is reached, |
473 // signaling that all child tags have been parsed and added. | 414 // signaling that all child tags have been parsed and added. |
474 // This is needed for <applet> and <object> elements, which can't lay themse
lves out | 415 // This is needed for <applet> and <object> elements, which can't lay themse
lves out |
475 // until they know all of their nested <param>s. [Radar 3603191, 4040848]. | 416 // until they know all of their nested <param>s. [Radar 3603191, 4040848]. |
476 // Also used for script elements and some SVG elements for similar purposes, | 417 // Also used for script elements and some SVG elements for similar purposes, |
477 // but making parsing a special case in this respect should be avoided if po
ssible. | 418 // but making parsing a special case in this respect should be avoided if po
ssible. |
478 virtual void finishParsingChildren(); | 419 virtual void finishParsingChildren(); |
479 | 420 |
480 void beginParsingChildren() { setIsFinishedParsingChildren(false); } | 421 void beginParsingChildren() { setIsFinishedParsingChildren(false); } |
481 | 422 |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 template <> inline bool isElementOfType<const thisType>(const Element& eleme
nt) { return element.predicate; } \ | 883 template <> inline bool isElementOfType<const thisType>(const Element& eleme
nt) { return element.predicate; } \ |
943 DEFINE_NODE_TYPE_CASTS(thisType, predicate) | 884 DEFINE_NODE_TYPE_CASTS(thisType, predicate) |
944 | 885 |
945 #define DEFINE_ELEMENT_TYPE_CASTS_WITH_FUNCTION(thisType) \ | 886 #define DEFINE_ELEMENT_TYPE_CASTS_WITH_FUNCTION(thisType) \ |
946 template <> inline bool isElementOfType<const thisType>(const Element& eleme
nt) { return is##thisType(element); } \ | 887 template <> inline bool isElementOfType<const thisType>(const Element& eleme
nt) { return is##thisType(element); } \ |
947 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(thisType) | 888 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(thisType) |
948 | 889 |
949 } // namespace | 890 } // namespace |
950 | 891 |
951 #endif | 892 #endif |
OLD | NEW |