OLD | NEW |
1 /** | 1 /** |
2 * This file is part of the theme implementation for form controls in WebCore. | 2 * This file is part of the theme implementation for form controls in WebCore. |
3 * | 3 * |
4 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Computer, Inc. | 4 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Computer, Inc. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 void RenderTheme::adjustRepaintRect(const RenderObject* o, IntRect& r) | 693 void RenderTheme::adjustRepaintRect(const RenderObject* o, IntRect& r) |
694 { | 694 { |
695 #if USE(NEW_THEME) | 695 #if USE(NEW_THEME) |
696 m_theme->inflateControlPaintRect(o->style()->appearance(), controlStatesForR
enderer(o), r, o->style()->effectiveZoom()); | 696 m_theme->inflateControlPaintRect(o->style()->appearance(), controlStatesForR
enderer(o), r, o->style()->effectiveZoom()); |
697 #else | 697 #else |
698 UNUSED_PARAM(o); | 698 UNUSED_PARAM(o); |
699 UNUSED_PARAM(r); | 699 UNUSED_PARAM(r); |
700 #endif | 700 #endif |
701 } | 701 } |
702 | 702 |
| 703 bool RenderTheme::shouldDrawDefaultFocusRing(RenderObject* renderer) const |
| 704 { |
| 705 if (supportsFocusRing(renderer->style())) |
| 706 return false; |
| 707 if (!renderer->style()->hasAppearance()) |
| 708 return true; |
| 709 Node* node = renderer->node(); |
| 710 if (!node) |
| 711 return true; |
| 712 // We can't use RenderTheme::isFocused because outline:auto might be |
| 713 // specified to non-:focus rulesets. |
| 714 if (node->focused() && !node->shouldHaveFocusAppearance()) |
| 715 return false; |
| 716 return true; |
| 717 } |
| 718 |
703 bool RenderTheme::supportsFocusRing(const RenderStyle* style) const | 719 bool RenderTheme::supportsFocusRing(const RenderStyle* style) const |
704 { | 720 { |
705 return (style->hasAppearance() && style->appearance() != TextFieldPart && st
yle->appearance() != TextAreaPart && style->appearance() != MenulistButtonPart &
& style->appearance() != ListboxPart); | 721 return (style->hasAppearance() && style->appearance() != TextFieldPart && st
yle->appearance() != TextAreaPart && style->appearance() != MenulistButtonPart &
& style->appearance() != ListboxPart); |
706 } | 722 } |
707 | 723 |
708 bool RenderTheme::stateChanged(RenderObject* o, ControlState state) const | 724 bool RenderTheme::stateChanged(RenderObject* o, ControlState state) const |
709 { | 725 { |
710 // Default implementation assumes the controls don't respond to changes in :
hover state | 726 // Default implementation assumes the controls don't respond to changes in :
hover state |
711 if (state == HoverState && !supportsHover(o->style())) | 727 if (state == HoverState && !supportsHover(o->style())) |
712 return false; | 728 return false; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 | 815 |
800 bool RenderTheme::isFocused(const RenderObject* o) const | 816 bool RenderTheme::isFocused(const RenderObject* o) const |
801 { | 817 { |
802 Node* node = o->node(); | 818 Node* node = o->node(); |
803 if (!node) | 819 if (!node) |
804 return false; | 820 return false; |
805 | 821 |
806 node = node->focusDelegate(); | 822 node = node->focusDelegate(); |
807 Document* document = node->document(); | 823 Document* document = node->document(); |
808 Frame* frame = document->frame(); | 824 Frame* frame = document->frame(); |
809 return node == document->focusedNode() && frame && frame->selection()->isFoc
usedAndActive(); | 825 return node == document->focusedNode() && node->shouldHaveFocusAppearance()
&& frame && frame->selection()->isFocusedAndActive(); |
810 } | 826 } |
811 | 827 |
812 bool RenderTheme::isPressed(const RenderObject* o) const | 828 bool RenderTheme::isPressed(const RenderObject* o) const |
813 { | 829 { |
814 if (!o->node()) | 830 if (!o->node()) |
815 return false; | 831 return false; |
816 return o->node()->active(); | 832 return o->node()->active(); |
817 } | 833 } |
818 | 834 |
819 bool RenderTheme::isSpinUpButtonPartPressed(const RenderObject* o) const | 835 bool RenderTheme::isSpinUpButtonPartPressed(const RenderObject* o) const |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1386 | 1402 |
1387 // padding - not honored by WinIE, needs to be removed. | 1403 // padding - not honored by WinIE, needs to be removed. |
1388 style->resetPadding(); | 1404 style->resetPadding(); |
1389 | 1405 |
1390 // border - honored by WinIE, but looks terrible (just paints in the control
box and turns off the Windows XP theme) | 1406 // border - honored by WinIE, but looks terrible (just paints in the control
box and turns off the Windows XP theme) |
1391 // for now, we will not honor it. | 1407 // for now, we will not honor it. |
1392 style->resetBorder(); | 1408 style->resetBorder(); |
1393 } | 1409 } |
1394 | 1410 |
1395 } // namespace WebCore | 1411 } // namespace WebCore |
OLD | NEW |