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

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

Issue 2095833003: :active pseudo class is not applied for element with display none. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated test case which require LocalStyleChange calculation from both setActive and setHover Created 4 years, 5 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 | « third_party/WebKit/LayoutTests/fast/css/pseudo-hover-active-display-none-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, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved.
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 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::creat eWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus)); 1019 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::creat eWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Focus));
1020 } 1020 }
1021 1021
1022 void ContainerNode::setActive(bool down) 1022 void ContainerNode::setActive(bool down)
1023 { 1023 {
1024 if (down == active()) 1024 if (down == active())
1025 return; 1025 return;
1026 1026
1027 Node::setActive(down); 1027 Node::setActive(down);
1028 1028
1029 // FIXME: Why does this not need to handle the display: none transition like :hover does? 1029 if (!layoutObject()) {
1030 if (layoutObject()) {
1031 if (computedStyle()->affectedByActive()) {
1032 StyleChangeType changeType = computedStyle()->hasPseudoStyle(PseudoI dFirstLetter) ? SubtreeStyleChange : LocalStyleChange;
1033 setNeedsStyleRecalc(changeType, StyleChangeReasonForTracing::createW ithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Active));
1034 }
1035 if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedByActi ve()) 1030 if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedByActi ve())
1036 toElement(this)->pseudoStateChanged(CSSSelector::PseudoActive); 1031 toElement(this)->pseudoStateChanged(CSSSelector::PseudoActive);
1032 else
1033 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::c reateWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Active) );
1034 return;
1035 }
1037 1036
1038 LayoutTheme::theme().controlStateChanged(*layoutObject(), PressedControl State); 1037 if (computedStyle()->affectedByActive()) {
1038 StyleChangeType changeType = computedStyle()->hasPseudoStyle(PseudoIdFir stLetter) ? SubtreeStyleChange : LocalStyleChange;
1039 setNeedsStyleRecalc(changeType, StyleChangeReasonForTracing::createWithE xtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Active));
1039 } 1040 }
1041 if (isElementNode() && toElement(this)->childrenOrSiblingsAffectedByActive() )
1042 toElement(this)->pseudoStateChanged(CSSSelector::PseudoActive);
1043
1044 LayoutTheme::theme().controlStateChanged(*layoutObject(), PressedControlStat e);
1040 } 1045 }
1041 1046
1042 void ContainerNode::setHovered(bool over) 1047 void ContainerNode::setHovered(bool over)
1043 { 1048 {
1044 if (over == hovered()) 1049 if (over == hovered())
1045 return; 1050 return;
1046 1051
1047 Node::setHovered(over); 1052 Node::setHovered(over);
1048 1053
1049 // If :hover sets display: none we lose our hover but still need to recalc o ur style. 1054 // If :hover sets display: none we lose our hover but still need to recalc o ur style.
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 return true; 1390 return true;
1386 1391
1387 if (node->isElementNode() && toElement(node)->shadow()) 1392 if (node->isElementNode() && toElement(node)->shadow())
1388 return true; 1393 return true;
1389 1394
1390 return false; 1395 return false;
1391 } 1396 }
1392 #endif 1397 #endif
1393 1398
1394 } // namespace blink 1399 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css/pseudo-hover-active-display-none-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698