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

Unified Diff: chrome/views/tree_view.cc

Issue 11253: Fixes trees on Hebrew locales. The current code was problematic... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/views/tree_view.cc
===================================================================
--- chrome/views/tree_view.cc (revision 5560)
+++ chrome/views/tree_view.cc (working copy)
@@ -642,16 +642,40 @@
if (canvas.isEmpty())
return 0;
- HDC dc = canvas.beginPlatformPaint();
+ HDC dc = canvas.beginPlatformPaint();
if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) {
// ChromeCanvas ends up configuring the DC with a mode of GM_ADVANCED.
// For some reason a graphics mode of ADVANCED triggers all the text
// to be mirrored when RTL. Set the mode back to COMPATIBLE and
- // explicitly set the layout.
+ // explicitly set the layout. Additionally SetWorldTransform and
+ // COMPATIBLE don't play nicely together. We need to use
+ // SetViewportOrgEx when using a mode of COMPATIBLE.
+ //
+ // Reset the transform to the identify transform. Even though
+ // SetWorldTransform and COMPATIBLE don't play nicely, bits of the
+ // transform still carry over when we set the mode.
+ XFORM xform = {0};
+ xform.eM11 = xform.eM22 = 1;
+ SetWorldTransform(dc, &xform);
+
+ // Set the mode and layout.
SetGraphicsMode(dc, GM_COMPATIBLE);
SetLayout(dc, LAYOUT_RTL);
+
+ // Transform the viewport such that the origin of the dc is that of
+ // the dirty region. This way when we invoke WM_PRINTCLIENT tree-view
+ // draws the dirty region at the origin of the DC so that when we
+ // copy the bits everything lines up nicely. Without this we end up
+ // copying the upper-left corner to the redraw region.
+ SetViewportOrgEx(dc, -canvas.paintStruct().rcPaint.left,
+ -canvas.paintStruct().rcPaint.top, NULL);
}
SendMessage(window, WM_PRINTCLIENT, reinterpret_cast<WPARAM>(dc), 0);
+ if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) {
+ // Reset the origin of the dc back to 0. This way when we copy the bits
+ // over we copy the right bits.
+ SetViewportOrgEx(dc, 0, 0, NULL);
+ }
canvas.endPlatformPaint();
return 0;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698