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

Side by Side Diff: Source/core/rendering/RenderDeprecatedFlexibleBox.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
« no previous file with comments | « no previous file | Source/core/rendering/RenderFileUploadControl.cpp » ('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 * This file is part of the render object implementation for KHTML. 2 * This file is part of the render object implementation for KHTML.
3 * 3 *
4 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 4 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
5 * (C) 1999 Antti Koivisto (koivisto@kde.org) 5 * (C) 1999 Antti Koivisto (koivisto@kde.org)
6 * Copyright (C) 2003 Apple Computer, Inc. 6 * Copyright (C) 2003 Apple Computer, Inc.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 LayoutUnit scrollbarWidth = instrinsicScrollbarLogicalWidth(); 221 LayoutUnit scrollbarWidth = instrinsicScrollbarLogicalWidth();
222 maxLogicalWidth += scrollbarWidth; 222 maxLogicalWidth += scrollbarWidth;
223 minLogicalWidth += scrollbarWidth; 223 minLogicalWidth += scrollbarWidth;
224 } 224 }
225 225
226 void RenderDeprecatedFlexibleBox::computePreferredLogicalWidths() 226 void RenderDeprecatedFlexibleBox::computePreferredLogicalWidths()
227 { 227 {
228 ASSERT(preferredLogicalWidthsDirty()); 228 ASSERT(preferredLogicalWidthsDirty());
229 229
230 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = 0; 230 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = 0;
231 if (style()->width().isFixed() && style()->width().value() > 0) 231 RenderStyle* styleToUse = style();
tkent 2014/04/16 14:11:24 I prefer RenderStyle& style = *this->style();
harpreet.sk 2014/04/16 14:26:52 RenderStyle* styleToUse = style(); is already bein
tkent 2014/04/17 02:12:01 ok, consistency is important.
232 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentB oxLogicalWidthForBoxSizing(style()->width().value()); 232
233 if (styleToUse->width().isFixed() && styleToUse->width().value() > 0)
234 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentB oxLogicalWidthForBoxSizing(styleToUse->width().value());
233 else 235 else
234 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferred LogicalWidth); 236 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferred LogicalWidth);
235 237
236 if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) { 238 if (styleToUse->minWidth().isFixed() && styleToUse->minWidth().value() > 0) {
237 m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(style()->minWidth().value())); 239 m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(styleToUse->minWidth().value()));
238 m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(style()->minWidth().value())); 240 m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(styleToUse->minWidth().value()));
239 } 241 }
240 242
241 if (style()->maxWidth().isFixed()) { 243 if (styleToUse->maxWidth().isFixed()) {
242 m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(style()->maxWidth().value())); 244 m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(styleToUse->maxWidth().value()));
243 m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(style()->maxWidth().value())); 245 m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(styleToUse->maxWidth().value()));
244 } 246 }
245 247
246 LayoutUnit borderAndPadding = borderAndPaddingLogicalWidth(); 248 LayoutUnit borderAndPadding = borderAndPaddingLogicalWidth();
247 m_minPreferredLogicalWidth += borderAndPadding; 249 m_minPreferredLogicalWidth += borderAndPadding;
248 m_maxPreferredLogicalWidth += borderAndPadding; 250 m_maxPreferredLogicalWidth += borderAndPadding;
249 251
250 clearPreferredLogicalWidthsDirty(); 252 clearPreferredLogicalWidthsDirty();
251 } 253 }
252 254
253 void RenderDeprecatedFlexibleBox::layoutBlock(bool relayoutChildren) 255 void RenderDeprecatedFlexibleBox::layoutBlock(bool relayoutChildren)
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 if (isPseudoElement()) 1078 if (isPseudoElement())
1077 return "RenderDeprecatedFlexibleBox (generated)"; 1079 return "RenderDeprecatedFlexibleBox (generated)";
1078 if (isAnonymous()) 1080 if (isAnonymous())
1079 return "RenderDeprecatedFlexibleBox (generated)"; 1081 return "RenderDeprecatedFlexibleBox (generated)";
1080 if (isRelPositioned()) 1082 if (isRelPositioned())
1081 return "RenderDeprecatedFlexibleBox (relative positioned)"; 1083 return "RenderDeprecatedFlexibleBox (relative positioned)";
1082 return "RenderDeprecatedFlexibleBox"; 1084 return "RenderDeprecatedFlexibleBox";
1083 } 1085 }
1084 1086
1085 } // namespace WebCore 1087 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/rendering/RenderFileUploadControl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698