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 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 anchor = localFrame->editor().firstRectForRange(range.get()); | 552 anchor = localFrame->editor().firstRectForRange(range.get()); |
553 | 553 |
554 range = Range::create(selectedRange->endContainer()->document(), | 554 range = Range::create(selectedRange->endContainer()->document(), |
555 selectedRange->endContainer(), | 555 selectedRange->endContainer(), |
556 selectedRange->endOffset(), | 556 selectedRange->endOffset(), |
557 selectedRange->endContainer(), | 557 selectedRange->endContainer(), |
558 selectedRange->endOffset()); | 558 selectedRange->endOffset()); |
559 focus = localFrame->editor().firstRectForRange(range.get()); | 559 focus = localFrame->editor().firstRectForRange(range.get()); |
560 } | 560 } |
561 | 561 |
562 IntRect scaledAnchor(localFrame->view()->contentsToWindow(anchor)); | 562 // FIXME: This doesn't apply page scale. This should probably be contents to
viewport. crbug.com/459293. |
563 IntRect scaledFocus(localFrame->view()->contentsToWindow(focus)); | 563 IntRect scaledAnchor(localFrame->view()->contentsToRootFrame(anchor)); |
| 564 IntRect scaledFocus(localFrame->view()->contentsToRootFrame(focus)); |
564 | 565 |
565 anchor = scaledAnchor; | 566 anchor = scaledAnchor; |
566 focus = scaledFocus; | 567 focus = scaledFocus; |
567 | 568 |
568 if (!selection.selection().isBaseFirst()) | 569 if (!selection.selection().isBaseFirst()) |
569 std::swap(anchor, focus); | 570 std::swap(anchor, focus); |
570 return true; | 571 return true; |
571 } | 572 } |
572 | 573 |
573 bool WebFrameWidgetImpl::selectionTextDirection(WebTextDirection& start, WebText
Direction& end) const | 574 bool WebFrameWidgetImpl::selectionTextDirection(WebTextDirection& start, WebText
Direction& end) const |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 PageWidgetEventHandler::handleMouseLeave(mainFrame, event); | 672 PageWidgetEventHandler::handleMouseLeave(mainFrame, event); |
672 } | 673 } |
673 | 674 |
674 void WebFrameWidgetImpl::handleMouseDown(LocalFrame& mainFrame, const WebMouseEv
ent& event) | 675 void WebFrameWidgetImpl::handleMouseDown(LocalFrame& mainFrame, const WebMouseEv
ent& event) |
675 { | 676 { |
676 // Take capture on a mouse down on a plugin so we can send it mouse events. | 677 // Take capture on a mouse down on a plugin so we can send it mouse events. |
677 // If the hit node is a plugin but a scrollbar is over it don't start mouse | 678 // If the hit node is a plugin but a scrollbar is over it don't start mouse |
678 // capture because it will interfere with the scrollbar receiving events. | 679 // capture because it will interfere with the scrollbar receiving events. |
679 IntPoint point(event.x, event.y); | 680 IntPoint point(event.x, event.y); |
680 if (event.button == WebMouseEvent::ButtonLeft) { | 681 if (event.button == WebMouseEvent::ButtonLeft) { |
681 point = m_localRoot->frameView()->windowToContents(point); | 682 point = m_localRoot->frameView()->rootFrameToContents(point); |
682 HitTestResult result(m_localRoot->frame()->eventHandler().hitTestResultA
tPoint(point)); | 683 HitTestResult result(m_localRoot->frame()->eventHandler().hitTestResultA
tPoint(point)); |
683 result.setToShadowHostIfInClosedShadowRoot(); | 684 result.setToShadowHostIfInClosedShadowRoot(); |
684 Node* hitNode = result.innerNonSharedNode(); | 685 Node* hitNode = result.innerNonSharedNode(); |
685 | 686 |
686 if (!result.scrollbar() && hitNode && hitNode->renderer() && hitNode->re
nderer()->isEmbeddedObject()) { | 687 if (!result.scrollbar() && hitNode && hitNode->renderer() && hitNode->re
nderer()->isEmbeddedObject()) { |
687 m_mouseCaptureNode = hitNode; | 688 m_mouseCaptureNode = hitNode; |
688 TRACE_EVENT_ASYNC_BEGIN0("input", "capturing mouse", this); | 689 TRACE_EVENT_ASYNC_BEGIN0("input", "capturing mouse", this); |
689 } | 690 } |
690 } | 691 } |
691 | 692 |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1023 // correspond to Page visibility, but is necessary until we properly sort ou
t OOPIF visibility. | 1024 // correspond to Page visibility, but is necessary until we properly sort ou
t OOPIF visibility. |
1024 m_page->setVisibilityState(static_cast<PageVisibilityState>(visibilityState)
, isInitialState); | 1025 m_page->setVisibilityState(static_cast<PageVisibilityState>(visibilityState)
, isInitialState); |
1025 | 1026 |
1026 if (m_layerTreeView) { | 1027 if (m_layerTreeView) { |
1027 bool visible = visibilityState == WebPageVisibilityStateVisible; | 1028 bool visible = visibilityState == WebPageVisibilityStateVisible; |
1028 m_layerTreeView->setVisible(visible); | 1029 m_layerTreeView->setVisible(visible); |
1029 } | 1030 } |
1030 } | 1031 } |
1031 | 1032 |
1032 } // namespace blink | 1033 } // namespace blink |
OLD | NEW |