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

Side by Side Diff: Source/core/html/HTMLElement.cpp

Issue 783513003: Consistently use isSpatialNavigationEnabled(...) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « Source/core/dom/Element.cpp ('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 * 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 * Copyright (C) 2004-2008, 2013, 2014 Apple Inc. All rights reserved. 4 * Copyright (C) 2004-2008, 2013, 2014 Apple Inc. All rights reserved.
5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. 6 * Copyright (C) 2011 Motorola Mobility. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "core/events/KeyboardEvent.h" 46 #include "core/events/KeyboardEvent.h"
47 #include "core/frame/Settings.h" 47 #include "core/frame/Settings.h"
48 #include "core/frame/UseCounter.h" 48 #include "core/frame/UseCounter.h"
49 #include "core/html/HTMLBRElement.h" 49 #include "core/html/HTMLBRElement.h"
50 #include "core/html/HTMLFormElement.h" 50 #include "core/html/HTMLFormElement.h"
51 #include "core/html/HTMLInputElement.h" 51 #include "core/html/HTMLInputElement.h"
52 #include "core/html/HTMLMenuElement.h" 52 #include "core/html/HTMLMenuElement.h"
53 #include "core/html/HTMLTemplateElement.h" 53 #include "core/html/HTMLTemplateElement.h"
54 #include "core/html/HTMLTextFormControlElement.h" 54 #include "core/html/HTMLTextFormControlElement.h"
55 #include "core/html/parser/HTMLParserIdioms.h" 55 #include "core/html/parser/HTMLParserIdioms.h"
56 #include "core/page/SpatialNavigation.h"
56 #include "core/rendering/RenderObject.h" 57 #include "core/rendering/RenderObject.h"
57 #include "platform/Language.h" 58 #include "platform/Language.h"
58 #include "platform/text/BidiResolver.h" 59 #include "platform/text/BidiResolver.h"
59 #include "platform/text/BidiTextRun.h" 60 #include "platform/text/BidiTextRun.h"
60 #include "platform/text/TextRunIterator.h" 61 #include "platform/text/TextRunIterator.h"
61 #include "wtf/StdLibExtras.h" 62 #include "wtf/StdLibExtras.h"
62 #include "wtf/text/CString.h" 63 #include "wtf/text/CString.h"
63 64
64 namespace blink { 65 namespace blink {
65 66
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 if (equalIgnoringCase(value, "false")) 1002 if (equalIgnoringCase(value, "false"))
1002 return false; 1003 return false;
1003 // All other values should be treated as "inherit". 1004 // All other values should be treated as "inherit".
1004 } 1005 }
1005 1006
1006 return parentElement() && parentElement()->hasEditableStyle(); 1007 return parentElement() && parentElement()->hasEditableStyle();
1007 } 1008 }
1008 1009
1009 void HTMLElement::handleKeypressEvent(KeyboardEvent* event) 1010 void HTMLElement::handleKeypressEvent(KeyboardEvent* event)
1010 { 1011 {
1011 if (!document().settings() || !document().settings()->spatialNavigationEnabl ed() || !supportsFocus()) 1012 if (!isSpatialNavigationEnabled(document().frame()) || !supportsFocus())
1012 return; 1013 return;
1013 // if the element is a text form control (like <input type=text> or <textare a>) 1014 // if the element is a text form control (like <input type=text> or <textare a>)
1014 // or has contentEditable attribute on, we should enter a space or newline 1015 // or has contentEditable attribute on, we should enter a space or newline
1015 // even in spatial navigation mode instead of handling it as a "click" actio n. 1016 // even in spatial navigation mode instead of handling it as a "click" actio n.
1016 if (isTextFormControl() || isContentEditable()) 1017 if (isTextFormControl() || isContentEditable())
1017 return; 1018 return;
1018 int charCode = event->charCode(); 1019 int charCode = event->charCode();
1019 if (charCode == '\r' || charCode == ' ') { 1020 if (charCode == '\r' || charCode == ' ') {
1020 dispatchSimulatedClick(event); 1021 dispatchSimulatedClick(event);
1021 event->setDefaultHandled(); 1022 event->setDefaultHandled();
(...skipping 11 matching lines...) Expand all
1033 #ifndef NDEBUG 1034 #ifndef NDEBUG
1034 1035
1035 // For use in the debugger 1036 // For use in the debugger
1036 void dumpInnerHTML(blink::HTMLElement*); 1037 void dumpInnerHTML(blink::HTMLElement*);
1037 1038
1038 void dumpInnerHTML(blink::HTMLElement* element) 1039 void dumpInnerHTML(blink::HTMLElement* element)
1039 { 1040 {
1040 printf("%s\n", element->innerHTML().ascii().data()); 1041 printf("%s\n", element->innerHTML().ascii().data());
1041 } 1042 }
1042 #endif 1043 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698