OLD | NEW |
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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 // to use Page messages. https://crbug.com/599688. | 204 // to use Page messages. https://crbug.com/599688. |
205 page()->frameHost().visualViewport().setSize(newSize); | 205 page()->frameHost().visualViewport().setSize(newSize); |
206 page()->frameHost().visualViewport().clampToBoundaries(); | 206 page()->frameHost().visualViewport().clampToBoundaries(); |
207 } | 207 } |
208 | 208 |
209 void WebFrameWidgetImpl::updateMainFrameLayoutSize() | 209 void WebFrameWidgetImpl::updateMainFrameLayoutSize() |
210 { | 210 { |
211 if (!m_localRoot) | 211 if (!m_localRoot) |
212 return; | 212 return; |
213 | 213 |
214 RawPtr<FrameView> view = m_localRoot->frameView(); | 214 FrameView* view = m_localRoot->frameView(); |
215 if (!view) | 215 if (!view) |
216 return; | 216 return; |
217 | 217 |
218 WebSize layoutSize = m_size; | 218 WebSize layoutSize = m_size; |
219 | 219 |
220 view->setLayoutSize(layoutSize); | 220 view->setLayoutSize(layoutSize); |
221 } | 221 } |
222 | 222 |
223 void WebFrameWidgetImpl::setIgnoreInputEvents(bool newValue) | 223 void WebFrameWidgetImpl::setIgnoreInputEvents(bool newValue) |
224 { | 224 { |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 if (m_ignoreInputEvents) | 328 if (m_ignoreInputEvents) |
329 return WebInputEventResult::NotHandled; | 329 return WebInputEventResult::NotHandled; |
330 | 330 |
331 // FIXME: pass event to m_localRoot's WebDevToolsAgentImpl once available. | 331 // FIXME: pass event to m_localRoot's WebDevToolsAgentImpl once available. |
332 | 332 |
333 TemporaryChange<const WebInputEvent*> currentEventChange(m_currentInputEvent
, &inputEvent); | 333 TemporaryChange<const WebInputEvent*> currentEventChange(m_currentInputEvent
, &inputEvent); |
334 | 334 |
335 if (m_mouseCaptureNode && WebInputEvent::isMouseEventType(inputEvent.type))
{ | 335 if (m_mouseCaptureNode && WebInputEvent::isMouseEventType(inputEvent.type))
{ |
336 TRACE_EVENT1("input", "captured mouse event", "type", inputEvent.type); | 336 TRACE_EVENT1("input", "captured mouse event", "type", inputEvent.type); |
337 // Save m_mouseCaptureNode since mouseCaptureLost() will clear it. | 337 // Save m_mouseCaptureNode since mouseCaptureLost() will clear it. |
338 RawPtr<Node> node = m_mouseCaptureNode; | 338 Node* node = m_mouseCaptureNode; |
339 | 339 |
340 // Not all platforms call mouseCaptureLost() directly. | 340 // Not all platforms call mouseCaptureLost() directly. |
341 if (inputEvent.type == WebInputEvent::MouseUp) | 341 if (inputEvent.type == WebInputEvent::MouseUp) |
342 mouseCaptureLost(); | 342 mouseCaptureLost(); |
343 | 343 |
344 OwnPtr<UserGestureIndicator> gestureIndicator; | 344 OwnPtr<UserGestureIndicator> gestureIndicator; |
345 | 345 |
346 AtomicString eventType; | 346 AtomicString eventType; |
347 switch (inputEvent.type) { | 347 switch (inputEvent.type) { |
348 case WebInputEvent::MouseMove: | 348 case WebInputEvent::MouseMove: |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 { | 420 { |
421 TRACE_EVENT_ASYNC_END0("input", "capturing mouse", this); | 421 TRACE_EVENT_ASYNC_END0("input", "capturing mouse", this); |
422 m_mouseCaptureNode = nullptr; | 422 m_mouseCaptureNode = nullptr; |
423 } | 423 } |
424 | 424 |
425 void WebFrameWidgetImpl::setFocus(bool enable) | 425 void WebFrameWidgetImpl::setFocus(bool enable) |
426 { | 426 { |
427 page()->focusController().setFocused(enable); | 427 page()->focusController().setFocused(enable); |
428 if (enable) { | 428 if (enable) { |
429 page()->focusController().setActive(true); | 429 page()->focusController().setActive(true); |
430 RawPtr<LocalFrame> focusedFrame = page()->focusController().focusedFrame
(); | 430 LocalFrame* focusedFrame = page()->focusController().focusedFrame(); |
431 if (focusedFrame) { | 431 if (focusedFrame) { |
432 Element* element = focusedFrame->document()->focusedElement(); | 432 Element* element = focusedFrame->document()->focusedElement(); |
433 if (element && focusedFrame->selection().selection().isNone()) { | 433 if (element && focusedFrame->selection().selection().isNone()) { |
434 // If the selection was cleared while the WebView was not | 434 // If the selection was cleared while the WebView was not |
435 // focused, then the focus element shows with a focus ring but | 435 // focused, then the focus element shows with a focus ring but |
436 // no caret and does respond to keyboard inputs. | 436 // no caret and does respond to keyboard inputs. |
437 if (element->isTextFormControl()) { | 437 if (element->isTextFormControl()) { |
438 element->updateFocusAppearance(SelectionBehaviorOnFocus::Res
tore); | 438 element->updateFocusAppearance(SelectionBehaviorOnFocus::Res
tore); |
439 } else if (element->isContentEditable()) { | 439 } else if (element->isContentEditable()) { |
440 // updateFocusAppearance() selects all the text of | 440 // updateFocusAppearance() selects all the text of |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 || (event.type == WebInputEvent::KeyUp)); | 765 || (event.type == WebInputEvent::KeyUp)); |
766 | 766 |
767 // Please refer to the comments explaining the m_suppressNextKeypressEvent | 767 // Please refer to the comments explaining the m_suppressNextKeypressEvent |
768 // member. | 768 // member. |
769 // The m_suppressNextKeypressEvent is set if the KeyDown is handled by | 769 // The m_suppressNextKeypressEvent is set if the KeyDown is handled by |
770 // Webkit. A keyDown event is typically associated with a keyPress(char) | 770 // Webkit. A keyDown event is typically associated with a keyPress(char) |
771 // event and a keyUp event. We reset this flag here as this is a new keyDown | 771 // event and a keyUp event. We reset this flag here as this is a new keyDown |
772 // event. | 772 // event. |
773 m_suppressNextKeypressEvent = false; | 773 m_suppressNextKeypressEvent = false; |
774 | 774 |
775 RawPtr<Frame> focusedFrame = focusedCoreFrame(); | 775 Frame* focusedFrame = focusedCoreFrame(); |
776 if (focusedFrame && focusedFrame->isRemoteFrame()) { | 776 if (focusedFrame && focusedFrame->isRemoteFrame()) { |
777 WebRemoteFrameImpl* webFrame = WebRemoteFrameImpl::fromFrame(*toRemoteFr
ame(focusedFrame.get())); | 777 WebRemoteFrameImpl* webFrame = WebRemoteFrameImpl::fromFrame(*toRemoteFr
ame(focusedFrame)); |
778 webFrame->client()->forwardInputEvent(&event); | 778 webFrame->client()->forwardInputEvent(&event); |
779 return WebInputEventResult::HandledSystem; | 779 return WebInputEventResult::HandledSystem; |
780 } | 780 } |
781 | 781 |
782 if (!focusedFrame || !focusedFrame->isLocalFrame()) | 782 if (!focusedFrame || !focusedFrame->isLocalFrame()) |
783 return WebInputEventResult::NotHandled; | 783 return WebInputEventResult::NotHandled; |
784 | 784 |
785 RawPtr<LocalFrame> frame = toLocalFrame(focusedFrame.get()); | 785 LocalFrame* frame = toLocalFrame(focusedFrame); |
786 | 786 |
787 PlatformKeyboardEventBuilder evt(event); | 787 PlatformKeyboardEventBuilder evt(event); |
788 | 788 |
789 WebInputEventResult result = frame->eventHandler().keyEvent(evt); | 789 WebInputEventResult result = frame->eventHandler().keyEvent(evt); |
790 if (result != WebInputEventResult::NotHandled) { | 790 if (result != WebInputEventResult::NotHandled) { |
791 if (WebInputEvent::RawKeyDown == event.type) { | 791 if (WebInputEvent::RawKeyDown == event.type) { |
792 // Suppress the next keypress event unless the focused node is a plu
gin node. | 792 // Suppress the next keypress event unless the focused node is a plu
gin node. |
793 // (Flash needs these keypress events to handle non-US keyboards.) | 793 // (Flash needs these keypress events to handle non-US keyboards.) |
794 Element* element = focusedElement(); | 794 Element* element = focusedElement(); |
795 if (!element || !element->layoutObject() || !element->layoutObject()
->isEmbeddedObject()) | 795 if (!element || !element->layoutObject() || !element->layoutObject()
->isEmbeddedObject()) |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1097 | 1097 |
1098 HitTestResult WebFrameWidgetImpl::hitTestResultForRootFramePos(const IntPoint& p
osInRootFrame) | 1098 HitTestResult WebFrameWidgetImpl::hitTestResultForRootFramePos(const IntPoint& p
osInRootFrame) |
1099 { | 1099 { |
1100 IntPoint docPoint(m_localRoot->frame()->view()->rootFrameToContents(posInRoo
tFrame)); | 1100 IntPoint docPoint(m_localRoot->frame()->view()->rootFrameToContents(posInRoo
tFrame)); |
1101 HitTestResult result = m_localRoot->frame()->eventHandler().hitTestResultAtP
oint(docPoint, HitTestRequest::ReadOnly | HitTestRequest::Active); | 1101 HitTestResult result = m_localRoot->frame()->eventHandler().hitTestResultAtP
oint(docPoint, HitTestRequest::ReadOnly | HitTestRequest::Active); |
1102 result.setToShadowHostIfInUserAgentShadowRoot(); | 1102 result.setToShadowHostIfInUserAgentShadowRoot(); |
1103 return result; | 1103 return result; |
1104 } | 1104 } |
1105 | 1105 |
1106 } // namespace blink | 1106 } // namespace blink |
OLD | NEW |