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

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

Issue 148243004: Use LocalStyleChange for :hover/:active not affected by descendants. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased. 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 | « Source/core/css/HoverUpdateTest.cpp ('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 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 828
829 void ContainerNode::setActive(bool down) 829 void ContainerNode::setActive(bool down)
830 { 830 {
831 if (down == active()) 831 if (down == active())
832 return; 832 return;
833 833
834 Node::setActive(down); 834 Node::setActive(down);
835 835
836 // FIXME: Why does this not need to handle the display: none transition like :hover does? 836 // FIXME: Why does this not need to handle the display: none transition like :hover does?
837 if (renderer()) { 837 if (renderer()) {
838 if (renderStyle()->affectedByActive() || (isElementNode() && toElement(t his)->childrenAffectedByActive())) 838 if (isElementNode() && toElement(this)->childrenAffectedByActive())
839 setNeedsStyleRecalc(SubtreeStyleChange); 839 setNeedsStyleRecalc(SubtreeStyleChange);
840 else if (renderStyle()->affectedByActive())
841 setNeedsStyleRecalc(LocalStyleChange);
842
840 if (renderStyle()->hasAppearance()) 843 if (renderStyle()->hasAppearance())
841 RenderTheme::theme().stateChanged(renderer(), PressedState); 844 RenderTheme::theme().stateChanged(renderer(), PressedState);
842 } 845 }
843 } 846 }
844 847
845 void ContainerNode::setHovered(bool over) 848 void ContainerNode::setHovered(bool over)
846 { 849 {
847 if (over == hovered()) 850 if (over == hovered())
848 return; 851 return;
849 852
850 Node::setHovered(over); 853 Node::setHovered(over);
851 854
852 // If :hover sets display: none we lose our hover but still need to recalc o ur style. 855 // If :hover sets display: none we lose our hover but still need to recalc o ur style.
853 if (!renderer()) { 856 if (!renderer()) {
854 if (!over) 857 if (over)
858 return;
859 if (isElementNode() && toElement(this)->childrenAffectedByHover())
855 setNeedsStyleRecalc(SubtreeStyleChange); 860 setNeedsStyleRecalc(SubtreeStyleChange);
861 else
862 setNeedsStyleRecalc(LocalStyleChange);
856 return; 863 return;
857 } 864 }
858 865
859 if (renderer()) { 866 if (isElementNode() && toElement(this)->childrenAffectedByHover())
860 if (renderStyle()->affectedByHover() || (isElementNode() && toElement(th is)->childrenAffectedByHover())) 867 setNeedsStyleRecalc(SubtreeStyleChange);
861 setNeedsStyleRecalc(SubtreeStyleChange); 868 else if (renderStyle()->affectedByHover())
862 if (renderer() && renderer()->style()->hasAppearance()) 869 setNeedsStyleRecalc(LocalStyleChange);
863 RenderTheme::theme().stateChanged(renderer(), HoverState); 870
864 } 871 if (renderer()->style()->hasAppearance())
872 RenderTheme::theme().stateChanged(renderer(), HoverState);
865 } 873 }
866 874
867 PassRefPtr<HTMLCollection> ContainerNode::children() 875 PassRefPtr<HTMLCollection> ContainerNode::children()
868 { 876 {
869 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<HTMLCollect ion>(this, NodeChildren); 877 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<HTMLCollect ion>(this, NodeChildren);
870 } 878 }
871 879
872 Element* ContainerNode::firstElementChild() const 880 Element* ContainerNode::firstElementChild() const
873 { 881 {
874 return ElementTraversal::firstWithin(*this); 882 return ElementTraversal::firstWithin(*this);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 return true; 1059 return true;
1052 1060
1053 if (node->isElementNode() && toElement(node)->shadow()) 1061 if (node->isElementNode() && toElement(node)->shadow())
1054 return true; 1062 return true;
1055 1063
1056 return false; 1064 return false;
1057 } 1065 }
1058 #endif 1066 #endif
1059 1067
1060 } // namespace WebCore 1068 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/HoverUpdateTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698