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

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

Issue 288933002: Fix crash after detaching document. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebasing Issue Created 6 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 | « LayoutTests/fast/forms/label/detached-document-expected.html ('k') | no next file » | 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 135
136 void HTMLLabelElement::defaultEventHandler(Event* evt) 136 void HTMLLabelElement::defaultEventHandler(Event* evt)
137 { 137 {
138 static bool processingClick = false; 138 static bool processingClick = false;
139 139
140 if (evt->type() == EventTypeNames::click && !processingClick) { 140 if (evt->type() == EventTypeNames::click && !processingClick) {
141 // If the click is not simulated and the text of label element is 141 // If the click is not simulated and the text of label element is
142 // selected, do not pass the event to control element. 142 // selected, do not pass the event to control element.
143 // Note: a click event may be not a mouse event if created by 143 // Note: a click event may be not a mouse event if created by
144 // document.createEvent(). 144 // document.createEvent().
145 if (evt->isMouseEvent() && !toMouseEvent(evt)->isSimulated() && document ().frame()->selection().selection().isRange()) 145 if (evt->isMouseEvent() && !toMouseEvent(evt)->isSimulated()) {
146 return; 146 if (LocalFrame* frame = document().frame()) {
147 if (frame->selection().selection().isRange())
148 return;
149 }
150 }
151
147 152
148 RefPtrWillBeRawPtr<HTMLElement> element = control(); 153 RefPtrWillBeRawPtr<HTMLElement> element = control();
149 154
150 // If we can't find a control or if the control received the click 155 // If we can't find a control or if the control received the click
151 // event, then there's no need for us to do anything. 156 // event, then there's no need for us to do anything.
152 if (!element || (evt->target() && element->containsIncludingShadowDOM(ev t->target()->toNode()))) 157 if (!element || (evt->target() && element->containsIncludingShadowDOM(ev t->target()->toNode())))
153 return; 158 return;
154 159
155 if (evt->target() && isInInteractiveContent(evt->target()->toNode())) 160 if (evt->target() && isInInteractiveContent(evt->target()->toNode()))
156 return; 161 return;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 196
192 void HTMLLabelElement::accessKeyAction(bool sendMouseEvents) 197 void HTMLLabelElement::accessKeyAction(bool sendMouseEvents)
193 { 198 {
194 if (HTMLElement* element = control()) 199 if (HTMLElement* element = control())
195 element->accessKeyAction(sendMouseEvents); 200 element->accessKeyAction(sendMouseEvents);
196 else 201 else
197 HTMLElement::accessKeyAction(sendMouseEvents); 202 HTMLElement::accessKeyAction(sendMouseEvents);
198 } 203 }
199 204
200 } // namespace 205 } // namespace
OLDNEW
« no previous file with comments | « LayoutTests/fast/forms/label/detached-document-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698