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

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

Issue 2667283007: Refactor Samsung SmartClip implementation. (Closed)
Patch Set: Move FrameMsg 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 #include "core/editing/TextAffinity.h" 113 #include "core/editing/TextAffinity.h"
114 #include "core/editing/iterators/TextIterator.h" 114 #include "core/editing/iterators/TextIterator.h"
115 #include "core/editing/serializers/Serialization.h" 115 #include "core/editing/serializers/Serialization.h"
116 #include "core/editing/spellcheck/SpellChecker.h" 116 #include "core/editing/spellcheck/SpellChecker.h"
117 #include "core/frame/FrameHost.h" 117 #include "core/frame/FrameHost.h"
118 #include "core/frame/FrameView.h" 118 #include "core/frame/FrameView.h"
119 #include "core/frame/LocalDOMWindow.h" 119 #include "core/frame/LocalDOMWindow.h"
120 #include "core/frame/PageScaleConstraintsSet.h" 120 #include "core/frame/PageScaleConstraintsSet.h"
121 #include "core/frame/RemoteFrame.h" 121 #include "core/frame/RemoteFrame.h"
122 #include "core/frame/Settings.h" 122 #include "core/frame/Settings.h"
123 #include "core/frame/SmartClip.h"
123 #include "core/frame/UseCounter.h" 124 #include "core/frame/UseCounter.h"
124 #include "core/frame/VisualViewport.h" 125 #include "core/frame/VisualViewport.h"
125 #include "core/html/HTMLAnchorElement.h" 126 #include "core/html/HTMLAnchorElement.h"
126 #include "core/html/HTMLCollection.h" 127 #include "core/html/HTMLCollection.h"
127 #include "core/html/HTMLFormElement.h" 128 #include "core/html/HTMLFormElement.h"
128 #include "core/html/HTMLFrameElementBase.h" 129 #include "core/html/HTMLFrameElementBase.h"
129 #include "core/html/HTMLFrameOwnerElement.h" 130 #include "core/html/HTMLFrameOwnerElement.h"
130 #include "core/html/HTMLHeadElement.h" 131 #include "core/html/HTMLHeadElement.h"
131 #include "core/html/HTMLImageElement.h" 132 #include "core/html/HTMLImageElement.h"
132 #include "core/html/HTMLInputElement.h" 133 #include "core/html/HTMLInputElement.h"
(...skipping 2243 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