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

Side by Side Diff: Source/core/layout/LayoutListBox.cpp

Issue 931423003: Rename rendering/RenderList* to layout/LayoutList* (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove spurious LayoutLayerModelObject reference Created 5 years, 10 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/layout/LayoutListBox.h ('k') | Source/core/layout/LayoutListItem.h » ('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) 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 10 matching lines...) Expand all
21 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 21 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */ 28 */
29 29
30 #include "config.h" 30 #include "config.h"
31 #include "core/rendering/RenderListBox.h" 31 #include "core/layout/LayoutListBox.h"
32 32
33 #include "core/HTMLNames.h" 33 #include "core/HTMLNames.h"
34 #include "core/css/CSSFontSelector.h" 34 #include "core/css/CSSFontSelector.h"
35 #include "core/css/resolver/StyleResolver.h" 35 #include "core/css/resolver/StyleResolver.h"
36 #include "core/dom/AXObjectCache.h" 36 #include "core/dom/AXObjectCache.h"
37 #include "core/dom/Document.h" 37 #include "core/dom/Document.h"
38 #include "core/dom/ElementTraversal.h" 38 #include "core/dom/ElementTraversal.h"
39 #include "core/dom/NodeLayoutStyle.h" 39 #include "core/dom/NodeLayoutStyle.h"
40 #include "core/dom/StyleEngine.h" 40 #include "core/dom/StyleEngine.h"
41 #include "core/editing/FrameSelection.h" 41 #include "core/editing/FrameSelection.h"
(...skipping 21 matching lines...) Expand all
63 63
64 namespace blink { 64 namespace blink {
65 65
66 using namespace HTMLNames; 66 using namespace HTMLNames;
67 67
68 // Default size when the multiple attribute is present but size attribute is abs ent. 68 // Default size when the multiple attribute is present but size attribute is abs ent.
69 const int defaultSize = 4; 69 const int defaultSize = 4;
70 70
71 const int defaultPaddingBottom = 1; 71 const int defaultPaddingBottom = 1;
72 72
73 RenderListBox::RenderListBox(Element* element) 73 LayoutListBox::LayoutListBox(Element* element)
74 : RenderBlockFlow(element) 74 : RenderBlockFlow(element)
75 { 75 {
76 ASSERT(element); 76 ASSERT(element);
77 ASSERT(element->isHTMLElement()); 77 ASSERT(element->isHTMLElement());
78 ASSERT(isHTMLSelectElement(element)); 78 ASSERT(isHTMLSelectElement(element));
79 } 79 }
80 80
81 RenderListBox::~RenderListBox() 81 LayoutListBox::~LayoutListBox()
82 { 82 {
83 } 83 }
84 84
85 inline HTMLSelectElement* RenderListBox::selectElement() const 85 inline HTMLSelectElement* LayoutListBox::selectElement() const
86 { 86 {
87 return toHTMLSelectElement(node()); 87 return toHTMLSelectElement(node());
88 } 88 }
89 89
90 int RenderListBox::size() const 90 int LayoutListBox::size() const
91 { 91 {
92 int specifiedSize = selectElement()->size(); 92 int specifiedSize = selectElement()->size();
93 if (specifiedSize >= 1) 93 if (specifiedSize >= 1)
94 return specifiedSize; 94 return specifiedSize;
95 95
96 return defaultSize; 96 return defaultSize;
97 } 97 }
98 98
99 LayoutUnit RenderListBox::defaultItemHeight() const 99 LayoutUnit LayoutListBox::defaultItemHeight() const
100 { 100 {
101 return style()->fontMetrics().height() + defaultPaddingBottom; 101 return style()->fontMetrics().height() + defaultPaddingBottom;
102 } 102 }
103 103
104 LayoutUnit RenderListBox::itemHeight() const 104 LayoutUnit LayoutListBox::itemHeight() const
105 { 105 {
106 HTMLSelectElement* select = selectElement(); 106 HTMLSelectElement* select = selectElement();
107 if (!select) 107 if (!select)
108 return 0; 108 return 0;
109 Element* baseItem = ElementTraversal::firstChild(*select); 109 Element* baseItem = ElementTraversal::firstChild(*select);
110 if (!baseItem) 110 if (!baseItem)
111 return defaultItemHeight(); 111 return defaultItemHeight();
112 if (isHTMLOptGroupElement(baseItem)) 112 if (isHTMLOptGroupElement(baseItem))
113 baseItem = &toHTMLOptGroupElement(baseItem)->optGroupLabelElement(); 113 baseItem = &toHTMLOptGroupElement(baseItem)->optGroupLabelElement();
114 else if (!isHTMLOptionElement(baseItem)) 114 else if (!isHTMLOptionElement(baseItem))
115 return defaultItemHeight(); 115 return defaultItemHeight();
116 LayoutObject* baseItemRenderer = baseItem->renderer(); 116 LayoutObject* baseItemRenderer = baseItem->renderer();
117 if (!baseItemRenderer) 117 if (!baseItemRenderer)
118 return defaultItemHeight(); 118 return defaultItemHeight();
119 if (!baseItemRenderer || !baseItemRenderer->isBox()) 119 if (!baseItemRenderer || !baseItemRenderer->isBox())
120 return defaultItemHeight(); 120 return defaultItemHeight();
121 return toRenderBox(baseItemRenderer)->size().height(); 121 return toRenderBox(baseItemRenderer)->size().height();
122 } 122 }
123 123
124 void RenderListBox::computeLogicalHeight(LayoutUnit, LayoutUnit logicalTop, Logi calExtentComputedValues& computedValues) const 124 void LayoutListBox::computeLogicalHeight(LayoutUnit, LayoutUnit logicalTop, Logi calExtentComputedValues& computedValues) const
125 { 125 {
126 LayoutUnit height = itemHeight() * size(); 126 LayoutUnit height = itemHeight() * size();
127 // FIXME: The item height should have been added before updateLogicalHeight was called to avoid this hack. 127 // FIXME: The item height should have been added before updateLogicalHeight was called to avoid this hack.
128 setIntrinsicContentLogicalHeight(height); 128 setIntrinsicContentLogicalHeight(height);
129 129
130 height += borderAndPaddingHeight(); 130 height += borderAndPaddingHeight();
131 131
132 RenderBox::computeLogicalHeight(height, logicalTop, computedValues); 132 RenderBox::computeLogicalHeight(height, logicalTop, computedValues);
133 } 133 }
134 134
135 void RenderListBox::stopAutoscroll() 135 void LayoutListBox::stopAutoscroll()
136 { 136 {
137 HTMLSelectElement* select = selectElement(); 137 HTMLSelectElement* select = selectElement();
138 if (select->isDisabledFormControl()) 138 if (select->isDisabledFormControl())
139 return; 139 return;
140 select->handleMouseRelease(); 140 select->handleMouseRelease();
141 } 141 }
142 142
143 void RenderListBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, L ayoutUnit& maxLogicalWidth) const 143 void LayoutListBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, L ayoutUnit& maxLogicalWidth) const
144 { 144 {
145 RenderBlockFlow::computeIntrinsicLogicalWidths(minLogicalWidth, maxLogicalWi dth); 145 RenderBlockFlow::computeIntrinsicLogicalWidths(minLogicalWidth, maxLogicalWi dth);
146 if (style()->width().isPercent()) 146 if (style()->width().isPercent())
147 minLogicalWidth = 0; 147 minLogicalWidth = 0;
148 } 148 }
149 149
150 void RenderListBox::scrollToRect(const LayoutRect& rect) 150 void LayoutListBox::scrollToRect(const LayoutRect& rect)
151 { 151 {
152 if (hasOverflowClip()) { 152 if (hasOverflowClip()) {
153 ASSERT(layer()); 153 ASSERT(layer());
154 ASSERT(layer()->scrollableArea()); 154 ASSERT(layer()->scrollableArea());
155 layer()->scrollableArea()->exposeRect(rect, ScrollAlignment::alignToEdge IfNeeded, ScrollAlignment::alignToEdgeIfNeeded); 155 layer()->scrollableArea()->exposeRect(rect, ScrollAlignment::alignToEdge IfNeeded, ScrollAlignment::alignToEdgeIfNeeded);
156 } 156 }
157 } 157 }
158 158
159 } // namespace blink 159 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutListBox.h ('k') | Source/core/layout/LayoutListItem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698