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

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: Added Layout test 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
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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 return false; 133 return false;
134 } 134 }
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 text of label element is selected, do not pass 141 // If text of label element is selected, do not pass
142 // the event to control element. 142 // the event to control element.
143 if (document().frame()->selection().selection().isRange()) 143 if (LocalFrame* frame = document().frame()) {
144 return; 144 if (frame->selection().selection().isRange())
145 return;
146 }
145 147
146 RefPtrWillBeRawPtr<HTMLElement> element = control(); 148 RefPtrWillBeRawPtr<HTMLElement> element = control();
147 149
148 // If we can't find a control or if the control received the click 150 // If we can't find a control or if the control received the click
149 // event, then there's no need for us to do anything. 151 // event, then there's no need for us to do anything.
150 if (!element || (evt->target() && element->containsIncludingShadowDOM(ev t->target()->toNode()))) 152 if (!element || (evt->target() && element->containsIncludingShadowDOM(ev t->target()->toNode())))
151 return; 153 return;
152 154
153 if (evt->target() && isInInteractiveContent(evt->target()->toNode())) 155 if (evt->target() && isInInteractiveContent(evt->target()->toNode()))
154 return; 156 return;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 191
190 void HTMLLabelElement::accessKeyAction(bool sendMouseEvents) 192 void HTMLLabelElement::accessKeyAction(bool sendMouseEvents)
191 { 193 {
192 if (HTMLElement* element = control()) 194 if (HTMLElement* element = control())
193 element->accessKeyAction(sendMouseEvents); 195 element->accessKeyAction(sendMouseEvents);
194 else 196 else
195 HTMLElement::accessKeyAction(sendMouseEvents); 197 HTMLElement::accessKeyAction(sendMouseEvents);
196 } 198 }
197 199
198 } // namespace 200 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698