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 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 { | 724 { |
725 // We recalculate size() each time through the loop because a callback | 725 // We recalculate size() each time through the loop because a callback |
726 // can add more callbacks to the end of the queue. | 726 // can add more callbacks to the end of the queue. |
727 for (size_t i = 0; i < s_postAttachCallbackQueue->size(); ++i) { | 727 for (size_t i = 0; i < s_postAttachCallbackQueue->size(); ++i) { |
728 const CallbackInfo& info = (*s_postAttachCallbackQueue)[i]; | 728 const CallbackInfo& info = (*s_postAttachCallbackQueue)[i]; |
729 info.first(info.second.get()); | 729 info.first(info.second.get()); |
730 } | 730 } |
731 s_postAttachCallbackQueue->clear(); | 731 s_postAttachCallbackQueue->clear(); |
732 } | 732 } |
733 | 733 |
734 void ContainerNode::attach() | 734 void ContainerNode::attach(const AttachContext& context) |
735 { | 735 { |
736 attachChildren(); | 736 attachChildren(); |
737 Node::attach(); | 737 Node::attach(context); |
738 } | 738 } |
739 | 739 |
740 void ContainerNode::detach() | 740 void ContainerNode::detach(const AttachContext& context) |
741 { | 741 { |
742 detachChildren(); | 742 detachChildren(); |
743 clearChildNeedsStyleRecalc(); | 743 clearChildNeedsStyleRecalc(); |
744 Node::detach(); | 744 Node::detach(context); |
745 } | 745 } |
746 | 746 |
747 void ContainerNode::childrenChanged(bool changedByParser, Node*, Node*, int chil
dCountDelta) | 747 void ContainerNode::childrenChanged(bool changedByParser, Node*, Node*, int chil
dCountDelta) |
748 { | 748 { |
749 document()->incDOMTreeVersion(); | 749 document()->incDOMTreeVersion(); |
750 if (!changedByParser && childCountDelta) | 750 if (!changedByParser && childCountDelta) |
751 document()->updateRangesAfterChildrenChanged(this); | 751 document()->updateRangesAfterChildrenChanged(this); |
752 invalidateNodeListCachesInAncestors(); | 752 invalidateNodeListCachesInAncestors(); |
753 } | 753 } |
754 | 754 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 renderer()->theme()->stateChanged(renderer(), PressedState); | 786 renderer()->theme()->stateChanged(renderer(), PressedState); |
787 } | 787 } |
788 } | 788 } |
789 | 789 |
790 void ContainerNode::setHovered(bool over) | 790 void ContainerNode::setHovered(bool over) |
791 { | 791 { |
792 if (over == hovered()) return; | 792 if (over == hovered()) return; |
793 | 793 |
794 Node::setHovered(over); | 794 Node::setHovered(over); |
795 | 795 |
| 796 if (!renderer()) { |
| 797 // When setting hover to false, the style needs to be recalc'd even when |
| 798 // there's no renderer (imagine setting display:none in the :hover class
, |
| 799 // if a nil renderer would prevent this element from recalculating its |
| 800 // style, it would never go back to its normal style and remain |
| 801 // stuck in its hovered style). |
| 802 if (!over) |
| 803 setNeedsStyleRecalc(); |
| 804 |
| 805 return; |
| 806 } |
| 807 |
796 // note that we need to recalc the style | 808 // note that we need to recalc the style |
797 // FIXME: Move to Element | 809 // FIXME: Move to Element |
798 if (renderer()) { | 810 if (renderer()) { |
799 if (renderStyle()->affectedByHover() || (isElementNode() && toElement(th
is)->childrenAffectedByHover())) | 811 if (renderStyle()->affectedByHover() || (isElementNode() && toElement(th
is)->childrenAffectedByHover())) |
800 setNeedsStyleRecalc(); | 812 setNeedsStyleRecalc(); |
801 if (renderer() && renderer()->style()->hasAppearance()) | 813 if (renderer() && renderer()->style()->hasAppearance()) |
802 renderer()->theme()->stateChanged(renderer(), HoverState); | 814 renderer()->theme()->stateChanged(renderer(), HoverState); |
803 } | 815 } |
804 } | 816 } |
805 | 817 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 return true; | 963 return true; |
952 | 964 |
953 if (node->isElementNode() && toElement(node)->shadow()) | 965 if (node->isElementNode() && toElement(node)->shadow()) |
954 return true; | 966 return true; |
955 | 967 |
956 return false; | 968 return false; |
957 } | 969 } |
958 #endif | 970 #endif |
959 | 971 |
960 } // namespace WebCore | 972 } // namespace WebCore |
OLD | NEW |