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

Side by Side Diff: Source/web/WebViewImpl.cpp

Issue 1303123002: Revert of Adding support for Smart GO NEXT feature in Android Chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove DocumentMarkerController.h include Created 5 years, 4 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
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | Source/web/tests/WebViewTest.cpp » ('j') | 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) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 18 matching lines...) Expand all
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "web/WebViewImpl.h" 32 #include "web/WebViewImpl.h"
33 33
34 #include "core/CSSValueKeywords.h" 34 #include "core/CSSValueKeywords.h"
35 #include "core/HTMLNames.h" 35 #include "core/HTMLNames.h"
36 #include "core/InputTypeNames.h" 36 #include "core/InputTypeNames.h"
37 #include "core/clipboard/DataObject.h" 37 #include "core/clipboard/DataObject.h"
38 #include "core/dom/Document.h" 38 #include "core/dom/Document.h"
39 #include "core/dom/ElementTraversal.h"
40 #include "core/dom/Fullscreen.h" 39 #include "core/dom/Fullscreen.h"
41 #include "core/dom/LayoutTreeBuilderTraversal.h" 40 #include "core/dom/LayoutTreeBuilderTraversal.h"
42 #include "core/dom/Text.h" 41 #include "core/dom/Text.h"
43 #include "core/editing/EditingUtilities.h" 42 #include "core/editing/EditingUtilities.h"
44 #include "core/editing/Editor.h" 43 #include "core/editing/Editor.h"
45 #include "core/editing/FrameSelection.h" 44 #include "core/editing/FrameSelection.h"
46 #include "core/editing/InputMethodController.h" 45 #include "core/editing/InputMethodController.h"
47 #include "core/editing/iterators/TextIterator.h" 46 #include "core/editing/iterators/TextIterator.h"
48 #include "core/editing/markers/DocumentMarkerController.h" 47 #include "core/editing/markers/DocumentMarkerController.h"
49 #include "core/editing/serializers/HTMLInterchange.h" 48 #include "core/editing/serializers/HTMLInterchange.h"
50 #include "core/editing/serializers/Serialization.h" 49 #include "core/editing/serializers/Serialization.h"
51 #include "core/events/KeyboardEvent.h" 50 #include "core/events/KeyboardEvent.h"
52 #include "core/events/UIEventWithKeyState.h" 51 #include "core/events/UIEventWithKeyState.h"
53 #include "core/events/WheelEvent.h" 52 #include "core/events/WheelEvent.h"
54 #include "core/fetch/UniqueIdentifier.h" 53 #include "core/fetch/UniqueIdentifier.h"
55 #include "core/frame/EventHandlerRegistry.h" 54 #include "core/frame/EventHandlerRegistry.h"
56 #include "core/frame/FrameHost.h" 55 #include "core/frame/FrameHost.h"
57 #include "core/frame/FrameView.h" 56 #include "core/frame/FrameView.h"
58 #include "core/frame/LocalFrame.h" 57 #include "core/frame/LocalFrame.h"
59 #include "core/frame/PageScaleConstraintsSet.h" 58 #include "core/frame/PageScaleConstraintsSet.h"
60 #include "core/frame/RemoteFrame.h" 59 #include "core/frame/RemoteFrame.h"
61 #include "core/frame/Settings.h" 60 #include "core/frame/Settings.h"
62 #include "core/frame/SmartClip.h" 61 #include "core/frame/SmartClip.h"
63 #include "core/frame/TopControls.h" 62 #include "core/frame/TopControls.h"
64 #include "core/frame/VisualViewport.h" 63 #include "core/frame/VisualViewport.h"
65 #include "core/html/HTMLFormElement.h"
66 #include "core/html/HTMLInputElement.h" 64 #include "core/html/HTMLInputElement.h"
67 #include "core/html/HTMLMediaElement.h" 65 #include "core/html/HTMLMediaElement.h"
68 #include "core/html/HTMLPlugInElement.h" 66 #include "core/html/HTMLPlugInElement.h"
69 #include "core/html/HTMLTextAreaElement.h" 67 #include "core/html/HTMLTextAreaElement.h"
70 #include "core/input/EventHandler.h" 68 #include "core/input/EventHandler.h"
71 #include "core/input/TouchActionUtil.h" 69 #include "core/input/TouchActionUtil.h"
72 #include "core/layout/LayoutPart.h" 70 #include "core/layout/LayoutPart.h"
73 #include "core/layout/LayoutView.h" 71 #include "core/layout/LayoutView.h"
74 #include "core/layout/TextAutosizer.h" 72 #include "core/layout/TextAutosizer.h"
75 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h" 73 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
(...skipping 2410 matching lines...) Expand 10 before | Expand all | Expand 10 after
2486 flags |= WebTextInputFlagAutocapitalizeCharacters; 2484 flags |= WebTextInputFlagAutocapitalizeCharacters;
2487 else if (autocapitalize == words) 2485 else if (autocapitalize == words)
2488 flags |= WebTextInputFlagAutocapitalizeWords; 2486 flags |= WebTextInputFlagAutocapitalizeWords;
2489 else if (autocapitalize == sentences) 2487 else if (autocapitalize == sentences)
2490 flags |= WebTextInputFlagAutocapitalizeSentences; 2488 flags |= WebTextInputFlagAutocapitalizeSentences;
2491 else 2489 else
2492 ASSERT_NOT_REACHED(); 2490 ASSERT_NOT_REACHED();
2493 } 2491 }
2494 } 2492 }
2495 2493
2496 if (isListeningToKeyboardEvents(element))
2497 flags |= WebTextInputFlagListeningToKeyboardEvents;
2498
2499 if (nextFocusableElementInForm(element, WebFocusTypeForward))
2500 flags |= WebTextInputFlagHaveNextFocusableElement;
2501
2502 if (nextFocusableElementInForm(element, WebFocusTypeBackward))
2503 flags |= WebTextInputFlagHavePreviousFocusableElement;
2504
2505 return flags; 2494 return flags;
2506 } 2495 }
2507 2496
2508 Element* WebViewImpl::nextFocusableElementInForm(Element* element, WebFocusType focusType)
2509 {
2510 if (!element->isFormControlElement() && !element->isContentEditable())
2511 return nullptr;
2512
2513 HTMLFormElement* formOwner = nullptr;
2514 if (element->isContentEditable())
2515 formOwner = Traversal<HTMLFormElement>::firstAncestor(*element);
2516 else
2517 formOwner = toHTMLFormControlElement(element)->formOwner();
2518
2519 if (!formOwner)
2520 return nullptr;
2521
2522 Element* nextElement = element;
2523 for (nextElement = page()->focusController().findFocusableElement(focusType, *nextElement); nextElement; nextElement = page()->focusController().findFocusab leElement(focusType, *nextElement)) {
2524 if (nextElement->isContentEditable() && nextElement->isDescendantOf(form Owner))
2525 return nextElement;
2526 if (!nextElement->isFormControlElement())
2527 continue;
2528 HTMLFormControlElement* formElement = toHTMLFormControlElement(nextEleme nt);
2529 if (formElement->formOwner() != formOwner)
2530 continue;
2531 // Skip disabled or readonly editable elements.
2532 if (formElement->isDisabledOrReadOnly())
2533 continue;
2534 LayoutObject* layout = nextElement->layoutObject();
2535 if (layout && layout->isTextControl()) {
2536 // TODO(ajith.v) Extend it for Select element, Radio button and Chec k boxes
2537 return nextElement;
2538 }
2539 }
2540 return nullptr;
2541 }
2542
2543 bool WebViewImpl::isListeningToKeyboardEvents(Element* element)
2544 {
2545 if (!element->isFormControlElement() && !element->isContentEditable())
2546 return false;
2547 for (Node* node = element; node; node = node->parentNode()) {
2548 if (node->hasEventListeners(EventTypeNames::keydown) || node->hasEventLi steners(EventTypeNames::keypress) || node->hasEventListeners(EventTypeNames::key up))
2549 return true;
2550 }
2551 return false;
2552 }
2553
2554 void WebViewImpl::advanceFocusInForm(WebFocusType focusType)
2555 {
2556 Element* element = focusedElement();
2557 if (!element)
2558 return;
2559
2560 RefPtrWillBeRawPtr<Element> nextElement = nextFocusableElementInForm(element , focusType);
2561 if (!nextElement)
2562 return;
2563
2564 nextElement->scrollIntoViewIfNeeded(true /*centerIfNeeded*/);
2565 nextElement->focus(false, focusType);
2566 }
2567
2568 WebString WebViewImpl::inputModeOfFocusedElement() 2497 WebString WebViewImpl::inputModeOfFocusedElement()
2569 { 2498 {
2570 if (!RuntimeEnabledFeatures::inputModeAttributeEnabled()) 2499 if (!RuntimeEnabledFeatures::inputModeAttributeEnabled())
2571 return WebString(); 2500 return WebString();
2572 2501
2573 Element* element = focusedElement(); 2502 Element* element = focusedElement();
2574 if (!element) 2503 if (!element)
2575 return WebString(); 2504 return WebString();
2576 2505
2577 if (isHTMLInputElement(*element)) { 2506 if (isHTMLInputElement(*element)) {
(...skipping 1899 matching lines...) Expand 10 before | Expand all | Expand 10 after
4477 if (m_pageColorOverlay) 4406 if (m_pageColorOverlay)
4478 m_pageColorOverlay->update(); 4407 m_pageColorOverlay->update();
4479 if (m_inspectorOverlay) { 4408 if (m_inspectorOverlay) {
4480 PageOverlay* inspectorPageOverlay = m_inspectorOverlay->pageOverlay(); 4409 PageOverlay* inspectorPageOverlay = m_inspectorOverlay->pageOverlay();
4481 if (inspectorPageOverlay) 4410 if (inspectorPageOverlay)
4482 inspectorPageOverlay->update(); 4411 inspectorPageOverlay->update();
4483 } 4412 }
4484 } 4413 }
4485 4414
4486 } // namespace blink 4415 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698