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

Side by Side Diff: ui/views/view.cc

Issue 2897533003: Change default ink drop center points to center of contents bounds (Closed)
Patch Set: fix compile Created 3 years, 7 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
« no previous file with comments | « ui/views/view.h ('k') | 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. 5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first.
6 6
7 #include "ui/views/view.h" 7 #include "ui/views/view.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 } 568 }
569 569
570 gfx::Point View::GetMirroredPosition() const { 570 gfx::Point View::GetMirroredPosition() const {
571 return gfx::Point(GetMirroredX(), y()); 571 return gfx::Point(GetMirroredX(), y());
572 } 572 }
573 573
574 int View::GetMirroredX() const { 574 int View::GetMirroredX() const {
575 return parent_ ? parent_->GetMirroredXForRect(bounds_) : x(); 575 return parent_ ? parent_->GetMirroredXForRect(bounds_) : x();
576 } 576 }
577 577
578 int View::GetMirroredXForRect(const gfx::Rect& bounds) const { 578 int View::GetMirroredXForRect(const gfx::Rect& rect) const {
579 return base::i18n::IsRTL() ? 579 return base::i18n::IsRTL() ? (width() - rect.x() - rect.width()) : rect.x();
580 (width() - bounds.x() - bounds.width()) : bounds.x(); 580 }
581
582 gfx::Rect View::GetMirroredRect(const gfx::Rect& rect) const {
583 gfx::Rect mirrored_rect = rect;
584 mirrored_rect.set_x(GetMirroredXForRect(rect));
585 return mirrored_rect;
581 } 586 }
582 587
583 int View::GetMirroredXInView(int x) const { 588 int View::GetMirroredXInView(int x) const {
584 return base::i18n::IsRTL() ? width() - x : x; 589 return base::i18n::IsRTL() ? width() - x : x;
585 } 590 }
586 591
587 int View::GetMirroredXWithWidthInView(int x, int w) const { 592 int View::GetMirroredXWithWidthInView(int x, int w) const {
588 return base::i18n::IsRTL() ? width() - x - w : x; 593 return base::i18n::IsRTL() ? width() - x - w : x;
589 } 594 }
590 595
(...skipping 2079 matching lines...) Expand 10 before | Expand all | Expand 10 after
2670 // Message the RootView to do the drag and drop. That way if we're removed 2675 // Message the RootView to do the drag and drop. That way if we're removed
2671 // the RootView can detect it and avoid calling us back. 2676 // the RootView can detect it and avoid calling us back.
2672 gfx::Point widget_location(event.location()); 2677 gfx::Point widget_location(event.location());
2673 ConvertPointToWidget(this, &widget_location); 2678 ConvertPointToWidget(this, &widget_location);
2674 widget->RunShellDrag(this, data, widget_location, drag_operations, source); 2679 widget->RunShellDrag(this, data, widget_location, drag_operations, source);
2675 // WARNING: we may have been deleted. 2680 // WARNING: we may have been deleted.
2676 return true; 2681 return true;
2677 } 2682 }
2678 2683
2679 } // namespace views 2684 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698