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

Side by Side Diff: Source/core/rendering/RenderSlider.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, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 { 55 {
56 maxLogicalWidth = defaultTrackLength * style()->effectiveZoom(); 56 maxLogicalWidth = defaultTrackLength * style()->effectiveZoom();
57 if (!style()->width().isPercent()) 57 if (!style()->width().isPercent())
58 minLogicalWidth = maxLogicalWidth; 58 minLogicalWidth = maxLogicalWidth;
59 } 59 }
60 60
61 void RenderSlider::computePreferredLogicalWidths() 61 void RenderSlider::computePreferredLogicalWidths()
62 { 62 {
63 m_minPreferredLogicalWidth = 0; 63 m_minPreferredLogicalWidth = 0;
64 m_maxPreferredLogicalWidth = 0; 64 m_maxPreferredLogicalWidth = 0;
65 RenderStyle* styleToUse = style();
65 66
66 if (style()->width().isFixed() && style()->width().value() > 0) 67 if (styleToUse->width().isFixed() && styleToUse->width().value() > 0)
67 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentB oxLogicalWidthForBoxSizing(style()->width().value()); 68 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentB oxLogicalWidthForBoxSizing(styleToUse->width().value());
68 else 69 else
69 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferred LogicalWidth); 70 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferred LogicalWidth);
70 71
71 if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) { 72 if (styleToUse->minWidth().isFixed() && styleToUse->minWidth().value() > 0) {
72 m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(style()->minWidth().value())); 73 m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(styleToUse->minWidth().value()));
73 m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(style()->minWidth().value())); 74 m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(styleToUse->minWidth().value()));
74 } 75 }
75 76
76 if (style()->maxWidth().isFixed()) { 77 if (styleToUse->maxWidth().isFixed()) {
77 m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(style()->maxWidth().value())); 78 m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(styleToUse->maxWidth().value()));
78 m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(style()->maxWidth().value())); 79 m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(styleToUse->maxWidth().value()));
79 } 80 }
80 81
81 LayoutUnit toAdd = borderAndPaddingWidth(); 82 LayoutUnit toAdd = borderAndPaddingWidth();
82 m_minPreferredLogicalWidth += toAdd; 83 m_minPreferredLogicalWidth += toAdd;
83 m_maxPreferredLogicalWidth += toAdd; 84 m_maxPreferredLogicalWidth += toAdd;
84 85
85 clearPreferredLogicalWidthsDirty(); 86 clearPreferredLogicalWidthsDirty();
86 } 87 }
87 88
88 inline SliderThumbElement* RenderSlider::sliderThumbElement() const 89 inline SliderThumbElement* RenderSlider::sliderThumbElement() const
(...skipping 11 matching lines...) Expand all
100 101
101 RenderFlexibleBox::layout(); 102 RenderFlexibleBox::layout();
102 } 103 }
103 104
104 bool RenderSlider::inDragMode() const 105 bool RenderSlider::inDragMode() const
105 { 106 {
106 return sliderThumbElement()->active(); 107 return sliderThumbElement()->active();
107 } 108 }
108 109
109 } // namespace WebCore 110 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698