New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 623949 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Apr 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: iOS
Pri: 3
Type: Bug



Sign in to add a comment

AddSameSizeConstraint constraints the location of the view

Project Member Reported by jif@chromium.org, Jun 28 2016

Issue description

AddSameSizeConstraint not only constrains the size of the view, but also constraints the position of the view.
 

Comment 1 by jif@chromium.org, Jun 28 2016

Note: the bug is upstream (i.e. in the chromium repository)
Cc: jasonkliu@chromium.org sklencarova@google.com
Owner: jif@chromium.org
Reassigning owner - please close if done.  Thanks!
jif@ what view is this referring to?
Components: Internals>Views

Comment 5 by jif@chromium.org, Apr 18 2017

Status: Started (was: Assigned)
#3> It's referring to the view on which constraints are added.

Another way to state the problem is that: either the name of the method is wrong, or the implementation is wrong.

---------------------

void AddSameSizeConstraint(UIView* view1, UIView* view2) {
  [NSLayoutConstraint activateConstraints:@[
    [view1.leadingAnchor constraintEqualToAnchor:view2.leadingAnchor],
    [view1.trailingAnchor constraintEqualToAnchor:view2.trailingAnchor],
    [view1.topAnchor constraintEqualToAnchor:view2.topAnchor],
    [view1.bottomAnchor constraintEqualToAnchor:view2.bottomAnchor]
  ]];
}

should be changed to either:

void AddSameSizeConstraint(UIView* view1, UIView* view2) {
  [NSLayoutConstraint activateConstraints:@[
    [view1.width​Anchor constraintEqualToAnchor:view2.width​Anchor],
    [view1.height​Anchor constraintEqualToAnchor:view2.height​Anchor]
  ]];
}

or (more easily because it's used in a bunch of places) renamed to:

void AddSameSizeAndPositionConstraint(UIView* view1, UIView* view2) {

---------------------

Because this method's name is misleading, people are doing:
AddSameCenterConstraints(foo, bar);
AddSameSizeConstraint(foo, bar); // <= this is already done by the current AddSameCenterConstraints

Project Member

Comment 6 by bugdroid1@chromium.org, Apr 18 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4682940d4a09ec69b133c495731b8b86d678dffa

commit 4682940d4a09ec69b133c495731b8b86d678dffa
Author: jif <jif@chromium.org>
Date: Tue Apr 18 17:23:44 2017

Rename |AddSameSizeConstraint| to |AddSameConstraints|.

The name of the function |AddSameSizeConstraint| was misleading.
This CL also remove extraneous calls to |AddSameCenterConstraints|.

BUG= 623949 

Review-Url: https://codereview.chromium.org/2823263002
Cr-Commit-Position: refs/heads/master@{#465271}

[modify] https://crrev.com/4682940d4a09ec69b133c495731b8b86d678dffa/ios/chrome/browser/payments/cells/autofill_profile_item.mm
[modify] https://crrev.com/4682940d4a09ec69b133c495731b8b86d678dffa/ios/chrome/browser/ui/authentication/signin_promo_item.mm
[modify] https://crrev.com/4682940d4a09ec69b133c495731b8b86d678dffa/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_article_item.mm
[modify] https://crrev.com/4682940d4a09ec69b133c495731b8b86d678dffa/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_footer_item.mm
[modify] https://crrev.com/4682940d4a09ec69b133c495731b8b86d678dffa/ios/chrome/browser/ui/elements/activity_overlay_coordinator.mm
[modify] https://crrev.com/4682940d4a09ec69b133c495731b8b86d678dffa/ios/chrome/browser/ui/favicon/favicon_view.mm
[modify] https://crrev.com/4682940d4a09ec69b133c495731b8b86d678dffa/ios/chrome/browser/ui/history/favicon_view.mm
[modify] https://crrev.com/4682940d4a09ec69b133c495731b8b86d678dffa/ios/chrome/browser/ui/history/history_entry_item.mm
[modify] https://crrev.com/4682940d4a09ec69b133c495731b8b86d678dffa/ios/chrome/browser/ui/reading_list/reading_list_toolbar.mm
[modify] https://crrev.com/4682940d4a09ec69b133c495731b8b86d678dffa/ios/chrome/browser/ui/side_swipe/card_side_swipe_view.mm
[modify] https://crrev.com/4682940d4a09ec69b133c495731b8b86d678dffa/ios/chrome/browser/ui/uikit_ui_util.h
[modify] https://crrev.com/4682940d4a09ec69b133c495731b8b86d678dffa/ios/chrome/browser/ui/uikit_ui_util.mm

Project Member

Comment 7 by bugdroid1@chromium.org, Apr 18 2017

The following revision refers to this bug:
  https://chrome-internal.googlesource.com/chrome/ios_internal.git/+/e87a5199596aad03763619dda16ee6426daddabd

commit e87a5199596aad03763619dda16ee6426daddabd
Author: mahmadi <mahmadi@google.com>
Date: Tue Apr 18 20:12:38 2017

Comment 8 by jif@chromium.org, Apr 19 2017

Status: Fixed (was: Started)

Sign in to add a comment