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

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: fix the indentation of HTML document Created 6 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 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 notifyEventHandlerrForSelectionChange();
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 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 } 1458 }
1458 1459
1459 void FrameSelection::notifyCompositorForSelectionChange() 1460 void FrameSelection::notifyCompositorForSelectionChange()
1460 { 1461 {
1461 if (!RuntimeEnabledFeatures::compositedSelectionUpdatesEnabled()) 1462 if (!RuntimeEnabledFeatures::compositedSelectionUpdatesEnabled())
1462 return; 1463 return;
1463 1464
1464 scheduleVisualUpdate(); 1465 scheduleVisualUpdate();
1465 } 1466 }
1466 1467
1468 void FrameSelection::notifyEventHandlerrForSelectionChange()
1469 {
1470 m_frame->eventHandler().notifySelectionChanged();
1471 }
1472
1467 void FrameSelection::focusedOrActiveStateChanged() 1473 void FrameSelection::focusedOrActiveStateChanged()
1468 { 1474 {
1469 bool activeAndFocused = isFocusedAndActive(); 1475 bool activeAndFocused = isFocusedAndActive();
1470 1476
1471 RefPtrWillBeRawPtr<Document> document = m_frame->document(); 1477 RefPtrWillBeRawPtr<Document> document = m_frame->document();
1472 document->updateRenderTreeIfNeeded(); 1478 document->updateRenderTreeIfNeeded();
1473 1479
1474 // Because RenderObject::selectionBackgroundColor() and 1480 // Because RenderObject::selectionBackgroundColor() and
1475 // RenderObject::selectionForegroundColor() check if the frame is active, 1481 // RenderObject::selectionForegroundColor() check if the frame is active,
1476 // we have to update places those colors were painted. 1482 // we have to update places those colors were painted.
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1935 sel.showTreeForThis(); 1941 sel.showTreeForThis();
1936 } 1942 }
1937 1943
1938 void showTree(const blink::FrameSelection* sel) 1944 void showTree(const blink::FrameSelection* sel)
1939 { 1945 {
1940 if (sel) 1946 if (sel)
1941 sel->showTreeForThis(); 1947 sel->showTreeForThis();
1942 } 1948 }
1943 1949
1944 #endif 1950 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698