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

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

Issue 238973008: Minor refactoring to avoid redundant calls to RenderObject::style() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 if (!style()->width().isPercent()) 233 if (!style()->width().isPercent())
234 minLogicalWidth = maxLogicalWidth; 234 minLogicalWidth = maxLogicalWidth;
235 } 235 }
236 236
237 void RenderListBox::computePreferredLogicalWidths() 237 void RenderListBox::computePreferredLogicalWidths()
238 { 238 {
239 ASSERT(!m_optionsChanged); 239 ASSERT(!m_optionsChanged);
240 240
241 m_minPreferredLogicalWidth = 0; 241 m_minPreferredLogicalWidth = 0;
242 m_maxPreferredLogicalWidth = 0; 242 m_maxPreferredLogicalWidth = 0;
243 RenderStyle* styleToUse = style();
243 244
244 if (style()->width().isFixed() && style()->width().value() > 0) 245 if (styleToUse->width().isFixed() && styleToUse->width().value() > 0)
245 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentB oxLogicalWidthForBoxSizing(style()->width().value()); 246 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentB oxLogicalWidthForBoxSizing(styleToUse->width().value());
246 else 247 else
247 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferred LogicalWidth); 248 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferred LogicalWidth);
248 249
249 if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) { 250 if (styleToUse->minWidth().isFixed() && styleToUse->minWidth().value() > 0) {
250 m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(style()->minWidth().value())); 251 m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(styleToUse->minWidth().value()));
251 m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(style()->minWidth().value())); 252 m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(styleToUse->minWidth().value()));
252 } 253 }
253 254
254 if (style()->maxWidth().isFixed()) { 255 if (styleToUse->maxWidth().isFixed()) {
255 m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(style()->maxWidth().value())); 256 m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(styleToUse->maxWidth().value()));
256 m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(style()->maxWidth().value())); 257 m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(styleToUse->maxWidth().value()));
257 } 258 }
258 259
259 LayoutUnit toAdd = borderAndPaddingWidth(); 260 LayoutUnit toAdd = borderAndPaddingWidth();
260 m_minPreferredLogicalWidth += toAdd; 261 m_minPreferredLogicalWidth += toAdd;
261 m_maxPreferredLogicalWidth += toAdd; 262 m_maxPreferredLogicalWidth += toAdd;
262 263
263 clearPreferredLogicalWidthsDirty(); 264 clearPreferredLogicalWidthsDirty();
264 } 265 }
265 266
266 int RenderListBox::size() const 267 int RenderListBox::size() const
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 { 1017 {
1017 return itemBoundingBoxRectInternal(point, listIndexToRenderListBoxIndex(inde x)); 1018 return itemBoundingBoxRectInternal(point, listIndexToRenderListBoxIndex(inde x));
1018 } 1019 }
1019 1020
1020 bool RenderListBox::scrollToRevealElementAtListIndex(int index) 1021 bool RenderListBox::scrollToRevealElementAtListIndex(int index)
1021 { 1022 {
1022 return scrollToRevealElementAtListIndexInternal(listIndexToRenderListBoxInde x(index)); 1023 return scrollToRevealElementAtListIndexInternal(listIndexToRenderListBoxInde x(index));
1023 } 1024 }
1024 1025
1025 } // namespace WebCore 1026 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698