| OLD | NEW |
| 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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 { | 272 { |
| 273 if (!*m_userGestureObserved && UserGestureIndicator::processedUserGestureSin
ceLoad()) { | 273 if (!*m_userGestureObserved && UserGestureIndicator::processedUserGestureSin
ceLoad()) { |
| 274 *m_userGestureObserved = true; | 274 *m_userGestureObserved = true; |
| 275 if (m_client) | 275 if (m_client) |
| 276 m_client->firstUserGestureObserved(); | 276 m_client->firstUserGestureObserved(); |
| 277 } | 277 } |
| 278 } | 278 } |
| 279 | 279 |
| 280 class EmptyEventListener final : public EventListener { | 280 class EmptyEventListener final : public EventListener { |
| 281 public: | 281 public: |
| 282 static PassRefPtrWillBeRawPtr<EmptyEventListener> create() | 282 static RawPtr<EmptyEventListener> create() |
| 283 { | 283 { |
| 284 return adoptRefWillBeNoop(new EmptyEventListener()); | 284 return new EmptyEventListener(); |
| 285 } | 285 } |
| 286 | 286 |
| 287 bool operator==(const EventListener& other) const override | 287 bool operator==(const EventListener& other) const override |
| 288 { | 288 { |
| 289 return this == &other; | 289 return this == &other; |
| 290 } | 290 } |
| 291 | 291 |
| 292 private: | 292 private: |
| 293 EmptyEventListener() | 293 EmptyEventListener() |
| 294 : EventListener(CPPEventListenerType) | 294 : EventListener(CPPEventListenerType) |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 event.y - event.data.tap.height / 2, | 819 event.y - event.data.tap.height / 2, |
| 820 event.data.tap.width, | 820 event.data.tap.width, |
| 821 event.data.tap.height))); | 821 event.data.tap.height))); |
| 822 | 822 |
| 823 // TODO(bokan): We shouldn't pass details of the VisualViewport offs
et to render_view_impl. | 823 // TODO(bokan): We shouldn't pass details of the VisualViewport offs
et to render_view_impl. |
| 824 // crbug.com/459591 | 824 // crbug.com/459591 |
| 825 WebSize visualViewportOffset = flooredIntSize(visualViewport.locatio
n()); | 825 WebSize visualViewportOffset = flooredIntSize(visualViewport.locatio
n()); |
| 826 | 826 |
| 827 if (m_webSettings->multiTargetTapNotificationEnabled()) { | 827 if (m_webSettings->multiTargetTapNotificationEnabled()) { |
| 828 Vector<IntRect> goodTargets; | 828 Vector<IntRect> goodTargets; |
| 829 WillBeHeapVector<RawPtrWillBeMember<Node>> highlightNodes; | 829 HeapVector<Member<Node>> highlightNodes; |
| 830 findGoodTouchTargets(boundingBox, mainFrameImpl()->frame(), good
Targets, highlightNodes); | 830 findGoodTouchTargets(boundingBox, mainFrameImpl()->frame(), good
Targets, highlightNodes); |
| 831 // FIXME: replace touch adjustment code when numberOfGoodTargets
== 1? | 831 // FIXME: replace touch adjustment code when numberOfGoodTargets
== 1? |
| 832 // Single candidate case is currently handled by: https://bugs.w
ebkit.org/show_bug.cgi?id=85101 | 832 // Single candidate case is currently handled by: https://bugs.w
ebkit.org/show_bug.cgi?id=85101 |
| 833 if (goodTargets.size() >= 2 && m_client | 833 if (goodTargets.size() >= 2 && m_client |
| 834 && m_client->didTapMultipleTargets(visualViewportOffset, bou
ndingBox, goodTargets)) { | 834 && m_client->didTapMultipleTargets(visualViewportOffset, bou
ndingBox, goodTargets)) { |
| 835 | 835 |
| 836 enableTapHighlights(highlightNodes); | 836 enableTapHighlights(highlightNodes); |
| 837 for (size_t i = 0; i < m_linkHighlights.size(); ++i) | 837 for (size_t i = 0; i < m_linkHighlights.size(); ++i) |
| 838 m_linkHighlights[i]->startHighlightAnimationIfNeeded(); | 838 m_linkHighlights[i]->startHighlightAnimationIfNeeded(); |
| 839 eventResult = WebInputEventResult::HandledSystem; | 839 eventResult = WebInputEventResult::HandledSystem; |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1058 // page. | 1058 // page. |
| 1059 if (m_pagePopup) { | 1059 if (m_pagePopup) { |
| 1060 m_pagePopup->handleKeyEvent(PlatformKeyboardEventBuilder(event)); | 1060 m_pagePopup->handleKeyEvent(PlatformKeyboardEventBuilder(event)); |
| 1061 // We need to ignore the next Char event after this otherwise pressing | 1061 // We need to ignore the next Char event after this otherwise pressing |
| 1062 // enter when selecting an item in the popup will go to the page. | 1062 // enter when selecting an item in the popup will go to the page. |
| 1063 if (WebInputEvent::RawKeyDown == event.type) | 1063 if (WebInputEvent::RawKeyDown == event.type) |
| 1064 m_suppressNextKeypressEvent = true; | 1064 m_suppressNextKeypressEvent = true; |
| 1065 return WebInputEventResult::HandledSystem; | 1065 return WebInputEventResult::HandledSystem; |
| 1066 } | 1066 } |
| 1067 | 1067 |
| 1068 RefPtrWillBeRawPtr<Frame> focusedFrame = focusedCoreFrame(); | 1068 RawPtr<Frame> focusedFrame = focusedCoreFrame(); |
| 1069 if (focusedFrame && focusedFrame->isRemoteFrame()) { | 1069 if (focusedFrame && focusedFrame->isRemoteFrame()) { |
| 1070 WebRemoteFrameImpl* webFrame = WebRemoteFrameImpl::fromFrame(*toRemoteFr
ame(focusedFrame.get())); | 1070 WebRemoteFrameImpl* webFrame = WebRemoteFrameImpl::fromFrame(*toRemoteFr
ame(focusedFrame.get())); |
| 1071 webFrame->client()->forwardInputEvent(&event); | 1071 webFrame->client()->forwardInputEvent(&event); |
| 1072 return WebInputEventResult::HandledSystem; | 1072 return WebInputEventResult::HandledSystem; |
| 1073 } | 1073 } |
| 1074 | 1074 |
| 1075 if (!focusedFrame || !focusedFrame->isLocalFrame()) | 1075 if (!focusedFrame || !focusedFrame->isLocalFrame()) |
| 1076 return WebInputEventResult::NotHandled; | 1076 return WebInputEventResult::NotHandled; |
| 1077 | 1077 |
| 1078 LocalFrame* frame = toLocalFrame(focusedFrame.get()); | 1078 LocalFrame* frame = toLocalFrame(focusedFrame.get()); |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1372 m_page->deprecatedLocalMainFrame()); | 1372 m_page->deprecatedLocalMainFrame()); |
| 1373 } while (cursorDefiningAncestor && showsHandCursor(cursorDefiningAncestor, m
_page->deprecatedLocalMainFrame())); | 1373 } while (cursorDefiningAncestor && showsHandCursor(cursorDefiningAncestor, m
_page->deprecatedLocalMainFrame())); |
| 1374 | 1374 |
| 1375 return bestTouchNode; | 1375 return bestTouchNode; |
| 1376 } | 1376 } |
| 1377 | 1377 |
| 1378 void WebViewImpl::enableTapHighlightAtPoint(const GestureEventWithHitTestResults
& targetedTapEvent) | 1378 void WebViewImpl::enableTapHighlightAtPoint(const GestureEventWithHitTestResults
& targetedTapEvent) |
| 1379 { | 1379 { |
| 1380 Node* touchNode = bestTapNode(targetedTapEvent); | 1380 Node* touchNode = bestTapNode(targetedTapEvent); |
| 1381 | 1381 |
| 1382 WillBeHeapVector<RawPtrWillBeMember<Node>> highlightNodes; | 1382 HeapVector<Member<Node>> highlightNodes; |
| 1383 highlightNodes.append(touchNode); | 1383 highlightNodes.append(touchNode); |
| 1384 | 1384 |
| 1385 enableTapHighlights(highlightNodes); | 1385 enableTapHighlights(highlightNodes); |
| 1386 } | 1386 } |
| 1387 | 1387 |
| 1388 void WebViewImpl::enableTapHighlights(WillBeHeapVector<RawPtrWillBeMember<Node>>
& highlightNodes) | 1388 void WebViewImpl::enableTapHighlights(HeapVector<Member<Node>>& highlightNodes) |
| 1389 { | 1389 { |
| 1390 if (highlightNodes.isEmpty()) | 1390 if (highlightNodes.isEmpty()) |
| 1391 return; | 1391 return; |
| 1392 | 1392 |
| 1393 // Always clear any existing highlight when this is invoked, even if we | 1393 // Always clear any existing highlight when this is invoked, even if we |
| 1394 // don't get a new target to highlight. | 1394 // don't get a new target to highlight. |
| 1395 m_linkHighlights.clear(); | 1395 m_linkHighlights.clear(); |
| 1396 | 1396 |
| 1397 for (size_t i = 0; i < highlightNodes.size(); ++i) { | 1397 for (size_t i = 0; i < highlightNodes.size(); ++i) { |
| 1398 Node* node = highlightNodes[i]; | 1398 Node* node = highlightNodes[i]; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1512 { | 1512 { |
| 1513 ContextMenuAllowedScope scope; | 1513 ContextMenuAllowedScope scope; |
| 1514 Frame* focusedFrame = page()->focusController().focusedOrMainFrame(); | 1514 Frame* focusedFrame = page()->focusController().focusedOrMainFrame(); |
| 1515 if (!focusedFrame->isLocalFrame()) | 1515 if (!focusedFrame->isLocalFrame()) |
| 1516 return WebInputEventResult::NotHandled; | 1516 return WebInputEventResult::NotHandled; |
| 1517 return toLocalFrame(focusedFrame)->eventHandler().sendContextMenuEventFo
rKey(nullptr); | 1517 return toLocalFrame(focusedFrame)->eventHandler().sendContextMenuEventFo
rKey(nullptr); |
| 1518 } | 1518 } |
| 1519 } | 1519 } |
| 1520 #endif | 1520 #endif |
| 1521 | 1521 |
| 1522 void WebViewImpl::showContextMenuAtPoint(float x, float y, PassRefPtrWillBeRawPt
r<ContextMenuProvider> menuProvider) | 1522 void WebViewImpl::showContextMenuAtPoint(float x, float y, RawPtr<ContextMenuPro
vider> menuProvider) |
| 1523 { | 1523 { |
| 1524 if (!page()->mainFrame()->isLocalFrame()) | 1524 if (!page()->mainFrame()->isLocalFrame()) |
| 1525 return; | 1525 return; |
| 1526 { | 1526 { |
| 1527 ContextMenuAllowedScope scope; | 1527 ContextMenuAllowedScope scope; |
| 1528 page()->contextMenuController().clearContextMenu(); | 1528 page()->contextMenuController().clearContextMenu(); |
| 1529 page()->contextMenuController().showContextMenuAtPoint(page()->deprecate
dLocalMainFrame(), x, y, menuProvider); | 1529 page()->contextMenuController().showContextMenuAtPoint(page()->deprecate
dLocalMainFrame(), x, y, menuProvider); |
| 1530 } | 1530 } |
| 1531 } | 1531 } |
| 1532 | 1532 |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2137 UIEventWithKeyState::clearNewTabModifierSetFromIsolatedWorld(); | 2137 UIEventWithKeyState::clearNewTabModifierSetFromIsolatedWorld(); |
| 2138 | 2138 |
| 2139 if (isPointerLocked() && WebInputEvent::isMouseEventType(inputEvent.type)) { | 2139 if (isPointerLocked() && WebInputEvent::isMouseEventType(inputEvent.type)) { |
| 2140 pointerLockMouseEvent(inputEvent); | 2140 pointerLockMouseEvent(inputEvent); |
| 2141 return WebInputEventResult::HandledSystem; | 2141 return WebInputEventResult::HandledSystem; |
| 2142 } | 2142 } |
| 2143 | 2143 |
| 2144 if (m_mouseCaptureNode && WebInputEvent::isMouseEventType(inputEvent.type))
{ | 2144 if (m_mouseCaptureNode && WebInputEvent::isMouseEventType(inputEvent.type))
{ |
| 2145 TRACE_EVENT1("input", "captured mouse event", "type", inputEvent.type); | 2145 TRACE_EVENT1("input", "captured mouse event", "type", inputEvent.type); |
| 2146 // Save m_mouseCaptureNode since mouseCaptureLost() will clear it. | 2146 // Save m_mouseCaptureNode since mouseCaptureLost() will clear it. |
| 2147 RefPtrWillBeRawPtr<Node> node = m_mouseCaptureNode; | 2147 RawPtr<Node> node = m_mouseCaptureNode; |
| 2148 | 2148 |
| 2149 // Not all platforms call mouseCaptureLost() directly. | 2149 // Not all platforms call mouseCaptureLost() directly. |
| 2150 if (inputEvent.type == WebInputEvent::MouseUp) | 2150 if (inputEvent.type == WebInputEvent::MouseUp) |
| 2151 mouseCaptureLost(); | 2151 mouseCaptureLost(); |
| 2152 | 2152 |
| 2153 OwnPtr<UserGestureIndicator> gestureIndicator; | 2153 OwnPtr<UserGestureIndicator> gestureIndicator; |
| 2154 | 2154 |
| 2155 AtomicString eventType; | 2155 AtomicString eventType; |
| 2156 switch (inputEvent.type) { | 2156 switch (inputEvent.type) { |
| 2157 case WebInputEvent::MouseMove: | 2157 case WebInputEvent::MouseMove: |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2213 { | 2213 { |
| 2214 TRACE_EVENT_ASYNC_END0("input", "capturing mouse", this); | 2214 TRACE_EVENT_ASYNC_END0("input", "capturing mouse", this); |
| 2215 m_mouseCaptureNode = nullptr; | 2215 m_mouseCaptureNode = nullptr; |
| 2216 } | 2216 } |
| 2217 | 2217 |
| 2218 void WebViewImpl::setFocus(bool enable) | 2218 void WebViewImpl::setFocus(bool enable) |
| 2219 { | 2219 { |
| 2220 m_page->focusController().setFocused(enable); | 2220 m_page->focusController().setFocused(enable); |
| 2221 if (enable) { | 2221 if (enable) { |
| 2222 m_page->focusController().setActive(true); | 2222 m_page->focusController().setActive(true); |
| 2223 RefPtrWillBeRawPtr<LocalFrame> focusedFrame = m_page->focusController().
focusedFrame(); | 2223 RawPtr<LocalFrame> focusedFrame = m_page->focusController().focusedFrame
(); |
| 2224 if (focusedFrame) { | 2224 if (focusedFrame) { |
| 2225 Element* element = focusedFrame->document()->focusedElement(); | 2225 Element* element = focusedFrame->document()->focusedElement(); |
| 2226 if (element && focusedFrame->selection().selection().isNone()) { | 2226 if (element && focusedFrame->selection().selection().isNone()) { |
| 2227 // If the selection was cleared while the WebView was not | 2227 // If the selection was cleared while the WebView was not |
| 2228 // focused, then the focus element shows with a focus ring but | 2228 // focused, then the focus element shows with a focus ring but |
| 2229 // no caret and does respond to keyboard inputs. | 2229 // no caret and does respond to keyboard inputs. |
| 2230 if (element->isTextFormControl()) { | 2230 if (element->isTextFormControl()) { |
| 2231 element->updateFocusAppearance(SelectionBehaviorOnFocus::Res
tore); | 2231 element->updateFocusAppearance(SelectionBehaviorOnFocus::Res
tore); |
| 2232 } else if (element->isContentEditable()) { | 2232 } else if (element->isContentEditable()) { |
| 2233 // updateFocusAppearance() selects all the text of | 2233 // updateFocusAppearance() selects all the text of |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2245 | 2245 |
| 2246 // Clear focus on the currently focused frame if any. | 2246 // Clear focus on the currently focused frame if any. |
| 2247 if (!m_page) | 2247 if (!m_page) |
| 2248 return; | 2248 return; |
| 2249 | 2249 |
| 2250 LocalFrame* frame = m_page->mainFrame() && m_page->mainFrame()->isLocalF
rame() | 2250 LocalFrame* frame = m_page->mainFrame() && m_page->mainFrame()->isLocalF
rame() |
| 2251 ? m_page->deprecatedLocalMainFrame() : nullptr; | 2251 ? m_page->deprecatedLocalMainFrame() : nullptr; |
| 2252 if (!frame) | 2252 if (!frame) |
| 2253 return; | 2253 return; |
| 2254 | 2254 |
| 2255 RefPtrWillBeRawPtr<LocalFrame> focusedFrame = m_page->focusController().
focusedFrame(); | 2255 RawPtr<LocalFrame> focusedFrame = m_page->focusController().focusedFrame
(); |
| 2256 if (focusedFrame) { | 2256 if (focusedFrame) { |
| 2257 // Finish an ongoing composition to delete the composition node. | 2257 // Finish an ongoing composition to delete the composition node. |
| 2258 if (focusedFrame->inputMethodController().hasComposition()) { | 2258 if (focusedFrame->inputMethodController().hasComposition()) { |
| 2259 WebAutofillClient* autofillClient = WebLocalFrameImpl::fromFrame
(focusedFrame.get())->autofillClient(); | 2259 WebAutofillClient* autofillClient = WebLocalFrameImpl::fromFrame
(focusedFrame.get())->autofillClient(); |
| 2260 | 2260 |
| 2261 if (autofillClient) | 2261 if (autofillClient) |
| 2262 autofillClient->setIgnoreTextChanges(true); | 2262 autofillClient->setIgnoreTextChanges(true); |
| 2263 | 2263 |
| 2264 focusedFrame->inputMethodController().confirmComposition(); | 2264 focusedFrame->inputMethodController().confirmComposition(); |
| 2265 | 2265 |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2866 Frame* frame = page()->focusController().focusedOrMainFrame(); | 2866 Frame* frame = page()->focusController().focusedOrMainFrame(); |
| 2867 if (frame->isLocalFrame()) { | 2867 if (frame->isLocalFrame()) { |
| 2868 if (Document* document = toLocalFrame(frame)->document()) | 2868 if (Document* document = toLocalFrame(frame)->document()) |
| 2869 document->clearFocusedElement(); | 2869 document->clearFocusedElement(); |
| 2870 } | 2870 } |
| 2871 page()->focusController().setInitialFocus(reverse ? WebFocusTypeBackward : W
ebFocusTypeForward); | 2871 page()->focusController().setInitialFocus(reverse ? WebFocusTypeBackward : W
ebFocusTypeForward); |
| 2872 } | 2872 } |
| 2873 | 2873 |
| 2874 void WebViewImpl::clearFocusedElement() | 2874 void WebViewImpl::clearFocusedElement() |
| 2875 { | 2875 { |
| 2876 RefPtrWillBeRawPtr<Frame> frame = focusedCoreFrame(); | 2876 RawPtr<Frame> frame = focusedCoreFrame(); |
| 2877 if (!frame || !frame->isLocalFrame()) | 2877 if (!frame || !frame->isLocalFrame()) |
| 2878 return; | 2878 return; |
| 2879 | 2879 |
| 2880 LocalFrame* localFrame = toLocalFrame(frame.get()); | 2880 LocalFrame* localFrame = toLocalFrame(frame.get()); |
| 2881 | 2881 |
| 2882 RefPtrWillBeRawPtr<Document> document = localFrame->document(); | 2882 RawPtr<Document> document = localFrame->document(); |
| 2883 if (!document) | 2883 if (!document) |
| 2884 return; | 2884 return; |
| 2885 | 2885 |
| 2886 RefPtrWillBeRawPtr<Element> oldFocusedElement = document->focusedElement(); | 2886 RawPtr<Element> oldFocusedElement = document->focusedElement(); |
| 2887 document->clearFocusedElement(); | 2887 document->clearFocusedElement(); |
| 2888 if (!oldFocusedElement) | 2888 if (!oldFocusedElement) |
| 2889 return; | 2889 return; |
| 2890 | 2890 |
| 2891 // If a text field has focus, we need to make sure the selection controller | 2891 // If a text field has focus, we need to make sure the selection controller |
| 2892 // knows to remove selection from it. Otherwise, the text field is still | 2892 // knows to remove selection from it. Otherwise, the text field is still |
| 2893 // processing keyboard events even though focus has been moved to the page a
nd | 2893 // processing keyboard events even though focus has been moved to the page a
nd |
| 2894 // keystrokes get eaten as a result. | 2894 // keystrokes get eaten as a result. |
| 2895 if (oldFocusedElement->isContentEditable() || oldFocusedElement->isTextFormC
ontrol()) | 2895 if (oldFocusedElement->isContentEditable() || oldFocusedElement->isTextFormC
ontrol()) |
| 2896 localFrame->selection().clear(); | 2896 localFrame->selection().clear(); |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3370 } | 3370 } |
| 3371 | 3371 |
| 3372 updateMainFrameLayoutSize(); | 3372 updateMainFrameLayoutSize(); |
| 3373 } | 3373 } |
| 3374 | 3374 |
| 3375 void WebViewImpl::updateMainFrameLayoutSize() | 3375 void WebViewImpl::updateMainFrameLayoutSize() |
| 3376 { | 3376 { |
| 3377 if (m_shouldAutoResize || !mainFrameImpl()) | 3377 if (m_shouldAutoResize || !mainFrameImpl()) |
| 3378 return; | 3378 return; |
| 3379 | 3379 |
| 3380 RefPtrWillBeRawPtr<FrameView> view = mainFrameImpl()->frameView(); | 3380 RawPtr<FrameView> view = mainFrameImpl()->frameView(); |
| 3381 if (!view) | 3381 if (!view) |
| 3382 return; | 3382 return; |
| 3383 | 3383 |
| 3384 WebSize layoutSize = m_size; | 3384 WebSize layoutSize = m_size; |
| 3385 | 3385 |
| 3386 if (settings()->viewportEnabled()) | 3386 if (settings()->viewportEnabled()) |
| 3387 layoutSize = pageScaleConstraintsSet().layoutSize(); | 3387 layoutSize = pageScaleConstraintsSet().layoutSize(); |
| 3388 | 3388 |
| 3389 if (page()->settings().forceZeroLayoutHeight()) | 3389 if (page()->settings().forceZeroLayoutHeight()) |
| 3390 layoutSize.height = 0; | 3390 layoutSize.height = 0; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3455 scrollableArea->setScrollPosition(DoublePoint::zero(), ProgrammaticS
croll); | 3455 scrollableArea->setScrollPosition(DoublePoint::zero(), ProgrammaticS
croll); |
| 3456 } | 3456 } |
| 3457 | 3457 |
| 3458 pageScaleConstraintsSet().setNeedsReset(true); | 3458 pageScaleConstraintsSet().setNeedsReset(true); |
| 3459 } | 3459 } |
| 3460 | 3460 |
| 3461 void WebViewImpl::performMediaPlayerAction(const WebMediaPlayerAction& action, | 3461 void WebViewImpl::performMediaPlayerAction(const WebMediaPlayerAction& action, |
| 3462 const WebPoint& location) | 3462 const WebPoint& location) |
| 3463 { | 3463 { |
| 3464 HitTestResult result = hitTestResultForViewportPos(location); | 3464 HitTestResult result = hitTestResultForViewportPos(location); |
| 3465 RefPtrWillBeRawPtr<Node> node = result.innerNode(); | 3465 RawPtr<Node> node = result.innerNode(); |
| 3466 if (!isHTMLVideoElement(*node) && !isHTMLAudioElement(*node)) | 3466 if (!isHTMLVideoElement(*node) && !isHTMLAudioElement(*node)) |
| 3467 return; | 3467 return; |
| 3468 | 3468 |
| 3469 RefPtrWillBeRawPtr<HTMLMediaElement> mediaElement = static_pointer_cast<HTML
MediaElement>(node); | 3469 RawPtr<HTMLMediaElement> mediaElement = static_pointer_cast<HTMLMediaElement
>(node); |
| 3470 switch (action.type) { | 3470 switch (action.type) { |
| 3471 case WebMediaPlayerAction::Play: | 3471 case WebMediaPlayerAction::Play: |
| 3472 if (action.enable) | 3472 if (action.enable) |
| 3473 mediaElement->play(); | 3473 mediaElement->play(); |
| 3474 else | 3474 else |
| 3475 mediaElement->pause(); | 3475 mediaElement->pause(); |
| 3476 break; | 3476 break; |
| 3477 case WebMediaPlayerAction::Mute: | 3477 case WebMediaPlayerAction::Mute: |
| 3478 mediaElement->setMuted(action.enable); | 3478 mediaElement->setMuted(action.enable); |
| 3479 break; | 3479 break; |
| 3480 case WebMediaPlayerAction::Loop: | 3480 case WebMediaPlayerAction::Loop: |
| 3481 mediaElement->setLoop(action.enable); | 3481 mediaElement->setLoop(action.enable); |
| 3482 break; | 3482 break; |
| 3483 case WebMediaPlayerAction::Controls: | 3483 case WebMediaPlayerAction::Controls: |
| 3484 mediaElement->setBooleanAttribute(HTMLNames::controlsAttr, action.enable
); | 3484 mediaElement->setBooleanAttribute(HTMLNames::controlsAttr, action.enable
); |
| 3485 break; | 3485 break; |
| 3486 default: | 3486 default: |
| 3487 ASSERT_NOT_REACHED(); | 3487 ASSERT_NOT_REACHED(); |
| 3488 } | 3488 } |
| 3489 } | 3489 } |
| 3490 | 3490 |
| 3491 void WebViewImpl::performPluginAction(const WebPluginAction& action, | 3491 void WebViewImpl::performPluginAction(const WebPluginAction& action, |
| 3492 const WebPoint& location) | 3492 const WebPoint& location) |
| 3493 { | 3493 { |
| 3494 // FIXME: Location is probably in viewport coordinates | 3494 // FIXME: Location is probably in viewport coordinates |
| 3495 HitTestResult result = hitTestResultForRootFramePos(location); | 3495 HitTestResult result = hitTestResultForRootFramePos(location); |
| 3496 RefPtrWillBeRawPtr<Node> node = result.innerNode(); | 3496 RawPtr<Node> node = result.innerNode(); |
| 3497 if (!isHTMLObjectElement(*node) && !isHTMLEmbedElement(*node)) | 3497 if (!isHTMLObjectElement(*node) && !isHTMLEmbedElement(*node)) |
| 3498 return; | 3498 return; |
| 3499 | 3499 |
| 3500 LayoutObject* object = node->layoutObject(); | 3500 LayoutObject* object = node->layoutObject(); |
| 3501 if (object && object->isLayoutPart()) { | 3501 if (object && object->isLayoutPart()) { |
| 3502 Widget* widget = toLayoutPart(object)->widget(); | 3502 Widget* widget = toLayoutPart(object)->widget(); |
| 3503 if (widget && widget->isPluginContainer()) { | 3503 if (widget && widget->isPluginContainer()) { |
| 3504 WebPluginContainerImpl* plugin = toWebPluginContainerImpl(widget); | 3504 WebPluginContainerImpl* plugin = toWebPluginContainerImpl(widget); |
| 3505 switch (action.type) { | 3505 switch (action.type) { |
| 3506 case WebPluginAction::Rotate90Clockwise: | 3506 case WebPluginAction::Rotate90Clockwise: |
| (...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4564 { | 4564 { |
| 4565 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than | 4565 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than |
| 4566 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. | 4566 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. |
| 4567 if (!page()) | 4567 if (!page()) |
| 4568 return 1; | 4568 return 1; |
| 4569 | 4569 |
| 4570 return page()->deviceScaleFactor(); | 4570 return page()->deviceScaleFactor(); |
| 4571 } | 4571 } |
| 4572 | 4572 |
| 4573 } // namespace blink | 4573 } // namespace blink |
| OLD | NEW |