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

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: rebase 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
« no previous file with comments | « Source/core/rendering/RenderTheme.h ('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 * 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
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 805
790 bool RenderTheme::isFocused(const RenderObject* o) const 806 bool RenderTheme::isFocused(const RenderObject* o) const
791 { 807 {
792 Node* node = o->node(); 808 Node* node = o->node();
793 if (!node) 809 if (!node)
794 return false; 810 return false;
795 811
796 node = node->focusDelegate(); 812 node = node->focusDelegate();
797 Document* document = node->document(); 813 Document* document = node->document();
798 Frame* frame = document->frame(); 814 Frame* frame = document->frame();
799 return node == document->focusedNode() && frame && frame->selection()->isFoc usedAndActive(); 815 return node == document->focusedNode() && node->shouldHaveFocusAppearance() && frame && frame->selection()->isFocusedAndActive();
800 } 816 }
801 817
802 bool RenderTheme::isPressed(const RenderObject* o) const 818 bool RenderTheme::isPressed(const RenderObject* o) const
803 { 819 {
804 if (!o->node()) 820 if (!o->node())
805 return false; 821 return false;
806 return o->node()->active(); 822 return o->node()->active();
807 } 823 }
808 824
809 bool RenderTheme::isSpinUpButtonPartPressed(const RenderObject* o) const 825 bool RenderTheme::isSpinUpButtonPartPressed(const RenderObject* o) const
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
1363 1379
1364 // padding - not honored by WinIE, needs to be removed. 1380 // padding - not honored by WinIE, needs to be removed.
1365 style->resetPadding(); 1381 style->resetPadding();
1366 1382
1367 // border - honored by WinIE, but looks terrible (just paints in the control box and turns off the Windows XP theme) 1383 // border - honored by WinIE, but looks terrible (just paints in the control box and turns off the Windows XP theme)
1368 // for now, we will not honor it. 1384 // for now, we will not honor it.
1369 style->resetBorder(); 1385 style->resetBorder();
1370 } 1386 }
1371 1387
1372 } // namespace WebCore 1388 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderTheme.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698