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 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 if (hasRareData()) | 527 if (hasRareData()) |
528 m_data.m_rareData->setRenderer(renderer); | 528 m_data.m_rareData->setRenderer(renderer); |
529 else | 529 else |
530 m_data.m_renderer = renderer; | 530 m_data.m_renderer = renderer; |
531 } | 531 } |
532 | 532 |
533 // Use these two methods with caution. | 533 // Use these two methods with caution. |
534 RenderBox* renderBox() const; | 534 RenderBox* renderBox() const; |
535 RenderBoxModelObject* renderBoxModelObject() const; | 535 RenderBoxModelObject* renderBoxModelObject() const; |
536 | 536 |
| 537 struct AttachContext { |
| 538 RenderStyle* resolvedStyle; |
| 539 bool performingReattach; |
| 540 |
| 541 AttachContext() : resolvedStyle(0), performingReattach(false) { } |
| 542 }; |
| 543 |
537 // Attaches this node to the rendering tree. This calculates the style to be
applied to the node and creates an | 544 // Attaches this node to the rendering tree. This calculates the style to be
applied to the node and creates an |
538 // appropriate RenderObject which will be inserted into the tree (except whe
n the style has display: none). This | 545 // appropriate RenderObject which will be inserted into the tree (except whe
n the style has display: none). This |
539 // makes the node visible in the FrameView. | 546 // makes the node visible in the FrameView. |
540 virtual void attach(); | 547 virtual void attach(const AttachContext& = AttachContext()); |
541 | 548 |
542 // Detaches the node from the rendering tree, making it invisible in the ren
dered view. This method will remove | 549 // Detaches the node from the rendering tree, making it invisible in the ren
dered view. This method will remove |
543 // the node's rendering object from the rendering tree and delete it. | 550 // the node's rendering object from the rendering tree and delete it. |
544 virtual void detach(); | 551 virtual void detach(const AttachContext& = AttachContext()); |
545 | 552 |
546 #ifndef NDEBUG | 553 #ifndef NDEBUG |
547 bool inDetach() const; | 554 bool inDetach() const; |
548 #endif | 555 #endif |
549 | 556 |
550 void reattach(); | 557 void reattach(const AttachContext& = AttachContext()); |
551 void lazyReattachIfAttached(); | 558 void lazyReattachIfAttached(); |
552 ContainerNode* parentNodeForRenderingAndStyle(); | 559 ContainerNode* parentNodeForRenderingAndStyle(); |
553 | 560 |
554 // Wrapper for nodes that don't have a renderer, but still cache the style (
like HTMLOptionElement). | 561 // Wrapper for nodes that don't have a renderer, but still cache the style (
like HTMLOptionElement). |
555 RenderStyle* renderStyle() const; | 562 RenderStyle* renderStyle() const; |
556 | 563 |
557 RenderStyle* computedStyle(PseudoId pseudoElementSpecifier = NOPSEUDO) { ret
urn virtualComputedStyle(pseudoElementSpecifier); } | 564 RenderStyle* computedStyle(PseudoId pseudoElementSpecifier = NOPSEUDO) { ret
urn virtualComputedStyle(pseudoElementSpecifier); } |
558 | 565 |
559 // -------------------------------------------------------------------------
---- | 566 // -------------------------------------------------------------------------
---- |
560 // Notification of document structure changes (see ContainerNode.h for more
notification methods) | 567 // Notification of document structure changes (see ContainerNode.h for more
notification methods) |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 { | 886 { |
880 return isShadowRoot() ? 0 : parentOrShadowHostNode(); | 887 return isShadowRoot() ? 0 : parentOrShadowHostNode(); |
881 } | 888 } |
882 | 889 |
883 inline ContainerNode* Node::parentNodeGuaranteedHostFree() const | 890 inline ContainerNode* Node::parentNodeGuaranteedHostFree() const |
884 { | 891 { |
885 ASSERT(!isShadowRoot()); | 892 ASSERT(!isShadowRoot()); |
886 return parentOrShadowHostNode(); | 893 return parentOrShadowHostNode(); |
887 } | 894 } |
888 | 895 |
889 inline void Node::reattach() | 896 inline void Node::reattach(const AttachContext& context) |
890 { | 897 { |
| 898 AttachContext reattachContext(context); |
| 899 reattachContext.performingReattach = true; |
| 900 |
891 if (attached()) | 901 if (attached()) |
892 detach(); | 902 detach(reattachContext); |
893 attach(); | 903 attach(reattachContext); |
894 } | 904 } |
895 | 905 |
896 inline void Node::lazyReattachIfAttached() | 906 inline void Node::lazyReattachIfAttached() |
897 { | 907 { |
898 if (attached()) | 908 if (attached()) |
899 lazyReattach(); | 909 lazyReattach(); |
900 } | 910 } |
901 | 911 |
902 inline void Node::lazyReattach(ShouldSetAttached shouldSetAttached) | 912 inline void Node::lazyReattach(ShouldSetAttached shouldSetAttached) |
903 { | 913 { |
(...skipping 11 matching lines...) Expand all Loading... |
915 | 925 |
916 } //namespace | 926 } //namespace |
917 | 927 |
918 #ifndef NDEBUG | 928 #ifndef NDEBUG |
919 // Outside the WebCore namespace for ease of invocation from gdb. | 929 // Outside the WebCore namespace for ease of invocation from gdb. |
920 void showTree(const WebCore::Node*); | 930 void showTree(const WebCore::Node*); |
921 void showNodePath(const WebCore::Node*); | 931 void showNodePath(const WebCore::Node*); |
922 #endif | 932 #endif |
923 | 933 |
924 #endif | 934 #endif |
OLD | NEW |