| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <UIKit/UIKit.h> | 5 #import <UIKit/UIKit.h> |
| 6 | 6 |
| 7 #include "ios/chrome/share_extension/ui_util.h" | 7 #include "ios/chrome/share_extension/ui_util.h" |
| 8 | 8 |
| 9 #if !defined(__has_feature) || !__has_feature(objc_arc) | 9 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 10 #error "This file requires ARC support." | 10 #error "This file requires ARC support." |
| 11 #endif | 11 #endif |
| 12 | 12 |
| 13 namespace ui_util { | 13 namespace ui_util { |
| 14 | 14 |
| 15 const CGFloat kAnimationDuration = 0.3; |
| 16 |
| 15 CGFloat AlignValueToPixel(CGFloat value) { | 17 CGFloat AlignValueToPixel(CGFloat value) { |
| 16 CGFloat scale = [[UIScreen mainScreen] scale]; | 18 CGFloat scale = [[UIScreen mainScreen] scale]; |
| 17 return floor(value * scale) / scale; | 19 return floor(value * scale) / scale; |
| 18 } | 20 } |
| 19 | 21 |
| 20 void ConstrainAllSidesOfViewToView(UIView* container, UIView* filler) { | 22 void ConstrainAllSidesOfViewToView(UIView* container, UIView* filler) { |
| 21 [NSLayoutConstraint activateConstraints:@[ | 23 [NSLayoutConstraint activateConstraints:@[ |
| 22 [filler.leadingAnchor constraintEqualToAnchor:container.leadingAnchor], | 24 [filler.leadingAnchor constraintEqualToAnchor:container.leadingAnchor], |
| 23 [filler.trailingAnchor constraintEqualToAnchor:container.trailingAnchor], | 25 [filler.trailingAnchor constraintEqualToAnchor:container.trailingAnchor], |
| 24 [filler.topAnchor constraintEqualToAnchor:container.topAnchor], | 26 [filler.topAnchor constraintEqualToAnchor:container.topAnchor], |
| 25 [filler.bottomAnchor constraintEqualToAnchor:container.bottomAnchor], | 27 [filler.bottomAnchor constraintEqualToAnchor:container.bottomAnchor], |
| 26 ]]; | 28 ]]; |
| 27 } | 29 } |
| 28 | 30 |
| 29 } // namespace ui_util | 31 } // namespace ui_util |
| OLD | NEW |