| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of the select element renderer in WebCore. | 2 * This file is part of the select element renderer in WebCore. |
| 3 * | 3 * |
| 4 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. | 4 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 class RenderListBox FINAL : public RenderBlockFlow, private ScrollableArea { | 41 class RenderListBox FINAL : public RenderBlockFlow, private ScrollableArea { |
| 42 public: | 42 public: |
| 43 explicit RenderListBox(Element*); | 43 explicit RenderListBox(Element*); |
| 44 virtual ~RenderListBox(); | 44 virtual ~RenderListBox(); |
| 45 | 45 |
| 46 void selectionChanged(); | 46 void selectionChanged(); |
| 47 | 47 |
| 48 void setOptionsChanged(bool changed) { m_optionsChanged = changed; } | 48 void setOptionsChanged(bool changed) { m_optionsChanged = changed; } |
| 49 | 49 |
| 50 int listIndexAtOffset(const LayoutSize&); | 50 int listIndexAtOffset(const LayoutSize&) const; |
| 51 LayoutRect itemBoundingBoxRect(const LayoutPoint&, int index); | 51 LayoutRect itemBoundingBoxRect(const LayoutPoint&, int index) const; |
| 52 | 52 |
| 53 bool scrollToRevealElementAtListIndex(int index); | 53 bool scrollToRevealElementAtListIndex(int index); |
| 54 bool listIndexIsVisible(int index); | |
| 55 | 54 |
| 56 int scrollToward(const IntPoint&); // Returns the new index or -1 if no scro
ll occurred | 55 int scrollToward(const IntPoint&); // Returns the new index or -1 if no scro
ll occurred |
| 57 | 56 |
| 58 int size() const; | 57 int size() const; |
| 59 | 58 |
| 60 void repaintScrollbarIfNeeded(); | 59 void repaintScrollbarIfNeeded(); |
| 61 | 60 |
| 62 private: | 61 private: |
| 63 HTMLSelectElement* selectElement() const; | 62 HTMLSelectElement* selectElement() const; |
| 64 | 63 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 virtual bool scrollbarsCanBeActive() const OVERRIDE; | 124 virtual bool scrollbarsCanBeActive() const OVERRIDE; |
| 126 virtual IntPoint minimumScrollPosition() const OVERRIDE; | 125 virtual IntPoint minimumScrollPosition() const OVERRIDE; |
| 127 virtual IntPoint maximumScrollPosition() const OVERRIDE; | 126 virtual IntPoint maximumScrollPosition() const OVERRIDE; |
| 128 virtual bool userInputScrollable(ScrollbarOrientation) const OVERRIDE; | 127 virtual bool userInputScrollable(ScrollbarOrientation) const OVERRIDE; |
| 129 virtual bool shouldPlaceVerticalScrollbarOnLeft() const OVERRIDE; | 128 virtual bool shouldPlaceVerticalScrollbarOnLeft() const OVERRIDE; |
| 130 virtual int lineStep(ScrollbarOrientation) const OVERRIDE; | 129 virtual int lineStep(ScrollbarOrientation) const OVERRIDE; |
| 131 virtual int pageStep(ScrollbarOrientation) const OVERRIDE; | 130 virtual int pageStep(ScrollbarOrientation) const OVERRIDE; |
| 132 virtual float pixelStep(ScrollbarOrientation) const OVERRIDE; | 131 virtual float pixelStep(ScrollbarOrientation) const OVERRIDE; |
| 133 virtual IntRect scrollableAreaBoundingBox() const OVERRIDE; | 132 virtual IntRect scrollableAreaBoundingBox() const OVERRIDE; |
| 134 | 133 |
| 134 LayoutRect itemBoundingBoxRectInternal(const LayoutPoint&, int index) const; |
| 135 bool scrollToRevealElementAtListIndexInternal(int index); |
| 136 |
| 135 // NOTE: This should only be called by the overriden setScrollOffset from Sc
rollableArea. | 137 // NOTE: This should only be called by the overriden setScrollOffset from Sc
rollableArea. |
| 136 void scrollTo(int newOffset); | 138 void scrollTo(int newOffset); |
| 137 | 139 |
| 138 void setHasVerticalScrollbar(bool hasScrollbar); | 140 void setHasVerticalScrollbar(bool hasScrollbar); |
| 139 PassRefPtr<Scrollbar> createScrollbar(); | 141 PassRefPtr<Scrollbar> createScrollbar(); |
| 140 void destroyScrollbar(); | 142 void destroyScrollbar(); |
| 141 | 143 |
| 142 LayoutUnit itemHeight() const; | 144 LayoutUnit itemHeight() const; |
| 143 int numVisibleItems() const; | 145 int numVisibleItems() const; |
| 146 bool listIndexIsVisible(int index) const; |
| 144 int numItems() const; | 147 int numItems() const; |
| 145 LayoutUnit listHeight() const; | 148 LayoutUnit listHeight() const; |
| 146 int scrollbarLeft() const; | 149 int scrollbarLeft() const; |
| 147 void paintScrollbar(PaintInfo&, const LayoutPoint&); | 150 void paintScrollbar(PaintInfo&, const LayoutPoint&); |
| 148 void paintItemForeground(PaintInfo&, const LayoutPoint&, int listIndex); | 151 void paintItemForeground(PaintInfo&, const LayoutPoint&, int listIndex); |
| 149 void paintItemBackground(PaintInfo&, const LayoutPoint&, int listIndex); | 152 void paintItemBackground(PaintInfo&, const LayoutPoint&, int listIndex); |
| 150 void scrollToRevealSelection(); | 153 void scrollToRevealSelection(); |
| 151 | 154 |
| 155 int renderListBoxIndexToListIndex(int index) const; |
| 156 int listIndexToRenderListBoxIndex(int index) const; |
| 157 |
| 152 bool m_optionsChanged; | 158 bool m_optionsChanged; |
| 153 bool m_scrollToRevealSelectionAfterLayout; | 159 bool m_scrollToRevealSelectionAfterLayout; |
| 154 bool m_inAutoscroll; | 160 bool m_inAutoscroll; |
| 155 int m_optionsWidth; | 161 int m_optionsWidth; |
| 156 int m_indexOffset; | 162 int m_indexOffset; |
| 163 int m_listItemCount; |
| 157 | 164 |
| 158 RefPtr<Scrollbar> m_vBar; | 165 RefPtr<Scrollbar> m_vBar; |
| 159 }; | 166 }; |
| 160 | 167 |
| 161 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderListBox, isListBox()); | 168 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderListBox, isListBox()); |
| 162 | 169 |
| 163 } // namepace WebCore | 170 } // namepace WebCore |
| 164 | 171 |
| 165 #endif // RenderListBox_h | 172 #endif // RenderListBox_h |
| OLD | NEW |