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

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

Issue 2692473003: Modify HTMLLabelElement::control to check if label is in tree scope (Closed)
Patch Set: Created 3 years, 10 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 if (!element.isFormControlElement()) 62 if (!element.isFormControlElement())
63 UseCounter::count( 63 UseCounter::count(
64 document(), 64 document(),
65 UseCounter::HTMLLabelElementControlForNonFormAssociatedElement); 65 UseCounter::HTMLLabelElementControlForNonFormAssociatedElement);
66 return &element; 66 return &element;
67 } 67 }
68 } 68 }
69 return nullptr; 69 return nullptr;
70 } 70 }
71 71
72 if (!isInTreeScope())
73 return nullptr;
74
72 if (Element* element = treeScope().getElementById(controlId)) { 75 if (Element* element = treeScope().getElementById(controlId)) {
73 if (isLabelableElement(*element) && 76 if (isLabelableElement(*element) &&
74 toLabelableElement(*element).supportLabels()) { 77 toLabelableElement(*element).supportLabels()) {
75 if (!element->isFormControlElement()) 78 if (!element->isFormControlElement())
76 UseCounter::count( 79 UseCounter::count(
77 document(), 80 document(),
78 UseCounter::HTMLLabelElementControlForNonFormAssociatedElement); 81 UseCounter::HTMLLabelElementControlForNonFormAssociatedElement);
79 return toLabelableElement(element); 82 return toLabelableElement(element);
80 } 83 }
81 } 84 }
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 } 228 }
226 229
227 void HTMLLabelElement::accessKeyAction(bool sendMouseEvents) { 230 void HTMLLabelElement::accessKeyAction(bool sendMouseEvents) {
228 if (HTMLElement* element = control()) 231 if (HTMLElement* element = control())
229 element->accessKeyAction(sendMouseEvents); 232 element->accessKeyAction(sendMouseEvents);
230 else 233 else
231 HTMLElement::accessKeyAction(sendMouseEvents); 234 HTMLElement::accessKeyAction(sendMouseEvents);
232 } 235 }
233 236
234 } // namespace blink 237 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/external/wpt/html/semantics/forms/the-label-element/label-attributes-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698