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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 #include "core/events/UIEventWithKeyState.h" | 50 #include "core/events/UIEventWithKeyState.h" |
51 #include "core/events/WheelEvent.h" | 51 #include "core/events/WheelEvent.h" |
52 #include "core/frame/BrowserControls.h" | 52 #include "core/frame/BrowserControls.h" |
53 #include "core/frame/EventHandlerRegistry.h" | 53 #include "core/frame/EventHandlerRegistry.h" |
54 #include "core/frame/FrameHost.h" | 54 #include "core/frame/FrameHost.h" |
55 #include "core/frame/FrameView.h" | 55 #include "core/frame/FrameView.h" |
56 #include "core/frame/LocalFrame.h" | 56 #include "core/frame/LocalFrame.h" |
57 #include "core/frame/PageScaleConstraintsSet.h" | 57 #include "core/frame/PageScaleConstraintsSet.h" |
58 #include "core/frame/RemoteFrame.h" | 58 #include "core/frame/RemoteFrame.h" |
59 #include "core/frame/Settings.h" | 59 #include "core/frame/Settings.h" |
60 #include "core/frame/SmartClip.h" | |
61 #include "core/frame/UseCounter.h" | 60 #include "core/frame/UseCounter.h" |
62 #include "core/frame/VisualViewport.h" | 61 #include "core/frame/VisualViewport.h" |
63 #include "core/html/HTMLMediaElement.h" | 62 #include "core/html/HTMLMediaElement.h" |
64 #include "core/html/HTMLPlugInElement.h" | 63 #include "core/html/HTMLPlugInElement.h" |
65 #include "core/html/HTMLTextAreaElement.h" | 64 #include "core/html/HTMLTextAreaElement.h" |
66 #include "core/input/EventHandler.h" | 65 #include "core/input/EventHandler.h" |
67 #include "core/input/TouchActionUtil.h" | 66 #include "core/input/TouchActionUtil.h" |
68 #include "core/layout/LayoutPart.h" | 67 #include "core/layout/LayoutPart.h" |
69 #include "core/layout/TextAutosizer.h" | 68 #include "core/layout/TextAutosizer.h" |
70 #include "core/layout/api/LayoutViewItem.h" | 69 #include "core/layout/api/LayoutViewItem.h" |
(...skipping 3430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3501 focusedFrame->eventHandler().sendContextMenuEventForKey(nullptr); | 3500 focusedFrame->eventHandler().sendContextMenuEventForKey(nullptr); |
3502 } | 3501 } |
3503 } | 3502 } |
3504 | 3503 |
3505 void WebViewImpl::didCloseContextMenu() { | 3504 void WebViewImpl::didCloseContextMenu() { |
3506 LocalFrame* frame = m_page->focusController().focusedFrame(); | 3505 LocalFrame* frame = m_page->focusController().focusedFrame(); |
3507 if (frame) | 3506 if (frame) |
3508 frame->selection().setCaretBlinkingSuspended(false); | 3507 frame->selection().setCaretBlinkingSuspended(false); |
3509 } | 3508 } |
3510 | 3509 |
3511 void WebViewImpl::extractSmartClipData(WebRect rectInViewport, | |
3512 WebString& clipText, | |
3513 WebString& clipHtml, | |
3514 WebRect& clipRectInViewport) { | |
3515 LocalFrame* localFrame = toLocalFrame(focusedCoreFrame()); | |
3516 if (!localFrame) | |
3517 return; | |
3518 SmartClipData clipData = SmartClip(localFrame).dataForRect(rectInViewport); | |
3519 clipText = clipData.clipData(); | |
3520 clipRectInViewport = clipData.rectInViewport(); | |
3521 | |
3522 WebLocalFrameImpl* frame = mainFrameImpl(); | |
3523 if (!frame) | |
3524 return; | |
3525 WebPoint startPoint(rectInViewport.x, rectInViewport.y); | |
3526 WebPoint endPoint(rectInViewport.x + rectInViewport.width, | |
3527 rectInViewport.y + rectInViewport.height); | |
3528 VisiblePosition startVisiblePosition = | |
3529 frame->visiblePositionForViewportPoint(startPoint); | |
3530 VisiblePosition endVisiblePosition = | |
3531 frame->visiblePositionForViewportPoint(endPoint); | |
3532 | |
3533 Position startPosition = startVisiblePosition.deepEquivalent(); | |
3534 Position endPosition = endVisiblePosition.deepEquivalent(); | |
3535 | |
3536 // document() will return null if -webkit-user-select is set to none. | |
3537 if (!startPosition.document() || !endPosition.document()) | |
3538 return; | |
3539 | |
3540 if (startPosition.compareTo(endPosition) <= 0) { | |
3541 clipHtml = | |
3542 createMarkup(startPosition, endPosition, AnnotateForInterchange, | |
3543 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); | |
3544 } else { | |
3545 clipHtml = | |
3546 createMarkup(endPosition, startPosition, AnnotateForInterchange, | |
3547 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); | |
3548 } | |
3549 } | |
3550 | |
3551 void WebViewImpl::hidePopups() { | 3510 void WebViewImpl::hidePopups() { |
3552 cancelPagePopup(); | 3511 cancelPagePopup(); |
3553 } | 3512 } |
3554 | 3513 |
3555 void WebViewImpl::setIsTransparent(bool isTransparent) { | 3514 void WebViewImpl::setIsTransparent(bool isTransparent) { |
3556 // Set any existing frames to be transparent. | 3515 // Set any existing frames to be transparent. |
3557 Frame* frame = m_page->mainFrame(); | 3516 Frame* frame = m_page->mainFrame(); |
3558 while (frame) { | 3517 while (frame) { |
3559 if (frame->isLocalFrame()) | 3518 if (frame->isLocalFrame()) |
3560 toLocalFrame(frame)->view()->setTransparent(isTransparent); | 3519 toLocalFrame(frame)->view()->setTransparent(isTransparent); |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4194 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) | 4153 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) |
4195 return nullptr; | 4154 return nullptr; |
4196 return focusedFrame; | 4155 return focusedFrame; |
4197 } | 4156 } |
4198 | 4157 |
4199 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { | 4158 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { |
4200 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; | 4159 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; |
4201 } | 4160 } |
4202 | 4161 |
4203 } // namespace blink | 4162 } // namespace blink |
OLD | NEW |