Closed Bug 1262686 Opened 9 years ago Closed 9 years ago

Don't use margin-left on PopupAutoCompleteRichResult with RTL locales

Categories

(Firefox :: Address Bar, defect, P1)

defect

Tracking

()

VERIFIED FIXED
Firefox 48
Tracking Status
firefox47 --- unaffected
firefox48 --- verified

People

(Reporter: magicp.jp, Assigned: adw)

References

Details

(Whiteboard: [fxsearch])

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0 Build ID: 20160406030221 Steps to reproduce: 1. Start latest Nightly with RTL locales (e.g. Arabic) 2. Enter any keywords in urlbar Actual results: The PopupAutoCompleteRichResult does not fit into Firefox window size by wrong direction of margin. Expected results: The PopupAutoCompleteRichResult should be fit into Firefox window size.
Has STR: --- → yes
Component: Untriaged → Location Bar
Blocks: 1181078
Blocks: 1262507
Priority: -- → P1
Whiteboard: [fxsearch]
Assignee: nobody → adw
Status: NEW → ASSIGNED
Comment on attachment 8739137 [details] MozReview Request: Bug 1262686 - Properly align awesomebar popup with window on RTL locales. r?mak https://reviewboard.mozilla.org/r/45059/#review41587 ::: browser/base/content/urlbarBindings.xml:1365 (Diff revision 1) > var popupDirection = aElement.ownerDocument.defaultView.getComputedStyle(aElement).direction; > this.style.direction = popupDirection; > > - // Move left margin to the window border. > - let elementRect = aElement.getBoundingClientRect(); > - this.style.marginLeft = "-" + (elementRect.left - rect.left) + "px"; > + // Make the popup's starting margin negaxtive so that the start of the > + // popup aligns with the window border. > + if (popupDirection == "rtl") { Where is elementRect defined? You appear to have removed its definition....
Attachment #8739137 - Flags: review?(mak77)
Comment on attachment 8739137 [details] MozReview Request: Bug 1262686 - Properly align awesomebar popup with window on RTL locales. r?mak Review request updated; see interdiff: https://reviewboard.mozilla.org/r/45059/diff/1-2/
Attachment #8739137 - Flags: review?(mak77)
Attachment #8739137 - Flags: review?(mak77) → review+
Comment on attachment 8739137 [details] MozReview Request: Bug 1262686 - Properly align awesomebar popup with window on RTL locales. r?mak https://reviewboard.mozilla.org/r/45059/#review41591 ::: browser/base/content/urlbarBindings.xml:1368 (Diff revision 2) > - // Move left margin to the window border. > + // Make the popup's starting margin negaxtive so that the start of the > + // popup aligns with the window border. > let elementRect = aElement.getBoundingClientRect(); > - this.style.marginLeft = "-" + (elementRect.left - rect.left) + "px"; > + if (popupDirection == "rtl") { > + let offset = elementRect.right - rect.right > + this.style.marginRight = offset + "px"; Can we use style.MozMarginStart and have it do black magic for us?
That was the first thing I tried, but it didn't have any effect in LTR mode (didn't try RTL). I looked around in nsMenuPopupFrame.cpp but couldn't see why. I don't know if -moz-margin-start doesn't get parsed into the nsStyleMargin struct or what. But even if it did work, we still need to calculate the offset differently in the different directions. RTL uses rect.right's and LTR uses rect.left's, and as far as I know there's no rect.start. So there's not much benefit to using a single CSS selector vs. two anyway.
// Move left margin to the window border. let elementRect = aElement.getBoundingClientRect(); if (popupDirection == "rtl") { this.style.marginRight = "-" + (rect.right - elementRect.right) + "px"; } else { this.style.marginLeft = "-" + (elementRect.left - rect.left) + "px"; }
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 48
A couple of more RTL bugs: bug 1263674, bug 1263698.
Verified fixed across platforms using Latest 48.0a2 DevEdition, buildID 20160503004116. Tested using the Arabic locale and by forcing en-US to be RTL (created intl.uidirection.en string set to rtl)
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: