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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java

Issue 302283008: [Android] Fix AutofillPopup positioning in RTL mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ted's suggestion Created 6 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 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: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
index 9f4f37955409cfd8f12d13917a8b3160b6274327..c7b4968cb8214b730b9e00afb27c12268bdea913 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
@@ -48,6 +48,7 @@ import android.widget.FrameLayout;
import com.google.common.annotations.VisibleForTesting;
+import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.CalledByNative;
import org.chromium.base.CommandLine;
import org.chromium.base.JNINamespace;
@@ -440,12 +441,19 @@ public class ContentViewCore
int scaledWidth = Math.round(width * scale);
// ContentViewCore currently only supports these two container view types.
if (mContainerView instanceof FrameLayout) {
- if (scaledWidth + leftMargin > mContainerView.getWidth()) {
- scaledWidth = mContainerView.getWidth() - leftMargin;
+ int startMargin;
+ if (ApiCompatibilityUtils.isLayoutRtl(mContainerView)) {
+ startMargin = mContainerView.getMeasuredWidth()
+ - Math.round((width + x) * scale);
+ } else {
+ startMargin = leftMargin;
+ }
+ if (scaledWidth + startMargin > mContainerView.getWidth()) {
+ scaledWidth = mContainerView.getWidth() - startMargin;
}
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(
scaledWidth, Math.round(height * scale));
- lp.leftMargin = leftMargin;
+ ApiCompatibilityUtils.setMarginStart(lp, startMargin);
lp.topMargin = topMargin;
view.setLayoutParams(lp);
} else if (mContainerView instanceof android.widget.AbsoluteLayout) {
« 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