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/core/editing/FrameSelection.cpp

Issue 507533002: Fix to keep the selection of the text field in input element after setSelectionRange is called by d… (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
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();
299 m_frame->domWindow()->enqueueDocumentEvent(Event::create(EventTypeNames::sel ectionchange)); 300 m_frame->domWindow()->enqueueDocumentEvent(Event::create(EventTypeNames::sel ectionchange));
300 } 301 }
301 302
302 static bool removingNodeRemovesPosition(Node& node, const Position& position) 303 static bool removingNodeRemovesPosition(Node& node, const Position& position)
303 { 304 {
304 if (!position.anchorNode()) 305 if (!position.anchorNode())
305 return false; 306 return false;
306 307
307 if (position.anchorNode() == node) 308 if (position.anchorNode() == node)
308 return true; 309 return true;
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1448 } 1449 }
1449 1450
1450 void FrameSelection::notifyCompositorForSelectionChange() 1451 void FrameSelection::notifyCompositorForSelectionChange()
1451 { 1452 {
1452 if (!RuntimeEnabledFeatures::compositedSelectionUpdatesEnabled()) 1453 if (!RuntimeEnabledFeatures::compositedSelectionUpdatesEnabled())
1453 return; 1454 return;
1454 1455
1455 scheduleVisualUpdate(); 1456 scheduleVisualUpdate();
1456 } 1457 }
1457 1458
1459 void FrameSelection::notifyEventHandlerForSelectionChange()
1460 {
1461 m_frame->eventHandler().notifySelectionChanged();
1462 }
1463
1458 void FrameSelection::focusedOrActiveStateChanged() 1464 void FrameSelection::focusedOrActiveStateChanged()
1459 { 1465 {
1460 bool activeAndFocused = isFocusedAndActive(); 1466 bool activeAndFocused = isFocusedAndActive();
1461 1467
1462 RefPtrWillBeRawPtr<Document> document = m_frame->document(); 1468 RefPtrWillBeRawPtr<Document> document = m_frame->document();
1463 document->updateRenderTreeIfNeeded(); 1469 document->updateRenderTreeIfNeeded();
1464 1470
1465 // Because RenderObject::selectionBackgroundColor() and 1471 // Because RenderObject::selectionBackgroundColor() and
1466 // RenderObject::selectionForegroundColor() check if the frame is active, 1472 // RenderObject::selectionForegroundColor() check if the frame is active,
1467 // we have to update places those colors were painted. 1473 // we have to update places those colors were painted.
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
1928 sel.showTreeForThis(); 1934 sel.showTreeForThis();
1929 } 1935 }
1930 1936
1931 void showTree(const blink::FrameSelection* sel) 1937 void showTree(const blink::FrameSelection* sel)
1932 { 1938 {
1933 if (sel) 1939 if (sel)
1934 sel->showTreeForThis(); 1940 sel->showTreeForThis();
1935 } 1941 }
1936 1942
1937 #endif 1943 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698