Changeset 129174 in webkit
- Timestamp:
- Sep 20, 2012 4:11:16 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r129168 r129174 1 2012-09-20 Tony Chang <tony@chromium.org> 2 3 Replace RenderListBox::updateLogicalHeight with RenderListBox::computeLogicalHeight 4 https://bugs.webkit.org/show_bug.cgi?id=97263 5 6 Reviewed by Ojan Vafai. 7 8 This is part of making computeLogicalHeight virtual so with any RenderBox pointer, one 9 can compute the logical height without mutating the RenderBox. 10 11 No new tests, this is a refactor and existing list box tests should pass. 12 13 * rendering/RenderBox.h: 14 (RenderBox): 15 * rendering/RenderListBox.cpp: 16 (WebCore::RenderListBox::layout): Move layout related logic here. 17 (WebCore::RenderListBox::computeLogicalHeight): Use const version and remove layout related code. 18 * rendering/RenderListBox.h: 19 (RenderListBox): Override computeLogicalHeight. 20 1 21 2012-09-20 Mike West <mkwst@chromium.org> 2 22 -
trunk/Source/WebCore/rendering/RenderBox.h
r129078 r129174 367 367 virtual void updateLogicalWidth(); 368 368 virtual void updateLogicalHeight(); 369 v oid computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const;369 virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const; 370 370 371 371 RenderBoxRegionInfo* renderBoxRegionInfo(RenderRegion*, LayoutUnit offsetFromLogicalTopOfFirstPage, RenderBoxRegionInfoFlags = CacheRenderBoxRegionInfo) const; -
trunk/Source/WebCore/rendering/RenderListBox.cpp
r128201 r129174 174 174 { 175 175 RenderBlock::layout(); 176 177 if (m_vBar) { 178 bool enabled = numVisibleItems() < numItems(); 179 m_vBar->setEnabled(enabled); 180 m_vBar->setSteps(1, max(1, numVisibleItems() - 1), itemHeight()); 181 m_vBar->setProportion(numVisibleItems(), numItems()); 182 if (!enabled) { 183 scrollToOffsetWithoutAnimation(VerticalScrollbar, 0); 184 m_indexOffset = 0; 185 } 186 } 187 176 188 if (m_scrollToRevealSelectionAfterLayout) { 177 189 LayoutStateDisabler layoutStateDisabler(view()); … … 251 263 } 252 264 253 void RenderListBox::updateLogicalHeight() 254 { 255 int toAdd = borderAndPaddingHeight(); 256 257 int itemHeight = RenderListBox::itemHeight(); 258 setHeight(itemHeight * size() - rowSpacing + toAdd); 259 260 RenderBlock::updateLogicalHeight(); 261 262 if (m_vBar) { 263 bool enabled = numVisibleItems() < numItems(); 264 m_vBar->setEnabled(enabled); 265 m_vBar->setSteps(1, max(1, numVisibleItems() - 1), itemHeight); 266 m_vBar->setProportion(numVisibleItems(), numItems()); 267 if (!enabled) { 268 scrollToOffsetWithoutAnimation(VerticalScrollbar, 0); 269 m_indexOffset = 0; 270 } 271 } 265 void RenderListBox::computeLogicalHeight(LayoutUnit, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const 266 { 267 LayoutUnit height = itemHeight() * size() - rowSpacing + borderAndPaddingHeight(); 268 RenderBox::computeLogicalHeight(height, logicalTop, computedValues); 272 269 } 273 270 -
trunk/Source/WebCore/rendering/RenderListBox.h
r128201 r129174 78 78 virtual void computePreferredLogicalWidths(); 79 79 virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; 80 virtual void updateLogicalHeight()OVERRIDE;80 virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const OVERRIDE; 81 81 82 82 virtual void layout();
Note: See TracChangeset
for help on using the changeset viewer.