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

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

Issue 330613002: Copying text closes the keyboard and the text input gets unfocused, forcing virtual keyboard is get… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated code based on self review. Created 6 years, 6 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
« no previous file with comments | « Source/web/WebLocalFrameImpl.h ('k') | Source/web/WebRemoteFrameImpl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1824 matching lines...) Expand 10 before | Expand all | Expand 10 after
1835 // Finally clear the active match, for two reasons: 1835 // Finally clear the active match, for two reasons:
1836 // We just finished the find 'session' and we don't want future (potenti ally 1836 // We just finished the find 'session' and we don't want future (potenti ally
1837 // unrelated) find 'sessions' operations to start at the same place. 1837 // unrelated) find 'sessions' operations to start at the same place.
1838 // The WebLocalFrameImpl could get reused and the activeMatch could end up pointing 1838 // The WebLocalFrameImpl could get reused and the activeMatch could end up pointing
1839 // to a document that is no longer valid. Keeping an invalid reference a round 1839 // to a document that is no longer valid. Keeping an invalid reference a round
1840 // is just asking for trouble. 1840 // is just asking for trouble.
1841 m_textFinder->resetActiveMatch(); 1841 m_textFinder->resetActiveMatch();
1842 } 1842 }
1843 } 1843 }
1844 1844
1845 bool WebLocalFrameImpl::setCaretSelectionFromRangeSelection()
1846 {
1847 if (hasSelection()) {
yosin_UTC9 2014/06/13 04:20:15 nit: We prefer early return, e.g. if (!hasSelecti
1848 // Check whether Selection exists
1849 FrameSelection& selection = frame()->selection();
1850 if (selection.isInTextField() && selection.isRange()) {
yosin_UTC9 2014/06/13 04:20:15 We may want not lose selection for contenteditable
AKVT 2014/06/16 10:34:34 Done.
AKVT 2014/06/16 10:34:34 Done.
1851 // Check whether it's a range selection. It appears to be reduandant .
yosin_UTC9 2014/06/13 04:20:15 It seems Selection.collapseToEnd() == selection().
AKVT 2014/06/16 10:34:34 Done.
1852 // During copy, Range selection should be available. For safety purp se added this condition.
Yuta Kitamura 2014/06/16 07:58:43 typo: purpse
AKVT 2014/06/16 10:34:34 Done.
1853 RefPtrWillBeRawPtr<Range> selectedRange = selection.toNormalizedRang e();
1854 if (!selectedRange)
1855 return false;
1856
1857 int startOffset = selectedRange->startOffset();
1858 int endOffset = selectedRange->endOffset();
1859 if (startOffset != endOffset) {
1860 // Convert to Caret selection without clearing selection to allo w continouous editing after copy.
1861 frame()->inputMethodController().setEditableSelectionOffsets(Pla inTextRange(endOffset, endOffset));
1862 return true;
1863 }
1864 }
1865 }
1866
1867 return false;
1868 }
1869
1845 void WebLocalFrameImpl::didFail(const ResourceError& error, bool wasProvisional) 1870 void WebLocalFrameImpl::didFail(const ResourceError& error, bool wasProvisional)
1846 { 1871 {
1847 if (!client()) 1872 if (!client())
1848 return; 1873 return;
1849 WebURLError webError = error; 1874 WebURLError webError = error;
1850 if (wasProvisional) 1875 if (wasProvisional)
1851 client()->didFailProvisionalLoad(this, webError); 1876 client()->didFailProvisionalLoad(this, webError);
1852 else 1877 else
1853 client()->didFailLoad(this, webError); 1878 client()->didFailLoad(this, webError);
1854 } 1879 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1946 1971
1947 void WebLocalFrameImpl::invalidateAll() const 1972 void WebLocalFrameImpl::invalidateAll() const
1948 { 1973 {
1949 ASSERT(frame() && frame()->view()); 1974 ASSERT(frame() && frame()->view());
1950 FrameView* view = frame()->view(); 1975 FrameView* view = frame()->view();
1951 view->invalidateRect(view->frameRect()); 1976 view->invalidateRect(view->frameRect());
1952 invalidateScrollbar(); 1977 invalidateScrollbar();
1953 } 1978 }
1954 1979
1955 } // namespace blink 1980 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebLocalFrameImpl.h ('k') | Source/web/WebRemoteFrameImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698