| 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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 // Take capture on a mouse down on a plugin so we can send it mouse events. | 528 // Take capture on a mouse down on a plugin so we can send it mouse events. |
| 529 // If the hit node is a plugin but a scrollbar is over it don't start mouse | 529 // If the hit node is a plugin but a scrollbar is over it don't start mouse |
| 530 // capture because it will interfere with the scrollbar receiving events. | 530 // capture because it will interfere with the scrollbar receiving events. |
| 531 IntPoint point(event.x, event.y); | 531 IntPoint point(event.x, event.y); |
| 532 if (event.button == WebMouseEvent::ButtonLeft && m_page->mainFrame()->isLoca
lFrame()) { | 532 if (event.button == WebMouseEvent::ButtonLeft && m_page->mainFrame()->isLoca
lFrame()) { |
| 533 point = m_page->deprecatedLocalMainFrame()->view()->windowToContents(poi
nt); | 533 point = m_page->deprecatedLocalMainFrame()->view()->windowToContents(poi
nt); |
| 534 HitTestResult result(m_page->deprecatedLocalMainFrame()->eventHandler().
hitTestResultAtPoint(point)); | 534 HitTestResult result(m_page->deprecatedLocalMainFrame()->eventHandler().
hitTestResultAtPoint(point)); |
| 535 result.setToShadowHostIfInClosedShadowRoot(); | 535 result.setToShadowHostIfInClosedShadowRoot(); |
| 536 Node* hitNode = result.innerNonSharedNode(); | 536 Node* hitNode = result.innerNonSharedNode(); |
| 537 | 537 |
| 538 if (!result.scrollbar() && hitNode && hitNode->renderer() && hitNode->re
nderer()->isEmbeddedObject()) { | 538 if (!result.scrollbar() && hitNode && hitNode->layoutObject() && hitNode
->layoutObject()->isEmbeddedObject()) { |
| 539 m_mouseCaptureNode = hitNode; | 539 m_mouseCaptureNode = hitNode; |
| 540 TRACE_EVENT_ASYNC_BEGIN0("input", "capturing mouse", this); | 540 TRACE_EVENT_ASYNC_BEGIN0("input", "capturing mouse", this); |
| 541 } | 541 } |
| 542 } | 542 } |
| 543 | 543 |
| 544 PageWidgetEventHandler::handleMouseDown(mainFrame, event); | 544 PageWidgetEventHandler::handleMouseDown(mainFrame, event); |
| 545 | 545 |
| 546 if (event.button == WebMouseEvent::ButtonLeft && m_mouseCaptureNode) | 546 if (event.button == WebMouseEvent::ButtonLeft && m_mouseCaptureNode) |
| 547 m_mouseCaptureGestureToken = mainFrame.eventHandler().takeLastMouseDownG
estureToken(); | 547 m_mouseCaptureGestureToken = mainFrame.eventHandler().takeLastMouseDownG
estureToken(); |
| 548 | 548 |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1045 | 1045 |
| 1046 LocalFrame* frame = toLocalFrame(focusedFrame.get()); | 1046 LocalFrame* frame = toLocalFrame(focusedFrame.get()); |
| 1047 | 1047 |
| 1048 PlatformKeyboardEventBuilder evt(event); | 1048 PlatformKeyboardEventBuilder evt(event); |
| 1049 | 1049 |
| 1050 if (frame->eventHandler().keyEvent(evt)) { | 1050 if (frame->eventHandler().keyEvent(evt)) { |
| 1051 if (WebInputEvent::RawKeyDown == event.type) { | 1051 if (WebInputEvent::RawKeyDown == event.type) { |
| 1052 // Suppress the next keypress event unless the focused node is a plu
g-in node. | 1052 // Suppress the next keypress event unless the focused node is a plu
g-in node. |
| 1053 // (Flash needs these keypress events to handle non-US keyboards.) | 1053 // (Flash needs these keypress events to handle non-US keyboards.) |
| 1054 Element* element = focusedElement(); | 1054 Element* element = focusedElement(); |
| 1055 if (!element || !element->renderer() || !element->renderer()->isEmbe
ddedObject()) | 1055 if (!element || !element->layoutObject() || !element->layoutObject()
->isEmbeddedObject()) |
| 1056 m_suppressNextKeypressEvent = true; | 1056 m_suppressNextKeypressEvent = true; |
| 1057 } | 1057 } |
| 1058 return true; | 1058 return true; |
| 1059 } | 1059 } |
| 1060 | 1060 |
| 1061 #if !OS(MACOSX) | 1061 #if !OS(MACOSX) |
| 1062 const WebInputEvent::Type contextMenuTriggeringEventType = | 1062 const WebInputEvent::Type contextMenuTriggeringEventType = |
| 1063 #if OS(WIN) | 1063 #if OS(WIN) |
| 1064 WebInputEvent::KeyUp; | 1064 WebInputEvent::KeyUp; |
| 1065 #else | 1065 #else |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1133 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitT
estRequest::Active | (ignoreClipping ? HitTestRequest::IgnoreClipping : 0); | 1133 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitT
estRequest::Active | (ignoreClipping ? HitTestRequest::IgnoreClipping : 0); |
| 1134 HitTestResult result = mainFrameImpl()->frame()->eventHandler().hitTestResul
tAtPoint(point, hitType); | 1134 HitTestResult result = mainFrameImpl()->frame()->eventHandler().hitTestResul
tAtPoint(point, hitType); |
| 1135 result.setToShadowHostIfInClosedShadowRoot(); | 1135 result.setToShadowHostIfInClosedShadowRoot(); |
| 1136 | 1136 |
| 1137 Node* node = result.innerNonSharedNode(); | 1137 Node* node = result.innerNonSharedNode(); |
| 1138 if (!node) | 1138 if (!node) |
| 1139 return WebRect(); | 1139 return WebRect(); |
| 1140 | 1140 |
| 1141 // Find the block type node based on the hit node. | 1141 // Find the block type node based on the hit node. |
| 1142 // FIXME: This wants to walk composed tree with NodeRenderingTraversal::pare
nt(). | 1142 // FIXME: This wants to walk composed tree with NodeRenderingTraversal::pare
nt(). |
| 1143 while (node && (!node->renderer() || node->renderer()->isInline())) | 1143 while (node && (!node->layoutObject() || node->layoutObject()->isInline())) |
| 1144 node = NodeRenderingTraversal::parent(*node); | 1144 node = NodeRenderingTraversal::parent(*node); |
| 1145 | 1145 |
| 1146 // Return the bounding box in the window coordinate system. | 1146 // Return the bounding box in the window coordinate system. |
| 1147 if (node) { | 1147 if (node) { |
| 1148 IntRect rect = node->Node::pixelSnappedBoundingBox(); | 1148 IntRect rect = node->Node::pixelSnappedBoundingBox(); |
| 1149 LocalFrame* frame = node->document().frame(); | 1149 LocalFrame* frame = node->document().frame(); |
| 1150 return frame->view()->contentsToWindow(rect); | 1150 return frame->view()->contentsToWindow(rect); |
| 1151 } | 1151 } |
| 1152 return WebRect(); | 1152 return WebRect(); |
| 1153 } | 1153 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1252 | 1252 |
| 1253 scale = clampPageScaleFactorToLimits(scale); | 1253 scale = clampPageScaleFactorToLimits(scale); |
| 1254 scroll = mainFrameImpl()->frameView()->windowToContents(scroll); | 1254 scroll = mainFrameImpl()->frameView()->windowToContents(scroll); |
| 1255 scroll = clampOffsetAtScale(scroll, scale); | 1255 scroll = clampOffsetAtScale(scroll, scale); |
| 1256 } | 1256 } |
| 1257 | 1257 |
| 1258 static Node* findCursorDefiningAncestor(Node* node, LocalFrame* frame) | 1258 static Node* findCursorDefiningAncestor(Node* node, LocalFrame* frame) |
| 1259 { | 1259 { |
| 1260 // Go up the tree to find the node that defines a mouse cursor style | 1260 // Go up the tree to find the node that defines a mouse cursor style |
| 1261 while (node) { | 1261 while (node) { |
| 1262 if (node->renderer()) { | 1262 if (node->layoutObject()) { |
| 1263 ECursor cursor = node->renderer()->style()->cursor(); | 1263 ECursor cursor = node->layoutObject()->style()->cursor(); |
| 1264 if (cursor != CURSOR_AUTO || frame->eventHandler().useHandCursor(nod
e, node->isLink())) | 1264 if (cursor != CURSOR_AUTO || frame->eventHandler().useHandCursor(nod
e, node->isLink())) |
| 1265 break; | 1265 break; |
| 1266 } | 1266 } |
| 1267 node = NodeRenderingTraversal::parent(*node); | 1267 node = NodeRenderingTraversal::parent(*node); |
| 1268 } | 1268 } |
| 1269 | 1269 |
| 1270 return node; | 1270 return node; |
| 1271 } | 1271 } |
| 1272 | 1272 |
| 1273 static bool showsHandCursor(Node* node, LocalFrame* frame) | 1273 static bool showsHandCursor(Node* node, LocalFrame* frame) |
| 1274 { | 1274 { |
| 1275 if (!node || !node->renderer()) | 1275 if (!node || !node->layoutObject()) |
| 1276 return false; | 1276 return false; |
| 1277 | 1277 |
| 1278 ECursor cursor = node->renderer()->style()->cursor(); | 1278 ECursor cursor = node->layoutObject()->style()->cursor(); |
| 1279 return cursor == CURSOR_POINTER | 1279 return cursor == CURSOR_POINTER |
| 1280 || (cursor == CURSOR_AUTO && frame->eventHandler().useHandCursor(node, n
ode->isLink())); | 1280 || (cursor == CURSOR_AUTO && frame->eventHandler().useHandCursor(node, n
ode->isLink())); |
| 1281 } | 1281 } |
| 1282 | 1282 |
| 1283 Node* WebViewImpl::bestTapNode(const GestureEventWithHitTestResults& targetedTap
Event) | 1283 Node* WebViewImpl::bestTapNode(const GestureEventWithHitTestResults& targetedTap
Event) |
| 1284 { | 1284 { |
| 1285 TRACE_EVENT0("input", "WebViewImpl::bestTapNode"); | 1285 TRACE_EVENT0("input", "WebViewImpl::bestTapNode"); |
| 1286 | 1286 |
| 1287 if (!m_page || !m_page->mainFrame()) | 1287 if (!m_page || !m_page->mainFrame()) |
| 1288 return 0; | 1288 return 0; |
| 1289 | 1289 |
| 1290 Node* bestTouchNode = targetedTapEvent.hitTestResult().innerNode(); | 1290 Node* bestTouchNode = targetedTapEvent.hitTestResult().innerNode(); |
| 1291 if (!bestTouchNode) | 1291 if (!bestTouchNode) |
| 1292 return nullptr; | 1292 return nullptr; |
| 1293 | 1293 |
| 1294 // We might hit something like an image map that has no renderer on it | 1294 // We might hit something like an image map that has no renderer on it |
| 1295 // Walk up the tree until we have a node with an attached renderer | 1295 // Walk up the tree until we have a node with an attached renderer |
| 1296 while (!bestTouchNode->renderer()) { | 1296 while (!bestTouchNode->layoutObject()) { |
| 1297 bestTouchNode = NodeRenderingTraversal::parent(*bestTouchNode); | 1297 bestTouchNode = NodeRenderingTraversal::parent(*bestTouchNode); |
| 1298 if (!bestTouchNode) | 1298 if (!bestTouchNode) |
| 1299 return nullptr; | 1299 return nullptr; |
| 1300 } | 1300 } |
| 1301 | 1301 |
| 1302 // Editable nodes should not be highlighted (e.g., <input>) | 1302 // Editable nodes should not be highlighted (e.g., <input>) |
| 1303 if (bestTouchNode->hasEditableStyle()) | 1303 if (bestTouchNode->hasEditableStyle()) |
| 1304 return nullptr; | 1304 return nullptr; |
| 1305 | 1305 |
| 1306 Node* cursorDefiningAncestor = | 1306 Node* cursorDefiningAncestor = |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1341 // Always clear any existing highlight when this is invoked, even if we | 1341 // Always clear any existing highlight when this is invoked, even if we |
| 1342 // don't get a new target to highlight. | 1342 // don't get a new target to highlight. |
| 1343 m_linkHighlights.clear(); | 1343 m_linkHighlights.clear(); |
| 1344 | 1344 |
| 1345 // LinkHighlight reads out layout and compositing state, so we need to make
sure that's all up to date. | 1345 // LinkHighlight reads out layout and compositing state, so we need to make
sure that's all up to date. |
| 1346 layout(); | 1346 layout(); |
| 1347 | 1347 |
| 1348 for (size_t i = 0; i < highlightNodes.size(); ++i) { | 1348 for (size_t i = 0; i < highlightNodes.size(); ++i) { |
| 1349 Node* node = highlightNodes[i]; | 1349 Node* node = highlightNodes[i]; |
| 1350 | 1350 |
| 1351 if (!node || !node->renderer()) | 1351 if (!node || !node->layoutObject()) |
| 1352 continue; | 1352 continue; |
| 1353 | 1353 |
| 1354 Color highlightColor = node->renderer()->style()->tapHighlightColor(); | 1354 Color highlightColor = node->layoutObject()->style()->tapHighlightColor(
); |
| 1355 // Safari documentation for -webkit-tap-highlight-color says if the spec
ified color has 0 alpha, | 1355 // Safari documentation for -webkit-tap-highlight-color says if the spec
ified color has 0 alpha, |
| 1356 // then tap highlighting is disabled. | 1356 // then tap highlighting is disabled. |
| 1357 // http://developer.apple.com/library/safari/#documentation/appleapplica
tions/reference/safaricssref/articles/standardcssproperties.html | 1357 // http://developer.apple.com/library/safari/#documentation/appleapplica
tions/reference/safaricssref/articles/standardcssproperties.html |
| 1358 if (!highlightColor.alpha()) | 1358 if (!highlightColor.alpha()) |
| 1359 continue; | 1359 continue; |
| 1360 | 1360 |
| 1361 m_linkHighlights.append(LinkHighlight::create(node, this)); | 1361 m_linkHighlights.append(LinkHighlight::create(node, this)); |
| 1362 } | 1362 } |
| 1363 } | 1363 } |
| 1364 | 1364 |
| (...skipping 2173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3538 } | 3538 } |
| 3539 | 3539 |
| 3540 void WebViewImpl::performPluginAction(const WebPluginAction& action, | 3540 void WebViewImpl::performPluginAction(const WebPluginAction& action, |
| 3541 const WebPoint& location) | 3541 const WebPoint& location) |
| 3542 { | 3542 { |
| 3543 HitTestResult result = hitTestResultForWindowPos(location); | 3543 HitTestResult result = hitTestResultForWindowPos(location); |
| 3544 RefPtrWillBeRawPtr<Node> node = result.innerNonSharedNode(); | 3544 RefPtrWillBeRawPtr<Node> node = result.innerNonSharedNode(); |
| 3545 if (!isHTMLObjectElement(*node) && !isHTMLEmbedElement(*node)) | 3545 if (!isHTMLObjectElement(*node) && !isHTMLEmbedElement(*node)) |
| 3546 return; | 3546 return; |
| 3547 | 3547 |
| 3548 LayoutObject* object = node->renderer(); | 3548 LayoutObject* object = node->layoutObject(); |
| 3549 if (object && object->isLayoutPart()) { | 3549 if (object && object->isLayoutPart()) { |
| 3550 Widget* widget = toLayoutPart(object)->widget(); | 3550 Widget* widget = toLayoutPart(object)->widget(); |
| 3551 if (widget && widget->isPluginContainer()) { | 3551 if (widget && widget->isPluginContainer()) { |
| 3552 WebPluginContainerImpl* plugin = toWebPluginContainerImpl(widget); | 3552 WebPluginContainerImpl* plugin = toWebPluginContainerImpl(widget); |
| 3553 switch (action.type) { | 3553 switch (action.type) { |
| 3554 case WebPluginAction::Rotate90Clockwise: | 3554 case WebPluginAction::Rotate90Clockwise: |
| 3555 plugin->plugin()->rotateView(WebPlugin::RotationType90Clockwise)
; | 3555 plugin->plugin()->rotateView(WebPlugin::RotationType90Clockwise)
; |
| 3556 break; | 3556 break; |
| 3557 case WebPluginAction::Rotate90Counterclockwise: | 3557 case WebPluginAction::Rotate90Counterclockwise: |
| 3558 plugin->plugin()->rotateView(WebPlugin::RotationType90Counterclo
ckwise); | 3558 plugin->plugin()->rotateView(WebPlugin::RotationType90Counterclo
ckwise); |
| (...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4667 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4667 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
| 4668 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 4668 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
| 4669 } | 4669 } |
| 4670 | 4670 |
| 4671 void WebViewImpl::forceNextWebGLContextCreationToFail() | 4671 void WebViewImpl::forceNextWebGLContextCreationToFail() |
| 4672 { | 4672 { |
| 4673 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); | 4673 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); |
| 4674 } | 4674 } |
| 4675 | 4675 |
| 4676 } // namespace blink | 4676 } // namespace blink |
| OLD | NEW |