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

Side by Side Diff: chrome/browser/ui/cocoa/new_tab_button.mm

Issue 2555033003: Add ScopedMacRTL class for Cocoa browser RTL testing (Closed)
Patch Set: Whitespace 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/ui/cocoa/new_tab_button.h" 5 #import "chrome/browser/ui/cocoa/new_tab_button.h"
6 6
7 #include "base/mac/foundation_util.h" 7 #include "base/mac/foundation_util.h"
8 #include "base/mac/sdk_forward_declarations.h" 8 #include "base/mac/sdk_forward_declarations.h"
9 #import "chrome/browser/ui/cocoa/image_button_cell.h" 9 #import "chrome/browser/ui/cocoa/image_button_cell.h"
10 #include "chrome/browser/ui/cocoa/l10n_util.h"
11 #include "chrome/browser/ui/cocoa/tabs/tab_view.h" 10 #include "chrome/browser/ui/cocoa/tabs/tab_view.h"
12 #include "chrome/grit/theme_resources.h" 11 #include "chrome/grit/theme_resources.h"
13 #include "ui/base/cocoa/nsgraphics_context_additions.h" 12 #include "ui/base/cocoa/nsgraphics_context_additions.h"
13 #import "ui/base/cocoa/rtl_feature.h"
14 #include "ui/base/material_design/material_design_controller.h" 14 #include "ui/base/material_design/material_design_controller.h"
15 #include "ui/base/resource/resource_bundle.h" 15 #include "ui/base/resource/resource_bundle.h"
16 #include "ui/base/theme_provider.h" 16 #include "ui/base/theme_provider.h"
17 17
18 @class NewTabButtonCell; 18 @class NewTabButtonCell;
19 19
20 namespace { 20 namespace {
21 21
22 enum class OverlayOption { 22 enum class OverlayOption {
23 NONE, 23 NONE,
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 367
368 [bezierPath curveToPoint:NSMakePoint(62.2756294,30) 368 [bezierPath curveToPoint:NSMakePoint(62.2756294,30)
369 controlPoint1:NSMakePoint(64.0268555,28.5502144) 369 controlPoint1:NSMakePoint(64.0268555,28.5502144)
370 controlPoint2:NSMakePoint(63.227482,29.9977011)]; 370 controlPoint2:NSMakePoint(63.227482,29.9977011)];
371 371
372 [bezierPath closePath]; 372 [bezierPath closePath];
373 373
374 // The SVG path is flipped for some reason, so flip it back. However, in RTL, 374 // The SVG path is flipped for some reason, so flip it back. However, in RTL,
375 // we'd need to flip it again below, so when in RTL mode just leave the flip 375 // we'd need to flip it again below, so when in RTL mode just leave the flip
376 // out altogether. 376 // out altogether.
377 if (!cocoa_l10n_util::ShouldDoExperimentalRTLLayout()) { 377 if (!ui::ShouldDoExperimentalRTLLayout()) {
378 const CGFloat kSVGHeight = 32; 378 const CGFloat kSVGHeight = 32;
379 NSAffineTransformStruct flipStruct = {1, 0, 0, -1, 0, kSVGHeight}; 379 NSAffineTransformStruct flipStruct = {1, 0, 0, -1, 0, kSVGHeight};
380 NSAffineTransform* flipTransform = [NSAffineTransform transform]; 380 NSAffineTransform* flipTransform = [NSAffineTransform transform];
381 [flipTransform setTransformStruct:flipStruct]; 381 [flipTransform setTransformStruct:flipStruct];
382 [bezierPath transformUsingAffineTransform:flipTransform]; 382 [bezierPath transformUsingAffineTransform:flipTransform];
383 } 383 }
384 384
385 // The SVG data is for the 2x version so scale it down. 385 // The SVG data is for the 2x version so scale it down.
386 NSAffineTransform* scaleTransform = [NSAffineTransform transform]; 386 NSAffineTransform* scaleTransform = [NSAffineTransform transform];
387 const CGFloat k50PercentScale = 0.5; 387 const CGFloat k50PercentScale = 0.5;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 [fillColor set]; 493 [fillColor set];
494 CGContextRef context = static_cast<CGContextRef>( 494 CGContextRef context = static_cast<CGContextRef>(
495 [[NSGraphicsContext currentContext] graphicsPort]); 495 [[NSGraphicsContext currentContext] graphicsPort]);
496 CGFloat lineWidth = LineWidthFromContext(context); 496 CGFloat lineWidth = LineWidthFromContext(context);
497 [[NewTabButton newTabButtonBezierPathWithLineWidth:lineWidth] fill]; 497 [[NewTabButton newTabButtonBezierPathWithLineWidth:lineWidth] fill];
498 [image unlockFocus]; 498 [image unlockFocus];
499 return image; 499 return image;
500 } 500 }
501 501
502 @end 502 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698