Bug 407861 - Bolding the found text in autocomplete breaks ligatures. r=gavin, a1.9b5=beltzner, b-ff3=beltzner

This commit is contained in:
edward.lee@engineering.uiuc.edu 2008-03-20 14:43:08 -07:00
parent 4f17380fd1
commit 2036ee572a
4 changed files with 47 additions and 4 deletions

View File

@ -1273,6 +1273,23 @@
</body>
</method>
<method name="_needsAlternateEmphasis">
<parameter name="aText"/>
<body>
<![CDATA[
for (let i = aText.length; --i >= 0; ) {
let charCode = aText.charCodeAt(i);
// Arabic, Syriac, Indic languages are likely to have ligatures
// that are broken when using the main emphasis styling
if (0x0600 <= charCode && charCode <= 0x109F)
return true;
}
return false;
]]>
</body>
</method>
<method name="_setUpDescription">
<parameter name="aDescriptionElement"/>
<parameter name="aText"/>
@ -1287,6 +1304,10 @@
let tokens = this._getSearchTokens(search);
let indices = this._getBoundaryIndices(aText, tokens);
// If we're searching for something that needs alternate emphasis,
// we'll need to check the text that we match
let checkAlt = this._needsAlternateEmphasis(search);
let next;
let start = 0;
let len = indices.length;
@ -1300,7 +1321,8 @@
// Emphasize the text for even indices
let span = aDescriptionElement.appendChild(
document.createElementNS("http://www.w3.org/1999/xhtml", "span"));
span.className = "ac-emphasize-text";
span.className = checkAlt && this._needsAlternateEmphasis(text) ?
"ac-emphasize-alt" : "ac-emphasize-text";
span.textContent = text;
} else {
// Otherwise, it's plain text

View File

@ -174,13 +174,20 @@ treechildren.autocomplete-treebody::-moz-tree-cell-text(selected) {
padding: 0;
}
html|*.ac-emphasize-text {
.ac-normal-text > html|span {
margin: 0 !important;
padding: 0;
}
html|span.ac-emphasize-text {
font-weight: bold;
text-decoration: underline;
}
html|span.ac-emphasize-alt {
text-decoration: underline;
}
.ac-title, .ac-url {
overflow: hidden;
}

View File

@ -161,13 +161,20 @@ treechildren.autocomplete-treebody::-moz-tree-cell-text(selected) {
padding: 0;
}
html|*.ac-emphasize-text {
.ac-normal-text > html|span {
margin: 0 !important;
padding: 0;
}
html|span.ac-emphasize-text {
font-weight: bold;
text-decoration: underline;
}
html|span.ac-emphasize-alt {
text-decoration: underline;
}
.ac-title, .ac-url {
overflow: hidden;
}

View File

@ -162,13 +162,20 @@ treechildren.autocomplete-treebody::-moz-tree-cell-text(selected) {
padding: 0;
}
html|*.ac-emphasize-text {
.ac-normal-text > html|span {
margin: 0 !important;
padding: 0;
}
html|span.ac-emphasize-text {
font-weight: bold;
text-decoration: underline;
}
html|span.ac-emphasize-alt {
text-decoration: underline;
}
.ac-title, .ac-url {
overflow: hidden;
}