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

Side by Side Diff: third_party/WebKit/Source/core/editing/SelectionController.cpp

Issue 2292913002: Ensure clean layout before calling plainText() (flat tree version) (Closed)
Patch Set: 201609021415 Created 4 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) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
5 * Copyright (C) 2015 Google Inc. All rights reserved. 5 * Copyright (C) 2015 Google Inc. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 updateSelectionForMouseDownDispatchingSelectStart(innerNode, expandSelection ToRespectUserSelectAll(innerNode, newSelection), WordGranularity); 359 updateSelectionForMouseDownDispatchingSelectStart(innerNode, expandSelection ToRespectUserSelectAll(innerNode, newSelection), WordGranularity);
360 } 360 }
361 361
362 void SelectionController::selectClosestWordFromMouseEvent(const MouseEventWithHi tTestResults& result) 362 void SelectionController::selectClosestWordFromMouseEvent(const MouseEventWithHi tTestResults& result)
363 { 363 {
364 if (!m_mouseDownMayStartSelect) 364 if (!m_mouseDownMayStartSelect)
365 return; 365 return;
366 366
367 AppendTrailingWhitespace appendTrailingWhitespace = (result.event().clickCou nt() == 2 && m_frame->editor().isSelectTrailingWhitespaceEnabled()) ? AppendTrai lingWhitespace::ShouldAppend : AppendTrailingWhitespace::DontAppend; 367 AppendTrailingWhitespace appendTrailingWhitespace = (result.event().clickCou nt() == 2 && m_frame->editor().isSelectTrailingWhitespaceEnabled()) ? AppendTrai lingWhitespace::ShouldAppend : AppendTrailingWhitespace::DontAppend;
368 368
369 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
370 // needs to be audited. See http://crbug.com/590369 for more details.
371 m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets();
372
369 return selectClosestWordFromHitTestResult(result.hitTestResult(), appendTrai lingWhitespace, result.event().fromTouch() ? SelectInputEventType::Touch : Selec tInputEventType::Mouse); 373 return selectClosestWordFromHitTestResult(result.hitTestResult(), appendTrai lingWhitespace, result.event().fromTouch() ? SelectInputEventType::Touch : Selec tInputEventType::Mouse);
370 } 374 }
371 375
372 void SelectionController::selectClosestMisspellingFromMouseEvent(const MouseEven tWithHitTestResults& result) 376 void SelectionController::selectClosestMisspellingFromMouseEvent(const MouseEven tWithHitTestResults& result)
373 { 377 {
374 if (!m_mouseDownMayStartSelect) 378 if (!m_mouseDownMayStartSelect)
375 return; 379 return;
376 380
377 selectClosestMisspellingFromHitTestResult(result.hitTestResult(), 381 selectClosestMisspellingFromHitTestResult(result.hitTestResult(),
378 (result.event().clickCount() == 2 && m_frame->editor().isSelectTrailingW hitespaceEnabled()) ? AppendTrailingWhitespace::ShouldAppend : AppendTrailingWhi tespace::DontAppend); 382 (result.event().clickCount() == 2 && m_frame->editor().isSelectTrailingW hitespaceEnabled()) ? AppendTrailingWhitespace::ShouldAppend : AppendTrailingWhi tespace::DontAppend);
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 return event.event().altKey() && event.isOverLink(); 676 return event.event().altKey() && event.isOverLink();
673 } 677 }
674 678
675 bool isExtendingSelection(const MouseEventWithHitTestResults& event) 679 bool isExtendingSelection(const MouseEventWithHitTestResults& event)
676 { 680 {
677 bool isMouseDownOnLinkOrImage = event.isOverLink() || event.hitTestResult(). image(); 681 bool isMouseDownOnLinkOrImage = event.isOverLink() || event.hitTestResult(). image();
678 return event.event().shiftKey() && !isMouseDownOnLinkOrImage; 682 return event.event().shiftKey() && !isMouseDownOnLinkOrImage;
679 } 683 }
680 684
681 } // namespace blink 685 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698