OLD | NEW |
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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 // See http://bugs.webkit.org/show_bug.cgi?id=12072 | 321 // See http://bugs.webkit.org/show_bug.cgi?id=12072 |
322 return false; | 322 return false; |
323 } | 323 } |
324 | 324 |
325 return HTMLFormControlElementWithState::isPresentationAttribute(name); | 325 return HTMLFormControlElementWithState::isPresentationAttribute(name); |
326 } | 326 } |
327 | 327 |
328 void HTMLSelectElement::parseAttribute(const QualifiedName& name, const AtomicSt
ring& value) | 328 void HTMLSelectElement::parseAttribute(const QualifiedName& name, const AtomicSt
ring& value) |
329 { | 329 { |
330 if (name == sizeAttr) { | 330 if (name == sizeAttr) { |
331 int oldSize = m_size; | 331 unsigned oldSize = m_size; |
332 // Set the attribute value to a number. | 332 // Set the attribute value to a number. |
333 // This is important since the style rules for this attribute can determ
ine the appearance property. | 333 // This is important since the style rules for this attribute can determ
ine the appearance property. |
334 int size = value.toInt(); | 334 unsigned size = value.string().toUInt(); |
335 AtomicString attrSize = AtomicString::number(size); | 335 AtomicString attrSize = AtomicString::number(size); |
336 if (attrSize != value) { | 336 if (attrSize != value) { |
337 // FIXME: This is horribly factored. | 337 // FIXME: This is horribly factored. |
338 if (Attribute* sizeAttribute = ensureUniqueElementData().attributes(
).find(sizeAttr)) | 338 if (Attribute* sizeAttribute = ensureUniqueElementData().attributes(
).find(sizeAttr)) |
339 sizeAttribute->setValue(attrSize); | 339 sizeAttribute->setValue(attrSize); |
340 } | 340 } |
341 size = std::max(size, 0); | 341 size = std::max(size, 0u); |
342 | 342 |
343 // Ensure that we've determined selectedness of the items at least once
prior to changing the size. | 343 // Ensure that we've determined selectedness of the items at least once
prior to changing the size. |
344 if (oldSize != size) | 344 if (oldSize != size) |
345 updateListItemSelectedStates(); | 345 updateListItemSelectedStates(); |
346 | 346 |
347 m_size = size; | 347 m_size = size; |
348 setNeedsValidityCheck(); | 348 setNeedsValidityCheck(); |
349 if (m_size != oldSize && inActiveDocument()) { | 349 if (m_size != oldSize && inActiveDocument()) { |
350 lazyReattachIfAttached(); | 350 lazyReattachIfAttached(); |
351 setRecalcListItems(); | 351 setRecalcListItems(); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 bool oldMultiple = this->multiple(); | 435 bool oldMultiple = this->multiple(); |
436 int oldSelectedIndex = selectedIndex(); | 436 int oldSelectedIndex = selectedIndex(); |
437 setAttribute(multipleAttr, multiple ? emptyAtom : nullAtom); | 437 setAttribute(multipleAttr, multiple ? emptyAtom : nullAtom); |
438 | 438 |
439 // Restore selectedIndex after changing the multiple flag to preserve | 439 // Restore selectedIndex after changing the multiple flag to preserve |
440 // selection as single-line and multi-line has different defaults. | 440 // selection as single-line and multi-line has different defaults. |
441 if (oldMultiple != this->multiple()) | 441 if (oldMultiple != this->multiple()) |
442 setSelectedIndex(oldSelectedIndex); | 442 setSelectedIndex(oldSelectedIndex); |
443 } | 443 } |
444 | 444 |
445 void HTMLSelectElement::setSize(int size) | 445 void HTMLSelectElement::setSize(unsigned size) |
446 { | 446 { |
447 setIntegralAttribute(sizeAttr, size); | 447 setUnsignedIntegralAttribute(sizeAttr, size); |
448 } | 448 } |
449 | 449 |
450 Element* HTMLSelectElement::namedItem(const AtomicString& name) | 450 Element* HTMLSelectElement::namedItem(const AtomicString& name) |
451 { | 451 { |
452 return options()->namedItem(name); | 452 return options()->namedItem(name); |
453 } | 453 } |
454 | 454 |
455 HTMLOptionElement* HTMLSelectElement::item(unsigned index) | 455 HTMLOptionElement* HTMLSelectElement::item(unsigned index) |
456 { | 456 { |
457 return options()->item(index); | 457 return options()->item(index); |
(...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1765 int focusedIndex = activeSelectionEndListIndex(); | 1765 int focusedIndex = activeSelectionEndListIndex(); |
1766 if (focusedIndex < 0) | 1766 if (focusedIndex < 0) |
1767 focusedIndex = firstSelectableListIndex(); | 1767 focusedIndex = firstSelectableListIndex(); |
1768 if (focusedIndex < 0) | 1768 if (focusedIndex < 0) |
1769 return nullptr; | 1769 return nullptr; |
1770 HTMLElement* focused = listItems()[focusedIndex]; | 1770 HTMLElement* focused = listItems()[focusedIndex]; |
1771 return isHTMLOptionElement(focused) ? toHTMLOptionElement(focused) : nullptr
; | 1771 return isHTMLOptionElement(focused) ? toHTMLOptionElement(focused) : nullptr
; |
1772 } | 1772 } |
1773 | 1773 |
1774 } // namespace | 1774 } // namespace |
OLD | NEW |