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

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

Issue 2151933003: Change WTF::TemporaryChange to be an alias for AutoReset (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: TemporaryChange -> AutoReset Created 4 years, 5 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 26 matching lines...) Expand all
37 #include "core/editing/markers/DocumentMarkerController.h" 37 #include "core/editing/markers/DocumentMarkerController.h"
38 #include "core/events/Event.h" 38 #include "core/events/Event.h"
39 #include "core/frame/FrameView.h" 39 #include "core/frame/FrameView.h"
40 #include "core/frame/LocalFrame.h" 40 #include "core/frame/LocalFrame.h"
41 #include "core/frame/Settings.h" 41 #include "core/frame/Settings.h"
42 #include "core/layout/LayoutView.h" 42 #include "core/layout/LayoutView.h"
43 #include "core/layout/api/LayoutViewItem.h" 43 #include "core/layout/api/LayoutViewItem.h"
44 #include "core/page/FocusController.h" 44 #include "core/page/FocusController.h"
45 #include "core/page/Page.h" 45 #include "core/page/Page.h"
46 #include "platform/RuntimeEnabledFeatures.h" 46 #include "platform/RuntimeEnabledFeatures.h"
47 #include "wtf/AutoReset.h"
47 48
48 namespace blink { 49 namespace blink {
49 SelectionController* SelectionController::create(LocalFrame& frame) 50 SelectionController* SelectionController::create(LocalFrame& frame)
50 { 51 {
51 return new SelectionController(frame); 52 return new SelectionController(frame);
52 } 53 }
53 54
54 SelectionController::SelectionController(LocalFrame& frame) 55 SelectionController::SelectionController(LocalFrame& frame)
55 : m_frame(&frame) 56 : m_frame(&frame)
56 , m_mouseDownMayStartSelect(false) 57 , m_mouseDownMayStartSelect(false)
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 return; 602 return;
602 if (selection().contains(position) 603 if (selection().contains(position)
603 || mev.scrollbar() 604 || mev.scrollbar()
604 // FIXME: In the editable case, word selection sometimes selects content that isn't underneath the mouse. 605 // FIXME: In the editable case, word selection sometimes selects content that isn't underneath the mouse.
605 // If the selection is non-editable, we do word selection to make it eas ier to use the contextual menu items 606 // If the selection is non-editable, we do word selection to make it eas ier to use the contextual menu items
606 // available for text selections. But only if we're above text. 607 // available for text selections. But only if we're above text.
607 || !(selection().isContentEditable() || (mev.innerNode() && mev.innerNod e()->isTextNode()))) 608 || !(selection().isContentEditable() || (mev.innerNode() && mev.innerNod e()->isTextNode())))
608 return; 609 return;
609 610
610 // Context menu events are always allowed to perform a selection. 611 // Context menu events are always allowed to perform a selection.
611 TemporaryChange<bool> mouseDownMayStartSelectChange(m_mouseDownMayStartSelec t, true); 612 AutoReset<bool> mouseDownMayStartSelectChange(&m_mouseDownMayStartSelect, tr ue);
612 613
613 if (mev.hitTestResult().isMisspelled()) 614 if (mev.hitTestResult().isMisspelled())
614 return selectClosestMisspellingFromMouseEvent(mev); 615 return selectClosestMisspellingFromMouseEvent(mev);
615 616
616 if (!m_frame->editor().behavior().shouldSelectOnContextualMenuClick()) 617 if (!m_frame->editor().behavior().shouldSelectOnContextualMenuClick())
617 return; 618 return;
618 619
619 selectClosestWordOrLinkFromMouseEvent(mev); 620 selectClosestWordOrLinkFromMouseEvent(mev);
620 } 621 }
621 622
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 return event.event().altKey() && event.isOverLink(); 675 return event.event().altKey() && event.isOverLink();
675 } 676 }
676 677
677 bool isExtendingSelection(const MouseEventWithHitTestResults& event) 678 bool isExtendingSelection(const MouseEventWithHitTestResults& event)
678 { 679 {
679 bool isMouseDownOnLinkOrImage = event.isOverLink() || event.hitTestResult(). image(); 680 bool isMouseDownOnLinkOrImage = event.isOverLink() || event.hitTestResult(). image();
680 return event.event().shiftKey() && !isMouseDownOnLinkOrImage; 681 return event.event().shiftKey() && !isMouseDownOnLinkOrImage;
681 } 682 }
682 683
683 } // namespace blink 684 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/StyleEngine.h ('k') | third_party/WebKit/Source/core/editing/commands/UndoStack.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698