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

Unified Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 2230993002: Refactor composited selection code out of WebViewImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use single localFrame clearing. Created 4 years, 4 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 | « no previous file | third_party/WebKit/Source/core/page/ChromeClient.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/frame/FrameView.cpp
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp
index 15cff79b46d15ca13cc20c86a0a8353235f3a9d2..c91a9f1c8778582d242df052fd8896b2c343ec1c 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -1718,12 +1718,23 @@ void FrameView::updateCompositedSelectionIfNeeded()
CompositedSelection selection;
LocalFrame* focusedFrame = page->focusController().focusedFrame();
LocalFrame* localFrame = (focusedFrame && (focusedFrame->localFrameRoot() == m_frame->localFrameRoot())) ? focusedFrame : nullptr;
- if (!localFrame || !computeCompositedSelection(*localFrame, selection)) {
- page->chromeClient().clearCompositedSelection();
- return;
- }
- page->chromeClient().updateCompositedSelection(selection);
+ if (localFrame && computeCompositedSelection(*localFrame, selection)) {
+ page->chromeClient().updateCompositedSelection(localFrame, selection);
+ } else {
+ if (!localFrame) {
+ // Clearing the mainframe when there is no focused frame (and hence
+ // no localFrame) is legacy behaviour, and implemented here to
+ // satisfy ParameterizedWebFrameTest.CompositedSelectionBoundsCleared's
+ // first check that the composited selection has been cleared even
+ // though no frame has focus yet. If this is not desired, then the
+ // expectation needs to be removed from the test.
+ localFrame = m_frame->localFrameRoot();
+ }
+
+ if (localFrame)
+ page->chromeClient().clearCompositedSelection(localFrame);
+ }
}
HostWindow* FrameView::getHostWindow() const
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/page/ChromeClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698