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

Side by Side Diff: Source/core/editing/FrameSelection.cpp

Issue 548413002: Revert of Fix to keep the selection of the text field in input element after setSelectionRange... (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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/core/editing/FrameSelection.h ('k') | Source/core/page/EventHandler.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) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 if (m_frame->editor().behavior().shouldCenterAlignWhenSelectionIsReveale d()) 289 if (m_frame->editor().behavior().shouldCenterAlignWhenSelectionIsReveale d())
290 alignment = (align == AlignCursorOnScrollAlways) ? ScrollAlignment:: alignCenterAlways : ScrollAlignment::alignCenterIfNeeded; 290 alignment = (align == AlignCursorOnScrollAlways) ? ScrollAlignment:: alignCenterAlways : ScrollAlignment::alignCenterIfNeeded;
291 else 291 else
292 alignment = (align == AlignCursorOnScrollAlways) ? ScrollAlignment:: alignTopAlways : ScrollAlignment::alignToEdgeIfNeeded; 292 alignment = (align == AlignCursorOnScrollAlways) ? ScrollAlignment:: alignTopAlways : ScrollAlignment::alignToEdgeIfNeeded;
293 293
294 revealSelection(alignment, RevealExtent); 294 revealSelection(alignment, RevealExtent);
295 } 295 }
296 296
297 notifyAccessibilityForSelectionChange(); 297 notifyAccessibilityForSelectionChange();
298 notifyCompositorForSelectionChange(); 298 notifyCompositorForSelectionChange();
299 notifyEventHandlerForSelectionChange();
300 m_frame->domWindow()->enqueueDocumentEvent(Event::create(EventTypeNames::sel ectionchange)); 299 m_frame->domWindow()->enqueueDocumentEvent(Event::create(EventTypeNames::sel ectionchange));
301 } 300 }
302 301
303 static bool removingNodeRemovesPosition(Node& node, const Position& position) 302 static bool removingNodeRemovesPosition(Node& node, const Position& position)
304 { 303 {
305 if (!position.anchorNode()) 304 if (!position.anchorNode())
306 return false; 305 return false;
307 306
308 if (position.anchorNode() == node) 307 if (position.anchorNode() == node)
309 return true; 308 return true;
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1449 } 1448 }
1450 1449
1451 void FrameSelection::notifyCompositorForSelectionChange() 1450 void FrameSelection::notifyCompositorForSelectionChange()
1452 { 1451 {
1453 if (!RuntimeEnabledFeatures::compositedSelectionUpdatesEnabled()) 1452 if (!RuntimeEnabledFeatures::compositedSelectionUpdatesEnabled())
1454 return; 1453 return;
1455 1454
1456 scheduleVisualUpdate(); 1455 scheduleVisualUpdate();
1457 } 1456 }
1458 1457
1459 void FrameSelection::notifyEventHandlerForSelectionChange()
1460 {
1461 m_frame->eventHandler().notifySelectionChanged();
1462 }
1463
1464 void FrameSelection::focusedOrActiveStateChanged() 1458 void FrameSelection::focusedOrActiveStateChanged()
1465 { 1459 {
1466 bool activeAndFocused = isFocusedAndActive(); 1460 bool activeAndFocused = isFocusedAndActive();
1467 1461
1468 RefPtrWillBeRawPtr<Document> document = m_frame->document(); 1462 RefPtrWillBeRawPtr<Document> document = m_frame->document();
1469 document->updateRenderTreeIfNeeded(); 1463 document->updateRenderTreeIfNeeded();
1470 1464
1471 // Because RenderObject::selectionBackgroundColor() and 1465 // Because RenderObject::selectionBackgroundColor() and
1472 // RenderObject::selectionForegroundColor() check if the frame is active, 1466 // RenderObject::selectionForegroundColor() check if the frame is active,
1473 // we have to update places those colors were painted. 1467 // we have to update places those colors were painted.
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
1934 sel.showTreeForThis(); 1928 sel.showTreeForThis();
1935 } 1929 }
1936 1930
1937 void showTree(const blink::FrameSelection* sel) 1931 void showTree(const blink::FrameSelection* sel)
1938 { 1932 {
1939 if (sel) 1933 if (sel)
1940 sel->showTreeForThis(); 1934 sel->showTreeForThis();
1941 } 1935 }
1942 1936
1943 #endif 1937 #endif
OLDNEW
« no previous file with comments | « Source/core/editing/FrameSelection.h ('k') | Source/core/page/EventHandler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698