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

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

Issue 2261593002: Use ScopedRTLFlipCanvas more pervasively for RTL flipping. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix namespace Created 4 years, 4 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/style/mac/combobox_background_mac.cc ('k') | ui/views/view.cc » ('j') | 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 #ifndef UI_VIEWS_VIEW_H_ 5 #ifndef UI_VIEWS_VIEW_H_
6 #define UI_VIEWS_VIEW_H_ 6 #define UI_VIEWS_VIEW_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 return const_cast<ui::NativeTheme*>( 531 return const_cast<ui::NativeTheme*>(
532 const_cast<const View*>(this)->GetNativeTheme()); 532 const_cast<const View*>(this)->GetNativeTheme());
533 } 533 }
534 const ui::NativeTheme* GetNativeTheme() const; 534 const ui::NativeTheme* GetNativeTheme() const;
535 535
536 // RTL painting -------------------------------------------------------------- 536 // RTL painting --------------------------------------------------------------
537 537
538 // This method determines whether the gfx::Canvas object passed to 538 // This method determines whether the gfx::Canvas object passed to
539 // View::Paint() needs to be transformed such that anything drawn on the 539 // View::Paint() needs to be transformed such that anything drawn on the
540 // canvas object during View::Paint() is flipped horizontally. 540 // canvas object during View::Paint() is flipped horizontally.
541 // 541 bool flip_canvas_on_paint_for_rtl_ui() const {
542 // By default, this function returns false (which is the initial value of 542 return flip_canvas_on_paint_for_rtl_ui_;
543 // |flip_canvas_on_paint_for_rtl_ui_|). View subclasses that need to paint on
544 // a flipped gfx::Canvas when the UI layout is right-to-left need to call
545 // EnableCanvasFlippingForRTLUI().
546 bool FlipCanvasOnPaintForRTLUI() const {
547 return flip_canvas_on_paint_for_rtl_ui_ ? base::i18n::IsRTL() : false;
548 } 543 }
549 544
550 // Enables or disables flipping of the gfx::Canvas during View::Paint(). 545 // Enables or disables flipping of the gfx::Canvas during View::Paint().
551 // Note that if canvas flipping is enabled, the canvas will be flipped only 546 // Note that if canvas flipping is enabled, the canvas will be flipped only
552 // if the UI layout is right-to-left; that is, the canvas will be flipped 547 // if the UI layout is right-to-left; that is, the canvas will be flipped
553 // only if base::i18n::IsRTL() returns true. 548 // only if base::i18n::IsRTL() returns true.
554 // 549 //
555 // Enabling canvas flipping is useful for leaf views that draw an image that 550 // Enabling canvas flipping is useful for leaf views that draw an image that
556 // needs to be flipped horizontally when the UI layout is right-to-left 551 // needs to be flipped horizontally when the UI layout is right-to-left
557 // (views::Button, for example). This method is helpful for such classes 552 // (views::Button, for example). This method is helpful for such classes
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
1569 // Belongs to this view, but it's reference-counted on some platforms 1564 // Belongs to this view, but it's reference-counted on some platforms
1570 // so we can't use a scoped_ptr. It's dereferenced in the destructor. 1565 // so we can't use a scoped_ptr. It's dereferenced in the destructor.
1571 NativeViewAccessibility* native_view_accessibility_; 1566 NativeViewAccessibility* native_view_accessibility_;
1572 1567
1573 DISALLOW_COPY_AND_ASSIGN(View); 1568 DISALLOW_COPY_AND_ASSIGN(View);
1574 }; 1569 };
1575 1570
1576 } // namespace views 1571 } // namespace views
1577 1572
1578 #endif // UI_VIEWS_VIEW_H_ 1573 #endif // UI_VIEWS_VIEW_H_
OLDNEW
« no previous file with comments | « ui/views/style/mac/combobox_background_mac.cc ('k') | ui/views/view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698