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

Side by Side Diff: Source/core/platform/ScrollbarTheme.cpp

Issue 23480037: Fix RTL scroll bars being misrendered on Android. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: isLeftSideVerticalScrollbar Created 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2011 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 } 201 }
202 result.moveBy(-scrollbar->location()); 202 result.moveBy(-scrollbar->location());
203 scrollbar->invalidateRect(result); 203 scrollbar->invalidateRect(result);
204 } 204 }
205 205
206 void ScrollbarTheme::splitTrack(ScrollbarThemeClient* scrollbar, const IntRect& unconstrainedTrackRect, IntRect& beforeThumbRect, IntRect& thumbRect, IntRect& a fterThumbRect) 206 void ScrollbarTheme::splitTrack(ScrollbarThemeClient* scrollbar, const IntRect& unconstrainedTrackRect, IntRect& beforeThumbRect, IntRect& thumbRect, IntRect& a fterThumbRect)
207 { 207 {
208 // This function won't even get called unless we're big enough to have some combination of these three rects where at least 208 // This function won't even get called unless we're big enough to have some combination of these three rects where at least
209 // one of them is non-empty. 209 // one of them is non-empty.
210 IntRect trackRect = constrainTrackRectToTrackPieces(scrollbar, unconstrained TrackRect); 210 IntRect trackRect = constrainTrackRectToTrackPieces(scrollbar, unconstrained TrackRect);
211 int thickness = scrollbar->orientation() == HorizontalScrollbar ? scrollbar- >height() : scrollbar->width();
212 int thumbPos = thumbPosition(scrollbar); 211 int thumbPos = thumbPosition(scrollbar);
213 if (scrollbar->orientation() == HorizontalScrollbar) { 212 if (scrollbar->orientation() == HorizontalScrollbar) {
214 thumbRect = IntRect(trackRect.x() + thumbPos, trackRect.y() + (trackRect .height() - thickness) / 2, thumbLength(scrollbar), thickness); 213 thumbRect = IntRect(trackRect.x() + thumbPos, trackRect.y(), thumbLength (scrollbar), scrollbar->height());
215 beforeThumbRect = IntRect(trackRect.x(), trackRect.y(), thumbPos + thumb Rect.width() / 2, trackRect.height()); 214 beforeThumbRect = IntRect(trackRect.x(), trackRect.y(), thumbPos + thumb Rect.width() / 2, trackRect.height());
216 afterThumbRect = IntRect(trackRect.x() + beforeThumbRect.width(), trackR ect.y(), trackRect.maxX() - beforeThumbRect.maxX(), trackRect.height()); 215 afterThumbRect = IntRect(trackRect.x() + beforeThumbRect.width(), trackR ect.y(), trackRect.maxX() - beforeThumbRect.maxX(), trackRect.height());
217 } else { 216 } else {
218 thumbRect = IntRect(trackRect.x() + (trackRect.width() - thickness) / 2, trackRect.y() + thumbPos, thickness, thumbLength(scrollbar)); 217 thumbRect = IntRect(trackRect.x(), trackRect.y() + thumbPos, scrollbar-> width(), thumbLength(scrollbar));
219 beforeThumbRect = IntRect(trackRect.x(), trackRect.y(), trackRect.width( ), thumbPos + thumbRect.height() / 2); 218 beforeThumbRect = IntRect(trackRect.x(), trackRect.y(), trackRect.width( ), thumbPos + thumbRect.height() / 2);
220 afterThumbRect = IntRect(trackRect.x(), trackRect.y() + beforeThumbRect. height(), trackRect.width(), trackRect.maxY() - beforeThumbRect.maxY()); 219 afterThumbRect = IntRect(trackRect.x(), trackRect.y() + beforeThumbRect. height(), trackRect.width(), trackRect.maxY() - beforeThumbRect.maxY());
221 } 220 }
222 } 221 }
223 222
224 // Returns the size represented by track taking into account scrolling past 223 // Returns the size represented by track taking into account scrolling past
225 // the end of the document. 224 // the end of the document.
226 static float usedTotalSize(ScrollbarThemeClient* scrollbar) 225 static float usedTotalSize(ScrollbarThemeClient* scrollbar)
227 { 226 {
228 float overhangAtStart = -scrollbar->currentPos(); 227 float overhangAtStart = -scrollbar->currentPos();
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 void ScrollbarTheme::paintOverhangBackground(ScrollView*, GraphicsContext* conte xt, const IntRect& horizontalOverhangRect, const IntRect& verticalOverhangRect, const IntRect& dirtyRect) 301 void ScrollbarTheme::paintOverhangBackground(ScrollView*, GraphicsContext* conte xt, const IntRect& horizontalOverhangRect, const IntRect& verticalOverhangRect, const IntRect& dirtyRect)
303 { 302 {
304 context->setFillColor(Color::white); 303 context->setFillColor(Color::white);
305 if (!horizontalOverhangRect.isEmpty()) 304 if (!horizontalOverhangRect.isEmpty())
306 context->fillRect(intersection(horizontalOverhangRect, dirtyRect)); 305 context->fillRect(intersection(horizontalOverhangRect, dirtyRect));
307 if (!verticalOverhangRect.isEmpty()) 306 if (!verticalOverhangRect.isEmpty())
308 context->fillRect(intersection(verticalOverhangRect, dirtyRect)); 307 context->fillRect(intersection(verticalOverhangRect, dirtyRect));
309 } 308 }
310 309
311 } 310 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698