| 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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 anchor = localFrame->editor().firstRectForRange(range.get()); | 563 anchor = localFrame->editor().firstRectForRange(range.get()); |
| 564 | 564 |
| 565 range = Range::create(selectedRange->endContainer()->document(), | 565 range = Range::create(selectedRange->endContainer()->document(), |
| 566 selectedRange->endContainer(), | 566 selectedRange->endContainer(), |
| 567 selectedRange->endOffset(), | 567 selectedRange->endOffset(), |
| 568 selectedRange->endContainer(), | 568 selectedRange->endContainer(), |
| 569 selectedRange->endOffset()); | 569 selectedRange->endOffset()); |
| 570 focus = localFrame->editor().firstRectForRange(range.get()); | 570 focus = localFrame->editor().firstRectForRange(range.get()); |
| 571 } | 571 } |
| 572 | 572 |
| 573 IntRect scaledAnchor(localFrame->view()->contentsToWindow(anchor)); | 573 // FIXME: This doesn't apply page scale. This should probably be contents to
viewport. crbug.com/459293. |
| 574 IntRect scaledFocus(localFrame->view()->contentsToWindow(focus)); | 574 IntRect scaledAnchor(localFrame->view()->contentsToRootFrame(anchor)); |
| 575 IntRect scaledFocus(localFrame->view()->contentsToRootFrame(focus)); |
| 575 | 576 |
| 576 anchor = scaledAnchor; | 577 anchor = scaledAnchor; |
| 577 focus = scaledFocus; | 578 focus = scaledFocus; |
| 578 | 579 |
| 579 if (!selection.selection().isBaseFirst()) | 580 if (!selection.selection().isBaseFirst()) |
| 580 std::swap(anchor, focus); | 581 std::swap(anchor, focus); |
| 581 return true; | 582 return true; |
| 582 } | 583 } |
| 583 | 584 |
| 584 bool WebFrameWidgetImpl::selectionTextDirection(WebTextDirection& start, WebText
Direction& end) const | 585 bool WebFrameWidgetImpl::selectionTextDirection(WebTextDirection& start, WebText
Direction& end) const |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 PageWidgetEventHandler::handleMouseLeave(mainFrame, event); | 683 PageWidgetEventHandler::handleMouseLeave(mainFrame, event); |
| 683 } | 684 } |
| 684 | 685 |
| 685 void WebFrameWidgetImpl::handleMouseDown(LocalFrame& mainFrame, const WebMouseEv
ent& event) | 686 void WebFrameWidgetImpl::handleMouseDown(LocalFrame& mainFrame, const WebMouseEv
ent& event) |
| 686 { | 687 { |
| 687 // Take capture on a mouse down on a plugin so we can send it mouse events. | 688 // Take capture on a mouse down on a plugin so we can send it mouse events. |
| 688 // If the hit node is a plugin but a scrollbar is over it don't start mouse | 689 // If the hit node is a plugin but a scrollbar is over it don't start mouse |
| 689 // capture because it will interfere with the scrollbar receiving events. | 690 // capture because it will interfere with the scrollbar receiving events. |
| 690 IntPoint point(event.x, event.y); | 691 IntPoint point(event.x, event.y); |
| 691 if (event.button == WebMouseEvent::ButtonLeft) { | 692 if (event.button == WebMouseEvent::ButtonLeft) { |
| 692 point = m_localRoot->frameView()->windowToContents(point); | 693 point = m_localRoot->frameView()->rootFrameToContents(point); |
| 693 HitTestResult result(m_localRoot->frame()->eventHandler().hitTestResultA
tPoint(point)); | 694 HitTestResult result(m_localRoot->frame()->eventHandler().hitTestResultA
tPoint(point)); |
| 694 result.setToShadowHostIfInClosedShadowRoot(); | 695 result.setToShadowHostIfInClosedShadowRoot(); |
| 695 Node* hitNode = result.innerNonSharedNode(); | 696 Node* hitNode = result.innerNonSharedNode(); |
| 696 | 697 |
| 697 if (!result.scrollbar() && hitNode && hitNode->layoutObject() && hitNode
->layoutObject()->isEmbeddedObject()) { | 698 if (!result.scrollbar() && hitNode && hitNode->layoutObject() && hitNode
->layoutObject()->isEmbeddedObject()) { |
| 698 m_mouseCaptureNode = hitNode; | 699 m_mouseCaptureNode = hitNode; |
| 699 TRACE_EVENT_ASYNC_BEGIN0("input", "capturing mouse", this); | 700 TRACE_EVENT_ASYNC_BEGIN0("input", "capturing mouse", this); |
| 700 } | 701 } |
| 701 } | 702 } |
| 702 | 703 |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 // correspond to Page visibility, but is necessary until we properly sort ou
t OOPIF visibility. | 1035 // correspond to Page visibility, but is necessary until we properly sort ou
t OOPIF visibility. |
| 1035 m_page->setVisibilityState(static_cast<PageVisibilityState>(visibilityState)
, isInitialState); | 1036 m_page->setVisibilityState(static_cast<PageVisibilityState>(visibilityState)
, isInitialState); |
| 1036 | 1037 |
| 1037 if (m_layerTreeView) { | 1038 if (m_layerTreeView) { |
| 1038 bool visible = visibilityState == WebPageVisibilityStateVisible; | 1039 bool visible = visibilityState == WebPageVisibilityStateVisible; |
| 1039 m_layerTreeView->setVisible(visible); | 1040 m_layerTreeView->setVisible(visible); |
| 1040 } | 1041 } |
| 1041 } | 1042 } |
| 1042 | 1043 |
| 1043 } // namespace blink | 1044 } // namespace blink |
| OLD | NEW |