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

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

Issue 339333002: Removing using declarations that import names in the C++ Standard library. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixing mac error Created 6 years, 6 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/rendering/RenderMarquee.cpp ('k') | Source/core/rendering/RenderMeter.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 select element renderer in WebCore. 2 * This file is part of the select element renderer in WebCore.
3 * 3 *
4 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
5 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
6 * 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 6 * 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
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 29 matching lines...) Expand all
40 #include "core/page/Chrome.h" 40 #include "core/page/Chrome.h"
41 #include "core/rendering/RenderBR.h" 41 #include "core/rendering/RenderBR.h"
42 #include "core/rendering/RenderScrollbar.h" 42 #include "core/rendering/RenderScrollbar.h"
43 #include "core/rendering/RenderTheme.h" 43 #include "core/rendering/RenderTheme.h"
44 #include "core/rendering/RenderView.h" 44 #include "core/rendering/RenderView.h"
45 #include "platform/fonts/FontCache.h" 45 #include "platform/fonts/FontCache.h"
46 #include "platform/geometry/IntSize.h" 46 #include "platform/geometry/IntSize.h"
47 #include "platform/text/PlatformLocale.h" 47 #include "platform/text/PlatformLocale.h"
48 #include <math.h> 48 #include <math.h>
49 49
50 using namespace std;
51
52 namespace WebCore { 50 namespace WebCore {
53 51
54 using namespace HTMLNames; 52 using namespace HTMLNames;
55 53
56 RenderMenuList::RenderMenuList(Element* element) 54 RenderMenuList::RenderMenuList(Element* element)
57 : RenderFlexibleBox(element) 55 : RenderFlexibleBox(element)
58 , m_buttonText(0) 56 , m_buttonText(0)
59 , m_innerBlock(0) 57 , m_innerBlock(0)
60 , m_optionsChanged(true) 58 , m_optionsChanged(true)
61 , m_optionsWidth(0) 59 , m_optionsWidth(0)
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 172
175 String text = toHTMLOptionElement(element)->textIndentedToRespectGroupLa bel(); 173 String text = toHTMLOptionElement(element)->textIndentedToRespectGroupLa bel();
176 applyTextTransform(style(), text, ' '); 174 applyTextTransform(style(), text, ' ');
177 if (RenderTheme::theme().popupOptionSupportsTextIndent()) { 175 if (RenderTheme::theme().popupOptionSupportsTextIndent()) {
178 // Add in the option's text indent. We can't calculate percentage v alues for now. 176 // Add in the option's text indent. We can't calculate percentage v alues for now.
179 float optionWidth = 0; 177 float optionWidth = 0;
180 if (RenderStyle* optionStyle = element->renderStyle()) 178 if (RenderStyle* optionStyle = element->renderStyle())
181 optionWidth += minimumValueForLength(optionStyle->textIndent(), 0); 179 optionWidth += minimumValueForLength(optionStyle->textIndent(), 0);
182 if (!text.isEmpty()) 180 if (!text.isEmpty())
183 optionWidth += style()->font().width(text); 181 optionWidth += style()->font().width(text);
184 maxOptionWidth = max(maxOptionWidth, optionWidth); 182 maxOptionWidth = std::max(maxOptionWidth, optionWidth);
185 } else if (!text.isEmpty()) 183 } else if (!text.isEmpty()) {
186 maxOptionWidth = max(maxOptionWidth, style()->font().width(text)); 184 maxOptionWidth = std::max(maxOptionWidth, style()->font().width(text ));
185 }
187 } 186 }
188 187
189 int width = static_cast<int>(ceilf(maxOptionWidth)); 188 int width = static_cast<int>(ceilf(maxOptionWidth));
190 if (m_optionsWidth == width) 189 if (m_optionsWidth == width)
191 return; 190 return;
192 191
193 m_optionsWidth = width; 192 m_optionsWidth = width;
194 if (parent()) 193 if (parent())
195 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); 194 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation();
196 } 195 }
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 LayoutRect innerBox(additionalOffset.x() + m_innerBlock->x() + m_innerBlock- >paddingLeft(), 315 LayoutRect innerBox(additionalOffset.x() + m_innerBlock->x() + m_innerBlock- >paddingLeft(),
317 additionalOffset.y() + m_innerBlock->y() + m_innerBlock->padd ingTop(), 316 additionalOffset.y() + m_innerBlock->y() + m_innerBlock->padd ingTop(),
318 m_innerBlock->contentWidth(), 317 m_innerBlock->contentWidth(),
319 m_innerBlock->contentHeight()); 318 m_innerBlock->contentHeight());
320 319
321 return intersection(outerBox, innerBox); 320 return intersection(outerBox, innerBox);
322 } 321 }
323 322
324 void RenderMenuList::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const 323 void RenderMenuList::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
325 { 324 {
326 maxLogicalWidth = max(m_optionsWidth, RenderTheme::theme().minimumMenuListSi ze(style())) + m_innerBlock->paddingLeft() + m_innerBlock->paddingRight(); 325 maxLogicalWidth = std::max(m_optionsWidth, RenderTheme::theme().minimumMenuL istSize(style())) + m_innerBlock->paddingLeft() + m_innerBlock->paddingRight();
327 if (!style()->width().isPercent()) 326 if (!style()->width().isPercent())
328 minLogicalWidth = maxLogicalWidth; 327 minLogicalWidth = maxLogicalWidth;
329 } 328 }
330 329
331 void RenderMenuList::computePreferredLogicalWidths() 330 void RenderMenuList::computePreferredLogicalWidths()
332 { 331 {
333 m_minPreferredLogicalWidth = 0; 332 m_minPreferredLogicalWidth = 0;
334 m_maxPreferredLogicalWidth = 0; 333 m_maxPreferredLogicalWidth = 0;
335 RenderStyle* styleToUse = style(); 334 RenderStyle* styleToUse = style();
336 335
337 if (styleToUse->width().isFixed() && styleToUse->width().value() > 0) 336 if (styleToUse->width().isFixed() && styleToUse->width().value() > 0)
338 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentB oxLogicalWidthForBoxSizing(styleToUse->width().value()); 337 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentB oxLogicalWidthForBoxSizing(styleToUse->width().value());
339 else 338 else
340 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferred LogicalWidth); 339 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferred LogicalWidth);
341 340
342 if (styleToUse->minWidth().isFixed() && styleToUse->minWidth().value() > 0) { 341 if (styleToUse->minWidth().isFixed() && styleToUse->minWidth().value() > 0) {
343 m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(styleToUse->minWidth().value())); 342 m_maxPreferredLogicalWidth = std::max(m_maxPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse->minWidth().value()));
344 m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(styleToUse->minWidth().value())); 343 m_minPreferredLogicalWidth = std::max(m_minPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse->minWidth().value()));
345 } 344 }
346 345
347 if (styleToUse->maxWidth().isFixed()) { 346 if (styleToUse->maxWidth().isFixed()) {
348 m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(styleToUse->maxWidth().value())); 347 m_maxPreferredLogicalWidth = std::min(m_maxPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse->maxWidth().value()));
349 m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(styleToUse->maxWidth().value())); 348 m_minPreferredLogicalWidth = std::min(m_minPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse->maxWidth().value()));
350 } 349 }
351 350
352 LayoutUnit toAdd = borderAndPaddingWidth(); 351 LayoutUnit toAdd = borderAndPaddingWidth();
353 m_minPreferredLogicalWidth += toAdd; 352 m_minPreferredLogicalWidth += toAdd;
354 m_maxPreferredLogicalWidth += toAdd; 353 m_maxPreferredLogicalWidth += toAdd;
355 354
356 clearPreferredLogicalWidthsDirty(); 355 clearPreferredLogicalWidthsDirty();
357 } 356 }
358 357
359 void RenderMenuList::showPopup() 358 void RenderMenuList::showPopup()
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 HTMLElement* element = listItems[listIndex]; 603 HTMLElement* element = listItems[listIndex];
605 return isHTMLOptionElement(*element) && toHTMLOptionElement(*element).select ed(); 604 return isHTMLOptionElement(*element) && toHTMLOptionElement(*element).select ed();
606 } 605 }
607 606
608 void RenderMenuList::setTextFromItem(unsigned listIndex) 607 void RenderMenuList::setTextFromItem(unsigned listIndex)
609 { 608 {
610 setTextFromOption(selectElement()->listToOptionIndex(listIndex)); 609 setTextFromOption(selectElement()->listToOptionIndex(listIndex));
611 } 610 }
612 611
613 } 612 }
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderMarquee.cpp ('k') | Source/core/rendering/RenderMeter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698