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

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

Issue 16599003: :hover style not applied on hover if its display property is different from original style's (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch (fixed test that was expected to fail and is now passing) Created 7 years, 6 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/dom/ContainerNode.h ('k') | Source/core/dom/Document.h » ('j') | 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 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 { 701 {
702 // We recalculate size() each time through the loop because a callback 702 // We recalculate size() each time through the loop because a callback
703 // can add more callbacks to the end of the queue. 703 // can add more callbacks to the end of the queue.
704 for (size_t i = 0; i < s_postAttachCallbackQueue->size(); ++i) { 704 for (size_t i = 0; i < s_postAttachCallbackQueue->size(); ++i) {
705 const CallbackInfo& info = (*s_postAttachCallbackQueue)[i]; 705 const CallbackInfo& info = (*s_postAttachCallbackQueue)[i];
706 info.first(info.second.get()); 706 info.first(info.second.get());
707 } 707 }
708 s_postAttachCallbackQueue->clear(); 708 s_postAttachCallbackQueue->clear();
709 } 709 }
710 710
711 void ContainerNode::attach() 711 void ContainerNode::attach(const AttachContext& context)
712 { 712 {
713 attachChildren(); 713 attachChildren();
714 Node::attach(); 714 Node::attach(context);
715 } 715 }
716 716
717 void ContainerNode::detach() 717 void ContainerNode::detach(const AttachContext& context)
718 { 718 {
719 detachChildren(); 719 detachChildren();
720 clearChildNeedsStyleRecalc(); 720 clearChildNeedsStyleRecalc();
721 Node::detach(); 721 Node::detach(context);
722 } 722 }
723 723
724 void ContainerNode::childrenChanged(bool changedByParser, Node*, Node*, int chil dCountDelta) 724 void ContainerNode::childrenChanged(bool changedByParser, Node*, Node*, int chil dCountDelta)
725 { 725 {
726 document()->incDOMTreeVersion(); 726 document()->incDOMTreeVersion();
727 if (!changedByParser && childCountDelta) 727 if (!changedByParser && childCountDelta)
728 document()->updateRangesAfterChildrenChanged(this); 728 document()->updateRangesAfterChildrenChanged(this);
729 invalidateNodeListCachesInAncestors(); 729 invalidateNodeListCachesInAncestors();
730 } 730 }
731 731
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 renderer()->theme()->stateChanged(renderer(), PressedState); 895 renderer()->theme()->stateChanged(renderer(), PressedState);
896 } 896 }
897 } 897 }
898 898
899 void ContainerNode::setHovered(bool over) 899 void ContainerNode::setHovered(bool over)
900 { 900 {
901 if (over == hovered()) return; 901 if (over == hovered()) return;
902 902
903 Node::setHovered(over); 903 Node::setHovered(over);
904 904
905 if (!renderer()) {
906 // When setting hover to false, the style needs to be recalc'd even when
907 // there's no renderer (imagine setting display:none in the :hover class ,
908 // if a nil renderer would prevent this element from recalculating its
909 // style, it would never go back to its normal style and remain
910 // stuck in its hovered style).
911 if (!over)
912 setNeedsStyleRecalc();
913
914 return;
915 }
916
905 // note that we need to recalc the style 917 // note that we need to recalc the style
906 // FIXME: Move to Element 918 // FIXME: Move to Element
907 if (renderer()) { 919 if (renderer()) {
908 if (renderStyle()->affectedByHover() || (isElementNode() && toElement(th is)->childrenAffectedByHover())) 920 if (renderStyle()->affectedByHover() || (isElementNode() && toElement(th is)->childrenAffectedByHover()))
909 setNeedsStyleRecalc(); 921 setNeedsStyleRecalc();
910 if (renderer() && renderer()->style()->hasAppearance()) 922 if (renderer() && renderer()->style()->hasAppearance())
911 renderer()->theme()->stateChanged(renderer(), HoverState); 923 renderer()->theme()->stateChanged(renderer(), HoverState);
912 } 924 }
913 } 925 }
914 926
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 return true; 1063 return true;
1052 1064
1053 if (node->isElementNode() && toElement(node)->shadow()) 1065 if (node->isElementNode() && toElement(node)->shadow())
1054 return true; 1066 return true;
1055 1067
1056 return false; 1068 return false;
1057 } 1069 }
1058 #endif 1070 #endif
1059 1071
1060 } // namespace WebCore 1072 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/ContainerNode.h ('k') | Source/core/dom/Document.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698