Chromium Code Reviews| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 #include "core/layout/LayoutView.h" | 44 #include "core/layout/LayoutView.h" |
| 45 #include "core/layout/api/LayoutViewItem.h" | 45 #include "core/layout/api/LayoutViewItem.h" |
| 46 #include "core/layout/compositing/PaintLayerCompositor.h" | 46 #include "core/layout/compositing/PaintLayerCompositor.h" |
| 47 #include "core/page/ContextMenuController.h" | 47 #include "core/page/ContextMenuController.h" |
| 48 #include "core/page/FocusController.h" | 48 #include "core/page/FocusController.h" |
| 49 #include "core/page/Page.h" | 49 #include "core/page/Page.h" |
| 50 #include "core/page/PointerLockController.h" | 50 #include "core/page/PointerLockController.h" |
| 51 #include "platform/KeyboardCodes.h" | 51 #include "platform/KeyboardCodes.h" |
| 52 #include "platform/graphics/CompositorMutatorClient.h" | 52 #include "platform/graphics/CompositorMutatorClient.h" |
| 53 #include "public/platform/WebFrameScheduler.h" | 53 #include "public/platform/WebFrameScheduler.h" |
| 54 #include "public/web/WebRange.h" | |
| 54 #include "public/web/WebWidgetClient.h" | 55 #include "public/web/WebWidgetClient.h" |
| 55 #include "web/CompositorMutatorImpl.h" | 56 #include "web/CompositorMutatorImpl.h" |
| 56 #include "web/CompositorProxyClientImpl.h" | 57 #include "web/CompositorProxyClientImpl.h" |
| 57 #include "web/ContextMenuAllowedScope.h" | 58 #include "web/ContextMenuAllowedScope.h" |
| 58 #include "web/WebDevToolsAgentImpl.h" | 59 #include "web/WebDevToolsAgentImpl.h" |
| 59 #include "web/WebInputEventConversion.h" | 60 #include "web/WebInputEventConversion.h" |
| 60 #include "web/WebLocalFrameImpl.h" | 61 #include "web/WebLocalFrameImpl.h" |
| 61 #include "web/WebPluginContainerImpl.h" | 62 #include "web/WebPluginContainerImpl.h" |
| 62 #include "web/WebRemoteFrameImpl.h" | 63 #include "web/WebRemoteFrameImpl.h" |
| 63 #include "web/WebViewFrameWidget.h" | 64 #include "web/WebViewFrameWidget.h" |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 463 } | 464 } |
| 464 } | 465 } |
| 465 } | 466 } |
| 466 | 467 |
| 467 bool WebFrameWidgetImpl::setComposition( | 468 bool WebFrameWidgetImpl::setComposition( |
| 468 const WebString& text, | 469 const WebString& text, |
| 469 const WebVector<WebCompositionUnderline>& underlines, | 470 const WebVector<WebCompositionUnderline>& underlines, |
| 470 int selectionStart, | 471 int selectionStart, |
| 471 int selectionEnd) | 472 int selectionEnd) |
| 472 { | 473 { |
| 473 // FIXME: To be implemented. | 474 return view()->setComposition(text, underlines, selectionStart, selectionEnd ); |
|
lfg
2016/07/05 18:30:46
Can you implement those functions here, instead of
EhsanK
2016/07/07 14:40:47
I initially wanted to keep this CL short so I only
kenrb
2016/07/07 15:30:38
Is it really better this way? One advantage of del
EhsanK
2016/07/07 20:25:07
Some of the changes made can be argued to be not r
| |
| 474 return false; | |
| 475 } | 475 } |
| 476 | 476 |
| 477 bool WebFrameWidgetImpl::confirmComposition() | 477 bool WebFrameWidgetImpl::confirmComposition() |
| 478 { | 478 { |
| 479 // FIXME: To be implemented. | 479 // FIXME: To be implemented. |
| 480 return false; | 480 return view()->confirmComposition(); |
| 481 } | 481 } |
| 482 | 482 |
| 483 bool WebFrameWidgetImpl::confirmComposition(ConfirmCompositionBehavior selection Behavior) | 483 bool WebFrameWidgetImpl::confirmComposition(ConfirmCompositionBehavior selection Behavior) |
| 484 { | 484 { |
| 485 // FIXME: To be implemented. | 485 return view()->confirmComposition(selectionBehavior); |
| 486 return false; | |
| 487 } | 486 } |
| 488 | 487 |
| 489 bool WebFrameWidgetImpl::confirmComposition(const WebString& text) | 488 bool WebFrameWidgetImpl::confirmComposition(const WebString& text) |
| 490 { | 489 { |
| 491 // FIXME: To be implemented. | 490 return view()->confirmComposition(text); |
| 492 return false; | |
| 493 } | 491 } |
| 494 | 492 |
| 495 bool WebFrameWidgetImpl::compositionRange(size_t* location, size_t* length) | 493 bool WebFrameWidgetImpl::compositionRange(size_t* location, size_t* length) |
| 496 { | 494 { |
| 497 // FIXME: To be implemented. | 495 return view()->compositionRange(location, length); |
| 498 return false; | |
| 499 } | 496 } |
| 500 | 497 |
| 501 WebTextInputInfo WebFrameWidgetImpl::textInputInfo() | 498 WebTextInputInfo WebFrameWidgetImpl::textInputInfo() |
| 502 { | 499 { |
| 503 return view()->textInputInfo(); | 500 return view()->textInputInfo(); |
| 504 } | 501 } |
| 505 | 502 |
| 506 WebTextInputType WebFrameWidgetImpl::textInputType() | 503 WebTextInputType WebFrameWidgetImpl::textInputType() |
| 507 { | 504 { |
| 508 return view()->textInputType(); | 505 return view()->textInputType(); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 657 void WebFrameWidgetImpl::didNotAcquirePointerLock() | 654 void WebFrameWidgetImpl::didNotAcquirePointerLock() |
| 658 { | 655 { |
| 659 page()->pointerLockController().didNotAcquirePointerLock(); | 656 page()->pointerLockController().didNotAcquirePointerLock(); |
| 660 } | 657 } |
| 661 | 658 |
| 662 void WebFrameWidgetImpl::didLosePointerLock() | 659 void WebFrameWidgetImpl::didLosePointerLock() |
| 663 { | 660 { |
| 664 page()->pointerLockController().didLosePointerLock(); | 661 page()->pointerLockController().didLosePointerLock(); |
| 665 } | 662 } |
| 666 | 663 |
| 664 bool WebFrameWidgetImpl::getCompositionCharacterBounds(WebVector<WebRect>& bound s) | |
| 665 { | |
| 666 size_t offset = 0; | |
| 667 size_t characterCount = 0; | |
| 668 if (!compositionRange(&offset, &characterCount)) | |
| 669 return false; | |
| 670 | |
| 671 if (characterCount == 0) | |
| 672 return false; | |
| 673 | |
| 674 WebLocalFrame* frame = focusedWebLocalFrameInWidget(); | |
| 675 if (!frame) | |
|
lfg
2016/07/05 18:30:46
Why |frame| can be null? Do we call this function
EhsanK
2016/07/07 14:40:47
Yes as the route of this call could be an update o
lfg
2016/07/07 15:13:31
So, in this example, can't you just early return i
EhsanK
2016/07/07 20:25:07
We still need to send the IPC so it comes down to
lfg
2016/07/07 20:58:26
Acknowledged.
| |
| 676 return false; | |
| 677 | |
| 678 WebVector<WebRect> result(characterCount); | |
| 679 WebRect webrect; | |
| 680 for (size_t i = 0; i < characterCount; ++i) { | |
| 681 if (!frame->firstRectForCharacterRange(offset + i, 1, webrect)) { | |
| 682 DLOG(ERROR) << "Could not retrieve character rectangle at " << i; | |
| 683 return false; | |
| 684 } | |
| 685 result[i] = webrect; | |
| 686 } | |
| 687 bounds.swap(result); | |
| 688 return true; | |
| 689 } | |
| 690 | |
| 691 void WebFrameWidgetImpl::applyReplacementRange(int start, int length) | |
| 692 { | |
| 693 if (WebLocalFrame* frame = focusedWebLocalFrameInWidget()) { | |
| 694 WebRange webrange = WebRange::fromDocumentRange(frame, start, length); | |
| 695 if (!webrange.isNull()) | |
| 696 frame->selectRange(webrange); | |
| 697 } | |
| 698 } | |
| 699 | |
| 667 void WebFrameWidgetImpl::handleMouseLeave(LocalFrame& mainFrame, const WebMouseE vent& event) | 700 void WebFrameWidgetImpl::handleMouseLeave(LocalFrame& mainFrame, const WebMouseE vent& event) |
| 668 { | 701 { |
| 669 // FIXME: WebWidget doesn't have the method below. | 702 // FIXME: WebWidget doesn't have the method below. |
| 670 // m_client->setMouseOverURL(WebURL()); | 703 // m_client->setMouseOverURL(WebURL()); |
| 671 PageWidgetEventHandler::handleMouseLeave(mainFrame, event); | 704 PageWidgetEventHandler::handleMouseLeave(mainFrame, event); |
| 672 } | 705 } |
| 673 | 706 |
| 674 void WebFrameWidgetImpl::handleMouseDown(LocalFrame& mainFrame, const WebMouseEv ent& event) | 707 void WebFrameWidgetImpl::handleMouseDown(LocalFrame& mainFrame, const WebMouseEv ent& event) |
| 675 { | 708 { |
| 676 // Take capture on a mouse down on a plugin so we can send it mouse events. | 709 // Take capture on a mouse down on a plugin so we can send it mouse events. |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1128 } | 1161 } |
| 1129 | 1162 |
| 1130 HitTestResult WebFrameWidgetImpl::hitTestResultForRootFramePos(const IntPoint& p osInRootFrame) | 1163 HitTestResult WebFrameWidgetImpl::hitTestResultForRootFramePos(const IntPoint& p osInRootFrame) |
| 1131 { | 1164 { |
| 1132 IntPoint docPoint(m_localRoot->frame()->view()->rootFrameToContents(posInRoo tFrame)); | 1165 IntPoint docPoint(m_localRoot->frame()->view()->rootFrameToContents(posInRoo tFrame)); |
| 1133 HitTestResult result = m_localRoot->frame()->eventHandler().hitTestResultAtP oint(docPoint, HitTestRequest::ReadOnly | HitTestRequest::Active); | 1166 HitTestResult result = m_localRoot->frame()->eventHandler().hitTestResultAtP oint(docPoint, HitTestRequest::ReadOnly | HitTestRequest::Active); |
| 1134 result.setToShadowHostIfInUserAgentShadowRoot(); | 1167 result.setToShadowHostIfInUserAgentShadowRoot(); |
| 1135 return result; | 1168 return result; |
| 1136 } | 1169 } |
| 1137 | 1170 |
| 1171 WebLocalFrame* WebFrameWidgetImpl::focusedWebLocalFrameInWidget() const | |
| 1172 { | |
| 1173 LocalFrame* frame = page()->focusController().focusedFrame(); | |
| 1174 return (frame && frame->localFrameRoot() == m_localRoot->frame()) ? WebLocal FrameImpl::fromFrame(frame) : nullptr; | |
| 1175 } | |
| 1176 | |
| 1138 } // namespace blink | 1177 } // namespace blink |
| OLD | NEW |