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

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

Issue 16982005: Allow objects without scrollbars to be scrollable (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Mac Build Fix Created 7 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
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 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 617
618 void RenderListBox::valueChanged(unsigned listIndex) 618 void RenderListBox::valueChanged(unsigned listIndex)
619 { 619 {
620 HTMLSelectElement* element = selectElement(); 620 HTMLSelectElement* element = selectElement();
621 element->setSelectedIndex(element->listToOptionIndex(listIndex)); 621 element->setSelectedIndex(element->listToOptionIndex(listIndex));
622 element->dispatchFormControlChangeEvent(); 622 element->dispatchFormControlChangeEvent();
623 } 623 }
624 624
625 int RenderListBox::scrollSize(ScrollbarOrientation orientation) const 625 int RenderListBox::scrollSize(ScrollbarOrientation orientation) const
626 { 626 {
627 return ((orientation == VerticalScrollbar) && m_vBar) ? (m_vBar->totalSize() - m_vBar->visibleSize()) : 0; 627 return orientation == VerticalScrollbar ? (numItems() - numVisibleItems()) : 0;
628 } 628 }
629 629
630 int RenderListBox::scrollPosition(Scrollbar*) const 630 int RenderListBox::scrollPosition(Scrollbar*) const
631 { 631 {
632 return m_indexOffset; 632 return m_indexOffset;
633 } 633 }
634 634
635 IntPoint RenderListBox::scrollPosition() const
636 {
637 int x = 0;
638 int y = m_indexOffset;
639 return IntPoint(x, y);
640 }
641
635 void RenderListBox::setScrollOffset(const IntPoint& offset) 642 void RenderListBox::setScrollOffset(const IntPoint& offset)
636 { 643 {
637 scrollTo(offset.y()); 644 scrollTo(offset.y());
638 } 645 }
639 646
640 void RenderListBox::scrollTo(int newOffset) 647 void RenderListBox::scrollTo(int newOffset)
641 { 648 {
642 if (newOffset == m_indexOffset) 649 if (newOffset == m_indexOffset)
643 return; 650 return;
644 651
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 895
889 if (m_vBar) 896 if (m_vBar)
890 m_vBar->styleChanged(); 897 m_vBar->styleChanged();
891 898
892 // Force an update since we know the scrollbars have changed things. 899 // Force an update since we know the scrollbars have changed things.
893 if (document()->hasAnnotatedRegions()) 900 if (document()->hasAnnotatedRegions())
894 document()->setAnnotatedRegionsDirty(true); 901 document()->setAnnotatedRegionsDirty(true);
895 } 902 }
896 903
897 } // namespace WebCore 904 } // namespace WebCore
OLDNEW
« Source/core/platform/ScrollableArea.cpp ('K') | « Source/core/rendering/RenderListBox.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698