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

Side by Side Diff: Source/core/rendering/RenderTheme.cpp

Issue 16194013: Mouse press should focus on any types of form controls. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 | Annotate | Revision Log
OLDNEW
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 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 void RenderTheme::adjustRepaintRect(const RenderObject* o, IntRect& r) 685 void RenderTheme::adjustRepaintRect(const RenderObject* o, IntRect& r)
686 { 686 {
687 #if USE(NEW_THEME) 687 #if USE(NEW_THEME)
688 m_theme->inflateControlPaintRect(o->style()->appearance(), controlStatesForR enderer(o), r, o->style()->effectiveZoom()); 688 m_theme->inflateControlPaintRect(o->style()->appearance(), controlStatesForR enderer(o), r, o->style()->effectiveZoom());
689 #else 689 #else
690 UNUSED_PARAM(o); 690 UNUSED_PARAM(o);
691 UNUSED_PARAM(r); 691 UNUSED_PARAM(r);
692 #endif 692 #endif
693 } 693 }
694 694
695 bool RenderTheme::shouldDrawCommonFocusRing(RenderObject* renderer) const
ojan 2013/05/31 22:48:16 I'm not really sure what "Common" means here.
tkent 2013/06/02 23:52:14 We have three types of focus rings. - Dedicated t
696 {
697 if (supportsFocusRing(renderer->style()))
698 return false;
699 if (!renderer->style()->hasAppearance())
700 return true;
701 Node* node = renderer->node();
702 if (!node)
703 return true;
704 // We can't use RenderTheme::isFocused because outline:auto might be
705 // specified to non-:focus rulesets.
706 if (node->focused() && !node->shouldHaveFocusAppearance())
707 return false;
708 return true;
709 }
710
695 bool RenderTheme::supportsFocusRing(const RenderStyle* style) const 711 bool RenderTheme::supportsFocusRing(const RenderStyle* style) const
696 { 712 {
697 return (style->hasAppearance() && style->appearance() != TextFieldPart && st yle->appearance() != TextAreaPart && style->appearance() != MenulistButtonPart & & style->appearance() != ListboxPart); 713 return (style->hasAppearance() && style->appearance() != TextFieldPart && st yle->appearance() != TextAreaPart && style->appearance() != MenulistButtonPart & & style->appearance() != ListboxPart);
698 } 714 }
699 715
700 bool RenderTheme::stateChanged(RenderObject* o, ControlState state) const 716 bool RenderTheme::stateChanged(RenderObject* o, ControlState state) const
701 { 717 {
702 // Default implementation assumes the controls don't respond to changes in : hover state 718 // Default implementation assumes the controls don't respond to changes in : hover state
703 if (state == HoverState && !supportsHover(o->style())) 719 if (state == HoverState && !supportsHover(o->style()))
704 return false; 720 return false;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 807
792 bool RenderTheme::isFocused(const RenderObject* o) const 808 bool RenderTheme::isFocused(const RenderObject* o) const
793 { 809 {
794 Node* node = o->node(); 810 Node* node = o->node();
795 if (!node) 811 if (!node)
796 return false; 812 return false;
797 813
798 node = node->focusDelegate(); 814 node = node->focusDelegate();
799 Document* document = node->document(); 815 Document* document = node->document();
800 Frame* frame = document->frame(); 816 Frame* frame = document->frame();
801 return node == document->focusedNode() && frame && frame->selection()->isFoc usedAndActive(); 817 return node == document->focusedNode() && node->shouldHaveFocusAppearance() && frame && frame->selection()->isFocusedAndActive();
802 } 818 }
803 819
804 bool RenderTheme::isPressed(const RenderObject* o) const 820 bool RenderTheme::isPressed(const RenderObject* o) const
805 { 821 {
806 if (!o->node()) 822 if (!o->node())
807 return false; 823 return false;
808 return o->node()->active(); 824 return o->node()->active();
809 } 825 }
810 826
811 bool RenderTheme::isSpinUpButtonPartPressed(const RenderObject* o) const 827 bool RenderTheme::isSpinUpButtonPartPressed(const RenderObject* o) const
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 1396
1381 // padding - not honored by WinIE, needs to be removed. 1397 // padding - not honored by WinIE, needs to be removed.
1382 style->resetPadding(); 1398 style->resetPadding();
1383 1399
1384 // border - honored by WinIE, but looks terrible (just paints in the control box and turns off the Windows XP theme) 1400 // border - honored by WinIE, but looks terrible (just paints in the control box and turns off the Windows XP theme)
1385 // for now, we will not honor it. 1401 // for now, we will not honor it.
1386 style->resetBorder(); 1402 style->resetBorder();
1387 } 1403 }
1388 1404
1389 } // namespace WebCore 1405 } // namespace WebCore
OLDNEW
« Source/core/html/HTMLFormControlElement.cpp ('K') | « Source/core/rendering/RenderTheme.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698