Skip to content

Commit

Permalink
Better RTS support around tab preview panel #3689
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Jan 7, 2025
1 parent e204b43 commit d96425a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 8 additions & 2 deletions webextensions/resources/module/tab-preview-frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ try{
box-shadow: var(--panel-shadow);
box-sizing: border-box;
color: var(--panel-color);
direction: ltr;
font: Message-Box;
left: auto;
line-height: 1.5;
Expand All @@ -145,6 +146,9 @@ try{
right: auto;
z-index: ${Number.MAX_SAFE_INTEGER}; /* for SIDEBAR and TAB case */
}
.tab-preview-panel.rtl {
direction: rtl;
}
.tab-preview-panel.animation {
transition: var(--tab-preview-panel-show-hide-animation),
left 0.1s ease-out,
Expand Down Expand Up @@ -417,7 +421,7 @@ function preparePanel() {
panel = createdPanel;
}

function updatePanel({ previewTabId, title, url, tooltipHtml, hasPreview, previewURL, previewTabRect, offsetTop, align, scale, logging, animation, backgroundColor, borderColor, color } = {}) {
function updatePanel({ previewTabId, title, url, tooltipHtml, hasPreview, previewURL, previewTabRect, offsetTop, align, rtl, scale, logging, animation, backgroundColor, borderColor, color } = {}) {
if (!panel)
return;

Expand All @@ -428,7 +432,7 @@ function updatePanel({ previewTabId, title, url, tooltipHtml, hasPreview, previe
hasPreview = hasLoadablePreviewURL;

if (logging)
console.log('updatePanel ', { previewTabId, title, url, tooltipHtml, hasPreview, previewURL, previewTabRect, offsetTop, align, scale });
console.log('updatePanel ', { previewTabId, title, url, tooltipHtml, hasPreview, previewURL, previewTabRect, offsetTop, align, rtl, scale });

panel.classList.add('updating');
panel.classList.toggle('animation', animation);
Expand Down Expand Up @@ -470,6 +474,8 @@ function updatePanel({ previewTabId, title, url, tooltipHtml, hasPreview, previe
if (align)
panel.dataset.align = align;

panel.classList.toggle('rtl', !!rtl);

const previewImage = panel.querySelector('.tab-preview-image');
previewImage.classList.toggle('blank', !hasPreview && !hasLoadablePreviewURL);
if (!previewURL ||
Expand Down
3 changes: 2 additions & 1 deletion webextensions/sidebar/tab-preview-tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,8 @@ async function onTabSubstanceEnter(event) {
/* These information is used to calculate offset of the sidebar header */
offsetTop: window.mozInnerScreenY - window.screenY,
offsetLeft: window.mozInnerScreenX - window.screenX,
align: mayBeRight || isRTL() ? 'right' : 'left',
align: mayBeRight ? 'right' : 'left',
rtl: isRTL(),
scale: 1 / window.devicePixelRatio,
hasCustomTooltip,
...(hasCustomTooltip ?
Expand Down

0 comments on commit d96425a

Please sign in to comment.