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 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 | 807 |
808 // This is used by FrameSelection to denote when the active-state of the page ha
s changed | 808 // This is used by FrameSelection to denote when the active-state of the page ha
s changed |
809 // independent of the focused element changing. | 809 // independent of the focused element changing. |
810 void ContainerNode::focusStateChanged() | 810 void ContainerNode::focusStateChanged() |
811 { | 811 { |
812 // If we're just changing the window's active state and the focused node has
no | 812 // If we're just changing the window's active state and the focused node has
no |
813 // renderer we can just ignore the state change. | 813 // renderer we can just ignore the state change. |
814 if (!renderer()) | 814 if (!renderer()) |
815 return; | 815 return; |
816 | 816 |
817 if ((isElementNode() && toElement(this)->childrenAffectedByFocus()) | 817 if (renderStyle()->affectedByFocus() && renderStyle()->hasPseudoStyle(FIRST_
LETTER)) |
818 || (renderStyle()->affectedByFocus() && renderStyle()->hasPseudoStyle(FI
RST_LETTER))) | |
819 setNeedsStyleRecalc(SubtreeStyleChange); | 818 setNeedsStyleRecalc(SubtreeStyleChange); |
| 819 else if (isElementNode() && toElement(this)->childrenAffectedByFocus()) |
| 820 document().styleResolver()->ensureUpdatedRuleFeatureSet().scheduleStyleI
nvalidationForPseudoChange(CSSSelector::PseudoFocus, *toElement(this)); |
820 else if (renderStyle()->affectedByFocus()) | 821 else if (renderStyle()->affectedByFocus()) |
821 setNeedsStyleRecalc(LocalStyleChange); | 822 setNeedsStyleRecalc(LocalStyleChange); |
822 | 823 |
823 if (renderer() && renderer()->style()->hasAppearance()) | 824 if (renderer() && renderer()->style()->hasAppearance()) |
824 RenderTheme::theme().stateChanged(renderer(), FocusState); | 825 RenderTheme::theme().stateChanged(renderer(), FocusState); |
825 } | 826 } |
826 | 827 |
827 void ContainerNode::setFocus(bool received) | 828 void ContainerNode::setFocus(bool received) |
828 { | 829 { |
829 if (focused() == received) | 830 if (focused() == received) |
830 return; | 831 return; |
831 | 832 |
832 Node::setFocus(received); | 833 Node::setFocus(received); |
833 | 834 |
834 focusStateChanged(); | 835 focusStateChanged(); |
835 | 836 |
836 if (renderer() || received) | 837 if (renderer() || received) |
837 return; | 838 return; |
838 | 839 |
839 // If :focus sets display: none, we lose focus but still need to recalc our
style. | 840 // If :focus sets display: none, we lose focus but still need to recalc our
style. |
840 if (isElementNode() && toElement(this)->childrenAffectedByFocus()) | 841 if (isElementNode() && toElement(this)->childrenAffectedByFocus()) |
841 setNeedsStyleRecalc(SubtreeStyleChange); | 842 document().styleResolver()->ensureUpdatedRuleFeatureSet().scheduleStyleI
nvalidationForPseudoChange(CSSSelector::PseudoFocus, *toElement(this)); |
842 else | 843 else |
843 setNeedsStyleRecalc(LocalStyleChange); | 844 setNeedsStyleRecalc(LocalStyleChange); |
844 } | 845 } |
845 | 846 |
846 void ContainerNode::setActive(bool down) | 847 void ContainerNode::setActive(bool down) |
847 { | 848 { |
848 if (down == active()) | 849 if (down == active()) |
849 return; | 850 return; |
850 | 851 |
851 Node::setActive(down); | 852 Node::setActive(down); |
852 | 853 |
853 // FIXME: Why does this not need to handle the display: none transition like
:hover does? | 854 // FIXME: Why does this not need to handle the display: none transition like
:hover does? |
854 if (renderer()) { | 855 if (renderer()) { |
855 if ((isElementNode() && toElement(this)->childrenAffectedByActive()) | 856 if (renderStyle()->affectedByActive() && renderStyle()->hasPseudoStyle(F
IRST_LETTER)) |
856 || (renderStyle()->affectedByActive() && renderStyle()->hasPseudoSty
le(FIRST_LETTER))) | |
857 setNeedsStyleRecalc(SubtreeStyleChange); | 857 setNeedsStyleRecalc(SubtreeStyleChange); |
| 858 else if (isElementNode() && toElement(this)->childrenAffectedByActive()) |
| 859 document().styleResolver()->ensureUpdatedRuleFeatureSet().scheduleSt
yleInvalidationForPseudoChange(CSSSelector::PseudoActive, *toElement(this)); |
858 else if (renderStyle()->affectedByActive()) | 860 else if (renderStyle()->affectedByActive()) |
859 setNeedsStyleRecalc(LocalStyleChange); | 861 setNeedsStyleRecalc(LocalStyleChange); |
860 | 862 |
861 if (renderStyle()->hasAppearance()) | 863 if (renderStyle()->hasAppearance()) |
862 RenderTheme::theme().stateChanged(renderer(), PressedState); | 864 RenderTheme::theme().stateChanged(renderer(), PressedState); |
863 } | 865 } |
864 } | 866 } |
865 | 867 |
866 void ContainerNode::setHovered(bool over) | 868 void ContainerNode::setHovered(bool over) |
867 { | 869 { |
868 if (over == hovered()) | 870 if (over == hovered()) |
869 return; | 871 return; |
870 | 872 |
871 Node::setHovered(over); | 873 Node::setHovered(over); |
872 | 874 |
873 // If :hover sets display: none we lose our hover but still need to recalc o
ur style. | 875 // If :hover sets display: none we lose our hover but still need to recalc o
ur style. |
874 if (!renderer()) { | 876 if (!renderer()) { |
875 if (over) | 877 if (over) |
876 return; | 878 return; |
877 if (isElementNode() && toElement(this)->childrenAffectedByHover()) | 879 if (isElementNode() && toElement(this)->childrenAffectedByHover()) |
878 setNeedsStyleRecalc(SubtreeStyleChange); | 880 document().styleResolver()->ensureUpdatedRuleFeatureSet().scheduleSt
yleInvalidationForPseudoChange(CSSSelector::PseudoHover, *toElement(this)); |
879 else | 881 else |
880 setNeedsStyleRecalc(LocalStyleChange); | 882 setNeedsStyleRecalc(LocalStyleChange); |
881 return; | 883 return; |
882 } | 884 } |
883 | 885 |
884 if ((isElementNode() && toElement(this)->childrenAffectedByHover()) | 886 if (renderStyle()->affectedByHover() && renderStyle()->hasPseudoStyle(FIRST_
LETTER)) |
885 || (renderStyle()->affectedByHover() && renderStyle()->hasPseudoStyle(FI
RST_LETTER))) | |
886 setNeedsStyleRecalc(SubtreeStyleChange); | 887 setNeedsStyleRecalc(SubtreeStyleChange); |
| 888 else if (isElementNode() && toElement(this)->childrenAffectedByHover()) |
| 889 document().styleResolver()->ensureUpdatedRuleFeatureSet().scheduleStyleI
nvalidationForPseudoChange(CSSSelector::PseudoHover, *toElement(this)); |
887 else if (renderStyle()->affectedByHover()) | 890 else if (renderStyle()->affectedByHover()) |
888 setNeedsStyleRecalc(LocalStyleChange); | 891 setNeedsStyleRecalc(LocalStyleChange); |
889 | 892 |
890 if (renderer()->style()->hasAppearance()) | 893 if (renderer()->style()->hasAppearance()) |
891 RenderTheme::theme().stateChanged(renderer(), HoverState); | 894 RenderTheme::theme().stateChanged(renderer(), HoverState); |
892 } | 895 } |
893 | 896 |
894 PassRefPtr<HTMLCollection> ContainerNode::children() | 897 PassRefPtr<HTMLCollection> ContainerNode::children() |
895 { | 898 { |
896 return ensureRareData().ensureNodeLists().addCache<HTMLCollection>(*this, No
deChildren); | 899 return ensureRareData().ensureNodeLists().addCache<HTMLCollection>(*this, No
deChildren); |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1172 return true; | 1175 return true; |
1173 | 1176 |
1174 if (node->isElementNode() && toElement(node)->shadow()) | 1177 if (node->isElementNode() && toElement(node)->shadow()) |
1175 return true; | 1178 return true; |
1176 | 1179 |
1177 return false; | 1180 return false; |
1178 } | 1181 } |
1179 #endif | 1182 #endif |
1180 | 1183 |
1181 } // namespace WebCore | 1184 } // namespace WebCore |
OLD | NEW |