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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 } | 622 } |
623 | 623 |
624 bool RenderTheme::supportsFocusRing(const RenderStyle* style) const | 624 bool RenderTheme::supportsFocusRing(const RenderStyle* style) const |
625 { | 625 { |
626 return (style->hasAppearance() && style->appearance() != TextFieldPart && st
yle->appearance() != TextAreaPart && style->appearance() != MenulistButtonPart &
& style->appearance() != ListboxPart); | 626 return (style->hasAppearance() && style->appearance() != TextFieldPart && st
yle->appearance() != TextAreaPart && style->appearance() != MenulistButtonPart &
& style->appearance() != ListboxPart); |
627 } | 627 } |
628 | 628 |
629 bool RenderTheme::stateChanged(RenderObject* o, ControlState state) const | 629 bool RenderTheme::stateChanged(RenderObject* o, ControlState state) const |
630 { | 630 { |
631 // Default implementation assumes the controls don't respond to changes in :
hover state | 631 // Default implementation assumes the controls don't respond to changes in :
hover state |
632 if (state == HoverState && !supportsHover(o->style())) | 632 if (state == HoverControlState && !supportsHover(o->style())) |
633 return false; | 633 return false; |
634 | 634 |
635 // Assume pressed state is only responded to if the control is enabled. | 635 // Assume pressed state is only responded to if the control is enabled. |
636 if (state == PressedState && !isEnabled(o)) | 636 if (state == PressedControlState && !isEnabled(o)) |
637 return false; | 637 return false; |
638 | 638 |
639 // Repaint the control. | 639 // Repaint the control. |
640 o->repaint(); | 640 o->repaint(); |
641 return true; | 641 return true; |
642 } | 642 } |
643 | 643 |
644 ControlStates RenderTheme::controlStatesForRenderer(const RenderObject* o) const | 644 ControlStates RenderTheme::controlStatesForRenderer(const RenderObject* o) const |
645 { | 645 { |
646 ControlStates result = 0; | 646 ControlStates result = 0; |
647 if (isHovered(o)) { | 647 if (isHovered(o)) { |
648 result |= HoverState; | 648 result |= HoverControlState; |
649 if (isSpinUpButtonPartHovered(o)) | 649 if (isSpinUpButtonPartHovered(o)) |
650 result |= SpinUpState; | 650 result |= SpinUpControlState; |
651 } | 651 } |
652 if (isPressed(o)) { | 652 if (isPressed(o)) { |
653 result |= PressedState; | 653 result |= PressedControlState; |
654 if (isSpinUpButtonPartPressed(o)) | 654 if (isSpinUpButtonPartPressed(o)) |
655 result |= SpinUpState; | 655 result |= SpinUpControlState; |
656 } | 656 } |
657 if (isFocused(o) && o->style()->outlineStyleIsAuto()) | 657 if (isFocused(o) && o->style()->outlineStyleIsAuto()) |
658 result |= FocusState; | 658 result |= FocusControlState; |
659 if (isEnabled(o)) | 659 if (isEnabled(o)) |
660 result |= EnabledState; | 660 result |= EnabledControlState; |
661 if (isChecked(o)) | 661 if (isChecked(o)) |
662 result |= CheckedState; | 662 result |= CheckedControlState; |
663 if (isReadOnlyControl(o)) | 663 if (isReadOnlyControl(o)) |
664 result |= ReadOnlyState; | 664 result |= ReadOnlyControlState; |
665 if (!isActive(o)) | 665 if (!isActive(o)) |
666 result |= WindowInactiveState; | 666 result |= WindowInactiveControlState; |
667 if (isIndeterminate(o)) | 667 if (isIndeterminate(o)) |
668 result |= IndeterminateState; | 668 result |= IndeterminateControlState; |
669 return result; | 669 return result; |
670 } | 670 } |
671 | 671 |
672 bool RenderTheme::isActive(const RenderObject* o) const | 672 bool RenderTheme::isActive(const RenderObject* o) const |
673 { | 673 { |
674 Node* node = o->node(); | 674 Node* node = o->node(); |
675 if (!node) | 675 if (!node) |
676 return false; | 676 return false; |
677 | 677 |
678 Page* page = node->document().page(); | 678 Page* page = node->document().page(); |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1216 | 1216 |
1217 // padding - not honored by WinIE, needs to be removed. | 1217 // padding - not honored by WinIE, needs to be removed. |
1218 style->resetPadding(); | 1218 style->resetPadding(); |
1219 | 1219 |
1220 // border - honored by WinIE, but looks terrible (just paints in the control
box and turns off the Windows XP theme) | 1220 // border - honored by WinIE, but looks terrible (just paints in the control
box and turns off the Windows XP theme) |
1221 // for now, we will not honor it. | 1221 // for now, we will not honor it. |
1222 style->resetBorder(); | 1222 style->resetBorder(); |
1223 } | 1223 } |
1224 | 1224 |
1225 } // namespace WebCore | 1225 } // namespace WebCore |
OLD | NEW |