1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 07:28:00 +01:00

Isolate hint nodes from page styles.

This commit is contained in:
Kris Maglione
2010-12-10 09:40:35 -05:00
parent 2f79dc44b7
commit 1c734e6709
4 changed files with 41 additions and 29 deletions

View File

@@ -13,6 +13,13 @@
</content> </content>
</binding> </binding>
<binding id="magic" inheritstyle="false">
<content>
<html:span xbl:inherits="dactyl:highlight=dactyl:highlight,number,style" />
</content>
</binding>
<binding id="compitem-td"> <binding id="compitem-td">
<!-- No white space. The table is white-space: pre; :( --> <!-- No white space. The table is white-space: pre; :( -->
<content><html:span class="td-strut"/><html:span class="td-span"><children/></html:span></content> <content><html:span class="td-strut"/><html:span class="td-span"><children/></html:span></content>

View File

@@ -146,7 +146,7 @@ const ConfigBase = Class(ModuleBase, {
* @property {string} The default highlighting rules. * @property {string} The default highlighting rules.
* See {@link Highlights#loadCSS} for details. * See {@link Highlights#loadCSS} for details.
*/ */
CSS: UTF8(<><![CDATA[ CSS: UTF8(String.replace(<><![CDATA[
// <css> // <css>
Boolean color: red; Boolean color: red;
Function color: navy; Function color: navy;
@@ -162,22 +162,14 @@ const ConfigBase = Class(ModuleBase, {
// Hack to give these groups slightly higher precedence // Hack to give these groups slightly higher precedence
// than their unadorned variants. // than their unadorned variants.
CmdCmdLine;[dactyl|highlight]>* CmdCmdLine;[dactyl|highlight]>* &#x0d; StatusCmdLine;[dactyl|highlight]>*
StatusCmdLine;[dactyl|highlight]>* CmdNormal;[dactyl|highlight] &#x0d; StatusNormal;[dactyl|highlight]
CmdNormal;[dactyl|highlight] CmdErrorMsg;[dactyl|highlight] &#x0d; StatusErrorMsg;[dactyl|highlight]
StatusNormal;[dactyl|highlight] CmdInfoMsg;[dactyl|highlight] &#x0d; StatusInfoMsg;[dactyl|highlight]
CmdErrorMsg;[dactyl|highlight] CmdModeMsg;[dactyl|highlight] &#x0d; StatusModeMsg;[dactyl|highlight]
StatusErrorMsg;[dactyl|highlight] CmdMoreMsg;[dactyl|highlight] &#x0d; StatusMoreMsg;[dactyl|highlight]
CmdInfoMsg;[dactyl|highlight] CmdQuestion;[dactyl|highlight] &#x0d; StatusQuestion;[dactyl|highlight]
StatusInfoMsg;[dactyl|highlight] CmdWarningMsg;[dactyl|highlight] &#x0d; StatusWarningMsg;[dactyl|highlight]
CmdModeMsg;[dactyl|highlight]
StatusModeMsg;[dactyl|highlight]
CmdMoreMsg;[dactyl|highlight]
StatusMoreMsg;[dactyl|highlight]
CmdQuestion;[dactyl|highlight]
StatusQuestion;[dactyl|highlight]
CmdWarningMsg;[dactyl|highlight]
StatusWarningMsg;[dactyl|highlight]
!Normal color: black !important; background: white !important; font-weight: normal !important; !Normal color: black !important; background: white !important; font-weight: normal !important;
!StatusNormal color: inherit !important; background: inherit !important; !StatusNormal color: inherit !important; background: inherit !important;
@@ -270,19 +262,21 @@ const ConfigBase = Class(ModuleBase, {
!Bell background-color: black !important; !Bell background-color: black !important;
Hint;;* { Hint;;* {
/* This gets released into the wild, so everything is important */ /* This gets released into the wild, so everything is important */
font: bold 10px monospace !important; font-size: 10px !important;
font-family: monospace !important;
font-weight: bold !important;
background-color: red !important; background-color: red !important;
color: white !important; color: white !important;
border: 0px solid ButtonShadow !important; border: 0px solid ButtonShadow !important;
padding: 0px 1px !important; padding: 0px 1px !important;
} }
!Hint::after;;* content: attr(number) !important; Hint::after;;* content: attr(number) !important;
!HintElem;;* background-color: yellow !important; color: black !important; HintElem;;* background-color: yellow !important; color: black !important;
!HintActive;;* background-color: #88FF00 !important; color: black !important; HintActive;;* background-color: #88FF00 !important; color: black !important;
!HintImage;;* opacity: .5 !important; HintImage;;* opacity: .5 !important;
// </css> // </css>
]]></>), ]]></>, /&#x0d;/g, "\n")),
helpCSS: UTF8(<><![CDATA[ helpCSS: UTF8(<><![CDATA[
// <css> // <css>

View File

@@ -287,7 +287,7 @@ const Hints = Module("hints", {
return true; return true;
} }
let baseNodeAbsolute = util.xmlToDom(<span highlight="Hint"/>, doc); let baseNodeAbsolute = util.xmlToDom(<span highlight="Hint" dactyl:class="magic" xmlns:dactyl={NS}/>, doc);
let mode = this._hintMode; let mode = this._hintMode;
let res = util.evaluateXPath(mode.xpath, doc, null, true); let res = util.evaluateXPath(mode.xpath, doc, null, true);
@@ -371,11 +371,11 @@ const Hints = Module("hints", {
* @param {boolean} active Whether it is the currently active hint or not. * @param {boolean} active Whether it is the currently active hint or not.
*/ */
_setClass: function _setClass(elem, active) { _setClass: function _setClass(elem, active) {
let prefix = (elem.getAttributeNS(NS, "class") || "") + " "; let prefix = (elem.getAttributeNS(NS, "hl") || "") + " ";
if (active) if (active)
elem.setAttributeNS(NS, "highlight", prefix + "HintActive"); highlight.highlightNode(elem, prefix + "HintActive");
else if (active != null) else if (active != null)
elem.setAttributeNS(NS, "highlight", prefix + "HintElem"); highlight.highlightNode(elem, prefix + "HintElem");
else else
elem.removeAttributeNS(NS, "highlight"); elem.removeAttributeNS(NS, "highlight");
}, },
@@ -412,7 +412,7 @@ const Hints = Module("hints", {
if (!rect) if (!rect)
continue; continue;
hint.imgSpan = util.xmlToDom(<span highlight="Hint" dactyl:class="HintImage" xmlns:dactyl={NS}/>, doc); hint.imgSpan = util.xmlToDom(<span dactyl:class="magic" dactyl:hl="Hint" dactyl:hl="HintImage" xmlns:dactyl={NS}/>, doc);
hint.imgSpan.style.left = (rect.left + offsetX) + "px"; hint.imgSpan.style.left = (rect.left + offsetX) + "px";
hint.imgSpan.style.top = (rect.top + offsetY) + "px"; hint.imgSpan.style.top = (rect.top + offsetY) + "px";
hint.imgSpan.style.width = (rect.right - rect.left) + "px"; hint.imgSpan.style.width = (rect.right - rect.left) + "px";

View File

@@ -3,7 +3,18 @@
/* Applied to all content */ /* Applied to all content */
[dactyl|activeframe] { [dactyl|activeframe] {
-moz-binding: url(chrome://dactyl/content/bindings.xml#frame); -moz-binding: url(chrome://dactyl/content/bindings.xml#frame) !important;
}
[dactyl|class~=magic] > [dactyl|highlight=Hint] {
visibility: visible !important;
}
[dactyl|class~=magic] {
-moz-binding: url(chrome://dactyl/content/bindings.xml#magic) !important;
visibility: hidden !important;
position: absolute !important;
top: 0 !important;
left: 0 !important;
} }
[dactyl|highlight~=HintImage], [dactyl|highlight~=HintImage],