Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Get font preview to work again after the change in 8520d53 (related

to issue 2495)
  • Loading branch information...
commit 1ae347f3958bf02d80c2380ecaf8da4c57bab1ba 1 parent 8520d53
Sebastian Zartner authored April 26, 2012
26  extension/content/firebug/css/cssElementPanel.js
@@ -555,6 +555,26 @@ CSSElementPanel.prototype = Obj.extend(CSSStyleSheetPanel.prototype,
555 555
         return ret;
556 556
     },
557 557
 
  558
+    showInfoTip: function(infoTip, target, x, y, rangeParent, rangeOffset)
  559
+    {
  560
+        var prop = Dom.getAncestorByClass(target, "cssProp");
  561
+        if (prop)
  562
+            var propNameNode = prop.getElementsByClassName("cssPropName").item(0);
  563
+  
  564
+        if (propNameNode && (propNameNode.textContent.toLowerCase() == "font" ||
  565
+            propNameNode.textContent.toLowerCase() == "font-family"))
  566
+        {
  567
+            var prevSibling = target.previousElementSibling;
  568
+            while (prevSibling)
  569
+            {
  570
+                rangeOffset += prevSibling.textContent.length;
  571
+                prevSibling = prevSibling.previousElementSibling;
  572
+            }
  573
+        }
  574
+
  575
+        return CSSStyleSheetPanel.prototype.showInfoTip(infoTip, target, x, y, rangeParent, rangeOffset);
  576
+    },
  577
+
558 578
     updateContentState: function(state, remove)
559 579
     {
560 580
         if (FBTrace.DBG_CSS)
@@ -691,16 +711,16 @@ function getFontParts(element, value)
691 711
 
692 712
         fontParts.before += fonts[i];
693 713
         if (i < fonts.length-1)
694  
-            fontParts.before += ", ";
  714
+            fontParts.before += ",";
695 715
     }
696 716
 
697 717
     if (i < fonts.length-1)
698  
-        fontParts.after = ", ";
  718
+        fontParts.after = ",";
699 719
     for (++i; i < fonts.length; ++i)
700 720
     {
701 721
         fontParts.after += fonts[i];
702 722
         if (i < fonts.length-1)
703  
-            fontParts.after += ", ";
  723
+            fontParts.after += ",";
704 724
     }
705 725
 
706 726
     return fontParts;
4  extension/content/firebug/css/cssPanel.js
@@ -1114,7 +1114,9 @@ Firebug.CSSStyleSheetPanel.prototype = Obj.extend(Firebug.Panel,
1114 1114
     showInfoTip: function(infoTip, target, x, y, rangeParent, rangeOffset)
1115 1115
     {
1116 1116
         var propValue = Dom.getAncestorByClass(target, "cssPropValue");
1117  
-        var propNameNode = target.parentNode.getElementsByClassName("cssPropName").item(0);
  1117
+        var prop = Dom.getAncestorByClass(target, "cssProp");
  1118
+        if (prop)
  1119
+            var propNameNode = prop.getElementsByClassName("cssPropName").item(0);
1118 1120
 
1119 1121
         if (propValue)
1120 1122
         {

0 notes on commit 1ae347f

Please sign in to comment.
Something went wrong with that request. Please try again.