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

Side by Side Diff: third_party/WebKit/Source/platform/scroll/ScrollbarThemeMac.mm

Issue 2512033002: RTL overlay scrollbar on Mac is left aligned. (Closed)
Patch Set: Layouttest draft deleted. Created 4 years 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 | « no previous file | 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) 2008, 2011 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008, 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 DrawingRecorder recorder(context, scrollbar, DisplayItem::kScrollbarThumb, 286 DrawingRecorder recorder(context, scrollbar, DisplayItem::kScrollbarThumb,
287 dirtyRect); 287 dirtyRect);
288 288
289 GraphicsContextStateSaver stateSaver(context); 289 GraphicsContextStateSaver stateSaver(context);
290 context.translate(rect.x(), rect.y()); 290 context.translate(rect.x(), rect.y());
291 LocalCurrentGraphicsContext localContext(context, 291 LocalCurrentGraphicsContext localContext(context,
292 IntRect(IntPoint(), rect.size())); 292 IntRect(IntPoint(), rect.size()));
293 293
294 ScrollbarPainter scrollbarPainter = painterForScrollbar(scrollbar); 294 ScrollbarPainter scrollbarPainter = painterForScrollbar(scrollbar);
295 [scrollbarPainter setEnabled:scrollbar.enabled()]; 295 [scrollbarPainter setEnabled:scrollbar.enabled()];
296 [scrollbarPainter setBoundsSize:NSSizeFromCGSize(rect.size())]; 296 // drawKnob aligns the thumb to right side of the draw rect.
297 // If the vertical overlay scrollbar is on the left, use trackWidth instead
298 // of scrollbar width, to avoid the gap on the left side of the thumb.
jbroman 2016/11/22 23:21:54 One question here: what happens if the Mac system
sahel 2016/11/23 18:22:07 I set the OS language to Farsi. The window scrollb
299 IntRect drawRect = IntRect(rect);
300 if (usesOverlayScrollbars() && scrollbar.isLeftSideVerticalScrollbar()) {
301 int thumbWidth = [scrollbarPainter trackWidth];
302 drawRect.setWidth(thumbWidth);
303 }
304 [scrollbarPainter setBoundsSize:NSSizeFromCGSize(drawRect.size())];
305
297 [scrollbarPainter setDoubleValue:0]; 306 [scrollbarPainter setDoubleValue:0];
298 [scrollbarPainter setKnobProportion:1]; 307 [scrollbarPainter setKnobProportion:1];
299 308
300 CGFloat oldKnobAlpha = [scrollbarPainter knobAlpha]; 309 CGFloat oldKnobAlpha = [scrollbarPainter knobAlpha];
301 [scrollbarPainter setKnobAlpha:1]; 310 [scrollbarPainter setKnobAlpha:1];
302 311
303 if (scrollbar.enabled()) 312 if (scrollbar.enabled())
304 [scrollbarPainter drawKnob]; 313 [scrollbarPainter drawKnob];
305 314
306 // If this state is not set, then moving the cursor over the scrollbar area 315 // If this state is not set, then moving the cursor over the scrollbar area
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 } 409 }
401 410
402 // static 411 // static
403 NSScrollerStyle ScrollbarThemeMac::recommendedScrollerStyle() { 412 NSScrollerStyle ScrollbarThemeMac::recommendedScrollerStyle() {
404 if (RuntimeEnabledFeatures::overlayScrollbarsEnabled()) 413 if (RuntimeEnabledFeatures::overlayScrollbarsEnabled())
405 return NSScrollerStyleOverlay; 414 return NSScrollerStyleOverlay;
406 return gPreferredScrollerStyle; 415 return gPreferredScrollerStyle;
407 } 416 }
408 417
409 } // namespace blink 418 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698