Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(436)

Side by Side Diff: Source/core/dom/ContainerNode.cpp

Issue 169643002: SubtreeStyleChange for :hover/:active/:focus with ::first-letter. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Check for :hover/:active/:focus instead. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « LayoutTests/fast/css/first-line-hover-001-expected.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 802
803 // This is used by FrameSelection to denote when the active-state of the page ha s changed 803 // This is used by FrameSelection to denote when the active-state of the page ha s changed
804 // independent of the focused element changing. 804 // independent of the focused element changing.
805 void ContainerNode::focusStateChanged() 805 void ContainerNode::focusStateChanged()
806 { 806 {
807 // If we're just changing the window's active state and the focused node has no 807 // If we're just changing the window's active state and the focused node has no
808 // renderer we can just ignore the state change. 808 // renderer we can just ignore the state change.
809 if (!renderer()) 809 if (!renderer())
810 return; 810 return;
811 811
812 if (isElementNode() && toElement(this)->childrenAffectedByFocus()) 812 if ((isElementNode() && toElement(this)->childrenAffectedByFocus())
813 || (renderStyle()->affectedByFocus() && renderStyle()->hasPseudoStyle(FI RST_LETTER)))
813 setNeedsStyleRecalc(SubtreeStyleChange); 814 setNeedsStyleRecalc(SubtreeStyleChange);
814 else if (renderStyle()->affectedByFocus()) 815 else if (renderStyle()->affectedByFocus())
815 setNeedsStyleRecalc(LocalStyleChange); 816 setNeedsStyleRecalc(LocalStyleChange);
816 817
817 if (renderer() && renderer()->style()->hasAppearance()) 818 if (renderer() && renderer()->style()->hasAppearance())
818 RenderTheme::theme().stateChanged(renderer(), FocusState); 819 RenderTheme::theme().stateChanged(renderer(), FocusState);
819 } 820 }
820 821
821 void ContainerNode::setFocus(bool received) 822 void ContainerNode::setFocus(bool received)
822 { 823 {
(...skipping 16 matching lines...) Expand all
839 840
840 void ContainerNode::setActive(bool down) 841 void ContainerNode::setActive(bool down)
841 { 842 {
842 if (down == active()) 843 if (down == active())
843 return; 844 return;
844 845
845 Node::setActive(down); 846 Node::setActive(down);
846 847
847 // FIXME: Why does this not need to handle the display: none transition like :hover does? 848 // FIXME: Why does this not need to handle the display: none transition like :hover does?
848 if (renderer()) { 849 if (renderer()) {
849 if (isElementNode() && toElement(this)->childrenAffectedByActive()) 850 if ((isElementNode() && toElement(this)->childrenAffectedByActive())
851 || (renderStyle()->affectedByActive() && renderStyle()->hasPseudoSty le(FIRST_LETTER)))
850 setNeedsStyleRecalc(SubtreeStyleChange); 852 setNeedsStyleRecalc(SubtreeStyleChange);
851 else if (renderStyle()->affectedByActive()) 853 else if (renderStyle()->affectedByActive())
852 setNeedsStyleRecalc(LocalStyleChange); 854 setNeedsStyleRecalc(LocalStyleChange);
853 855
854 if (renderStyle()->hasAppearance()) 856 if (renderStyle()->hasAppearance())
855 RenderTheme::theme().stateChanged(renderer(), PressedState); 857 RenderTheme::theme().stateChanged(renderer(), PressedState);
856 } 858 }
857 } 859 }
858 860
859 void ContainerNode::setHovered(bool over) 861 void ContainerNode::setHovered(bool over)
860 { 862 {
861 if (over == hovered()) 863 if (over == hovered())
862 return; 864 return;
863 865
864 Node::setHovered(over); 866 Node::setHovered(over);
865 867
866 // If :hover sets display: none we lose our hover but still need to recalc o ur style. 868 // If :hover sets display: none we lose our hover but still need to recalc o ur style.
867 if (!renderer()) { 869 if (!renderer()) {
868 if (over) 870 if (over)
869 return; 871 return;
870 if (isElementNode() && toElement(this)->childrenAffectedByHover()) 872 if (isElementNode() && toElement(this)->childrenAffectedByHover())
871 setNeedsStyleRecalc(SubtreeStyleChange); 873 setNeedsStyleRecalc(SubtreeStyleChange);
872 else 874 else
873 setNeedsStyleRecalc(LocalStyleChange); 875 setNeedsStyleRecalc(LocalStyleChange);
874 return; 876 return;
875 } 877 }
876 878
877 if (isElementNode() && toElement(this)->childrenAffectedByHover()) 879 if ((isElementNode() && toElement(this)->childrenAffectedByHover())
880 || (renderStyle()->affectedByHover() && renderStyle()->hasPseudoStyle(FI RST_LETTER)))
878 setNeedsStyleRecalc(SubtreeStyleChange); 881 setNeedsStyleRecalc(SubtreeStyleChange);
879 else if (renderStyle()->affectedByHover()) 882 else if (renderStyle()->affectedByHover())
880 setNeedsStyleRecalc(LocalStyleChange); 883 setNeedsStyleRecalc(LocalStyleChange);
881 884
882 if (renderer()->style()->hasAppearance()) 885 if (renderer()->style()->hasAppearance())
883 RenderTheme::theme().stateChanged(renderer(), HoverState); 886 RenderTheme::theme().stateChanged(renderer(), HoverState);
884 } 887 }
885 888
886 PassRefPtr<HTMLCollection> ContainerNode::children() 889 PassRefPtr<HTMLCollection> ContainerNode::children()
887 { 890 {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 return true; 1049 return true;
1047 1050
1048 if (node->isElementNode() && toElement(node)->shadow()) 1051 if (node->isElementNode() && toElement(node)->shadow())
1049 return true; 1052 return true;
1050 1053
1051 return false; 1054 return false;
1052 } 1055 }
1053 #endif 1056 #endif
1054 1057
1055 } // namespace WebCore 1058 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/css/first-line-hover-001-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698