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