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

Side by Side Diff: third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp

Issue 1420693006: Introduce a struct to store arguments of Element::focus(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 page()->focusController().setActive(true); 414 page()->focusController().setActive(true);
415 RefPtrWillBeRawPtr<Frame> focusedFrame = page()->focusController().focus edFrame(); 415 RefPtrWillBeRawPtr<Frame> focusedFrame = page()->focusController().focus edFrame();
416 if (focusedFrame && focusedFrame->isLocalFrame()) { 416 if (focusedFrame && focusedFrame->isLocalFrame()) {
417 LocalFrame* localFrame = toLocalFrame(focusedFrame.get()); 417 LocalFrame* localFrame = toLocalFrame(focusedFrame.get());
418 Element* element = localFrame->document()->focusedElement(); 418 Element* element = localFrame->document()->focusedElement();
419 if (element && localFrame->selection().selection().isNone()) { 419 if (element && localFrame->selection().selection().isNone()) {
420 // If the selection was cleared while the WebView was not 420 // If the selection was cleared while the WebView was not
421 // focused, then the focus element shows with a focus ring but 421 // focused, then the focus element shows with a focus ring but
422 // no caret and does respond to keyboard inputs. 422 // no caret and does respond to keyboard inputs.
423 if (element->isTextFormControl()) { 423 if (element->isTextFormControl()) {
424 element->updateFocusAppearance(true); 424 element->updateFocusAppearance(SelectionBehaviorOnFocus::Res tore);
425 } else if (element->isContentEditable()) { 425 } else if (element->isContentEditable()) {
426 // updateFocusAppearance() selects all the text of 426 // updateFocusAppearance() selects all the text of
427 // contentseditable DIVs. So we set the selection explicitly 427 // contentseditable DIVs. So we set the selection explicitly
428 // instead. Note that this has the side effect of moving the 428 // instead. Note that this has the side effect of moving the
429 // caret back to the beginning of the text. 429 // caret back to the beginning of the text.
430 Position position(element, 0); 430 Position position(element, 0);
431 localFrame->selection().setSelection(VisibleSelection(positi on, SEL_DEFAULT_AFFINITY)); 431 localFrame->selection().setSelection(VisibleSelection(positi on, SEL_DEFAULT_AFFINITY));
432 } 432 }
433 } 433 }
434 } 434 }
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 1070
1071 HitTestResult WebFrameWidgetImpl::hitTestResultForRootFramePos(const IntPoint& p osInRootFrame) 1071 HitTestResult WebFrameWidgetImpl::hitTestResultForRootFramePos(const IntPoint& p osInRootFrame)
1072 { 1072 {
1073 IntPoint docPoint(m_localRoot->frame()->view()->rootFrameToContents(posInRoo tFrame)); 1073 IntPoint docPoint(m_localRoot->frame()->view()->rootFrameToContents(posInRoo tFrame));
1074 HitTestResult result = m_localRoot->frame()->eventHandler().hitTestResultAtP oint(docPoint, HitTestRequest::ReadOnly | HitTestRequest::Active); 1074 HitTestResult result = m_localRoot->frame()->eventHandler().hitTestResultAtP oint(docPoint, HitTestRequest::ReadOnly | HitTestRequest::Active);
1075 result.setToShadowHostIfInUserAgentShadowRoot(); 1075 result.setToShadowHostIfInUserAgentShadowRoot();
1076 return result; 1076 return result;
1077 } 1077 }
1078 1078
1079 } // namespace blink 1079 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/page/FocusController.cpp ('k') | third_party/WebKit/Source/web/WebViewImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698