Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1693)

Unified Diff: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp

Issue 2667283007: Refactor Samsung SmartClip implementation. (Closed)
Patch Set: Really apply code review comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/web/WebLocalFrameImpl.h ('k') | third_party/WebKit/Source/web/WebViewImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
index f20abcf564e0fe33dc3d7ba9d89260e36cdd8d40..859ed9967d4c420907b7b2fb2ce70167129e7875 100644
--- a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
+++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
@@ -87,6 +87,9 @@
#include "web/WebLocalFrameImpl.h"
+#include <algorithm>
+#include <memory>
+#include <utility>
#include "bindings/core/v8/BindingSecurity.h"
#include "bindings/core/v8/DOMWrapperWorld.h"
#include "bindings/core/v8/ExceptionState.h"
@@ -120,6 +123,7 @@
#include "core/frame/PageScaleConstraintsSet.h"
#include "core/frame/RemoteFrame.h"
#include "core/frame/Settings.h"
+#include "core/frame/SmartClip.h"
#include "core/frame/UseCounter.h"
#include "core/frame/VisualViewport.h"
#include "core/html/HTMLAnchorElement.h"
@@ -229,9 +233,6 @@
#include "wtf/CurrentTime.h"
#include "wtf/HashMap.h"
#include "wtf/PtrUtil.h"
-#include <algorithm>
-#include <memory>
-#include <utility>
namespace blink {
@@ -2383,4 +2384,36 @@ WebInputMethodControllerImpl* WebLocalFrameImpl::inputMethodController() const {
return m_inputMethodController.get();
}
+void WebLocalFrameImpl::extractSmartClipData(WebRect rectInViewport,
+ WebString& clipText,
+ WebString& clipHtml) {
+ SmartClipData clipData = SmartClip(frame()).dataForRect(rectInViewport);
+ clipText = clipData.clipData();
+
+ WebPoint startPoint(rectInViewport.x, rectInViewport.y);
+ WebPoint endPoint(rectInViewport.x + rectInViewport.width,
+ rectInViewport.y + rectInViewport.height);
+ VisiblePosition startVisiblePosition =
+ visiblePositionForViewportPoint(startPoint);
+ VisiblePosition endVisiblePosition =
+ visiblePositionForViewportPoint(endPoint);
+
+ Position startPosition = startVisiblePosition.deepEquivalent();
+ Position endPosition = endVisiblePosition.deepEquivalent();
+
+ // document() will return null if -webkit-user-select is set to none.
+ if (!startPosition.document() || !endPosition.document())
+ return;
+
+ if (startPosition.compareTo(endPosition) <= 0) {
+ clipHtml =
+ createMarkup(startPosition, endPosition, AnnotateForInterchange,
+ ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs);
+ } else {
+ clipHtml =
+ createMarkup(endPosition, startPosition, AnnotateForInterchange,
+ ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs);
+ }
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/web/WebLocalFrameImpl.h ('k') | third_party/WebKit/Source/web/WebViewImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698