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

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

Issue 580013002: Support size<4 rendering of listbox <select>. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/platform/mac/fast/forms/select/listbox-appearance-basic-expected.txt ('k') | no next file » | 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 * 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 #include "platform/fonts/FontCache.h" 57 #include "platform/fonts/FontCache.h"
58 #include "platform/graphics/GraphicsContext.h" 58 #include "platform/graphics/GraphicsContext.h"
59 #include "platform/scroll/Scrollbar.h" 59 #include "platform/scroll/Scrollbar.h"
60 #include "platform/text/BidiTextRun.h" 60 #include "platform/text/BidiTextRun.h"
61 #include <math.h> 61 #include <math.h>
62 62
63 namespace blink { 63 namespace blink {
64 64
65 using namespace HTMLNames; 65 using namespace HTMLNames;
66 66
67 // The minSize constant was originally defined to render scrollbars correctly.
68 // This might vary for different platforms.
69 const int minSize = 4;
70
71 // Default size when the multiple attribute is present but size attribute is abs ent. 67 // Default size when the multiple attribute is present but size attribute is abs ent.
72 const int defaultSize = 4; 68 const int defaultSize = 4;
73 69
74 const int defaultPaddingBottom = 1; 70 const int defaultPaddingBottom = 1;
75 71
76 RenderListBox::RenderListBox(Element* element) 72 RenderListBox::RenderListBox(Element* element)
77 : RenderBlockFlow(element) 73 : RenderBlockFlow(element)
78 { 74 {
79 ASSERT(element); 75 ASSERT(element);
80 ASSERT(element->isHTMLElement()); 76 ASSERT(element->isHTMLElement());
81 ASSERT(isHTMLSelectElement(element)); 77 ASSERT(isHTMLSelectElement(element));
82 } 78 }
83 79
84 RenderListBox::~RenderListBox() 80 RenderListBox::~RenderListBox()
85 { 81 {
86 } 82 }
87 83
88 inline HTMLSelectElement* RenderListBox::selectElement() const 84 inline HTMLSelectElement* RenderListBox::selectElement() const
89 { 85 {
90 return toHTMLSelectElement(node()); 86 return toHTMLSelectElement(node());
91 } 87 }
92 88
93 int RenderListBox::size() const 89 int RenderListBox::size() const
94 { 90 {
95 int specifiedSize = selectElement()->size(); 91 int specifiedSize = selectElement()->size();
96 if (specifiedSize > 1) 92 if (specifiedSize >= 1)
97 return max(minSize, specifiedSize); 93 return specifiedSize;
98 94
99 return defaultSize; 95 return defaultSize;
100 } 96 }
101 97
102 LayoutUnit RenderListBox::defaultItemHeight() const 98 LayoutUnit RenderListBox::defaultItemHeight() const
103 { 99 {
104 return style()->fontMetrics().height() + defaultPaddingBottom; 100 return style()->fontMetrics().height() + defaultPaddingBottom;
105 } 101 }
106 102
107 LayoutUnit RenderListBox::itemHeight() const 103 LayoutUnit RenderListBox::itemHeight() const
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 } 135 }
140 136
141 void RenderListBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, L ayoutUnit& maxLogicalWidth) const 137 void RenderListBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, L ayoutUnit& maxLogicalWidth) const
142 { 138 {
143 RenderBlockFlow::computeIntrinsicLogicalWidths(minLogicalWidth, maxLogicalWi dth); 139 RenderBlockFlow::computeIntrinsicLogicalWidths(minLogicalWidth, maxLogicalWi dth);
144 if (style()->width().isPercent()) 140 if (style()->width().isPercent())
145 minLogicalWidth = 0; 141 minLogicalWidth = 0;
146 } 142 }
147 143
148 } // namespace blink 144 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/platform/mac/fast/forms/select/listbox-appearance-basic-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698