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 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 | 822 |
823 // This is used by FrameSelection to denote when the active-state of the page ha
s changed | 823 // This is used by FrameSelection to denote when the active-state of the page ha
s changed |
824 // independent of the focused element changing. | 824 // independent of the focused element changing. |
825 void ContainerNode::focusStateChanged() | 825 void ContainerNode::focusStateChanged() |
826 { | 826 { |
827 // If we're just changing the window's active state and the focused node has
no | 827 // If we're just changing the window's active state and the focused node has
no |
828 // renderer we can just ignore the state change. | 828 // renderer we can just ignore the state change. |
829 if (!renderer()) | 829 if (!renderer()) |
830 return; | 830 return; |
831 | 831 |
832 if (renderStyle()->affectedByFocus() && renderStyle()->hasPseudoStyle(FIRST_
LETTER)) | 832 if (styleChangeType() < SubtreeStyleChange) { |
833 setNeedsStyleRecalc(SubtreeStyleChange); | 833 if (renderStyle()->affectedByFocus() && renderStyle()->hasPseudoStyle(FI
RST_LETTER)) |
834 else if (isElementNode() && toElement(this)->childrenAffectedByFocus()) | 834 setNeedsStyleRecalc(SubtreeStyleChange); |
835 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().scheduleS
tyleInvalidationForPseudoChange(CSSSelector::PseudoFocus, *toElement(this)); | 835 else if (isElementNode() && toElement(this)->childrenAffectedByFocus()) |
836 else if (renderStyle()->affectedByFocus()) | 836 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().sched
uleStyleInvalidationForPseudoChange(CSSSelector::PseudoFocus, *toElement(this)); |
837 setNeedsStyleRecalc(LocalStyleChange); | 837 else if (renderStyle()->affectedByFocus()) |
| 838 setNeedsStyleRecalc(LocalStyleChange); |
| 839 } |
838 | 840 |
839 if (renderer() && renderer()->style()->hasAppearance()) | 841 if (renderer() && renderer()->style()->hasAppearance()) |
840 RenderTheme::theme().stateChanged(renderer(), FocusState); | 842 RenderTheme::theme().stateChanged(renderer(), FocusState); |
841 } | 843 } |
842 | 844 |
843 void ContainerNode::setFocus(bool received) | 845 void ContainerNode::setFocus(bool received) |
844 { | 846 { |
845 if (focused() == received) | 847 if (focused() == received) |
846 return; | 848 return; |
847 | 849 |
848 Node::setFocus(received); | 850 Node::setFocus(received); |
849 | 851 |
850 focusStateChanged(); | 852 focusStateChanged(); |
851 | 853 |
852 if (renderer() || received) | 854 if (renderer() || received) |
853 return; | 855 return; |
854 | 856 |
855 // If :focus sets display: none, we lose focus but still need to recalc our
style. | 857 // If :focus sets display: none, we lose focus but still need to recalc our
style. |
856 if (isElementNode() && toElement(this)->childrenAffectedByFocus()) | 858 if (isElementNode() && toElement(this)->childrenAffectedByFocus() && styleCh
angeType() < SubtreeStyleChange) |
857 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().scheduleS
tyleInvalidationForPseudoChange(CSSSelector::PseudoFocus, *toElement(this)); | 859 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().scheduleS
tyleInvalidationForPseudoChange(CSSSelector::PseudoFocus, *toElement(this)); |
858 else | 860 else |
859 setNeedsStyleRecalc(LocalStyleChange); | 861 setNeedsStyleRecalc(LocalStyleChange); |
860 } | 862 } |
861 | 863 |
862 void ContainerNode::setActive(bool down) | 864 void ContainerNode::setActive(bool down) |
863 { | 865 { |
864 if (down == active()) | 866 if (down == active()) |
865 return; | 867 return; |
866 | 868 |
867 Node::setActive(down); | 869 Node::setActive(down); |
868 | 870 |
869 // FIXME: Why does this not need to handle the display: none transition like
:hover does? | 871 // FIXME: Why does this not need to handle the display: none transition like
:hover does? |
870 if (renderer()) { | 872 if (renderer()) { |
871 if (renderStyle()->affectedByActive() && renderStyle()->hasPseudoStyle(F
IRST_LETTER)) | 873 if (styleChangeType() < SubtreeStyleChange) { |
872 setNeedsStyleRecalc(SubtreeStyleChange); | 874 if (renderStyle()->affectedByActive() && renderStyle()->hasPseudoSty
le(FIRST_LETTER)) |
873 else if (isElementNode() && toElement(this)->childrenAffectedByActive()) | 875 setNeedsStyleRecalc(SubtreeStyleChange); |
874 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().sched
uleStyleInvalidationForPseudoChange(CSSSelector::PseudoActive, *toElement(this))
; | 876 else if (isElementNode() && toElement(this)->childrenAffectedByActiv
e()) |
875 else if (renderStyle()->affectedByActive()) | 877 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().s
cheduleStyleInvalidationForPseudoChange(CSSSelector::PseudoActive, *toElement(th
is)); |
876 setNeedsStyleRecalc(LocalStyleChange); | 878 else if (renderStyle()->affectedByActive()) |
| 879 setNeedsStyleRecalc(LocalStyleChange); |
| 880 } |
877 | 881 |
878 if (renderStyle()->hasAppearance()) | 882 if (renderStyle()->hasAppearance()) |
879 RenderTheme::theme().stateChanged(renderer(), PressedState); | 883 RenderTheme::theme().stateChanged(renderer(), PressedState); |
880 } | 884 } |
881 } | 885 } |
882 | 886 |
883 void ContainerNode::setHovered(bool over) | 887 void ContainerNode::setHovered(bool over) |
884 { | 888 { |
885 if (over == hovered()) | 889 if (over == hovered()) |
886 return; | 890 return; |
887 | 891 |
888 Node::setHovered(over); | 892 Node::setHovered(over); |
889 | 893 |
890 // If :hover sets display: none we lose our hover but still need to recalc o
ur style. | 894 // If :hover sets display: none we lose our hover but still need to recalc o
ur style. |
891 if (!renderer()) { | 895 if (!renderer()) { |
892 if (over) | 896 if (over) |
893 return; | 897 return; |
894 if (isElementNode() && toElement(this)->childrenAffectedByHover()) | 898 if (isElementNode() && toElement(this)->childrenAffectedByHover() && sty
leChangeType() < SubtreeStyleChange) |
895 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().sched
uleStyleInvalidationForPseudoChange(CSSSelector::PseudoHover, *toElement(this)); | 899 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().sched
uleStyleInvalidationForPseudoChange(CSSSelector::PseudoHover, *toElement(this)); |
896 else | 900 else |
897 setNeedsStyleRecalc(LocalStyleChange); | 901 setNeedsStyleRecalc(LocalStyleChange); |
898 return; | 902 return; |
899 } | 903 } |
900 | 904 |
901 if (renderStyle()->affectedByHover() && renderStyle()->hasPseudoStyle(FIRST_
LETTER)) | 905 if (styleChangeType() < SubtreeStyleChange) { |
902 setNeedsStyleRecalc(SubtreeStyleChange); | 906 if (renderStyle()->affectedByHover() && renderStyle()->hasPseudoStyle(FI
RST_LETTER)) |
903 else if (isElementNode() && toElement(this)->childrenAffectedByHover()) | 907 setNeedsStyleRecalc(SubtreeStyleChange); |
904 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().scheduleS
tyleInvalidationForPseudoChange(CSSSelector::PseudoHover, *toElement(this)); | 908 else if (isElementNode() && toElement(this)->childrenAffectedByHover()) |
905 else if (renderStyle()->affectedByHover()) | 909 document().ensureStyleResolver().ensureUpdatedRuleFeatureSet().sched
uleStyleInvalidationForPseudoChange(CSSSelector::PseudoHover, *toElement(this)); |
906 setNeedsStyleRecalc(LocalStyleChange); | 910 else if (renderStyle()->affectedByHover()) |
| 911 setNeedsStyleRecalc(LocalStyleChange); |
| 912 } |
907 | 913 |
908 if (renderer()->style()->hasAppearance()) | 914 if (renderer()->style()->hasAppearance()) |
909 RenderTheme::theme().stateChanged(renderer(), HoverState); | 915 RenderTheme::theme().stateChanged(renderer(), HoverState); |
910 } | 916 } |
911 | 917 |
912 PassRefPtr<HTMLCollection> ContainerNode::children() | 918 PassRefPtr<HTMLCollection> ContainerNode::children() |
913 { | 919 { |
914 return ensureRareData().ensureNodeLists().addCache<HTMLCollection>(*this, No
deChildren); | 920 return ensureRareData().ensureNodeLists().addCache<HTMLCollection>(*this, No
deChildren); |
915 } | 921 } |
916 | 922 |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1212 return true; | 1218 return true; |
1213 | 1219 |
1214 if (node->isElementNode() && toElement(node)->shadow()) | 1220 if (node->isElementNode() && toElement(node)->shadow()) |
1215 return true; | 1221 return true; |
1216 | 1222 |
1217 return false; | 1223 return false; |
1218 } | 1224 } |
1219 #endif | 1225 #endif |
1220 | 1226 |
1221 } // namespace WebCore | 1227 } // namespace WebCore |
OLD | NEW |