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

Side by Side Diff: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp

Issue 2667283007: Refactor Samsung SmartClip implementation. (Closed)
Patch Set: Rebase 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // to LocalFrame. FrameLoaderClient::detached() also notifies the embedder via 80 // to LocalFrame. FrameLoaderClient::detached() also notifies the embedder via
81 // WebFrameClient that the frame is detached. Most embedders will invoke 81 // WebFrameClient that the frame is detached. Most embedders will invoke
82 // close() on the WebFrame at this point, triggering its deletion unless 82 // close() on the WebFrame at this point, triggering its deletion unless
83 // something else is still retaining a reference. 83 // something else is still retaining a reference.
84 // 84 //
85 // The client is expected to be set whenever the WebLocalFrameImpl is attached 85 // The client is expected to be set whenever the WebLocalFrameImpl is attached
86 // to the DOM. 86 // to the DOM.
87 87
88 #include "web/WebLocalFrameImpl.h" 88 #include "web/WebLocalFrameImpl.h"
89 89
90 #include <algorithm>
91 #include <memory>
92 #include <utility>
90 #include "bindings/core/v8/BindingSecurity.h" 93 #include "bindings/core/v8/BindingSecurity.h"
91 #include "bindings/core/v8/DOMWrapperWorld.h" 94 #include "bindings/core/v8/DOMWrapperWorld.h"
92 #include "bindings/core/v8/ExceptionState.h" 95 #include "bindings/core/v8/ExceptionState.h"
93 #include "bindings/core/v8/ScriptController.h" 96 #include "bindings/core/v8/ScriptController.h"
94 #include "bindings/core/v8/ScriptSourceCode.h" 97 #include "bindings/core/v8/ScriptSourceCode.h"
95 #include "bindings/core/v8/ScriptValue.h" 98 #include "bindings/core/v8/ScriptValue.h"
96 #include "bindings/core/v8/SourceLocation.h" 99 #include "bindings/core/v8/SourceLocation.h"
97 #include "bindings/core/v8/V8Binding.h" 100 #include "bindings/core/v8/V8Binding.h"
98 #include "bindings/core/v8/V8GCController.h" 101 #include "bindings/core/v8/V8GCController.h"
99 #include "bindings/core/v8/V8PerIsolateData.h" 102 #include "bindings/core/v8/V8PerIsolateData.h"
(...skipping 13 matching lines...) Expand all
113 #include "core/editing/TextAffinity.h" 116 #include "core/editing/TextAffinity.h"
114 #include "core/editing/iterators/TextIterator.h" 117 #include "core/editing/iterators/TextIterator.h"
115 #include "core/editing/serializers/Serialization.h" 118 #include "core/editing/serializers/Serialization.h"
116 #include "core/editing/spellcheck/SpellChecker.h" 119 #include "core/editing/spellcheck/SpellChecker.h"
117 #include "core/frame/FrameHost.h" 120 #include "core/frame/FrameHost.h"
118 #include "core/frame/FrameView.h" 121 #include "core/frame/FrameView.h"
119 #include "core/frame/LocalDOMWindow.h" 122 #include "core/frame/LocalDOMWindow.h"
120 #include "core/frame/PageScaleConstraintsSet.h" 123 #include "core/frame/PageScaleConstraintsSet.h"
121 #include "core/frame/RemoteFrame.h" 124 #include "core/frame/RemoteFrame.h"
122 #include "core/frame/Settings.h" 125 #include "core/frame/Settings.h"
126 #include "core/frame/SmartClip.h"
123 #include "core/frame/UseCounter.h" 127 #include "core/frame/UseCounter.h"
124 #include "core/frame/VisualViewport.h" 128 #include "core/frame/VisualViewport.h"
125 #include "core/html/HTMLAnchorElement.h" 129 #include "core/html/HTMLAnchorElement.h"
126 #include "core/html/HTMLCollection.h" 130 #include "core/html/HTMLCollection.h"
127 #include "core/html/HTMLFormElement.h" 131 #include "core/html/HTMLFormElement.h"
128 #include "core/html/HTMLFrameElementBase.h" 132 #include "core/html/HTMLFrameElementBase.h"
129 #include "core/html/HTMLFrameOwnerElement.h" 133 #include "core/html/HTMLFrameOwnerElement.h"
130 #include "core/html/HTMLHeadElement.h" 134 #include "core/html/HTMLHeadElement.h"
131 #include "core/html/HTMLImageElement.h" 135 #include "core/html/HTMLImageElement.h"
132 #include "core/html/HTMLInputElement.h" 136 #include "core/html/HTMLInputElement.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 #include "web/WebAssociatedURLLoaderImpl.h" 226 #include "web/WebAssociatedURLLoaderImpl.h"
223 #include "web/WebDataSourceImpl.h" 227 #include "web/WebDataSourceImpl.h"
224 #include "web/WebDevToolsAgentImpl.h" 228 #include "web/WebDevToolsAgentImpl.h"
225 #include "web/WebFrameWidgetImpl.h" 229 #include "web/WebFrameWidgetImpl.h"
226 #include "web/WebPluginContainerImpl.h" 230 #include "web/WebPluginContainerImpl.h"
227 #include "web/WebRemoteFrameImpl.h" 231 #include "web/WebRemoteFrameImpl.h"
228 #include "web/WebViewImpl.h" 232 #include "web/WebViewImpl.h"
229 #include "wtf/CurrentTime.h" 233 #include "wtf/CurrentTime.h"
230 #include "wtf/HashMap.h" 234 #include "wtf/HashMap.h"
231 #include "wtf/PtrUtil.h" 235 #include "wtf/PtrUtil.h"
232 #include <algorithm>
233 #include <memory>
234 #include <utility>
235 236
236 namespace blink { 237 namespace blink {
237 238
238 static int frameCount = 0; 239 static int frameCount = 0;
239 240
240 static HeapVector<ScriptSourceCode> createSourcesVector( 241 static HeapVector<ScriptSourceCode> createSourcesVector(
241 const WebScriptSource* sourcesIn, 242 const WebScriptSource* sourcesIn,
242 unsigned numSources) { 243 unsigned numSources) {
243 HeapVector<ScriptSourceCode> sources; 244 HeapVector<ScriptSourceCode> sources;
244 sources.append(sourcesIn, numSources); 245 sources.append(sourcesIn, numSources);
(...skipping 2131 matching lines...) Expand 10 before | Expand all | Expand 10 after
2376 return frame() 2377 return frame()
2377 ->frameScheduler() 2378 ->frameScheduler()
2378 ->unthrottledTaskRunner() 2379 ->unthrottledTaskRunner()
2379 ->toSingleThreadTaskRunner(); 2380 ->toSingleThreadTaskRunner();
2380 } 2381 }
2381 2382
2382 WebInputMethodControllerImpl* WebLocalFrameImpl::inputMethodController() const { 2383 WebInputMethodControllerImpl* WebLocalFrameImpl::inputMethodController() const {
2383 return m_inputMethodController.get(); 2384 return m_inputMethodController.get();
2384 } 2385 }
2385 2386
2387 void WebLocalFrameImpl::extractSmartClipData(WebRect rectInViewport,
2388 WebString& clipText,
2389 WebString& clipHtml) {
2390 SmartClipData clipData = SmartClip(frame()).dataForRect(rectInViewport);
2391 clipText = clipData.clipData();
2392
2393 WebPoint startPoint(rectInViewport.x, rectInViewport.y);
2394 WebPoint endPoint(rectInViewport.x + rectInViewport.width,
2395 rectInViewport.y + rectInViewport.height);
2396 VisiblePosition startVisiblePosition =
2397 visiblePositionForViewportPoint(startPoint);
2398 VisiblePosition endVisiblePosition =
2399 visiblePositionForViewportPoint(endPoint);
2400
2401 Position startPosition = startVisiblePosition.deepEquivalent();
2402 Position endPosition = endVisiblePosition.deepEquivalent();
2403
2404 // document() will return null if -webkit-user-select is set to none.
2405 if (!startPosition.document() || !endPosition.document())
2406 return;
2407
2408 if (startPosition.compareTo(endPosition) <= 0) {
2409 clipHtml =
2410 createMarkup(startPosition, endPosition, AnnotateForInterchange,
2411 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs);
2412 } else {
2413 clipHtml =
2414 createMarkup(endPosition, startPosition, AnnotateForInterchange,
2415 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs);
2416 }
2417 }
2418
2386 } // namespace blink 2419 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698