Chromium Code Reviews| 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 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. |
| 6 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) | 6 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) |
| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 class ShadowRoot; | 83 class ShadowRoot; |
| 84 class TagNodeList; | 84 class TagNodeList; |
| 85 class TouchEvent; | 85 class TouchEvent; |
| 86 | 86 |
| 87 const int nodeStyleChangeShift = 14; | 87 const int nodeStyleChangeShift = 14; |
| 88 | 88 |
| 89 enum StyleChangeType { | 89 enum StyleChangeType { |
| 90 NoStyleChange = 0, | 90 NoStyleChange = 0, |
| 91 LocalStyleChange = 1 << nodeStyleChangeShift, | 91 LocalStyleChange = 1 << nodeStyleChangeShift, |
| 92 SubtreeStyleChange = 2 << nodeStyleChangeShift, | 92 SubtreeStyleChange = 2 << nodeStyleChangeShift, |
| 93 LazyAttachStyleChange = 3 << nodeStyleChangeShift, | 93 DeferredRenderTreeCreationStyleChange = 3 << nodeStyleChangeShift, |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 // If the style change is from the renderer then we'll call setStyle on the | 96 // If the style change is from the renderer then we'll call setStyle on the |
| 97 // renderer even if the style computed from CSS is identical. | 97 // renderer even if the style computed from CSS is identical. |
| 98 enum StyleChangeSource { | 98 enum StyleChangeSource { |
| 99 StyleChangeFromCSS, | 99 StyleChangeFromCSS, |
| 100 StyleChangeFromRenderer | 100 StyleChangeFromRenderer |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 class NodeRareDataBase { | 103 class NodeRareDataBase { |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 400 | 400 |
| 401 bool hasScopedHTMLStyleChild() const { return getFlag(HasScopedHTMLStyleChil dFlag); } | 401 bool hasScopedHTMLStyleChild() const { return getFlag(HasScopedHTMLStyleChil dFlag); } |
| 402 void setHasScopedHTMLStyleChild(bool flag) { setFlag(flag, HasScopedHTMLStyl eChildFlag); } | 402 void setHasScopedHTMLStyleChild(bool flag) { setFlag(flag, HasScopedHTMLStyl eChildFlag); } |
| 403 | 403 |
| 404 bool hasEventTargetData() const { return getFlag(HasEventTargetDataFlag); } | 404 bool hasEventTargetData() const { return getFlag(HasEventTargetDataFlag); } |
| 405 void setHasEventTargetData(bool flag) { setFlag(flag, HasEventTargetDataFlag ); } | 405 void setHasEventTargetData(bool flag) { setFlag(flag, HasEventTargetDataFlag ); } |
| 406 | 406 |
| 407 bool isV8CollectableDuringMinorGC() const { return getFlag(V8CollectableDuri ngMinorGCFlag); } | 407 bool isV8CollectableDuringMinorGC() const { return getFlag(V8CollectableDuri ngMinorGCFlag); } |
| 408 void setV8CollectableDuringMinorGC(bool flag) { setFlag(flag, V8CollectableD uringMinorGCFlag); } | 408 void setV8CollectableDuringMinorGC(bool flag) { setFlag(flag, V8CollectableD uringMinorGCFlag); } |
| 409 | 409 |
| 410 void lazyAttach(); | 410 void scheduleRenderTreeCreation(); |
| 411 void lazyReattach(); | 411 void scheduleRenderTreeReconstruction(); |
|
ojan
2013/09/24 22:41:24
How about scheduleRenderTreeRecreation?
| |
| 412 | 412 |
| 413 virtual void setFocus(bool flag); | 413 virtual void setFocus(bool flag); |
| 414 virtual void setActive(bool flag = true, bool pause = false); | 414 virtual void setActive(bool flag = true, bool pause = false); |
| 415 virtual void setHovered(bool flag = true); | 415 virtual void setHovered(bool flag = true); |
| 416 | 416 |
| 417 virtual short tabIndex() const; | 417 virtual short tabIndex() const; |
| 418 | 418 |
| 419 virtual Node* focusDelegate(); | 419 virtual Node* focusDelegate(); |
| 420 // This is called only when the node is focused. | 420 // This is called only when the node is focused. |
| 421 virtual bool shouldHaveFocusAppearance() const; | 421 virtual bool shouldHaveFocusAppearance() const; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 531 else | 531 else |
| 532 m_data.m_renderer = renderer; | 532 m_data.m_renderer = renderer; |
| 533 } | 533 } |
| 534 | 534 |
| 535 // Use these two methods with caution. | 535 // Use these two methods with caution. |
| 536 RenderBox* renderBox() const; | 536 RenderBox* renderBox() const; |
| 537 RenderBoxModelObject* renderBoxModelObject() const; | 537 RenderBoxModelObject* renderBoxModelObject() const; |
| 538 | 538 |
| 539 struct AttachContext { | 539 struct AttachContext { |
| 540 RenderStyle* resolvedStyle; | 540 RenderStyle* resolvedStyle; |
| 541 bool performingReattach; | 541 bool reconstructingRenderTree; |
|
ojan
2013/09/24 22:41:24
Ditto...recreatingRenderTree.
| |
| 542 | 542 |
| 543 AttachContext() : resolvedStyle(0), performingReattach(false) { } | 543 AttachContext() : resolvedStyle(0), reconstructingRenderTree(false) { } |
| 544 }; | 544 }; |
| 545 | 545 |
| 546 // Attaches this node to the rendering tree. This calculates the style to be applied to the node and creates an | 546 // Attaches this node to the rendering tree. This calculates the style to be applied to the node and creates an |
| 547 // appropriate RenderObject which will be inserted into the tree (except whe n the style has display: none). This | 547 // appropriate RenderObject which will be inserted into the tree (except whe n the style has display: none). This |
| 548 // makes the node visible in the FrameView. | 548 // makes the node visible in the FrameView. |
| 549 virtual void attach(const AttachContext& = AttachContext()); | 549 virtual void createRenderTree(const AttachContext& = AttachContext()); |
| 550 | 550 |
| 551 // Detaches the node from the rendering tree, making it invisible in the ren dered view. This method will remove | 551 // Detaches the node from the rendering tree, making it invisible in the ren dered view. This method will remove |
| 552 // the node's rendering object from the rendering tree and delete it. | 552 // the node's rendering object from the rendering tree and delete it. |
| 553 virtual void detach(const AttachContext& = AttachContext()); | 553 virtual void destroyRenderTree(const AttachContext& = AttachContext()); |
| 554 | 554 |
| 555 #ifndef NDEBUG | 555 #ifndef NDEBUG |
| 556 bool inDetach() const; | 556 bool inDetach() const; |
| 557 #endif | 557 #endif |
| 558 | 558 |
| 559 void reattach(const AttachContext& = AttachContext()); | 559 void recreateRenderTree(const AttachContext& = AttachContext()); |
| 560 void lazyReattachIfAttached(); | 560 void scheduleRenderTreeRecreationIfAttached(); |
| 561 | 561 |
| 562 // Wrapper for nodes that don't have a renderer, but still cache the style ( like HTMLOptionElement). | 562 // Wrapper for nodes that don't have a renderer, but still cache the style ( like HTMLOptionElement). |
| 563 RenderStyle* renderStyle() const; | 563 RenderStyle* renderStyle() const; |
| 564 RenderStyle* parentRenderStyle() const; | 564 RenderStyle* parentRenderStyle() const; |
| 565 | 565 |
| 566 RenderStyle* computedStyle(PseudoId pseudoElementSpecifier = NOPSEUDO) { ret urn virtualComputedStyle(pseudoElementSpecifier); } | 566 RenderStyle* computedStyle(PseudoId pseudoElementSpecifier = NOPSEUDO) { ret urn virtualComputedStyle(pseudoElementSpecifier); } |
| 567 | 567 |
| 568 // ------------------------------------------------------------------------- ---- | 568 // ------------------------------------------------------------------------- ---- |
| 569 // Notification of document structure changes (see ContainerNode.h for more notification methods) | 569 // Notification of document structure changes (see ContainerNode.h for more notification methods) |
| 570 // | 570 // |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 824 bool rendererIsEditable(EditableLevel, UserSelectAllTreatment = UserSelectAl lIsAlwaysNonEditable) const; | 824 bool rendererIsEditable(EditableLevel, UserSelectAllTreatment = UserSelectAl lIsAlwaysNonEditable) const; |
| 825 bool isEditableToAccessibility(EditableLevel) const; | 825 bool isEditableToAccessibility(EditableLevel) const; |
| 826 | 826 |
| 827 bool isUserActionElementActive() const; | 827 bool isUserActionElementActive() const; |
| 828 bool isUserActionElementInActiveChain() const; | 828 bool isUserActionElementInActiveChain() const; |
| 829 bool isUserActionElementHovered() const; | 829 bool isUserActionElementHovered() const; |
| 830 bool isUserActionElementFocused() const; | 830 bool isUserActionElementFocused() const; |
| 831 | 831 |
| 832 void setStyleChange(StyleChangeType); | 832 void setStyleChange(StyleChangeType); |
| 833 | 833 |
| 834 void detachNode(Node*, const AttachContext&); | 834 void destroyRenderTreeForNode(Node*, const AttachContext&); |
| 835 void clearAttached() { clearFlag(IsAttachedFlag); } | 835 void clearAttached() { clearFlag(IsAttachedFlag); } |
| 836 | 836 |
| 837 // Used to share code between lazyAttach and setNeedsStyleRecalc. | 837 // Used to share code between scheduleRenderTreeCreation and setNeedsStyleRe calc. |
| 838 void markAncestorsWithChildNeedsStyleRecalc(); | 838 void markAncestorsWithChildNeedsStyleRecalc(); |
| 839 | 839 |
| 840 virtual void refEventTarget(); | 840 virtual void refEventTarget(); |
| 841 virtual void derefEventTarget(); | 841 virtual void derefEventTarget(); |
| 842 | 842 |
| 843 virtual RenderStyle* nonRendererStyle() const { return 0; } | 843 virtual RenderStyle* nonRendererStyle() const { return 0; } |
| 844 | 844 |
| 845 virtual RenderStyle* virtualComputedStyle(PseudoId = NOPSEUDO); | 845 virtual RenderStyle* virtualComputedStyle(PseudoId = NOPSEUDO); |
| 846 | 846 |
| 847 Element* ancestorElement() const; | 847 Element* ancestorElement() const; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 896 { | 896 { |
| 897 return isShadowRoot() ? 0 : parentOrShadowHostNode(); | 897 return isShadowRoot() ? 0 : parentOrShadowHostNode(); |
| 898 } | 898 } |
| 899 | 899 |
| 900 inline ContainerNode* Node::parentNodeGuaranteedHostFree() const | 900 inline ContainerNode* Node::parentNodeGuaranteedHostFree() const |
| 901 { | 901 { |
| 902 ASSERT(!isShadowRoot()); | 902 ASSERT(!isShadowRoot()); |
| 903 return parentOrShadowHostNode(); | 903 return parentOrShadowHostNode(); |
| 904 } | 904 } |
| 905 | 905 |
| 906 inline void Node::lazyReattachIfAttached() | 906 inline void Node::scheduleRenderTreeRecreationIfAttached() |
| 907 { | 907 { |
| 908 if (attached()) | 908 if (attached()) |
| 909 lazyReattach(); | 909 scheduleRenderTreeReconstruction(); |
| 910 } | 910 } |
| 911 | 911 |
| 912 inline void Node::lazyReattach() | 912 inline void Node::scheduleRenderTreeReconstruction() |
| 913 { | 913 { |
| 914 if (styleChangeType() == LazyAttachStyleChange) | 914 if (styleChangeType() == DeferredRenderTreeCreationStyleChange) |
| 915 return; | 915 return; |
| 916 | 916 |
| 917 AttachContext context; | 917 AttachContext context; |
| 918 context.performingReattach = true; | 918 context.reconstructingRenderTree = true; |
| 919 | 919 |
| 920 if (attached()) | 920 if (attached()) |
| 921 detach(context); | 921 destroyRenderTree(context); |
| 922 lazyAttach(); | 922 scheduleRenderTreeCreation(); |
| 923 } | 923 } |
| 924 | 924 |
| 925 inline bool shouldRecalcStyle(StyleRecalcChange change, const Node* node) | 925 inline bool shouldRecalcStyle(StyleRecalcChange change, const Node* node) |
| 926 { | 926 { |
| 927 return change >= Inherit || node->childNeedsStyleRecalc() || node->needsStyl eRecalc(); | 927 return change >= Inherit || node->childNeedsStyleRecalc() || node->needsStyl eRecalc(); |
| 928 } | 928 } |
| 929 | 929 |
| 930 } //namespace | 930 } //namespace |
| 931 | 931 |
| 932 #ifndef NDEBUG | 932 #ifndef NDEBUG |
| 933 // Outside the WebCore namespace for ease of invocation from gdb. | 933 // Outside the WebCore namespace for ease of invocation from gdb. |
| 934 void showTree(const WebCore::Node*); | 934 void showTree(const WebCore::Node*); |
| 935 void showNodePath(const WebCore::Node*); | 935 void showNodePath(const WebCore::Node*); |
| 936 #endif | 936 #endif |
| 937 | 937 |
| 938 #endif | 938 #endif |
| OLD | NEW |