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

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

Issue 2623513005: Introduce Element::AttributeModificationParams (Closed)
Patch Set: Created 3 years, 11 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) 2010 Nokia Corporation and/or its subsidiary(-ies). 2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
4 * (C) 1999 Antti Koivisto (koivisto@kde.org) 4 * (C) 1999 Antti Koivisto (koivisto@kde.org)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights 6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights
7 * reserved. 7 * reserved.
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * Copyright (C) 2010 Google Inc. All rights reserved. 9 * Copyright (C) 2010 Google Inc. All rights reserved.
10 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. 10 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 const QualifiedName& name) const { 287 const QualifiedName& name) const {
288 if (name == alignAttr) { 288 if (name == alignAttr) {
289 // Don't map 'align' attribute. This matches what Firefox, Opera and IE do. 289 // Don't map 'align' attribute. This matches what Firefox, Opera and IE do.
290 // See http://bugs.webkit.org/show_bug.cgi?id=12072 290 // See http://bugs.webkit.org/show_bug.cgi?id=12072
291 return false; 291 return false;
292 } 292 }
293 293
294 return HTMLFormControlElementWithState::isPresentationAttribute(name); 294 return HTMLFormControlElementWithState::isPresentationAttribute(name);
295 } 295 }
296 296
297 void HTMLSelectElement::parseAttribute(const QualifiedName& name, 297 void HTMLSelectElement::parseAttribute(
298 const AtomicString& oldValue, 298 const AttributeModificationParams& params) {
299 const AtomicString& value) { 299 if (params.name == sizeAttr) {
300 if (name == sizeAttr) {
301 unsigned oldSize = m_size; 300 unsigned oldSize = m_size;
302 // Set the attribute value to a number. 301 // Set the attribute value to a number.
303 // This is important since the style rules for this attribute can 302 // This is important since the style rules for this attribute can
304 // determine the appearance property. 303 // determine the appearance property.
305 unsigned size = value.getString().toUInt(); 304 unsigned size = params.newValue.getString().toUInt();
306 AtomicString attrSize = AtomicString::number(size); 305 AtomicString attrSize = AtomicString::number(size);
307 if (attrSize != value) { 306 if (attrSize != params.newValue) {
308 // FIXME: This is horribly factored. 307 // FIXME: This is horribly factored.
309 if (Attribute* sizeAttribute = 308 if (Attribute* sizeAttribute =
310 ensureUniqueElementData().attributes().find(sizeAttr)) 309 ensureUniqueElementData().attributes().find(sizeAttr))
311 sizeAttribute->setValue(attrSize); 310 sizeAttribute->setValue(attrSize);
312 } 311 }
313 m_size = size; 312 m_size = size;
314 setNeedsValidityCheck(); 313 setNeedsValidityCheck();
315 if (m_size != oldSize) { 314 if (m_size != oldSize) {
316 if (inActiveDocument()) 315 if (inActiveDocument())
317 lazyReattachIfAttached(); 316 lazyReattachIfAttached();
318 resetToDefaultSelection(); 317 resetToDefaultSelection();
319 if (!usesMenuList()) 318 if (!usesMenuList())
320 saveListboxActiveSelection(); 319 saveListboxActiveSelection();
321 } 320 }
322 } else if (name == multipleAttr) { 321 } else if (params.name == multipleAttr) {
323 parseMultipleAttribute(value); 322 parseMultipleAttribute(params.newValue);
324 } else if (name == accesskeyAttr) { 323 } else if (params.name == accesskeyAttr) {
325 // FIXME: ignore for the moment. 324 // FIXME: ignore for the moment.
326 // 325 //
327 } else { 326 } else {
328 HTMLFormControlElementWithState::parseAttribute(name, oldValue, value); 327 HTMLFormControlElementWithState::parseAttribute(params);
329 } 328 }
330 } 329 }
331 330
332 bool HTMLSelectElement::shouldShowFocusRingOnMouseFocus() const { 331 bool HTMLSelectElement::shouldShowFocusRingOnMouseFocus() const {
333 return true; 332 return true;
334 } 333 }
335 334
336 bool HTMLSelectElement::canSelectAll() const { 335 bool HTMLSelectElement::canSelectAll() const {
337 return !usesMenuList(); 336 return !usesMenuList();
338 } 337 }
(...skipping 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after
2045 m_popupUpdater = nullptr; 2044 m_popupUpdater = nullptr;
2046 } 2045 }
2047 2046
2048 void HTMLSelectElement::didMutateSubtree() { 2047 void HTMLSelectElement::didMutateSubtree() {
2049 DCHECK(popupIsVisible()); 2048 DCHECK(popupIsVisible());
2050 DCHECK(m_popup); 2049 DCHECK(m_popup);
2051 m_popup->updateFromElement(PopupMenu::ByDOMChange); 2050 m_popup->updateFromElement(PopupMenu::ByDOMChange);
2052 } 2051 }
2053 2052
2054 } // namespace blink 2053 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLSelectElement.h ('k') | third_party/WebKit/Source/core/html/HTMLSlotElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698