| 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 { | 273 { |
| 274 if (!*m_userGestureObserved && UserGestureIndicator::processedUserGestureSin
ceLoad()) { | 274 if (!*m_userGestureObserved && UserGestureIndicator::processedUserGestureSin
ceLoad()) { |
| 275 *m_userGestureObserved = true; | 275 *m_userGestureObserved = true; |
| 276 if (m_client) | 276 if (m_client) |
| 277 m_client->firstUserGestureObserved(); | 277 m_client->firstUserGestureObserved(); |
| 278 } | 278 } |
| 279 } | 279 } |
| 280 | 280 |
| 281 class EmptyEventListener final : public EventListener { | 281 class EmptyEventListener final : public EventListener { |
| 282 public: | 282 public: |
| 283 static PassRefPtrWillBeRawPtr<EmptyEventListener> create() | 283 static RawPtr<EmptyEventListener> create() |
| 284 { | 284 { |
| 285 return adoptRefWillBeNoop(new EmptyEventListener()); | 285 return (new EmptyEventListener()); |
| 286 } | 286 } |
| 287 | 287 |
| 288 bool operator==(const EventListener& other) const override | 288 bool operator==(const EventListener& other) const override |
| 289 { | 289 { |
| 290 return this == &other; | 290 return this == &other; |
| 291 } | 291 } |
| 292 | 292 |
| 293 private: | 293 private: |
| 294 EmptyEventListener() | 294 EmptyEventListener() |
| 295 : EventListener(CPPEventListenerType) | 295 : EventListener(CPPEventListenerType) |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 event.y - event.data.tap.height / 2, | 817 event.y - event.data.tap.height / 2, |
| 818 event.data.tap.width, | 818 event.data.tap.width, |
| 819 event.data.tap.height))); | 819 event.data.tap.height))); |
| 820 | 820 |
| 821 // TODO(bokan): We shouldn't pass details of the VisualViewport offs
et to render_view_impl. | 821 // TODO(bokan): We shouldn't pass details of the VisualViewport offs
et to render_view_impl. |
| 822 // crbug.com/459591 | 822 // crbug.com/459591 |
| 823 WebSize visualViewportOffset = flooredIntSize(visualViewport.locatio
n()); | 823 WebSize visualViewportOffset = flooredIntSize(visualViewport.locatio
n()); |
| 824 | 824 |
| 825 if (m_webSettings->multiTargetTapNotificationEnabled()) { | 825 if (m_webSettings->multiTargetTapNotificationEnabled()) { |
| 826 Vector<IntRect> goodTargets; | 826 Vector<IntRect> goodTargets; |
| 827 WillBeHeapVector<RawPtrWillBeMember<Node>> highlightNodes; | 827 HeapVector<Member<Node>> highlightNodes; |
| 828 findGoodTouchTargets(boundingBox, mainFrameImpl()->frame(), good
Targets, highlightNodes); | 828 findGoodTouchTargets(boundingBox, mainFrameImpl()->frame(), good
Targets, highlightNodes); |
| 829 // FIXME: replace touch adjustment code when numberOfGoodTargets
== 1? | 829 // FIXME: replace touch adjustment code when numberOfGoodTargets
== 1? |
| 830 // Single candidate case is currently handled by: https://bugs.w
ebkit.org/show_bug.cgi?id=85101 | 830 // Single candidate case is currently handled by: https://bugs.w
ebkit.org/show_bug.cgi?id=85101 |
| 831 if (goodTargets.size() >= 2 && m_client | 831 if (goodTargets.size() >= 2 && m_client |
| 832 && m_client->didTapMultipleTargets(visualViewportOffset, bou
ndingBox, goodTargets)) { | 832 && m_client->didTapMultipleTargets(visualViewportOffset, bou
ndingBox, goodTargets)) { |
| 833 | 833 |
| 834 enableTapHighlights(highlightNodes); | 834 enableTapHighlights(highlightNodes); |
| 835 for (size_t i = 0; i < m_linkHighlights.size(); ++i) | 835 for (size_t i = 0; i < m_linkHighlights.size(); ++i) |
| 836 m_linkHighlights[i]->startHighlightAnimationIfNeeded(); | 836 m_linkHighlights[i]->startHighlightAnimationIfNeeded(); |
| 837 eventResult = WebInputEventResult::HandledSystem; | 837 eventResult = WebInputEventResult::HandledSystem; |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1053 // page. | 1053 // page. |
| 1054 if (m_pagePopup) { | 1054 if (m_pagePopup) { |
| 1055 m_pagePopup->handleKeyEvent(PlatformKeyboardEventBuilder(event)); | 1055 m_pagePopup->handleKeyEvent(PlatformKeyboardEventBuilder(event)); |
| 1056 // We need to ignore the next Char event after this otherwise pressing | 1056 // We need to ignore the next Char event after this otherwise pressing |
| 1057 // enter when selecting an item in the popup will go to the page. | 1057 // enter when selecting an item in the popup will go to the page. |
| 1058 if (WebInputEvent::RawKeyDown == event.type) | 1058 if (WebInputEvent::RawKeyDown == event.type) |
| 1059 m_suppressNextKeypressEvent = true; | 1059 m_suppressNextKeypressEvent = true; |
| 1060 return WebInputEventResult::HandledSystem; | 1060 return WebInputEventResult::HandledSystem; |
| 1061 } | 1061 } |
| 1062 | 1062 |
| 1063 RefPtrWillBeRawPtr<Frame> focusedFrame = focusedCoreFrame(); | 1063 RawPtr<Frame> focusedFrame = focusedCoreFrame(); |
| 1064 if (focusedFrame && focusedFrame->isRemoteFrame()) { | 1064 if (focusedFrame && focusedFrame->isRemoteFrame()) { |
| 1065 WebRemoteFrameImpl* webFrame = WebRemoteFrameImpl::fromFrame(*toRemoteFr
ame(focusedFrame.get())); | 1065 WebRemoteFrameImpl* webFrame = WebRemoteFrameImpl::fromFrame(*toRemoteFr
ame(focusedFrame.get())); |
| 1066 webFrame->client()->forwardInputEvent(&event); | 1066 webFrame->client()->forwardInputEvent(&event); |
| 1067 return WebInputEventResult::HandledSystem; | 1067 return WebInputEventResult::HandledSystem; |
| 1068 } | 1068 } |
| 1069 | 1069 |
| 1070 if (!focusedFrame || !focusedFrame->isLocalFrame()) | 1070 if (!focusedFrame || !focusedFrame->isLocalFrame()) |
| 1071 return WebInputEventResult::NotHandled; | 1071 return WebInputEventResult::NotHandled; |
| 1072 | 1072 |
| 1073 LocalFrame* frame = toLocalFrame(focusedFrame.get()); | 1073 LocalFrame* frame = toLocalFrame(focusedFrame.get()); |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1367 m_page->deprecatedLocalMainFrame()); | 1367 m_page->deprecatedLocalMainFrame()); |
| 1368 } while (cursorDefiningAncestor && showsHandCursor(cursorDefiningAncestor, m
_page->deprecatedLocalMainFrame())); | 1368 } while (cursorDefiningAncestor && showsHandCursor(cursorDefiningAncestor, m
_page->deprecatedLocalMainFrame())); |
| 1369 | 1369 |
| 1370 return bestTouchNode; | 1370 return bestTouchNode; |
| 1371 } | 1371 } |
| 1372 | 1372 |
| 1373 void WebViewImpl::enableTapHighlightAtPoint(const GestureEventWithHitTestResults
& targetedTapEvent) | 1373 void WebViewImpl::enableTapHighlightAtPoint(const GestureEventWithHitTestResults
& targetedTapEvent) |
| 1374 { | 1374 { |
| 1375 Node* touchNode = bestTapNode(targetedTapEvent); | 1375 Node* touchNode = bestTapNode(targetedTapEvent); |
| 1376 | 1376 |
| 1377 WillBeHeapVector<RawPtrWillBeMember<Node>> highlightNodes; | 1377 HeapVector<Member<Node>> highlightNodes; |
| 1378 highlightNodes.append(touchNode); | 1378 highlightNodes.append(touchNode); |
| 1379 | 1379 |
| 1380 enableTapHighlights(highlightNodes); | 1380 enableTapHighlights(highlightNodes); |
| 1381 } | 1381 } |
| 1382 | 1382 |
| 1383 void WebViewImpl::enableTapHighlights(WillBeHeapVector<RawPtrWillBeMember<Node>>
& highlightNodes) | 1383 void WebViewImpl::enableTapHighlights(HeapVector<Member<Node>>& highlightNodes) |
| 1384 { | 1384 { |
| 1385 if (highlightNodes.isEmpty()) | 1385 if (highlightNodes.isEmpty()) |
| 1386 return; | 1386 return; |
| 1387 | 1387 |
| 1388 // Always clear any existing highlight when this is invoked, even if we | 1388 // Always clear any existing highlight when this is invoked, even if we |
| 1389 // don't get a new target to highlight. | 1389 // don't get a new target to highlight. |
| 1390 m_linkHighlights.clear(); | 1390 m_linkHighlights.clear(); |
| 1391 | 1391 |
| 1392 for (size_t i = 0; i < highlightNodes.size(); ++i) { | 1392 for (size_t i = 0; i < highlightNodes.size(); ++i) { |
| 1393 Node* node = highlightNodes[i]; | 1393 Node* node = highlightNodes[i]; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1507 { | 1507 { |
| 1508 ContextMenuAllowedScope scope; | 1508 ContextMenuAllowedScope scope; |
| 1509 Frame* focusedFrame = page()->focusController().focusedOrMainFrame(); | 1509 Frame* focusedFrame = page()->focusController().focusedOrMainFrame(); |
| 1510 if (!focusedFrame->isLocalFrame()) | 1510 if (!focusedFrame->isLocalFrame()) |
| 1511 return WebInputEventResult::NotHandled; | 1511 return WebInputEventResult::NotHandled; |
| 1512 return toLocalFrame(focusedFrame)->eventHandler().sendContextMenuEventFo
rKey(nullptr); | 1512 return toLocalFrame(focusedFrame)->eventHandler().sendContextMenuEventFo
rKey(nullptr); |
| 1513 } | 1513 } |
| 1514 } | 1514 } |
| 1515 #endif | 1515 #endif |
| 1516 | 1516 |
| 1517 void WebViewImpl::showContextMenuAtPoint(float x, float y, PassRefPtrWillBeRawPt
r<ContextMenuProvider> menuProvider) | 1517 void WebViewImpl::showContextMenuAtPoint(float x, float y, RawPtr<ContextMenuPro
vider> menuProvider) |
| 1518 { | 1518 { |
| 1519 if (!page()->mainFrame()->isLocalFrame()) | 1519 if (!page()->mainFrame()->isLocalFrame()) |
| 1520 return; | 1520 return; |
| 1521 { | 1521 { |
| 1522 ContextMenuAllowedScope scope; | 1522 ContextMenuAllowedScope scope; |
| 1523 page()->contextMenuController().clearContextMenu(); | 1523 page()->contextMenuController().clearContextMenu(); |
| 1524 page()->contextMenuController().showContextMenuAtPoint(page()->deprecate
dLocalMainFrame(), x, y, menuProvider); | 1524 page()->contextMenuController().showContextMenuAtPoint(page()->deprecate
dLocalMainFrame(), x, y, menuProvider); |
| 1525 } | 1525 } |
| 1526 } | 1526 } |
| 1527 | 1527 |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2141 UIEventWithKeyState::clearNewTabModifierSetFromIsolatedWorld(); | 2141 UIEventWithKeyState::clearNewTabModifierSetFromIsolatedWorld(); |
| 2142 | 2142 |
| 2143 if (isPointerLocked() && WebInputEvent::isMouseEventType(inputEvent.type)) { | 2143 if (isPointerLocked() && WebInputEvent::isMouseEventType(inputEvent.type)) { |
| 2144 pointerLockMouseEvent(inputEvent); | 2144 pointerLockMouseEvent(inputEvent); |
| 2145 return WebInputEventResult::HandledSystem; | 2145 return WebInputEventResult::HandledSystem; |
| 2146 } | 2146 } |
| 2147 | 2147 |
| 2148 if (m_mouseCaptureNode && WebInputEvent::isMouseEventType(inputEvent.type))
{ | 2148 if (m_mouseCaptureNode && WebInputEvent::isMouseEventType(inputEvent.type))
{ |
| 2149 TRACE_EVENT1("input", "captured mouse event", "type", inputEvent.type); | 2149 TRACE_EVENT1("input", "captured mouse event", "type", inputEvent.type); |
| 2150 // Save m_mouseCaptureNode since mouseCaptureLost() will clear it. | 2150 // Save m_mouseCaptureNode since mouseCaptureLost() will clear it. |
| 2151 RefPtrWillBeRawPtr<Node> node = m_mouseCaptureNode; | 2151 RawPtr<Node> node = m_mouseCaptureNode; |
| 2152 | 2152 |
| 2153 // Not all platforms call mouseCaptureLost() directly. | 2153 // Not all platforms call mouseCaptureLost() directly. |
| 2154 if (inputEvent.type == WebInputEvent::MouseUp) | 2154 if (inputEvent.type == WebInputEvent::MouseUp) |
| 2155 mouseCaptureLost(); | 2155 mouseCaptureLost(); |
| 2156 | 2156 |
| 2157 OwnPtr<UserGestureIndicator> gestureIndicator; | 2157 OwnPtr<UserGestureIndicator> gestureIndicator; |
| 2158 | 2158 |
| 2159 AtomicString eventType; | 2159 AtomicString eventType; |
| 2160 switch (inputEvent.type) { | 2160 switch (inputEvent.type) { |
| 2161 case WebInputEvent::MouseMove: | 2161 case WebInputEvent::MouseMove: |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2217 { | 2217 { |
| 2218 TRACE_EVENT_ASYNC_END0("input", "capturing mouse", this); | 2218 TRACE_EVENT_ASYNC_END0("input", "capturing mouse", this); |
| 2219 m_mouseCaptureNode = nullptr; | 2219 m_mouseCaptureNode = nullptr; |
| 2220 } | 2220 } |
| 2221 | 2221 |
| 2222 void WebViewImpl::setFocus(bool enable) | 2222 void WebViewImpl::setFocus(bool enable) |
| 2223 { | 2223 { |
| 2224 m_page->focusController().setFocused(enable); | 2224 m_page->focusController().setFocused(enable); |
| 2225 if (enable) { | 2225 if (enable) { |
| 2226 m_page->focusController().setActive(true); | 2226 m_page->focusController().setActive(true); |
| 2227 RefPtrWillBeRawPtr<LocalFrame> focusedFrame = m_page->focusController().
focusedFrame(); | 2227 RawPtr<LocalFrame> focusedFrame = m_page->focusController().focusedFrame
(); |
| 2228 if (focusedFrame) { | 2228 if (focusedFrame) { |
| 2229 Element* element = focusedFrame->document()->focusedElement(); | 2229 Element* element = focusedFrame->document()->focusedElement(); |
| 2230 if (element && focusedFrame->selection().selection().isNone()) { | 2230 if (element && focusedFrame->selection().selection().isNone()) { |
| 2231 // If the selection was cleared while the WebView was not | 2231 // If the selection was cleared while the WebView was not |
| 2232 // focused, then the focus element shows with a focus ring but | 2232 // focused, then the focus element shows with a focus ring but |
| 2233 // no caret and does respond to keyboard inputs. | 2233 // no caret and does respond to keyboard inputs. |
| 2234 if (element->isTextFormControl()) { | 2234 if (element->isTextFormControl()) { |
| 2235 element->updateFocusAppearance(SelectionBehaviorOnFocus::Res
tore); | 2235 element->updateFocusAppearance(SelectionBehaviorOnFocus::Res
tore); |
| 2236 } else if (element->isContentEditable()) { | 2236 } else if (element->isContentEditable()) { |
| 2237 // updateFocusAppearance() selects all the text of | 2237 // updateFocusAppearance() selects all the text of |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2249 | 2249 |
| 2250 // Clear focus on the currently focused frame if any. | 2250 // Clear focus on the currently focused frame if any. |
| 2251 if (!m_page) | 2251 if (!m_page) |
| 2252 return; | 2252 return; |
| 2253 | 2253 |
| 2254 LocalFrame* frame = m_page->mainFrame() && m_page->mainFrame()->isLocalF
rame() | 2254 LocalFrame* frame = m_page->mainFrame() && m_page->mainFrame()->isLocalF
rame() |
| 2255 ? m_page->deprecatedLocalMainFrame() : nullptr; | 2255 ? m_page->deprecatedLocalMainFrame() : nullptr; |
| 2256 if (!frame) | 2256 if (!frame) |
| 2257 return; | 2257 return; |
| 2258 | 2258 |
| 2259 RefPtrWillBeRawPtr<LocalFrame> focusedFrame = m_page->focusController().
focusedFrame(); | 2259 RawPtr<LocalFrame> focusedFrame = m_page->focusController().focusedFrame
(); |
| 2260 if (focusedFrame) { | 2260 if (focusedFrame) { |
| 2261 // Finish an ongoing composition to delete the composition node. | 2261 // Finish an ongoing composition to delete the composition node. |
| 2262 if (focusedFrame->inputMethodController().hasComposition()) { | 2262 if (focusedFrame->inputMethodController().hasComposition()) { |
| 2263 WebAutofillClient* autofillClient = WebLocalFrameImpl::fromFrame
(focusedFrame.get())->autofillClient(); | 2263 WebAutofillClient* autofillClient = WebLocalFrameImpl::fromFrame
(focusedFrame.get())->autofillClient(); |
| 2264 | 2264 |
| 2265 if (autofillClient) | 2265 if (autofillClient) |
| 2266 autofillClient->setIgnoreTextChanges(true); | 2266 autofillClient->setIgnoreTextChanges(true); |
| 2267 | 2267 |
| 2268 focusedFrame->inputMethodController().confirmComposition(); | 2268 focusedFrame->inputMethodController().confirmComposition(); |
| 2269 | 2269 |
| (...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2869 Frame* frame = page()->focusController().focusedOrMainFrame(); | 2869 Frame* frame = page()->focusController().focusedOrMainFrame(); |
| 2870 if (frame->isLocalFrame()) { | 2870 if (frame->isLocalFrame()) { |
| 2871 if (Document* document = toLocalFrame(frame)->document()) | 2871 if (Document* document = toLocalFrame(frame)->document()) |
| 2872 document->clearFocusedElement(); | 2872 document->clearFocusedElement(); |
| 2873 } | 2873 } |
| 2874 page()->focusController().setInitialFocus(reverse ? WebFocusTypeBackward : W
ebFocusTypeForward); | 2874 page()->focusController().setInitialFocus(reverse ? WebFocusTypeBackward : W
ebFocusTypeForward); |
| 2875 } | 2875 } |
| 2876 | 2876 |
| 2877 void WebViewImpl::clearFocusedElement() | 2877 void WebViewImpl::clearFocusedElement() |
| 2878 { | 2878 { |
| 2879 RefPtrWillBeRawPtr<Frame> frame = focusedCoreFrame(); | 2879 RawPtr<Frame> frame = focusedCoreFrame(); |
| 2880 if (!frame || !frame->isLocalFrame()) | 2880 if (!frame || !frame->isLocalFrame()) |
| 2881 return; | 2881 return; |
| 2882 | 2882 |
| 2883 LocalFrame* localFrame = toLocalFrame(frame.get()); | 2883 LocalFrame* localFrame = toLocalFrame(frame.get()); |
| 2884 | 2884 |
| 2885 RefPtrWillBeRawPtr<Document> document = localFrame->document(); | 2885 RawPtr<Document> document = localFrame->document(); |
| 2886 if (!document) | 2886 if (!document) |
| 2887 return; | 2887 return; |
| 2888 | 2888 |
| 2889 RefPtrWillBeRawPtr<Element> oldFocusedElement = document->focusedElement(); | 2889 RawPtr<Element> oldFocusedElement = document->focusedElement(); |
| 2890 document->clearFocusedElement(); | 2890 document->clearFocusedElement(); |
| 2891 if (!oldFocusedElement) | 2891 if (!oldFocusedElement) |
| 2892 return; | 2892 return; |
| 2893 | 2893 |
| 2894 // If a text field has focus, we need to make sure the selection controller | 2894 // If a text field has focus, we need to make sure the selection controller |
| 2895 // knows to remove selection from it. Otherwise, the text field is still | 2895 // knows to remove selection from it. Otherwise, the text field is still |
| 2896 // processing keyboard events even though focus has been moved to the page a
nd | 2896 // processing keyboard events even though focus has been moved to the page a
nd |
| 2897 // keystrokes get eaten as a result. | 2897 // keystrokes get eaten as a result. |
| 2898 if (oldFocusedElement->isContentEditable() || oldFocusedElement->isTextFormC
ontrol()) | 2898 if (oldFocusedElement->isContentEditable() || oldFocusedElement->isTextFormC
ontrol()) |
| 2899 localFrame->selection().clear(); | 2899 localFrame->selection().clear(); |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3358 } | 3358 } |
| 3359 | 3359 |
| 3360 updateMainFrameLayoutSize(); | 3360 updateMainFrameLayoutSize(); |
| 3361 } | 3361 } |
| 3362 | 3362 |
| 3363 void WebViewImpl::updateMainFrameLayoutSize() | 3363 void WebViewImpl::updateMainFrameLayoutSize() |
| 3364 { | 3364 { |
| 3365 if (m_shouldAutoResize || !mainFrameImpl()) | 3365 if (m_shouldAutoResize || !mainFrameImpl()) |
| 3366 return; | 3366 return; |
| 3367 | 3367 |
| 3368 RefPtrWillBeRawPtr<FrameView> view = mainFrameImpl()->frameView(); | 3368 RawPtr<FrameView> view = mainFrameImpl()->frameView(); |
| 3369 if (!view) | 3369 if (!view) |
| 3370 return; | 3370 return; |
| 3371 | 3371 |
| 3372 WebSize layoutSize = m_size; | 3372 WebSize layoutSize = m_size; |
| 3373 | 3373 |
| 3374 if (settings()->viewportEnabled()) | 3374 if (settings()->viewportEnabled()) |
| 3375 layoutSize = pageScaleConstraintsSet().layoutSize(); | 3375 layoutSize = pageScaleConstraintsSet().layoutSize(); |
| 3376 | 3376 |
| 3377 if (page()->settings().forceZeroLayoutHeight()) | 3377 if (page()->settings().forceZeroLayoutHeight()) |
| 3378 layoutSize.height = 0; | 3378 layoutSize.height = 0; |
| (...skipping 76 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 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4563 { | 4563 { |
| 4564 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than | 4564 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than |
| 4565 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. | 4565 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. |
| 4566 if (!page()) | 4566 if (!page()) |
| 4567 return 1; | 4567 return 1; |
| 4568 | 4568 |
| 4569 return page()->deviceScaleFactor(); | 4569 return page()->deviceScaleFactor(); |
| 4570 } | 4570 } |
| 4571 | 4571 |
| 4572 } // namespace blink | 4572 } // namespace blink |
| OLD | NEW |