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)
Firefox
Address Bar
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
status-firefox47:
--- → unaffected
status-firefox48:
--- → affected
Component: Untriaged → Location Bar
Regression range:
https://hg.mozilla.org/integration/fx-team/pushloghtml?fromchange=c131636dae420773342d1439b6086b6c62b222f4&tochange=061165ac1ff9e076ec51ea268878efa751173511
Has Regression Range: --- → yes
Updated•9 years ago
|
Assignee | ||
Updated•9 years ago
|
Assignee: nobody → adw
Status: NEW → ASSIGNED
Assignee | ||
Comment 2•9 years ago
|
||
Tested with Force RTL.
Review commit: https://reviewboard.mozilla.org/r/45059/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/45059/
Attachment #8739137 -
Flags: review?(mak77)
Assignee | ||
Comment 3•9 years ago
|
||
Comment 4•9 years ago
|
||
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)
Assignee | ||
Comment 5•9 years ago
|
||
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)
Assignee | ||
Comment 6•9 years ago
|
||
Updated•9 years ago
|
Attachment #8739137 -
Flags: review?(mak77) → review+
Comment 7•9 years ago
|
||
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?
Assignee | ||
Comment 8•9 years ago
|
||
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";
}
Assignee | ||
Comment 10•9 years ago
|
||
Comment 11•9 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 48
Assignee | ||
Comment 12•9 years ago
|
||
A couple of more RTL bugs: bug 1263674, bug 1263698.
Comment 13•9 years ago
|
||
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.
Description
•