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

Side by Side Diff: Source/core/html/HTMLLabelElement.cpp

Issue 1157833002: Revert of Refactor the selection code in EventHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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/SelectionController.cpp ('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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Apple Inc. All rights reserved.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 11 matching lines...) Expand all
22 * 22 *
23 */ 23 */
24 24
25 #include "config.h" 25 #include "config.h"
26 #include "core/html/HTMLLabelElement.h" 26 #include "core/html/HTMLLabelElement.h"
27 27
28 #include "core/HTMLNames.h" 28 #include "core/HTMLNames.h"
29 #include "core/dom/Document.h" 29 #include "core/dom/Document.h"
30 #include "core/dom/ElementTraversal.h" 30 #include "core/dom/ElementTraversal.h"
31 #include "core/editing/FrameSelection.h" 31 #include "core/editing/FrameSelection.h"
32 #include "core/editing/SelectionController.h"
33 #include "core/events/MouseEvent.h" 32 #include "core/events/MouseEvent.h"
34 #include "core/frame/LocalFrame.h" 33 #include "core/frame/LocalFrame.h"
35 #include "core/html/FormAssociatedElement.h" 34 #include "core/html/FormAssociatedElement.h"
36 #include "core/page/EventHandler.h" 35 #include "core/page/EventHandler.h"
37 36
38 namespace blink { 37 namespace blink {
39 38
40 using namespace HTMLNames; 39 using namespace HTMLNames;
41 40
42 inline HTMLLabelElement::HTMLLabelElement(Document& document, HTMLFormElement* f orm) 41 inline HTMLLabelElement::HTMLLabelElement(Document& document, HTMLFormElement* f orm)
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 153
155 // If the click is not simulated and the text of the label element 154 // If the click is not simulated and the text of the label element
156 // is selected by dragging over it, then return without passing the 155 // is selected by dragging over it, then return without passing the
157 // click event to control element. 156 // click event to control element.
158 // Note: a click event may be not a mouse event if created by 157 // Note: a click event may be not a mouse event if created by
159 // document.createEvent(). 158 // document.createEvent().
160 if (evt->isMouseEvent() && !toMouseEvent(evt)->isSimulated()) { 159 if (evt->isMouseEvent() && !toMouseEvent(evt)->isSimulated()) {
161 if (LocalFrame* frame = document().frame()) { 160 if (LocalFrame* frame = document().frame()) {
162 // Check if there is a selection and click is not on the 161 // Check if there is a selection and click is not on the
163 // selection. 162 // selection.
164 if (!Position::nodeIsUserSelectNone(this) && frame->selection(). isRange() && !frame->eventHandler().selectionController().singleClickInSelection ()) 163 if (!Position::nodeIsUserSelectNone(this) && frame->selection(). isRange() && !frame->eventHandler().mouseDownWasSingleClickInSelection())
165 isLabelTextSelected = true; 164 isLabelTextSelected = true;
166 // If selection is there and is single click i.e. text is 165 // If selection is there and is single click i.e. text is
167 // selected by dragging over label text, then return. 166 // selected by dragging over label text, then return.
168 // Click count >=2, meaning double click or triple click, 167 // Click count >=2, meaning double click or triple click,
169 // should pass click event to control element. 168 // should pass click event to control element.
170 // Only in case of drag, *neither* we pass the click event, 169 // Only in case of drag, *neither* we pass the click event,
171 // *nor* we focus the control element. 170 // *nor* we focus the control element.
172 if (isLabelTextSelected && frame->eventHandler().clickCount() == 1) 171 if (isLabelTextSelected && frame->eventHandler().clickCount() == 1)
173 return; 172 return;
174 } 173 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 282
284 void HTMLLabelElement::parseAttribute(const QualifiedName& attributeName, const AtomicString& attributeValue) 283 void HTMLLabelElement::parseAttribute(const QualifiedName& attributeName, const AtomicString& attributeValue)
285 { 284 {
286 if (attributeName == formAttr) 285 if (attributeName == formAttr)
287 formAttributeChanged(); 286 formAttributeChanged();
288 else 287 else
289 HTMLElement::parseAttribute(attributeName, attributeValue); 288 HTMLElement::parseAttribute(attributeName, attributeValue);
290 } 289 }
291 290
292 } // namespace 291 } // namespace
OLDNEW
« no previous file with comments | « Source/core/editing/SelectionController.cpp ('k') | Source/core/page/EventHandler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698