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

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

Issue 189543012: Update <select> when any of its <option> children has "display: none" (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addtional layout test included. 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
OLDNEW
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
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();
60 int toRenderListBoxIndex(int index) const;
61 61
62 private: 62 private:
63 HTMLSelectElement* selectElement() const; 63 HTMLSelectElement* selectElement() const;
64 64
65 virtual const char* renderName() const OVERRIDE { return "RenderListBox"; } 65 virtual const char* renderName() const OVERRIDE { return "RenderListBox"; }
66 66
67 virtual bool isListBox() const OVERRIDE { return true; } 67 virtual bool isListBox() const OVERRIDE { return true; }
68 virtual bool isChildAllowed(RenderObject*, RenderStyle*) const OVERRIDE; 68 virtual bool isChildAllowed(RenderObject*, RenderStyle*) const OVERRIDE;
69 69
70 virtual void updateFromElement() OVERRIDE; 70 virtual void updateFromElement() OVERRIDE;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 132
133 // NOTE: This should only be called by the overriden setScrollOffset from Sc rollableArea. 133 // NOTE: This should only be called by the overriden setScrollOffset from Sc rollableArea.
134 void scrollTo(int newOffset); 134 void scrollTo(int newOffset);
135 135
136 void setHasVerticalScrollbar(bool hasScrollbar); 136 void setHasVerticalScrollbar(bool hasScrollbar);
137 PassRefPtr<Scrollbar> createScrollbar(); 137 PassRefPtr<Scrollbar> createScrollbar();
138 void destroyScrollbar(); 138 void destroyScrollbar();
139 139
140 LayoutUnit itemHeight() const; 140 LayoutUnit itemHeight() const;
141 int numVisibleItems() const; 141 int numVisibleItems() const;
142 bool listIndexIsVisible(int index) const;
142 int numItems() const; 143 int numItems() const;
143 LayoutUnit listHeight() const; 144 LayoutUnit listHeight() const;
144 int scrollbarLeft() const; 145 int scrollbarLeft() const;
145 void paintScrollbar(PaintInfo&, const LayoutPoint&); 146 void paintScrollbar(PaintInfo&, const LayoutPoint&);
146 void paintItemForeground(PaintInfo&, const LayoutPoint&, int listIndex); 147 void paintItemForeground(PaintInfo&, const LayoutPoint&, int listIndex);
147 void paintItemBackground(PaintInfo&, const LayoutPoint&, int listIndex); 148 void paintItemBackground(PaintInfo&, const LayoutPoint&, int listIndex);
148 void scrollToRevealSelection(); 149 void scrollToRevealSelection();
149 150
151 int toOptionListIndex(int index) const;
152
150 bool m_optionsChanged; 153 bool m_optionsChanged;
151 bool m_scrollToRevealSelectionAfterLayout; 154 bool m_scrollToRevealSelectionAfterLayout;
152 bool m_inAutoscroll; 155 bool m_inAutoscroll;
153 int m_optionsWidth; 156 int m_optionsWidth;
154 int m_indexOffset; 157 int m_indexOffset;
158 int m_listItemCount;
155 159
156 RefPtr<Scrollbar> m_vBar; 160 RefPtr<Scrollbar> m_vBar;
157 }; 161 };
158 162
159 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderListBox, isListBox()); 163 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderListBox, isListBox());
160 164
161 } // namepace WebCore 165 } // namepace WebCore
162 166
163 #endif // RenderListBox_h 167 #endif // RenderListBox_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698