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

Unified Diff: ui/views/view.cc

Issue 1773393002: Address some bubble clipping issues (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no aa Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/view.h ('k') | ui/views/window/non_client_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/view.cc
diff --git a/ui/views/view.cc b/ui/views/view.cc
index 3580d046a375bf6b231976a4ef91827425f6302c..beedbb1ff261813e9add59d03cbd91e8fe2efdeb 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -804,16 +804,17 @@ void View::Paint(const ui::PaintContext& parent_context) {
// std::optional once we can do so.
ui::ClipRecorder clip_recorder(parent_context);
if (paint_relative_to_parent) {
- // Set the clip rect to the bounds of this View. Note that the X (or left)
- // position we pass to ClipRect takes into consideration whether or not the
- // View uses a right-to-left layout so that we paint the View in its
- // mirrored position if need be.
- gfx::Rect clip_rect_in_parent = bounds();
- clip_rect_in_parent.Inset(clip_insets_);
- if (parent_)
- clip_rect_in_parent.set_x(
- parent_->GetMirroredXForRect(clip_rect_in_parent));
- clip_recorder.ClipRect(clip_rect_in_parent);
+ // Set the clip rect to the bounds of this View, or |clip_path_| if it's
+ // been set. Note that the X (or left) position we pass to ClipRect takes
+ // into consideration whether or not the View uses a right-to-left layout so
+ // that we paint the View in its mirrored position if need be.
+ if (clip_path_.isEmpty()) {
+ clip_recorder.ClipRect(GetMirroredBounds());
+ } else {
+ gfx::Path clip_path_in_parent = clip_path_;
+ clip_path_in_parent.offset(GetMirroredX(), y());
+ clip_recorder.ClipPath(clip_path_in_parent);
+ }
}
ui::TransformRecorder transform_recorder(context);
« no previous file with comments | « ui/views/view.h ('k') | ui/views/window/non_client_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698