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

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

Issue 84713002: Add number() static methods to AtomicString class (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years 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 | Annotate | Revision Log
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 reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved.
7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
8 * Copyright (C) 2010 Google Inc. All rights reserved. 8 * Copyright (C) 2010 Google Inc. All rights reserved.
9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
10 * 10 *
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 return HTMLFormControlElementWithState::isPresentationAttribute(name); 282 return HTMLFormControlElementWithState::isPresentationAttribute(name);
283 } 283 }
284 284
285 void HTMLSelectElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value) 285 void HTMLSelectElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value)
286 { 286 {
287 if (name == sizeAttr) { 287 if (name == sizeAttr) {
288 int oldSize = m_size; 288 int oldSize = m_size;
289 // Set the attribute value to a number. 289 // Set the attribute value to a number.
290 // This is important since the style rules for this attribute can determ ine the appearance property. 290 // This is important since the style rules for this attribute can determ ine the appearance property.
291 int size = value.toInt(); 291 int size = value.toInt();
292 String attrSize = String::number(size); 292 AtomicString attrSize = AtomicString::number(size);
293 if (attrSize != value) { 293 if (attrSize != value) {
294 // FIXME: This is horribly factored. 294 // FIXME: This is horribly factored.
295 if (Attribute* sizeAttribute = ensureUniqueElementData()->getAttribu teItem(sizeAttr)) 295 if (Attribute* sizeAttribute = ensureUniqueElementData()->getAttribu teItem(sizeAttr))
296 sizeAttribute->setValue(attrSize); 296 sizeAttribute->setValue(attrSize);
297 } 297 }
298 size = max(size, 1); 298 size = max(size, 1);
299 299
300 // Ensure that we've determined selectedness of the items at least once prior to changing the size. 300 // Ensure that we've determined selectedness of the items at least once prior to changing the size.
301 if (oldSize != size) 301 if (oldSize != size)
302 updateListItemSelectedStates(); 302 updateListItemSelectedStates();
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 setAttribute(multipleAttr, multiple ? "" : 0); 394 setAttribute(multipleAttr, multiple ? "" : 0);
395 395
396 // Restore selectedIndex after changing the multiple flag to preserve 396 // Restore selectedIndex after changing the multiple flag to preserve
397 // selection as single-line and multi-line has different defaults. 397 // selection as single-line and multi-line has different defaults.
398 if (oldMultiple != this->multiple()) 398 if (oldMultiple != this->multiple())
399 setSelectedIndex(oldSelectedIndex); 399 setSelectedIndex(oldSelectedIndex);
400 } 400 }
401 401
402 void HTMLSelectElement::setSize(int size) 402 void HTMLSelectElement::setSize(int size)
403 { 403 {
404 setAttribute(sizeAttr, String::number(size)); 404 setAttribute(sizeAttr, AtomicString::number(size));
405 } 405 }
406 406
407 Node* HTMLSelectElement::namedItem(const AtomicString& name) 407 Node* HTMLSelectElement::namedItem(const AtomicString& name)
408 { 408 {
409 return options()->namedItem(name); 409 return options()->namedItem(name);
410 } 410 }
411 411
412 Node* HTMLSelectElement::item(unsigned index) 412 Node* HTMLSelectElement::item(unsigned index)
413 { 413 {
414 return options()->item(index); 414 return options()->item(index);
(...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 remove(index); 1579 remove(index);
1580 return true; 1580 return true;
1581 } 1581 }
1582 1582
1583 bool HTMLSelectElement::isInteractiveContent() const 1583 bool HTMLSelectElement::isInteractiveContent() const
1584 { 1584 {
1585 return true; 1585 return true;
1586 } 1586 }
1587 1587
1588 } // namespace 1588 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698