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