| 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 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 } | 798 } |
| 799 | 799 |
| 800 // This is used by FrameSelection to denote when the active-state of the page ha
s changed | 800 // This is used by FrameSelection to denote when the active-state of the page ha
s changed |
| 801 // independent of the focused element changing. | 801 // independent of the focused element changing. |
| 802 void ContainerNode::focusStateChanged() | 802 void ContainerNode::focusStateChanged() |
| 803 { | 803 { |
| 804 // If we're just changing the window's active state and the focused node has
no | 804 // If we're just changing the window's active state and the focused node has
no |
| 805 // renderer we can just ignore the state change. | 805 // renderer we can just ignore the state change. |
| 806 if (!renderer()) | 806 if (!renderer()) |
| 807 return; | 807 return; |
| 808 // FIXME: This could probably setNeedsStyleRecalc(LocalStyleChange) in the a
ffectedByFocus case | 808 |
| 809 // and only setNeedsStyleRecalc(SubtreeStyleChange) in the childrenAffectedB
yFocus case. | 809 if (isElementNode() && toElement(this)->childrenAffectedByFocus()) |
| 810 if (renderStyle()->affectedByFocus() || (isElementNode() && toElement(this)-
>childrenAffectedByFocus())) | |
| 811 setNeedsStyleRecalc(); | 810 setNeedsStyleRecalc(); |
| 811 else if (renderStyle()->affectedByFocus()) |
| 812 setNeedsStyleRecalc(LocalStyleChange); |
| 813 |
| 812 if (renderer() && renderer()->style()->hasAppearance()) | 814 if (renderer() && renderer()->style()->hasAppearance()) |
| 813 RenderTheme::theme().stateChanged(renderer(), FocusState); | 815 RenderTheme::theme().stateChanged(renderer(), FocusState); |
| 814 } | 816 } |
| 815 | 817 |
| 816 void ContainerNode::setFocus(bool received) | 818 void ContainerNode::setFocus(bool received) |
| 817 { | 819 { |
| 818 if (focused() == received) | 820 if (focused() == received) |
| 819 return; | 821 return; |
| 820 | 822 |
| 821 Node::setFocus(received); | 823 Node::setFocus(received); |
| 822 | 824 |
| 823 focusStateChanged(); | 825 focusStateChanged(); |
| 826 |
| 827 if (renderer() || received) |
| 828 return; |
| 829 |
| 824 // If :focus sets display: none, we lose focus but still need to recalc our
style. | 830 // If :focus sets display: none, we lose focus but still need to recalc our
style. |
| 825 if (!renderer() && !received) | 831 if (isElementNode() && toElement(this)->childrenAffectedByFocus()) |
| 826 setNeedsStyleRecalc(); | 832 setNeedsStyleRecalc(); |
| 833 else |
| 834 setNeedsStyleRecalc(LocalStyleChange); |
| 827 } | 835 } |
| 828 | 836 |
| 829 void ContainerNode::setActive(bool down) | 837 void ContainerNode::setActive(bool down) |
| 830 { | 838 { |
| 831 if (down == active()) | 839 if (down == active()) |
| 832 return; | 840 return; |
| 833 | 841 |
| 834 Node::setActive(down); | 842 Node::setActive(down); |
| 835 | 843 |
| 836 // FIXME: Why does this not need to handle the display: none transition like
:hover does? | 844 // FIXME: Why does this not need to handle the display: none transition like
:hover does? |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |