| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2008, 2009 Google Inc. | 3 * Copyright (C) 2008, 2009 Google Inc. |
| 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 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } else { | 89 } else { |
| 90 x = scrollbar->x(); | 90 x = scrollbar->x(); |
| 91 y = scrollbar->y() + scrollbar->height() - size.height(); | 91 y = scrollbar->y() + scrollbar->height() - size.height(); |
| 92 } | 92 } |
| 93 return IntRect(x, y, size.width(), size.height()); | 93 return IntRect(x, y, size.width(), size.height()); |
| 94 } | 94 } |
| 95 | 95 |
| 96 IntRect ScrollbarThemeChromium::trackRect(Scrollbar* scrollbar, bool) | 96 IntRect ScrollbarThemeChromium::trackRect(Scrollbar* scrollbar, bool) |
| 97 { | 97 { |
| 98 IntSize bs = buttonSize(scrollbar); | 98 IntSize bs = buttonSize(scrollbar); |
| 99 int thickness = scrollbarThickness(); | 99 int thickness = scrollbarThickness(scrollbar->controlSize()); |
| 100 if (scrollbar->orientation() == HorizontalScrollbar) { | 100 if (scrollbar->orientation() == HorizontalScrollbar) { |
| 101 if (scrollbar->width() < 2 * thickness) | 101 if (scrollbar->width() < 2 * thickness) |
| 102 return IntRect(); | 102 return IntRect(); |
| 103 return IntRect(scrollbar->x() + bs.width(), scrollbar->y(), scrollbar->w
idth() - 2 * bs.width(), thickness); | 103 return IntRect(scrollbar->x() + bs.width(), scrollbar->y(), scrollbar->w
idth() - 2 * bs.width(), thickness); |
| 104 } | 104 } |
| 105 if (scrollbar->height() < 2 * thickness) | 105 if (scrollbar->height() < 2 * thickness) |
| 106 return IntRect(); | 106 return IntRect(); |
| 107 return IntRect(scrollbar->x(), scrollbar->y() + bs.height(), thickness, scro
llbar->height() - 2 * bs.height()); | 107 return IntRect(scrollbar->x(), scrollbar->y() + bs.height(), thickness, scro
llbar->height() - 2 * bs.height()); |
| 108 } | 108 } |
| 109 | 109 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 } | 166 } |
| 167 | 167 |
| 168 IntSize ScrollbarThemeChromium::buttonSize(Scrollbar* scrollbar) | 168 IntSize ScrollbarThemeChromium::buttonSize(Scrollbar* scrollbar) |
| 169 { | 169 { |
| 170 // Our desired rect is essentially thickness by thickness. | 170 // Our desired rect is essentially thickness by thickness. |
| 171 | 171 |
| 172 // Our actual rect will shrink to half the available space when we have < 2 | 172 // Our actual rect will shrink to half the available space when we have < 2 |
| 173 // times thickness pixels left. This allows the scrollbar to scale down | 173 // times thickness pixels left. This allows the scrollbar to scale down |
| 174 // and function even at tiny sizes. | 174 // and function even at tiny sizes. |
| 175 | 175 |
| 176 int thickness = scrollbarThickness(); | 176 int thickness = scrollbarThickness(scrollbar->controlSize()); |
| 177 | 177 |
| 178 #if !defined(__linux__) | 178 #if !defined(__linux__) |
| 179 // In layout test mode, we force the button "girth" (i.e., the length of | 179 // In layout test mode, we force the button "girth" (i.e., the length of |
| 180 // the button along the axis of the scrollbar) to be a fixed size. | 180 // the button along the axis of the scrollbar) to be a fixed size. |
| 181 // FIXME: This is retarded! scrollbarThickness is already fixed in layout | 181 // FIXME: This is retarded! scrollbarThickness is already fixed in layout |
| 182 // test mode so that should be enough to result in repeatable results, but | 182 // test mode so that should be enough to result in repeatable results, but |
| 183 // preserving this hack avoids having to rebaseline pixel tests. | 183 // preserving this hack avoids having to rebaseline pixel tests. |
| 184 const int kLayoutTestModeGirth = 17; | 184 const int kLayoutTestModeGirth = 17; |
| 185 | 185 |
| 186 int girth = ChromiumBridge::layoutTestMode() ? kLayoutTestModeGirth : thickn
ess; | 186 int girth = ChromiumBridge::layoutTestMode() ? kLayoutTestModeGirth : thickn
ess; |
| 187 #else | 187 #else |
| 188 int girth = thickness; | 188 int girth = thickness; |
| 189 #endif | 189 #endif |
| 190 | 190 |
| 191 if (scrollbar->orientation() == HorizontalScrollbar) { | 191 if (scrollbar->orientation() == HorizontalScrollbar) { |
| 192 int width = scrollbar->width() < 2 * girth ? scrollbar->width() / 2 : gi
rth; | 192 int width = scrollbar->width() < 2 * girth ? scrollbar->width() / 2 : gi
rth; |
| 193 return IntSize(width, thickness); | 193 return IntSize(width, thickness); |
| 194 } | 194 } |
| 195 | 195 |
| 196 int height = scrollbar->height() < 2 * girth ? scrollbar->height() / 2 : gir
th; | 196 int height = scrollbar->height() < 2 * girth ? scrollbar->height() / 2 : gir
th; |
| 197 return IntSize(thickness, height); | 197 return IntSize(thickness, height); |
| 198 } | 198 } |
| 199 | 199 |
| 200 } // namespace WebCore | 200 } // namespace WebCore |
| OLD | NEW |