Commit 1794b0f4 authored by ap's avatar ap

2007-01-07 Mitz Pettel <mitz@webkit.org>

        Reviewed by Mark Rowe.

        - fix http://bugs.webkit.org/show_bug.cgi?id=11133

        Test: fast/forms/listbox-clip.html

        * platform/mac/PlatformScrollBarMac.mm:
        (-[WebCoreScrollBar initWithPlatformScrollbar:]): Get the correct scrollbar
        width/height based on control size.
        * rendering/RenderListBox.cpp:
        Renamed optionsSpacingLeft to optionsSpacingHorizontal since it is applied
        on both sides.
        (WebCore::RenderListBox::calcMinMaxWidth): Account for optionsSpacingHorizontal.
        Not including the spacing before went unnoticed since the scrollbar was lying
        about its width by exactly the same amount.
        (WebCore::RenderListBox::paintObject): Clip out the scrollbar.
        (WebCore::RenderListBox::paintItemForeground): Changed for the rename.



git-svn-id: svn://svn.chromium.org/blink/trunk@18648 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 53406cc0
2007-01-07 Mitz Pettel <mitz@webkit.org>
Reviewed by Mark Rowe.
- pixel test for http://bugs.webkit.org/show_bug.cgi?id=11133
* fast/forms/listbox-clip-expected.checksum: Added.
* fast/forms/listbox-clip-expected.png: Added.
* fast/forms/listbox-clip-expected.txt: Added.
* fast/forms/listbox-clip.html: Added.
2007-01-07 Mitz Pettel <mitz@webkit.org>
Reviewed by Hyatt.
b8eb06d370de7a1aef6a77bdd48b6a21
\ No newline at end of file
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
RenderListBox {SELECT} at (0,2) size 102x107 [bgcolor=#FFFFFF] [border: (1px inset #808080)]
RenderText {#text} at (0,0) size 0x0
RenderText {#text} at (0,0) size 0x0
RenderText {#text} at (0,0) size 0x0
RenderText {#text} at (0,0) size 0x0
<html>
<head>
<title>Test for http://bugs.webkit.org/show_bug.cgi?id=11133</title>
</head>
<body>
<select multiple style="width: 100px; font-size: 20px; font-family: Ahem;">
<option>aaaaaa</option>
<option>aaaaaa</option>
<option>aaaaaa</option>
<option>aaaaaa</option>
<option>aaaaaa</option>
</select>
<script>
if (window.layoutTestController)
layoutTestController.display();
</script>
</body>
</html>
2007-01-07 Mitz Pettel <mitz@webkit.org>
Reviewed by Mark Rowe.
- fix http://bugs.webkit.org/show_bug.cgi?id=11133
Test: fast/forms/listbox-clip.html
* platform/mac/PlatformScrollBarMac.mm:
(-[WebCoreScrollBar initWithPlatformScrollbar:]): Get the correct scrollbar
width/height based on control size.
* rendering/RenderListBox.cpp:
Renamed optionsSpacingLeft to optionsSpacingHorizontal since it is applied
on both sides.
(WebCore::RenderListBox::calcMinMaxWidth): Account for optionsSpacingHorizontal.
Not including the spacing before went unnoticed since the scrollbar was lying
about its width by exactly the same amount.
(WebCore::RenderListBox::paintObject): Clip out the scrollbar.
(WebCore::RenderListBox::paintItemForeground): Changed for the rename.
2007-01-07 Mitz Pettel <mitz@webkit.org>
Reviewed by Hyatt.
......
......@@ -58,13 +58,14 @@ static NSControlSize NSControlSizeForScrollBarControlSize(ScrollbarControlSize s
// Cocoa scrollbars just set their orientation by examining their own
// dimensions, so we have to do this unsavory hack.
NSRect orientation;
NSControlSize controlSize = NSControlSizeForScrollBarControlSize(s->controlSize());
orientation.origin.x = orientation.origin.y = 0;
if (s->orientation() == VerticalScrollbar) {
orientation.size.width = [NSScroller scrollerWidth];
orientation.size.width = [NSScroller scrollerWidthForControlSize:controlSize];
orientation.size.height = 100;
} else {
orientation.size.width = 100;
orientation.size.height = [NSScroller scrollerWidth];
orientation.size.height = [NSScroller scrollerWidthForControlSize:controlSize];
}
self = [self initWithFrame:orientation];
......@@ -73,7 +74,7 @@ static NSControlSize NSControlSizeForScrollBarControlSize(ScrollbarControlSize s
[self setEnabled:YES];
[self setTarget:self];
[self setAction:@selector(scroll:)];
[self setControlSize:NSControlSizeForScrollBarControlSize(s->controlSize())];
[self setControlSize:controlSize];
return self;
}
......
......@@ -50,7 +50,7 @@ using namespace HTMLNames;
using namespace EventNames;
const int optionsSpacingMiddle = 1;
const int optionsSpacingLeft = 2;
const int optionsSpacingHorizontal = 2;
RenderListBox::RenderListBox(HTMLSelectElement* element)
: RenderBlock(element)
......@@ -136,7 +136,7 @@ void RenderListBox::calcMinMaxWidth()
if (style()->width().isFixed() && style()->width().value() > 0)
m_minWidth = m_maxWidth = calcContentBoxWidth(style()->width().value());
else {
m_maxWidth = m_optionsWidth;
m_maxWidth = m_optionsWidth + 2 * optionsSpacingHorizontal;
if (m_vBar)
m_maxWidth += m_vBar->width();
}
......@@ -214,7 +214,7 @@ void RenderListBox::paintObject(PaintInfo& paintInfo, int tx, int ty)
{
// Push a clip.
IntRect clipRect(tx + borderLeft(), ty + borderTop(),
width() - borderLeft() - borderRight(), height() - borderBottom() - borderTop());
width() - borderLeft() - borderRight() - (m_vBar ? m_vBar->width() : 0), height() - borderBottom() - borderTop());
if (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseChildBlockBackgrounds) {
if (clipRect.width() == 0 || clipRect.height() == 0)
return;
......@@ -278,7 +278,7 @@ void RenderListBox::paintItemForeground(PaintInfo& paintInfo, int tx, int ty, in
// Determine where the item text should be placed
IntRect r = itemBoundingBoxRect(tx, ty, listIndex);
r.move(optionsSpacingLeft, style()->font().ascent());
r.move(optionsSpacingHorizontal, style()->font().ascent());
RenderStyle* itemStyle = element->renderStyle();
if (!itemStyle)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment