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

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

Issue 1858163002: Rename inDocument() to inShadowIncludingDocument() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 8 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 void HTMLLabelElement::accessKeyAction(bool sendMouseEvents) 238 void HTMLLabelElement::accessKeyAction(bool sendMouseEvents)
239 { 239 {
240 if (HTMLElement* element = control()) 240 if (HTMLElement* element = control())
241 element->accessKeyAction(sendMouseEvents); 241 element->accessKeyAction(sendMouseEvents);
242 else 242 else
243 HTMLElement::accessKeyAction(sendMouseEvents); 243 HTMLElement::accessKeyAction(sendMouseEvents);
244 } 244 }
245 245
246 void HTMLLabelElement::updateLabel(TreeScope& scope, const AtomicString& oldForA ttributeValue, const AtomicString& newForAttributeValue) 246 void HTMLLabelElement::updateLabel(TreeScope& scope, const AtomicString& oldForA ttributeValue, const AtomicString& newForAttributeValue)
247 { 247 {
248 if (!inDocument()) 248 if (!inShadowIncludingDocument())
249 return; 249 return;
250 250
251 if (oldForAttributeValue == newForAttributeValue) 251 if (oldForAttributeValue == newForAttributeValue)
252 return; 252 return;
253 253
254 if (!oldForAttributeValue.isEmpty()) 254 if (!oldForAttributeValue.isEmpty())
255 scope.removeLabel(oldForAttributeValue, this); 255 scope.removeLabel(oldForAttributeValue, this);
256 if (!newForAttributeValue.isEmpty()) 256 if (!newForAttributeValue.isEmpty())
257 scope.addLabel(newForAttributeValue, this); 257 scope.addLabel(newForAttributeValue, this);
258 } 258 }
259 259
260 Node::InsertionNotificationRequest HTMLLabelElement::insertedInto(ContainerNode* insertionPoint) 260 Node::InsertionNotificationRequest HTMLLabelElement::insertedInto(ContainerNode* insertionPoint)
261 { 261 {
262 InsertionNotificationRequest result = HTMLElement::insertedInto(insertionPoi nt); 262 InsertionNotificationRequest result = HTMLElement::insertedInto(insertionPoi nt);
263 FormAssociatedElement::insertedInto(insertionPoint); 263 FormAssociatedElement::insertedInto(insertionPoint);
264 if (insertionPoint->isInTreeScope()) { 264 if (insertionPoint->isInTreeScope()) {
265 TreeScope& scope = insertionPoint->treeScope(); 265 TreeScope& scope = insertionPoint->treeScope();
266 if (scope == treeScope() && scope.shouldCacheLabelsByForAttribute()) 266 if (scope == treeScope() && scope.shouldCacheLabelsByForAttribute())
267 updateLabel(scope, nullAtom, fastGetAttribute(forAttr)); 267 updateLabel(scope, nullAtom, fastGetAttribute(forAttr));
268 } 268 }
269 269
270 // Trigger for elements outside of forms. 270 // Trigger for elements outside of forms.
271 if (!formOwner() && insertionPoint->inDocument()) 271 if (!formOwner() && insertionPoint->inShadowIncludingDocument())
272 document().didAssociateFormControl(this); 272 document().didAssociateFormControl(this);
273 273
274 return result; 274 return result;
275 } 275 }
276 276
277 void HTMLLabelElement::removedFrom(ContainerNode* insertionPoint) 277 void HTMLLabelElement::removedFrom(ContainerNode* insertionPoint)
278 { 278 {
279 if (insertionPoint->isInTreeScope() && treeScope() == document()) { 279 if (insertionPoint->isInTreeScope() && treeScope() == document()) {
280 TreeScope& treeScope = insertionPoint->treeScope(); 280 TreeScope& treeScope = insertionPoint->treeScope();
281 if (treeScope.shouldCacheLabelsByForAttribute()) 281 if (treeScope.shouldCacheLabelsByForAttribute())
(...skipping 19 matching lines...) Expand all
301 if (attributeName == forAttr) { 301 if (attributeName == forAttr) {
302 TreeScope& scope = treeScope(); 302 TreeScope& scope = treeScope();
303 if (scope.shouldCacheLabelsByForAttribute()) 303 if (scope.shouldCacheLabelsByForAttribute())
304 updateLabel(scope, oldValue, attributeValue); 304 updateLabel(scope, oldValue, attributeValue);
305 } 305 }
306 HTMLElement::parseAttribute(attributeName, oldValue, attributeValue); 306 HTMLElement::parseAttribute(attributeName, oldValue, attributeValue);
307 } 307 }
308 } 308 }
309 309
310 } // namespace blink 310 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLInputElement.cpp ('k') | third_party/WebKit/Source/core/html/HTMLLinkElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698