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

Side by Side Diff: Source/core/rendering/RenderListBox.cpp

Issue 204333002: Minor Refactor in RenderListBox (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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/rendering/RenderListBox.h ('k') | no next file » | 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) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
3 * 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 3 * 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 bool RenderListBox::listIndexIsVisible(int index) 624 bool RenderListBox::listIndexIsVisible(int index)
625 { 625 {
626 return index >= m_indexOffset && index < m_indexOffset + numVisibleItems(); 626 return index >= m_indexOffset && index < m_indexOffset + numVisibleItems();
627 } 627 }
628 628
629 bool RenderListBox::scroll(ScrollDirection direction, ScrollGranularity granular ity, float multiplier) 629 bool RenderListBox::scroll(ScrollDirection direction, ScrollGranularity granular ity, float multiplier)
630 { 630 {
631 return ScrollableArea::scroll(direction, granularity, multiplier); 631 return ScrollableArea::scroll(direction, granularity, multiplier);
632 } 632 }
633 633
634 void RenderListBox::valueChanged(unsigned listIndex)
635 {
636 HTMLSelectElement* element = selectElement();
637 element->setSelectedIndex(element->listToOptionIndex(listIndex));
638 element->dispatchFormControlChangeEvent();
639 }
640
641 int RenderListBox::scrollSize(ScrollbarOrientation orientation) const 634 int RenderListBox::scrollSize(ScrollbarOrientation orientation) const
642 { 635 {
643 return orientation == VerticalScrollbar ? (numItems() - numVisibleItems()) : 0; 636 return orientation == VerticalScrollbar ? (numItems() - numVisibleItems()) : 0;
644 } 637 }
645 638
646 IntPoint RenderListBox::scrollPosition() const 639 IntPoint RenderListBox::scrollPosition() const
647 { 640 {
648 return IntPoint(0, m_indexOffset); 641 return IntPoint(0, m_indexOffset);
649 } 642 }
650 643
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 943
951 if (m_vBar) 944 if (m_vBar)
952 m_vBar->styleChanged(); 945 m_vBar->styleChanged();
953 946
954 // Force an update since we know the scrollbars have changed things. 947 // Force an update since we know the scrollbars have changed things.
955 if (document().hasAnnotatedRegions()) 948 if (document().hasAnnotatedRegions())
956 document().setAnnotatedRegionsDirty(true); 949 document().setAnnotatedRegionsDirty(true);
957 } 950 }
958 951
959 } // namespace WebCore 952 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderListBox.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698