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

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

Issue 334593005: Removing using declarations that import names in the C++ Standard library. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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
« no previous file with comments | « Source/core/html/HTMLMediaElement.cpp ('k') | Source/core/html/HTMLSourceElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "core/html/HTMLOptionElement.h" 45 #include "core/html/HTMLOptionElement.h"
46 #include "core/html/forms/FormController.h" 46 #include "core/html/forms/FormController.h"
47 #include "core/page/EventHandler.h" 47 #include "core/page/EventHandler.h"
48 #include "core/page/SpatialNavigation.h" 48 #include "core/page/SpatialNavigation.h"
49 #include "core/rendering/RenderListBox.h" 49 #include "core/rendering/RenderListBox.h"
50 #include "core/rendering/RenderMenuList.h" 50 #include "core/rendering/RenderMenuList.h"
51 #include "core/rendering/RenderTheme.h" 51 #include "core/rendering/RenderTheme.h"
52 #include "platform/PlatformMouseEvent.h" 52 #include "platform/PlatformMouseEvent.h"
53 #include "platform/text/PlatformLocale.h" 53 #include "platform/text/PlatformLocale.h"
54 54
55 using namespace std;
56 using namespace WTF::Unicode; 55 using namespace WTF::Unicode;
57 56
58 namespace WebCore { 57 namespace WebCore {
59 58
60 using namespace HTMLNames; 59 using namespace HTMLNames;
61 60
62 // Upper limit agreed upon with representatives of Opera and Mozilla. 61 // Upper limit agreed upon with representatives of Opera and Mozilla.
63 static const unsigned maxSelectItems = 10000; 62 static const unsigned maxSelectItems = 10000;
64 63
65 HTMLSelectElement::HTMLSelectElement(Document& document, HTMLFormElement* form) 64 HTMLSelectElement::HTMLSelectElement(Document& document, HTMLFormElement* form)
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 int oldSize = m_size; 319 int oldSize = m_size;
321 // Set the attribute value to a number. 320 // Set the attribute value to a number.
322 // This is important since the style rules for this attribute can determ ine the appearance property. 321 // This is important since the style rules for this attribute can determ ine the appearance property.
323 int size = value.toInt(); 322 int size = value.toInt();
324 AtomicString attrSize = AtomicString::number(size); 323 AtomicString attrSize = AtomicString::number(size);
325 if (attrSize != value) { 324 if (attrSize != value) {
326 // FIXME: This is horribly factored. 325 // FIXME: This is horribly factored.
327 if (Attribute* sizeAttribute = ensureUniqueElementData().findAttribu teByName(sizeAttr)) 326 if (Attribute* sizeAttribute = ensureUniqueElementData().findAttribu teByName(sizeAttr))
328 sizeAttribute->setValue(attrSize); 327 sizeAttribute->setValue(attrSize);
329 } 328 }
330 size = max(size, 1); 329 size = std::max(size, 1);
331 330
332 // Ensure that we've determined selectedness of the items at least once prior to changing the size. 331 // Ensure that we've determined selectedness of the items at least once prior to changing the size.
333 if (oldSize != size) 332 if (oldSize != size)
334 updateListItemSelectedStates(); 333 updateListItemSelectedStates();
335 334
336 m_size = size; 335 m_size = size;
337 setNeedsValidityCheck(); 336 setNeedsValidityCheck();
338 if (m_size != oldSize && inActiveDocument()) { 337 if (m_size != oldSize && inActiveDocument()) {
339 lazyReattachIfAttached(); 338 lazyReattachIfAttached();
340 setRecalcListItems(); 339 setRecalcListItems();
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 void HTMLSelectElement::setActiveSelectionEndIndex(int index) 627 void HTMLSelectElement::setActiveSelectionEndIndex(int index)
629 { 628 {
630 m_activeSelectionEndIndex = index; 629 m_activeSelectionEndIndex = index;
631 } 630 }
632 631
633 void HTMLSelectElement::updateListBoxSelection(bool deselectOtherOptions) 632 void HTMLSelectElement::updateListBoxSelection(bool deselectOtherOptions)
634 { 633 {
635 ASSERT(renderer() && (renderer()->isListBox() || m_multiple)); 634 ASSERT(renderer() && (renderer()->isListBox() || m_multiple));
636 ASSERT(!listItems().size() || m_activeSelectionAnchorIndex >= 0); 635 ASSERT(!listItems().size() || m_activeSelectionAnchorIndex >= 0);
637 636
638 unsigned start = min(m_activeSelectionAnchorIndex, m_activeSelectionEndIndex ); 637 unsigned start = std::min(m_activeSelectionAnchorIndex, m_activeSelectionEnd Index);
639 unsigned end = max(m_activeSelectionAnchorIndex, m_activeSelectionEndIndex); 638 unsigned end = std::max(m_activeSelectionAnchorIndex, m_activeSelectionEndIn dex);
640 639
641 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement> >& items = listItems( ); 640 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement> >& items = listItems( );
642 for (unsigned i = 0; i < items.size(); ++i) { 641 for (unsigned i = 0; i < items.size(); ++i) {
643 HTMLElement* element = items[i]; 642 HTMLElement* element = items[i];
644 if (!isHTMLOptionElement(*element) || toHTMLOptionElement(element)->isDi sabledFormControl() || toHTMLOptionElement(element)->isDisplayNone()) 643 if (!isHTMLOptionElement(*element) || toHTMLOptionElement(element)->isDi sabledFormControl() || toHTMLOptionElement(element)->isDisplayNone())
645 continue; 644 continue;
646 645
647 if (i >= start && i <= end) 646 if (i >= start && i <= end)
648 toHTMLOptionElement(element)->setSelectedState(m_activeSelectionStat e); 647 toHTMLOptionElement(element)->setSelectedState(m_activeSelectionStat e);
649 else if (deselectOtherOptions || i >= m_cachedStateForActiveSelection.si ze()) 648 else if (deselectOtherOptions || i >= m_cachedStateForActiveSelection.si ze())
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
1659 1658
1660 void HTMLSelectElement::trace(Visitor* visitor) 1659 void HTMLSelectElement::trace(Visitor* visitor)
1661 { 1660 {
1662 #if ENABLE(OILPAN) 1661 #if ENABLE(OILPAN)
1663 visitor->trace(m_listItems); 1662 visitor->trace(m_listItems);
1664 #endif 1663 #endif
1665 HTMLFormControlElementWithState::trace(visitor); 1664 HTMLFormControlElementWithState::trace(visitor);
1666 } 1665 }
1667 1666
1668 } // namespace 1667 } // namespace
OLDNEW
« no previous file with comments | « Source/core/html/HTMLMediaElement.cpp ('k') | Source/core/html/HTMLSourceElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698