detached e337302

omnibox: render favicon inside 20x20 circular wrapper chip (match homepage); prevents stretching and ensures consistent round shape

commit
e337302d5ba3d5f39c33b3d4c437db4478b1825c
author
bamen · · 2025-09-09 18:12 UTC
committer
bamen · · 2025-09-09 17:03 UTC
parent
c6e3d36
signature
unsigned
1 file · +7 -5
M pkg/webkit/ucm_js_cgo.go +7 -5
@@ -168,13 +168,15 @@ func getOmniboxScript() string {
168168 H.suggestions.forEach((s, i)=>{
169169 const item = document.createElement('div');
170170 item.style.cssText = 'padding:8px 10px;display:flex;gap:10px;align-items:center;cursor:pointer;border-bottom:1px solid #2a2a2a;'+(i===H.selectedIndex?'background:#0a0a0a;':'');
171- // Favicon
171+ // Favicon chip (wrapper ensures perfect circle sizing)
172+ const chip = document.createElement('div');
173+ chip.style.cssText = 'flex:0 0 20px;width:20px;height:20px;border-radius:50%;background:#ccc;border:1px solid rgba(0,0,0,.12);box-shadow:0 1px 2px rgba(0,0,0,.12);display:flex;align-items:center;justify-content:center;';
172174 const icon = document.createElement('img');
173175 icon.src = s.favicon || '';
174176 icon.width = 16; icon.height = 16; icon.loading = 'lazy';
175- // Circular chip with light gray background for consistent contrast
176- icon.style.cssText = 'flex:0 0 20px;width:16px;height:16px;padding:2px;box-sizing:content-box;border-radius:50%;background:#ccc;border:1px solid rgba(0,0,0,.12);box-shadow:0 1px 2px rgba(0,0,0,.12);filter:brightness(1.06) contrast(1.03);';
177- icon.onerror = ()=>{ icon.style.display='none'; };
177+ icon.style.cssText = 'width:16px;height:16px;filter:brightness(1.06) contrast(1.03);image-rendering:-webkit-optimize-contrast;';
178+ icon.onerror = ()=>{ chip.style.display='none'; };
179+ chip.appendChild(icon);
178180 // Text line: Domain | full path (one line, fade at end)
179181 let domain = '', path = '';
180182 try { const u = new URL(s.url, window.location.href); domain = u.hostname; path = (u.pathname||'') + (u.search||'') + (u.hash||''); } catch(_) { domain = s.url || ''; }
@@ -187,7 +189,7 @@ func getOmniboxScript() string {
187189 const sep = document.createElement('span'); sep.textContent = ' | '; sep.style.cssText = 'color:#777;';
188190 const pathEl = document.createElement('span'); pathEl.textContent = path || '/'; pathEl.style.cssText = 'color:#9ad;';
189191 text.appendChild(domainEl); text.appendChild(sep); text.appendChild(pathEl);
190- item.appendChild(icon); item.appendChild(text);
192+ item.appendChild(chip); item.appendChild(text);
191193 item.addEventListener('mouseenter', ()=>{ H.selectedIndex = i; H.paintList(); H.scrollListToSelection(); H.setFaded(true); });
192194 item.addEventListener('click',()=>{ H.post({type:'navigate', url:s.url}); H.toggle(false); });
193195 list.appendChild(item);
@@ -168,13 +168,15 @@ func getOmniboxScript() string {
168 H.suggestions.forEach((s, i)=>{168 H.suggestions.forEach((s, i)=>{
169 const item = document.createElement('div');169 const item = document.createElement('div');
170 item.style.cssText = 'padding:8px 10px;display:flex;gap:10px;align-items:center;cursor:pointer;border-bottom:1px solid #2a2a2a;'+(i===H.selectedIndex?'background:#0a0a0a;':'');170 item.style.cssText = 'padding:8px 10px;display:flex;gap:10px;align-items:center;cursor:pointer;border-bottom:1px solid #2a2a2a;'+(i===H.selectedIndex?'background:#0a0a0a;':'');
171- // Favicon171+ // Favicon chip (wrapper ensures perfect circle sizing)
172+ const chip = document.createElement('div');
173+ chip.style.cssText = 'flex:0 0 20px;width:20px;height:20px;border-radius:50%;background:#ccc;border:1px solid rgba(0,0,0,.12);box-shadow:0 1px 2px rgba(0,0,0,.12);display:flex;align-items:center;justify-content:center;';
172 const icon = document.createElement('img');174 const icon = document.createElement('img');
173 icon.src = s.favicon || '';175 icon.src = s.favicon || '';
174 icon.width = 16; icon.height = 16; icon.loading = 'lazy';176 icon.width = 16; icon.height = 16; icon.loading = 'lazy';
175- // Circular chip with light gray background for consistent contrast177+ icon.style.cssText = 'width:16px;height:16px;filter:brightness(1.06) contrast(1.03);image-rendering:-webkit-optimize-contrast;';
176- icon.style.cssText = 'flex:0 0 20px;width:16px;height:16px;padding:2px;box-sizing:content-box;border-radius:50%;background:#ccc;border:1px solid rgba(0,0,0,.12);box-shadow:0 1px 2px rgba(0,0,0,.12);filter:brightness(1.06) contrast(1.03);';178+ icon.onerror = ()=>{ chip.style.display='none'; };
177- icon.onerror = ()=>{ icon.style.display='none'; };179+ chip.appendChild(icon);
178 // Text line: Domain | full path (one line, fade at end)180 // Text line: Domain | full path (one line, fade at end)
179 let domain = '', path = '';181 let domain = '', path = '';
180 try { const u = new URL(s.url, window.location.href); domain = u.hostname; path = (u.pathname||'') + (u.search||'') + (u.hash||''); } catch(_) { domain = s.url || ''; }182 try { const u = new URL(s.url, window.location.href); domain = u.hostname; path = (u.pathname||'') + (u.search||'') + (u.hash||''); } catch(_) { domain = s.url || ''; }
@@ -187,7 +189,7 @@ func getOmniboxScript() string {
187 const sep = document.createElement('span'); sep.textContent = ' | '; sep.style.cssText = 'color:#777;';189 const sep = document.createElement('span'); sep.textContent = ' | '; sep.style.cssText = 'color:#777;';
188 const pathEl = document.createElement('span'); pathEl.textContent = path || '/'; pathEl.style.cssText = 'color:#9ad;';190 const pathEl = document.createElement('span'); pathEl.textContent = path || '/'; pathEl.style.cssText = 'color:#9ad;';
189 text.appendChild(domainEl); text.appendChild(sep); text.appendChild(pathEl);191 text.appendChild(domainEl); text.appendChild(sep); text.appendChild(pathEl);
190- item.appendChild(icon); item.appendChild(text);192+ item.appendChild(chip); item.appendChild(text);
191 item.addEventListener('mouseenter', ()=>{ H.selectedIndex = i; H.paintList(); H.scrollListToSelection(); H.setFaded(true); });193 item.addEventListener('mouseenter', ()=>{ H.selectedIndex = i; H.paintList(); H.scrollListToSelection(); H.setFaded(true); });
192 item.addEventListener('click',()=>{ H.post({type:'navigate', url:s.url}); H.toggle(false); });194 item.addEventListener('click',()=>{ H.post({type:'navigate', url:s.url}); H.toggle(false); });
193 list.appendChild(item);195 list.appendChild(item);

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close