Browse files

Merge branch 'codemirror' of https://github.com/firebug/firebug into …

…codemirror
  • Loading branch information...
2 parents 176e8cf + 35ed6c5 commit 8fe9f00a340c1a967ef26a1c6b2ea7050707eb38 @farshidbeheshti farshidbeheshti committed May 9, 2013
Showing with 3,030 additions and 938 deletions.
  1. +4 −4 extension/chrome.manifest
  2. +1 −1 extension/content/firebug/branch.properties
  3. +23 −11 extension/content/firebug/chrome/chrome.js
  4. +8 −3 extension/content/firebug/chrome/menu.js
  5. +18 −4 extension/content/firebug/chrome/panelActivation.js
  6. +19 −62 extension/content/firebug/chrome/reps.js
  7. +1 −1 extension/content/firebug/console/commandLineExposed.js
  8. +22 −6 extension/content/firebug/console/commandLineInclude.js
  9. +1 −0 extension/content/firebug/console/console.js
  10. +209 −49 extension/content/firebug/console/eventMonitor.js
  11. +1 −1 extension/content/firebug/cookies/cookieReps.js
  12. +26 −6 extension/content/firebug/css/computedPanel.js
  13. +281 −17 extension/content/firebug/css/cssPanel.js
  14. +1 −1 extension/content/firebug/css/selectorModule.js
  15. +3 −3 extension/content/firebug/css/stylePanel.js
  16. +1 −1 extension/content/firebug/debugger/script/breakNotification.js
  17. +3 −0 extension/content/firebug/editor/editor.js
  18. +11 −9 extension/content/firebug/firebug.css
  19. +0 −2 extension/content/firebug/firebugOverlay.xul
  20. +1 −1 extension/content/firebug/firefox/bindings.xml
  21. +114 −41 extension/content/firebug/lib/css.js
  22. +11 −2 extension/content/firebug/lib/events.js
  23. +1 −1 extension/install.rdf
  24. +1 −0 extension/locale/en-US/cookies.properties
  25. +5 −0 extension/locale/en-US/firebug.properties
  26. +20 −3 extension/modules/storageService.js
  27. +1 −2 extension/skin/classic/breakOn.svg
  28. +1 −2 extension/skin/classic/breakOn/breakOnError.svg
  29. +1 −2 extension/skin/classic/breakOn/breakOnMutate.svg
  30. +1 −2 extension/skin/classic/breakOn/breakOnNext.svg
  31. +1 −2 extension/skin/classic/breakOn/breakOnXHR.svg
  32. +4 −3 extension/skin/classic/breakOnArmed.svg
  33. +0 −4 extension/skin/classic/breakpoint.css
  34. +7 −9 extension/skin/classic/breakpointCondition.svg
  35. BIN extension/skin/classic/condBorders.png
  36. BIN extension/skin/classic/condBordersUps.png
  37. BIN extension/skin/classic/condCorners.png
  38. BIN extension/skin/classic/condCornersUps.png
  39. BIN extension/skin/classic/console-error-caret.png
  40. +2 −2 extension/skin/classic/console.css
  41. +1 −2 extension/skin/classic/cookies/breakOnCookie.svg
  42. +4 −4 extension/skin/classic/css.css
  43. +2 −23 extension/skin/classic/debugger.css
  44. +35 −0 extension/skin/classic/errorColumnIndicator.svg
  45. +480 −533 extension/skin/classic/firebug.css
  46. +2 −1 extension/skin/classic/html.css
  47. +39 −0 extension/skin/classic/mac/breakpointConditionEditor.svg
  48. +39 −0 extension/skin/classic/mac/breakpointConditionEditorDown.svg
  49. +12 −18 extension/skin/classic/mac/debugger.css
  50. +2 −2 extension/skin/classic/mac/firebug.css
  51. +37 −0 extension/skin/classic/mac/optionsMenuTarget.svg
  52. +40 −0 extension/skin/classic/mac/optionsMenuTargetHover.svg
  53. +5 −13 extension/skin/classic/mac/panel.css
  54. BIN extension/skin/classic/mac/search-panel-down.png
  55. BIN extension/skin/classic/mac/search-panel.png
  56. +39 −0 extension/skin/classic/mac/searchPanel.svg
  57. +40 −0 extension/skin/classic/mac/searchPanelDown.svg
  58. BIN extension/skin/classic/mac/twistyClosed.png
  59. +36 −0 extension/skin/classic/mac/twistyClosed.svg
  60. BIN extension/skin/classic/mac/twistyOpen.png
  61. +36 −0 extension/skin/classic/mac/twistyOpen.svg
  62. BIN extension/skin/classic/tabMenuTarget.png
  63. BIN extension/skin/classic/tabMenuTargetHover.png
  64. +94 −0 extension/skin/classic/win/breakpointConditionEditor.svg
  65. +220 −0 extension/skin/classic/win/breakpointConditionEditorDown.svg
  66. +33 −0 extension/skin/classic/win/debugger.css
  67. +36 −0 extension/skin/classic/win/optionsMenuTarget.svg
  68. +38 −0 extension/skin/classic/win/optionsMenuTargetHover.svg
  69. +3 −7 extension/skin/classic/win/panel.css
  70. BIN extension/skin/classic/win/tabMenuTarget.png
  71. BIN extension/skin/classic/win/tabMenuTargetHover.png
  72. BIN extension/skin/classic/win/twistyClosed.png
  73. +80 −0 extension/skin/classic/win/twistyClosed.svg
  74. BIN extension/skin/classic/win/twistyOpen.png
  75. +83 −0 extension/skin/classic/win/twistyOpen.svg
  76. +13 −13 tests/FBTest/content/FBTestFirebug.js
  77. +5 −2 tests/FBTest/defaults/preferences/prefs.js
  78. +1 −1 tests/FBTest/skin/classic/tabView.css
  79. +4 −4 tests/FBTest/skin/classic/testList.css
  80. +3 −3 tests/FBTest/skin/classic/testResult.css
  81. BIN tests/FBTest/skin/classic/twistyClosed.png
  82. +80 −0 tests/FBTest/skin/classic/twistyClosed.svg
  83. BIN tests/FBTest/skin/classic/twistyOpen.png
  84. +83 −0 tests/FBTest/skin/classic/twistyOpen.svg
  85. +1 −1 tests/content/_common/tabView.css
  86. +4 −4 tests/content/_common/testList.css
  87. +3 −3 tests/content/_common/testResult.css
  88. +80 −0 tests/content/_common/twistyClosed.svg
  89. +83 −0 tests/content/_common/twistyOpen.svg
  90. +4 −1 tests/content/commandLine/6291/issue6291.html
  91. +16 −15 tests/content/commandLine/6291/issue6291.js
  92. +1 −1 tests/content/console/3042/issue3042.js
  93. +4 −3 tests/content/console/5945/issue5945.js
  94. +17 −1 tests/content/css/2976/issue2976.js
  95. +4 −1 tests/content/css/4411/issue4411.js
  96. +5 −1 tests/content/css/4460/issue4460.js
  97. +9 −5 tests/content/css/5644/issue5644.js
  98. +42 −0 tests/content/css/6405/issue6405.html
  99. +68 −0 tests/content/css/6405/issue6405.js
  100. +2 −2 tests/content/css/computed/5449/issue5449.js
  101. +2 −1 tests/content/firebug.html
  102. +1 −1 tests/content/net/654/issue654.js
  103. +6 −1 tests/content/search/4602/issue4602.js
  104. +2 −2 trace/FBTrace/chrome/skin/classic/console.css
  105. +2 −2 trace/FBTrace/chrome/skin/classic/mac/panel.css
  106. +2 −2 trace/FBTrace/chrome/skin/classic/mac/traceConsole.css
  107. BIN trace/FBTrace/chrome/skin/classic/mac/twistyClosed.png
  108. +36 −0 trace/FBTrace/chrome/skin/classic/mac/twistyClosed.svg
  109. BIN trace/FBTrace/chrome/skin/classic/mac/twistyOpen.png
  110. +36 −0 trace/FBTrace/chrome/skin/classic/mac/twistyOpen.svg
  111. +4 −4 trace/FBTrace/chrome/skin/classic/traceConsole.css
  112. +2 −2 trace/FBTrace/chrome/skin/classic/win/panel.css
  113. +2 −2 trace/FBTrace/chrome/skin/classic/win/traceConsole.css
  114. BIN trace/FBTrace/chrome/skin/classic/win/twistyClosed.png
  115. +80 −0 trace/FBTrace/chrome/skin/classic/win/twistyClosed.svg
  116. BIN trace/FBTrace/chrome/skin/classic/win/twistyOpen.png
  117. +83 −0 trace/FBTrace/chrome/skin/classic/win/twistyOpen.svg
View
8 extension/chrome.manifest
@@ -48,10 +48,10 @@ locale firebug zh-CN locale/zh-CN/
locale firebug zh-TW locale/zh-TW/
# Support for Mac
-override chrome://firebug/skin/debugger.css chrome://firebug/skin/mac/debugger.css os=Darwin
-override chrome://firebug-os/skin/firebug.css chrome://firebug/skin/mac/firebug.css os=Darwin
-override chrome://firebug-os/skin/panel.css chrome://firebug/skin/mac/panel.css os=Darwin
-override chrome://firebug-os/skin/window.css chrome://firebug/skin/mac/window.css os=Darwin
+override chrome://firebug-os/skin/debugger.css chrome://firebug/skin/mac/debugger.css os=Darwin
+override chrome://firebug-os/skin/firebug.css chrome://firebug/skin/mac/firebug.css os=Darwin
+override chrome://firebug-os/skin/panel.css chrome://firebug/skin/mac/panel.css os=Darwin
+override chrome://firebug-os/skin/window.css chrome://firebug/skin/mac/window.css os=Darwin
# Support for Linux
override chrome://firebug-os/skin/firebug.css chrome://firebug/skin/linux/firebug.css os=Linux
View
2 extension/content/firebug/branch.properties
@@ -1,5 +1,5 @@
# DO NOT MERGE INTO TRUNK
-RELEASE=.0a4
+RELEASE=.0a5
VERSION=1.12
TRUNK=
# To allow build.xml to drop the xpi directly into the svn working copy for getfirebug.com
View
34 extension/content/firebug/chrome/chrome.js
@@ -2094,32 +2094,44 @@ function onPanelMouseUp(event)
{
var selection = event.target.ownerDocument.defaultView.getSelection();
var target = selection.focusNode || event.target;
- if (selection.focusNode === selection.anchorNode)
+
+ if (Dom.getAncestorByClass(selection.focusNode, "editable") ===
+ Dom.getAncestorByClass(selection.anchorNode, "editable"))
{
var editable = Dom.getAncestorByClass(target, "editable");
if (editable || Css.hasClass(event.target, "inlineExpander"))
{
var selectionData;
- var selFO = selection.focusOffset,selAO = selection.anchorOffset;
+ var unselectedRange = event.target.ownerDocument.createRange();
+ var selectedRange = selection.getRangeAt(0);
+ unselectedRange.setStart(editable.firstElementChild || editable, 0);
+ unselectedRange.setEnd(selectedRange.startContainer, selectedRange.startOffset);
- // selection is collapsed
- if (selFO == selAO)
+ if (selectedRange.collapsed)
{
var distance = Math.abs(event.screenX - this.lastMouseDownPosition.x) +
Math.abs(event.screenY - this.lastMouseDownPosition.y);
// If mouse has moved far enough, set selection at that point
if (distance > 3)
- selectionData = {start: selFO, end: selFO};
+ {
+ selectionData =
+ {
+ start: selectedRange.startOffset,
+ end: selectedRange.endOffset
+ };
+ }
// otherwise leave selectionData undefined to select all text
}
- else if (selFO < selAO)
- {
- selectionData = {start: selFO, end: selAO};
- }
else
{
- selectionData = {start: selAO, end: selFO};
+ var unselectedRangeLength = unselectedRange.toString().length;
+ var selectedRangeLength = selection.getRangeAt(0).toString().length;
+ selectionData =
+ {
+ start: unselectedRangeLength,
+ end: unselectedRangeLength + selectedRangeLength
+ };
}
if (editable)
@@ -2128,7 +2140,7 @@ function onPanelMouseUp(event)
}
else
{
- Firebug.Editor.setSelection(selectionData || {start: selFO, end: selFO});
+ Firebug.Editor.setSelection(selectionData);
selection.removeAllRanges();
}
View
11 extension/content/firebug/chrome/menu.js
@@ -95,9 +95,6 @@ Menu.setItemIntoElement = function(element, item)
if (item.type == "checkbox" && !item.closemenu)
element.setAttribute("closemenu", "none");
- if (item.checked)
- element.setAttribute("checked", "true");
-
if (item.disabled)
element.setAttribute("disabled", "true");
@@ -134,7 +131,15 @@ Menu.setItemIntoElement = function(element, item)
element.setAttribute("name", item.name);
if (item.items && (item.command || item.commandID))
+ {
element.setAttribute("type", "splitmenu");
+ element.setAttribute("iconic", "true");
+ }
+
+ // xxxHonza: must be done after 'type' == 'splitmenu' otherwise the menu-item
+ // is not checked (the check icon is not displayed from some reason).
+ if (item.checked)
+ element.setAttribute("checked", "true");
return element;
};
View
22 extension/content/firebug/chrome/panelActivation.js
@@ -6,10 +6,11 @@ define([
"firebug/chrome/firefox",
"firebug/lib/locale",
"firebug/lib/domplate",
+ "firebug/lib/xpcom",
"firebug/lib/url",
- "firebug/lib/dom",
+ "firebug/lib/dom"
],
-function(Obj, Firebug, Firefox, Locale, Domplate, Url, Dom) {
+function(Obj, Firebug, Firefox, Locale, Domplate, Xpcom, Url, Dom) {
// ************************************************************************************************
// Constants
@@ -18,7 +19,7 @@ const Cc = Components.classes;
const Ci = Components.interfaces;
const prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
-
+const prompts = Xpcom.CCSV("@mozilla.org/embedcomp/prompt-service;1", "nsIPromptService");
/**
* @module Implements Panel activation logic. A Firebug panel can support activation in order
@@ -223,8 +224,21 @@ Firebug.PanelActivation = Obj.extend(Firebug.Module,
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// UI commands
- clearAnnotations: function()
+ clearAnnotations: function(force)
{
+ if (!force)
+ {
+ var check = {value: false};
+ var flags = prompts.BUTTON_POS_0 * prompts.BUTTON_TITLE_YES +
+ prompts.BUTTON_POS_1 * prompts.BUTTON_TITLE_NO;
+
+ if (!prompts.confirmEx(Firebug.chrome.window, Locale.$STR("Firebug"),
+ Locale.$STR("annotations.confirm.clear"), flags, "", "", "", null, check) == 0)
+ {
+ return;
+ }
+ }
+
Firebug.connection.clearAnnotations();
},
View
81 extension/content/firebug/chrome/reps.js
@@ -25,7 +25,6 @@ define([
"firebug/lib/string",
"firebug/lib/xml",
"firebug/dom/toggleBranch",
- "firebug/console/eventMonitor",
"firebug/console/closureInspector",
"firebug/chrome/menu",
"arch/compilationunit",
@@ -1485,23 +1484,10 @@ FirebugReps.Element = domplate(Firebug.Rep,
}
]);
}
-
+
items = items.concat([
"-",
{
- label: "ShowEventsInConsole",
- tooltiptext: "html.tip.Show_Events_In_Console",
- id: "fbShowEventsInConsole",
- type: "checkbox",
- checked: EventMonitor.areEventsMonitored(elt, null, context),
- command: function()
- {
- var checked = this.hasAttribute("checked");
- EventMonitor.toggleMonitorEvents(elt, null, !checked, context);
- }
- },
- "-",
- {
label: "ScrollIntoView",
tooltiptext: "html.tip.Scroll_Into_View",
id: "fbScrollIntoView",
@@ -1734,6 +1720,15 @@ FirebugReps.CSSRule = domplate(Firebug.Rep,
{
return "CSSStyleRule";
}
+ else if (window.CSSSupportsRule && rule instanceof window.CSSSupportsRule)
+ {
+ return "CSSSupportsRule";
+ }
+ else if ((window.CSSDocumentRule && rule instanceof window.CSSDocumentRule) ||
+ rule instanceof window.CSSMozDocumentRule)
+ {
+ return "CSSDocumentRule";
+ }
else if (rule instanceof window.CSSFontFaceRule)
{
return "CSSFontFaceRule";
@@ -1778,6 +1773,15 @@ FirebugReps.CSSRule = domplate(Firebug.Rep,
{
return rule.selectorText;
}
+ else if (window.CSSSupportsRule && rule instanceof window.CSSSupportsRule)
+ {
+ return rule.conditionText;
+ }
+ else if ((window.CSSDocumentRule && rule instanceof window.CSSDocumentRule) ||
+ rule instanceof window.CSSMozDocumentRule)
+ {
+ return rule.conditionText;
+ }
else if (rule instanceof window.CSSFontFaceRule)
{
return rule.style.getPropertyValue("font-family");
@@ -1962,52 +1966,6 @@ FirebugReps.Event = domplate(Firebug.Rep,
// ********************************************************************************************* //
-FirebugReps.EventLog = domplate(FirebugReps.Event,
-{
- className: "eventLog",
-
- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
- tag:
- TAG("$copyEventTag", {object: "$object|copyEvent"}),
-
- copyEventTag:
- SPAN(
- OBJECTLINK("$object|summarizeEvent"),
- SPAN("&nbsp"),
- SPAN("&#187;"),
- SPAN("&nbsp"),
- TAG("$object|getTargetTag", {object: "$object|getTarget"})
- ),
-
- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
- copyEvent: function(log)
- {
- return new Dom.EventCopy(log.event);
- },
-
- getTarget: function(event)
- {
- return event.target;
- },
-
- getTargetTag: function(event)
- {
- var rep = Firebug.getRep(event.target);
- return rep.shortTag ? rep.shortTag : rep.tag;
- },
-
- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
- supportsObject: function(object, type)
- {
- return object instanceof EventMonitor.EventLog;
- },
-});
-
-// ********************************************************************************************* //
-
FirebugReps.SourceLink = domplate(Firebug.Rep,
{
tag:
@@ -2800,7 +2758,6 @@ Firebug.registerRep(
FirebugReps.Date,
FirebugReps.NamedNodeMap,
FirebugReps.Reference,
- FirebugReps.EventLog,
FirebugReps.ClosureScope,
FirebugReps.OptimizedAway
);
View
2 extension/content/firebug/console/commandLineExposed.js
@@ -314,7 +314,7 @@ function evaluate(context, win, expr, origExpr, onSuccess, onError)
{
// Change source and line number of exceptions from commandline code
// create new error since properties of nsIXPCException are not modifiable.
- // Example of code raising nsIXPCException: `alert()` (without arguments)
+ // Example of code raising nsIXPCException: `alert({toString: function(){ throw "blah"; }})`
// xxxFlorent: FIXME: we can't get the right stack trace with this example:
// function a(){
View
28 extension/content/firebug/console/commandLineInclude.js
@@ -25,6 +25,7 @@ const Ci = Components.interfaces;
const Cu = Components.utils;
const removeConfirmation = "commandline.include.removeConfirmation";
const prompts = Xpcom.CCSV("@mozilla.org/embedcomp/prompt-service;1", "nsIPromptService");
+const storeFilename = "includeAliases.json";
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -41,8 +42,13 @@ catch(ex)
// Scratchpad does not exists (when using Seamonkey ...)
}
-var storageScope = {};
+var storageScope = {}, StorageService;
Cu.import("resource://firebug/storageService.js", storageScope);
+StorageService = storageScope.StorageService;
+
+var defaultAliases = {
+ "jquery": "http://code.jquery.com/jquery-latest.js"
+};
// ********************************************************************************************* //
// Implementation
@@ -340,14 +346,22 @@ var CommandLineInclude = Obj.extend(Firebug.Module,
{
if (!this.store)
{
+ var isNewStore = !StorageService.hasStorage(storeFilename);
// Pass also the parent window to the new storage. The window will be
// used to figure out whether the browser is running in private mode.
// If yes, no data will be persisted.
- this.store = storageScope.StorageService.getStorage("includeAliases.json",
+ this.store = StorageService.getStorage(storeFilename,
Firebug.chrome.window);
+
+ // If the file did not exist, we put in there the default aliases.
+ if (isNewStore)
+ {
+ for (var alias in defaultAliases)
+ this.store.setItem(alias, defaultAliases[alias]);
+ }
}
- // let's log when the store could not be opened:
+ // Let's log when the store could not be opened.
if (!this.store)
{
if (FBTrace.DBG_COMMANDLINE)
@@ -499,9 +513,11 @@ var CommandLineInclude = Obj.extend(Firebug.Module,
resetAllOptions: function()
{
- var store = this.getStore();
- if (store)
- store.clear(true);
+ if (StorageService.hasStorage(storeFilename))
+ {
+ StorageService.removeStorage(storeFilename);
+ this.store = null;
+ }
}
});
View
1 extension/content/firebug/console/console.js
@@ -14,6 +14,7 @@ define([
"firebug/console/consolePanel",
"firebug/console/commandEditor",
"firebug/console/functionMonitor",
+ "firebug/console/eventMonitor",
"firebug/console/performanceTiming",
],
function(Obj, Firebug, Firefox, Events, Win, Search, Xml, Options) {
View
258 extension/content/firebug/console/eventMonitor.js
@@ -6,8 +6,12 @@ define([
"firebug/lib/trace",
"firebug/lib/events",
"firebug/lib/locale",
+ "firebug/lib/dom",
+ "firebug/lib/domplate",
+ "firebug/chrome/reps",
+ "firebug/chrome/menu",
],
-function(Obj, Firebug, FBTrace, Events, Locale) {
+function(Obj, Firebug, FBTrace, Events, Locale, Dom, Domplate, FirebugReps, Menu) {
// ********************************************************************************************* //
// EventMonitor Module
@@ -19,15 +23,27 @@ var EventMonitor = Obj.extend(Firebug.Module,
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Module
+ initialize: function()
+ {
+ Firebug.Module.initialize.apply(this, arguments);
+ Firebug.registerUIListener(this);
+ },
+
+ shutdown: function()
+ {
+ Firebug.unregisterUIListener(this);
+ Firebug.Module.shutdown.apply(this, arguments);
+ },
+
destroyContext: function(context, persistedState)
{
// Clean up all existing monitors.
- var eventsMonitored = context.eventsMonitored;
- if (eventsMonitored)
+ var monitoredEvents = context.monitoredEvents;
+ if (monitoredEvents)
{
- for (var i=0; i<eventsMonitored.length; ++i)
+ for (var i=0; i<monitoredEvents.length; ++i)
{
- var m = eventsMonitored[i];
+ var m = monitoredEvents[i];
if (!m.type)
Events.detachAllListeners(m.object, context.onMonitorEvent, context);
@@ -40,12 +56,12 @@ var EventMonitor = Obj.extend(Firebug.Module,
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Event Monitor
- toggleMonitorEvents: function(object, types, state, context)
+ toggleMonitorEvents: function(object, types, monitor, context)
{
- if (state)
- this.unmonitorEvents(object, types, context);
- else
+ if (monitor)
this.monitorEvents(object, types, context);
+ else
+ this.unmonitorEvents(object, types, context);
},
monitorEvents: function(object, types, context)
@@ -60,76 +76,82 @@ var EventMonitor = Obj.extend(Firebug.Module,
};
}
- if (!context.eventsMonitored)
- context.eventsMonitored = [];
+ if (!context.monitoredEvents)
+ context.monitoredEvents = new Map();
+ var monitoredEvents = context.monitoredEvents;
var eventTypes = getMonitoredEventTypes(types);
if (FBTrace.DBG_EVENTS)
FBTrace.sysout("EventMonitor.monitorEvents", eventTypes);
- for (var i = 0; i < eventTypes.length; ++i)
+ if (!context.monitoredEvents.has(object))
+ context.monitoredEvents.set(object, new Set());
+
+ var monitoredEventTypes = monitoredEvents.get(object);
+ for (var i = 0, len = eventTypes.length; i < len; ++i)
{
if (!this.areEventsMonitored(object, eventTypes[i], context))
{
Events.addEventListener(object, eventTypes[i], context.onMonitorEvent, false);
- context.eventsMonitored.push({object: object, type: eventTypes[i]});
+ monitoredEventTypes.add(eventTypes[i]);
}
}
}
},
unmonitorEvents: function(object, types, context)
{
- var eventsMonitored = context.eventsMonitored;
+ var monitoredEvents = context.monitoredEvents;
+
+ if (!monitoredEvents)
+ return;
+
var eventTypes = getMonitoredEventTypes(types);
if (FBTrace.DBG_EVENTS)
FBTrace.sysout("EventMonitor.unmonitorEvents", eventTypes);
- for (var i = 0; i < eventTypes.length; ++i)
+ if (object)
{
- for (var j = 0; j < eventsMonitored.length; ++j)
+ if (monitoredEvents.has(object))
{
- if (eventsMonitored[j].object == object && eventsMonitored[j].type == eventTypes[i])
+ var monitoredObjectEvents = monitoredEvents.get(object);
+ for (var i = 0, len = eventTypes.length; i < len; ++i)
{
- eventsMonitored.splice(j, 1);
-
- Events.removeEventListener(object, eventTypes[i], context.onMonitorEvent, false);
- break;
+ if (monitoredObjectEvents.has(eventTypes[i]))
+ {
+ Events.removeEventListener(object, eventTypes[i],
+ context.onMonitorEvent, false);
+ monitoredObjectEvents["delete"](eventTypes[i]);
+ }
}
}
}
},
- areEventsMonitored: function(object, types, context)
+ areEventsMonitored: function(object, types, context, allMonitored)
{
- var eventsMonitored = context.eventsMonitored;
- if (!eventsMonitored)
+ var monitoredEvents = context.monitoredEvents;
+ if (!monitoredEvents)
{
if (FBTrace.DBG_EVENTS)
FBTrace.sysout("EventMonitor.areEventsMonitored - No events monitored", object);
return false;
}
- var eventTypes = [];
- if (!types)
- eventTypes = Events.getEventTypes();
- else
- eventTypes = typeof types == "string" ? [types] : types;
+ var eventTypes = getMonitoredEventTypes(types);
+ var monitoredObjectEvents = monitoredEvents.get(object);
+ if (!monitoredObjectEvents)
+ return;
+
+ if (typeof allMonitored == "undefined")
+ allMonitored = true;
- for (var i = 0; i < eventTypes.length; ++i)
+ for (var i = 0, len = eventTypes.length; i < len; ++i)
{
- var monitored = false;
- for (var j = 0; j < eventsMonitored.length; ++j)
- {
- if (eventsMonitored[j].object == object && eventsMonitored[j].type == eventTypes[i])
- {
- monitored = true;
- break;
- }
- }
+ var monitored = monitoredObjectEvents.has(eventTypes[i]);
if (!monitored)
{
@@ -139,7 +161,8 @@ var EventMonitor = Obj.extend(Firebug.Module,
eventTypes[i] + "'");
}
- return false;
+ if (allMonitored)
+ return false;
}
else
{
@@ -148,28 +171,108 @@ var EventMonitor = Obj.extend(Firebug.Module,
FBTrace.sysout("EventMonitor.areEventsMonitored - Events monitored for '" +
eventTypes[i] + "'");
}
+
+ if (!allMonitored)
+ return true;
}
}
- return true;
+ return allMonitored;
},
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Logging
onMonitorEvent: function(event, context)
{
- var obj = new EventMonitor.EventLog(event);
+ var obj = new EventLog(event);
Firebug.Console.log(obj, context);
- }
-});
+ },
-// ********************************************************************************************* //
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // UI Listener
-EventMonitor.EventLog = function(event)
-{
- this.event = event;
-};
+ onContextMenu: function(items, object, target, context, panel, popup)
+ {
+ if (panel.name != "html")
+ return items;
+
+ var before = popup.querySelector("#fbScrollIntoView");
+ if (!before)
+ return items;
+
+ var elt = object;
+
+ // Create sub-menu-items for "Log Event"
+ var logEventItems = [];
+ var eventFamilies = Events.getEventFamilies();
+ for (var i=0, count=eventFamilies.length; i<count; ++i)
+ {
+ var family = eventFamilies[i];
+
+ // Compose a tooltip for the menu item.
+ var tooltipText = "Monitor " + eventFamilies[i] + " events:";
+ var types = Events.getEventTypes(family);
+ tooltipText += "\n" + types.join(", ");
+
+ // xxxHonza: there could be a helper for getting the CSS selector
+ var Element = FirebugReps.Element;
+ var selector = Element.getSelectorTag(elt) +
+ Element.getSelectorId(elt) +
+ Element.getSelectorClass(elt);
+
+ // xxxHonza: localization?
+ tooltipText += "\n\nCommand Line Example:\n" +
+ "monitorEvents($('" + selector + "'), '" + family + "')";
+
+ logEventItems.push({
+ nol10n: true,
+ label: Locale.$STR(family),
+ tooltiptext: tooltipText,
+ id: "monitor" + family + "Events",
+ type: "checkbox",
+ checked: this.areEventsMonitored(elt, family, context),
+ command: Obj.bind(this.onToggleMonitorEvents, this, elt, family, context)
+ });
+ }
+
+ function onCommand(event)
+ {
+ Events.cancelEvent(event);
+
+ var checked = this.areEventsMonitored(elt, null, context, false);
+ this.toggleMonitorEvents(elt, null, !checked, context);
+ }
+
+ var item = {
+ label: "ShowEventsInConsole",
+ tooltiptext: "html.tip.Show_Events_In_Console",
+ id: "fbShowEventsInConsole",
+ type: "checkbox",
+ checked: this.areEventsMonitored(elt, null, context, false),
+ command: onCommand.bind(this),
+ items: logEventItems
+ };
+
+ var logEventsItem = Menu.createMenuItem(popup, item, before);
+ var separator = Menu.createMenuItem(popup, "-", before);
+
+ return items;
+ },
+
+ onToggleMonitorEvents: function(event, elt, type, context)
+ {
+ var checked = event.target.getAttribute("checked") == "true";
+ this.toggleMonitorEvents(elt, type, checked, context);
+
+ Events.cancelEvent(event);
+
+ // Toggle the main "Log Events" option depending on whether all events are monitored.
+ var doc = event.target.ownerDocument;
+ var logEvents = doc.getElementById("fbShowEventsInConsole");
+ logEvents.setAttribute("checked", this.areEventsMonitored(elt, null, context, false));
+ },
+});
// ********************************************************************************************* //
// Helpers
@@ -209,6 +312,62 @@ function getMonitoredEventTypes(types)
}
// ********************************************************************************************* //
+// Rep Object
+
+var EventLog = function(event)
+{
+ this.event = event;
+};
+
+// ********************************************************************************************* //
+// Rep Template
+
+with (Domplate) {
+var EventLogRep = domplate(FirebugReps.Event,
+{
+ className: "eventLog",
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+ tag:
+ TAG("$copyEventTag", {object: "$object|copyEvent"}),
+
+ copyEventTag:
+ SPAN(
+ FirebugReps.OBJECTLINK("$object|summarizeEvent"),
+ SPAN("&nbsp"),
+ SPAN("&#187;"),
+ SPAN("&nbsp"),
+ TAG("$object|getTargetTag", {object: "$object|getTarget"})
+ ),
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+ copyEvent: function(log)
+ {
+ return new Dom.EventCopy(log.event);
+ },
+
+ getTarget: function(event)
+ {
+ return event.target;
+ },
+
+ getTargetTag: function(event)
+ {
+ var rep = Firebug.getRep(event.target);
+ return rep.shortTag ? rep.shortTag : rep.tag;
+ },
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+ supportsObject: function(object, type)
+ {
+ return object instanceof EventLog;
+ },
+})};
+
+// ********************************************************************************************* //
// CommandLine Support
function monitorEvents(context, args)
@@ -233,6 +392,7 @@ function unmonitorEvents(context, args)
// Registration
Firebug.registerModule(EventMonitor);
+Firebug.registerRep(EventLogRep);
Firebug.registerCommand("monitorEvents", {
handler: monitorEvents.bind(this),
View
2 extension/content/firebug/cookies/cookieReps.js
@@ -1027,7 +1027,7 @@ CookieReps.CookieTable = domplate(CookieReps.Rep,
TD({id: "colRawSize", role: "columnheader",
"class": "cookieHeaderCell a11yFocus"},
DIV({"class": "cookieHeaderCellBox",
- title: Locale.$STR("cookies.header.size.tooltip")},
+ title: Locale.$STR("cookies.header.rawSize.tooltip")},
Locale.$STR("cookies.header.rawSize"))
),
TD({id: "colSize", role: "columnheader",
View
32 extension/content/firebug/css/computedPanel.js
@@ -34,6 +34,8 @@ const statusClasses = ["cssUnmatched", "cssParentMatch", "cssOverridden", "cssBe
try
{
+ // xxxHonza: broken by: https://bugzilla.mozilla.org/show_bug.cgi?id=855914
+ // waiting for: https://bugzilla.mozilla.org/show_bug.cgi?id=867595
Cu.import("resource:///modules/devtools/CssLogic.jsm");
}
catch (err)
@@ -138,10 +140,7 @@ CSSComputedPanel.prototype = Obj.extend(Firebug.Panel,
formatValue: function(value)
{
- if (Options.get("colorDisplay") == "hex")
- value = Css.rgbToHex(value);
- else if (Options.get("colorDisplay") == "hsl")
- value = Css.rgbToHSL(value);
+ value = formatColor(value);
var limit = Options.get("stringCropLength");
if (limit > 0)
@@ -610,7 +609,8 @@ CSSComputedPanel.prototype = Obj.extend(Firebug.Panel,
{
var propInfo = Firebug.getRepObject(target);
- var prop = propInfo.property, value = propInfo.value;
+ var prop = propInfo.property;
+ var value = formatColor(propInfo.value);
var cssValue;
if (prop == "font" || prop == "font-family")
@@ -700,7 +700,27 @@ CSSComputedPanel.prototype = Obj.extend(Firebug.Panel,
});
//********************************************************************************************* //
-//Helpers
+// Helpers
+
+function formatColor(color)
+{
+ var colorDisplay = Options.get("colorDisplay");
+
+ switch (colorDisplay)
+ {
+ case "hex":
+ return Css.rgbToHex(color);
+
+ case "hsl":
+ return Css.rgbToHSL(color);
+
+ case "rgb":
+ return Css.colorNameToRGB(color);
+
+ default:
+ return value;
+ }
+}
const styleGroups =
{
View
298 extension/content/firebug/css/cssPanel.js
@@ -78,7 +78,7 @@ var CSSPropTag = domplate(CSSDomplateBase,
role: "option"},
// Use spaces for indent to make "copy to clipboard" nice.
- SPAN("&nbsp;&nbsp;&nbsp;&nbsp;"),
+ SPAN({"class": "cssPropIndent"}, "&nbsp;&nbsp;&nbsp;&nbsp;"),
SPAN({"class": "cssPropName", $editable: "$rule|isEditable"},
"$prop.name"
),
@@ -125,6 +125,99 @@ var CSSCharsetRuleTag = domplate(CSSDomplateBase,
)
});
+var CSSMediaRuleTag = domplate(CSSDomplateBase,
+{
+ tag:
+ DIV({"class": "cssRule focusRow cssMediaRule", _repObject: "$rule.rule"},
+ DIV({"class": "cssHead focusRow", role : "listitem"},
+ SPAN({"class": "cssRuleName"}, "@media"),
+ SPAN({"class": "separator"}, " "),
+ SPAN({"class": "cssMediaRuleCondition", $editable: "$rule|isEditable"},
+ "$rule.rule.conditionText"),
+ SPAN(" {")
+ ),
+ DIV({"class": "cssRulesListBox", role: "listbox"},
+ FOR("subRule", "$rule.subRules",
+ TAG("$subRule.tag", {rule: "$subRule"})
+ )
+ ),
+ DIV({$editable: "$rule|isEditable", $insertBefore:"$rule|isEditable",
+ role:"presentation"},
+ "}")
+ )
+});
+
+var CSSSupportsRuleTag = domplate(CSSDomplateBase,
+{
+ tag:
+ DIV({"class": "cssRule focusRow cssSupportsRule", _repObject: "$rule.rule"},
+ DIV({"class": "cssHead focusRow", role : "listitem"},
+ SPAN({"class": "cssRuleName"}, "@supports"),
+ SPAN({"class": "separator"}, " "),
+ SPAN({"class": "cssSupportsRuleCondition", $editable: "$rule|isEditable"},
+ "$rule.rule.conditionText"),
+ SPAN(" {")
+ ),
+ DIV({"class": "cssRulesListBox", role: "listbox"},
+ FOR("subRule", "$rule.subRules",
+ TAG("$subRule.tag", {rule: "$subRule"})
+ )
+ ),
+ DIV({$editable: "$rule|isEditable", $insertBefore:"$rule|isEditable",
+ role:"presentation"},
+ "}")
+ )
+});
+
+var CSSKeyframesRuleTag = domplate(CSSDomplateBase,
+{
+ tag:
+ DIV({"class": "cssRule focusRow cssKeyframesRule", _repObject: "$rule.rule"},
+ DIV({"class": "cssHead focusRow", role : "listitem"},
+ SPAN({"class": "cssRuleName"}, "@-moz-keyframes"),
+ SPAN({"class": "separator"}, " "),
+ SPAN({"class": "cssKeyframesRuleName", $editable: "$rule|isEditable"},
+ "$rule.rule.name"),
+ SPAN(" {")
+ ),
+ DIV({"class": "cssRulesListBox", role: "listbox"},
+ FOR("subRule", "$rule.subRules",
+ TAG("$subRule.tag", {rule: "$subRule"})
+ )
+ ),
+ DIV({role:"presentation"},
+ "}")
+ )
+});
+
+var CSSKeyframeRuleTag = domplate(CSSDomplateBase,
+{
+ tag:
+ DIV({"class": "cssRule",
+ $cssEditableRule: "$rule|isEditable",
+ $insertInto: "$rule|isEditable",
+ $editGroup: "$rule|isSelectorEditable",
+ _repObject: "$rule.rule",
+ role: "presentation"},
+ DIV({"class": "cssHead focusRow", role: "listitem"},
+ SPAN({"class": "cssKeyText", $editable: "$rule|isEditable"},
+ "$rule.rule.keyText"),
+ " {"
+ ),
+ DIV({role: "group"},
+ DIV({"class": "cssPropertyListBox", _rule: "$rule", role: "listbox"},
+ FOR("prop", "$rule.props",
+ TAG(CSSPropTag.tag, {rule: "$rule", prop: "$prop"})
+ )
+ )
+ ),
+ DIV({$editable: "$rule|isEditable", $insertBefore: "$rule|isEditable",
+ role:"presentation"},
+ "}"
+ )
+ )
+});
+
var CSSNamespaceRuleTag = domplate(CSSDomplateBase,
{
tag:
@@ -200,6 +293,28 @@ var CSSPageRuleTag = domplate(CSSDomplateBase,
}
});
+var CSSDocumentRuleTag = domplate(CSSDomplateBase,
+{
+ tag:
+ DIV({"class": "cssRule focusRow cssDocumentRule", _repObject: "$rule.rule"},
+ DIV({"class": "cssHead focusRow", role : "listitem"},
+ SPAN({"class": "cssRuleName"}, "@-moz-document"),
+ SPAN({"class": "separator"}, " "),
+ SPAN({"class": "cssDocumentRuleCondition", $editable: "$rule|isEditable"},
+ "$rule.rule.conditionText"),
+ SPAN(" {")
+ ),
+ DIV({"class": "cssRulesListBox", role: "listbox"},
+ FOR("subRule", "$rule.subRules",
+ TAG("$subRule.tag", {rule: "$subRule"})
+ )
+ ),
+ DIV({$editable: "$rule|isEditable", $insertBefore:"$rule|isEditable",
+ role:"presentation"},
+ "}")
+ )
+});
+
var CSSStyleRuleTag = domplate(CSSDomplateBase,
{
tag:
@@ -430,10 +545,11 @@ Firebug.CSSStyleSheetPanel.prototype = Obj.extend(Firebug.Panel,
var isSystemSheet = Url.isSystemStyleSheet(styleSheet);
- var rules = [];
- var appendRules = function(cssRules)
+ var createRules = function(cssRules)
{
- var i, props;
+ var i;
+ var props;
+ var rules = [];
if (!cssRules)
return;
@@ -453,6 +569,15 @@ Firebug.CSSStyleSheetPanel.prototype = Obj.extend(Firebug.Panel,
isSelectorEditable: true
});
}
+ else if (window.CSSSupportsRule && rule instanceof window.CSSSupportsRule)
+ {
+ rules.push({
+ tag: CSSSupportsRuleTag.tag,
+ rule: rule,
+ subRules: createRules(Css.safeGetCSSRules(rule)),
+ isSystemSheet: isSystemSheet
+ });
+ }
else if (rule instanceof window.CSSImportRule)
{
rules.push({tag: CSSImportRuleTag.tag, rule: rule});
@@ -461,18 +586,33 @@ Firebug.CSSStyleSheetPanel.prototype = Obj.extend(Firebug.Panel,
{
rules.push({tag: CSSCharsetRuleTag.tag, rule: rule});
}
- else if (rule instanceof window.CSSMediaRule ||
- rule instanceof window.CSSMozDocumentRule)
+ else if (rule instanceof window.CSSMediaRule)
+ {
+ rules.push({
+ tag: CSSMediaRuleTag.tag,
+ rule: rule,
+ subRules: createRules(Css.safeGetCSSRules(rule)),
+ isSystemSheet: isSystemSheet
+ });
+ }
+ else if (rule instanceof window.CSSMozDocumentRule)
{
- appendRules(Css.safeGetCSSRules(rule));
+ rules.push({
+ tag: CSSDocumentRuleTag.tag,
+ rule: rule,
+ subRules: createRules(Css.safeGetCSSRules(rule)),
+ isSystemSheet: isSystemSheet
+ });
}
else if (rule instanceof window.CSSFontFaceRule)
{
props = this.parseCSSProps(rule.style);
this.sortProperties(props);
rules.push({
- tag: CSSFontFaceRuleTag.tag, rule: rule,
- props: props, isSystemSheet: isSystemSheet,
+ tag: CSSFontFaceRuleTag.tag,
+ rule: rule,
+ props: props,
+ isSystemSheet: isSystemSheet,
isNotEditable: true
});
}
@@ -488,9 +628,29 @@ Firebug.CSSStyleSheetPanel.prototype = Obj.extend(Firebug.Panel,
isNotEditable: true
});
}
- else if (rule instanceof window.CSSNameSpaceRule &&
- !(rule instanceof window.MozCSSKeyframesRule ||
- rule instanceof window.MozCSSKeyframeRule))
+ else if ((window.CSSKeyframesRule && rule instanceof window.CSSKeyframesRule) ||
+ rule instanceof window.MozCSSKeyframesRule)
+ {
+ rules.push({
+ tag: CSSKeyframesRuleTag.tag,
+ rule: rule,
+ subRules: createRules(Css.safeGetCSSRules(rule)),
+ isSystemSheet: isSystemSheet
+ });
+ }
+ else if ((window.CSSKeyframeRule && rule instanceof window.CSSKeyframeRule) ||
+ rule instanceof window.MozCSSKeyframeRule)
+ {
+ props = this.parseCSSProps(rule.style);
+ this.sortProperties(props);
+ rules.push({
+ tag: CSSKeyframeRuleTag.tag,
+ rule: rule,
+ props: props,
+ isSystemSheet: isSystemSheet
+ });
+ }
+ else if (rule instanceof window.CSSNameSpaceRule)
{
// Workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=754772
// MozCSSKeyframesRules, MozCSSKeyframeRules and CSSPageRules are recognized
@@ -510,10 +670,11 @@ Firebug.CSSStyleSheetPanel.prototype = Obj.extend(Firebug.Panel,
FBTrace.sysout("css getStyleSheetRules failed to classify a rule ", rule);
}
}
+
+ return rules;
}.bind(this);
- appendRules(Css.safeGetCSSRules(styleSheet));
- return rules;
+ return createRules(Css.safeGetCSSRules(styleSheet));
},
parseCSSProps: function(style, inheritMode)
@@ -880,8 +1041,12 @@ Firebug.CSSStyleSheetPanel.prototype = Obj.extend(Firebug.Panel,
clickedDisableButton: function(event)
{
+ if (!Css.hasClass(event.target, "cssPropIndent"))
+ return false;
+
// XXX hack
- if (event.clientX > 20)
+ var clientOffset = Dom.getClientOffset(event.target);
+ if (event.clientX - clientOffset.x > 20)
return false;
if (Css.hasClass(event.target, "textEditor inlineExpander"))
return false;
@@ -1816,7 +1981,11 @@ CSSEditor.prototype = domplate(Firebug.InlineEditor.prototype,
var cssRule = Dom.getAncestorByClass(target, "cssRule");
var rule = Firebug.getRepObject(cssRule);
- if (rule instanceof window.CSSStyleRule || rule instanceof window.Element)
+ if (rule instanceof window.CSSStyleRule ||
+ ((window.CSSKeyframeRule && rule instanceof window.CSSKeyframeRule) ||
+ rule instanceof window.MozCSSKeyframeRule) &&
+ !Css.hasClass(target, "cssKeyText") ||
+ rule instanceof window.Element)
{
var prop = Dom.getAncestorByClass(target, "cssProp");
@@ -1887,6 +2056,67 @@ CSSEditor.prototype = domplate(Firebug.InlineEditor.prototype,
}
}
}
+ else if (window.CSSSupportsRule && rule instanceof window.CSSSupportsRule &&
+ Css.hasClass(target, "cssSupportsRuleCondition"))
+ {
+ target.textContent = value;
+
+ if (FBTrace.DBG_CSS)
+ {
+ FBTrace.sysout("CSSEditor.saveEdit: @supports rule condition: " +
+ previousValue + "->" + value);
+ }
+
+ try
+ {
+ rule.conditionText = value;
+ }
+ catch (e)
+ {
+ }
+
+ var saveSuccess = (rule.conditionText == value);
+ this.box.setAttribute("saveSuccess", saveSuccess);
+ }
+ else if (((window.CSSKeyframeRule && rule instanceof window.CSSKeyframeRule) ||
+ rule instanceof window.MozCSSKeyframeRule) &&
+ Css.hasClass(target, "cssKeyText"))
+ {
+ target.textContent = value;
+
+ if (FBTrace.DBG_CSS)
+ {
+ FBTrace.sysout("CSSEditor.saveEdit: @-moz-keyframe rule key: " +
+ previousValue + "->" + value);
+ }
+
+ rule.keyText = value;
+
+ var saveSuccess = (rule.keyText == value || rule.keyText == Css.keyframeKeys[value]);
+ this.box.setAttribute("saveSuccess", saveSuccess);
+ }
+ else if (rule instanceof window.CSSMozDocumentRule &&
+ Css.hasClass(target, "cssDocumentRuleCondition"))
+ {
+ target.textContent = value;
+
+ if (FBTrace.DBG_CSS)
+ {
+ FBTrace.sysout("CSSEditor.saveEdit: @-moz-document rule condition: " +
+ previousValue + "->" + value);
+ }
+
+ try
+ {
+ rule.conditionText = value;
+ }
+ catch (e)
+ {
+ }
+
+ var saveSuccess = (rule.conditionText == value);
+ this.box.setAttribute("saveSuccess", saveSuccess);
+ }
else if (rule instanceof window.CSSImportRule && Css.hasClass(target, "cssMediaQuery"))
{
target.textContent = value;
@@ -1910,6 +2140,22 @@ CSSEditor.prototype = domplate(Firebug.InlineEditor.prototype,
var saveSuccess = rule.media.mediaText != "not all" || value == "not all";
this.box.setAttribute("saveSuccess", saveSuccess);
}
+ else if (rule instanceof window.CSSMediaRule &&
+ Css.hasClass(target, "cssMediaRuleCondition"))
+ {
+ target.textContent = value;
+
+ if (FBTrace.DBG_CSS)
+ {
+ FBTrace.sysout("CSSEditor.saveEdit: @media rule condition: " +
+ previousValue + "->" + value);
+ }
+
+ rule.conditionText = value;
+
+ var saveSuccess = (rule.conditionText == value);
+ this.box.setAttribute("saveSuccess", saveSuccess);
+ }
else if (rule instanceof window.CSSCharsetRule)
{
target.textContent = value;
@@ -2026,6 +2272,21 @@ CSSEditor.prototype = domplate(Firebug.InlineEditor.prototype,
var nodeType = Xml.getElementSimpleType(Firebug.getRepObject(this.target));
return Css.getCSSPropertyNames(nodeType);
}
+ else if (Dom.getAncestorByClass(this.target, "cssDocumentRule") &&
+ !Css.hasClass(this.target, "cssPropValue"))
+ {
+ return Css.documentConditions;
+ }
+ else if (Dom.getAncestorByClass(this.target, "cssKeyframesRule") &&
+ !Css.hasClass(this.target, "cssPropValue"))
+ {
+ return Object.getOwnPropertyNames(Css.keyframeKeys);
+ }
+ else if (Dom.getAncestorByClass(this.target, "cssMediaRule") &&
+ !Css.hasClass(this.target, "cssPropValue"))
+ {
+ return Css.mediaTypes;
+ }
else
{
if (expr.charAt(0) === "!")
@@ -2732,8 +2993,11 @@ function formatColor(color)
case "hsl":
return Css.rgbToHSL(color);
+ case "rgb":
+ return Css.colorNameToRGB(color);
+
default:
- return color;
+ return value;
}
}
View
2 extension/content/firebug/css/selectorModule.js
@@ -42,7 +42,7 @@ var SelectorModule = Obj.extend(Firebug.Module,
return;
var rule = cssRule.repObject;
- if (!rule)
+ if (!rule || !rule.selectorText)
return;
var panel = context.getPanel("selector");
View
6 extension/content/firebug/css/stylePanel.js
@@ -85,12 +85,10 @@ CSSStylePanel.prototype = Obj.extend(CSSStyleSheetPanel.prototype,
),
CSSFontPropValueTag:
- SPAN({"class": "cssFontPropValue"},
FOR("part", "$propValueParts",
SPAN({"class": "$part.type|getClass", _repObject: "$part.font"}, "$part.value"),
SPAN({"class": "cssFontPropSeparator"}, "$part|getSeparator")
- )
- ),
+ ),
getSeparator: function(part)
{
@@ -164,6 +162,8 @@ CSSStylePanel.prototype = Obj.extend(CSSStyleSheetPanel.prototype,
var propValue = propValueElem.textContent;
var fontPropValueParts = getFontPropValueParts(element, propValue, propName);
+ Css.setClass(propValueElem, "cssFontPropValue");
+
// xxxsz: Web fonts not being loaded at display time
// won't be marked as used. See issue 5420.
this.template.CSSFontPropValueTag.replace({propValueParts: fontPropValueParts},
View
2 extension/content/firebug/debugger/script/breakNotification.js
@@ -48,7 +48,7 @@ BreakNotification.prototype = domplate(Firebug.Rep,
TR(
TD({"class": "imageCol"},
IMG({"class": "notificationImage",
- src: "chrome://firebug/skin/breakpoint.png"})
+ src: "chrome://firebug/skin/breakpoint.svg"})
),
TD({"class": "descCol"},
SPAN({"class": "notificationDesc"}, "$cause|getDescription"),
View
3 extension/content/firebug/editor/editor.js
@@ -683,7 +683,10 @@ Firebug.InlineEditor.prototype = domplate(Firebug.BaseEditor,
panel.panelNode.appendChild(this.box);
this.input.select();
if (selectionData) // transfer selection to input element
+ {
+ FBTrace.sysout("selectionData", selectionData);
this.setSelection(selectionData);
+ }
// Insert the "expander" to cover the target element with white space
if (!this.fixedWidth)
View
20 extension/content/firebug/firebug.css
@@ -178,15 +178,19 @@ panelTab > panelTabMenu .menuTarget {
panelTab[selected="true"] > panelTabMenu .menuTarget,
panelTab:focus > panelTabMenu .menuTarget {
- background: url(chrome://firebug/skin/tabMenuTarget.png) no-repeat center;
+ background: url(chrome://firebug-os/skin/optionsMenuTarget.svg) no-repeat center;
width: 11px;
height: 10px;
vertical-align: middle;
visibility: visible;
}
panelTab[selected="true"]:hover > panelTabMenu .menuTarget {
- background: url(chrome://firebug/skin/tabMenuTargetHover.png) no-repeat center;
+ background: url(chrome://firebug-os/skin/optionsMenuTargetHover.svg) no-repeat center;
+}
+
+panelTab[selected="true"]:hover:active > panelTabMenu .menuTarget {
+ filter: url(chrome://firebug/skin/filters.svg#darken);
}
panelTab > panelTabMenu .menuPopup:-moz-locale-dir(rtl) {
@@ -343,24 +347,21 @@ panelTab > panelTabMenu .menuPopup:-moz-locale-dir(rtl) {
/************************************************************************************************/
-@-moz-keyframes armedBlinking {
+@keyframes armedBlinking {
100% {
text-shadow: 1px 1px 2px darkGray, 0px 0px 1em orange, 0px 0px 0.2em orange;
}
}
panelTab[breakOnNextArmed="true"] > .panelTab-text {
- text-shadow: 1px 1px 2px darkGray, 0 0 1em orange, 0 0 0.2em orange !important;
- /* animation: armedBlinking 0.8s ease-out infinite alternate; see issue 5618 */
+ animation: armedBlinking 0.8s steps(9, end) infinite alternate;
}
-/* see issue 5618
panelTab.highlighted {
text-shadow: 1px 1px 2px darkGray, 0px 0px 1em orange, 0px 0px 0.2em orange !important;
- -moz-transition-property: text-shadow;
- -moz-transition-duration: 0.8s;
+ transition-property: text-shadow;
+ transition-duration: 1.4s;
}
-*/
panelTab[aria-disabled='true'] {
color: graytext !important;
@@ -383,6 +384,7 @@ panelBarTabList {
/************************************************************************************************/
/* splitmenu */
+
menuitem.split-menuitem-item[_moz-menuactive="true"], .split-menu-right-image[_moz-menuactive="true"] {
background-color: -moz-menuhover;
color: -moz-menuhovertext;
View
2 extension/content/firebug/firebugOverlay.xul
@@ -152,9 +152,7 @@
tooltiptext="script.Break On Next" breakable="disabled"
class="fbInternational">
<stack id="fbBreakOnNextButtonStack">
- <image id="fbBreakOnImageDisabled"></image>
<image id="fbBreakOnImage" class="fbBreakOnImage"></image>
- <image id="fbBreakOnImageActive" class="fbBreakOnImage"></image>
<image id="fbBreakOnImageArmed" class="fbBreakOnImage"></image>
<!-- Badges -->
<image id="fbBreakOnImageError" class="fbBreakOnImage"></image>
View
2 extension/content/firebug/firefox/bindings.xml
@@ -1910,7 +1910,7 @@
<content align="stretch">
<xul:menuitem anonid="item" flex="1"
class="menuitem-tooltip split-menuitem-item"
- xbl:inherits="label,key,image,value" allowevents="true"/>
+ xbl:inherits="label,key,image,value,checked" allowevents="true"/>
<xul:hbox class="split-menu-right-image" xbl:inherits="_moz-menuactive" >
<xul:hbox align="center" class="menu-right" xbl:inherits="_moz-menuactive,disabled">
<xul:image/>
View
155 extension/content/firebug/lib/css.js
@@ -7,11 +7,17 @@ define([
"firebug/chrome/window",
"firebug/lib/xml",
"firebug/lib/http",
- "firebug/lib/xpath",
+ "firebug/lib/xpath"
],
function(FBTrace, Url, Options, Win, Xml, Http, Xpath) {
// ********************************************************************************************* //
+// Constants
+
+var Ci = Components.interfaces;
+var Cc = Components.classes;
+
+// ********************************************************************************************* //
// Module Implementation
var Css = {};
@@ -23,6 +29,7 @@ var cssKeywordMap = {};
var cssPropNames = {};
var cssColorNames = null;
var imageRules = null;
+var domUtils = Cc["@mozilla.org/inspector/dom-utils;1"].getService(Ci.inIDOMUtils);
Css.getCSSKeywordsByProperty = function(nodeType, propName, avoid)
{
@@ -773,66 +780,101 @@ Css.extractURLs = function(value)
return urls;
};
+Css.colorNameToRGB = function(value)
+{
+ try
+ {
+ var rgbValue = domUtils.colorNameToRGB(value);
+ return "rgb(" + rgbValue.r + ", " + rgbValue.g + ", " + rgbValue.b + ")";
+ }
+ catch(e) {
+ return value;
+ }
+};
+
Css.rgbToHex = function(value)
{
+ function convertRGBToHex(r, g, b)
+ {
+ return "#" + ((1 << 24) + (r << 16) + (g << 8) + (b << 0)).
+ toString(16).substr(-6).toUpperCase();
+ }
+ try
+ {
+ var rgbValue = domUtils.colorNameToRGB(value);
+ return convertRGBToHex(rgbValue.r, rgbValue.g, rgbValue.b);
+ }
+ catch(e) {}
+
return value.replace(/\brgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)/gi,
function(_, r, g, b) {
- return "#" + ((1 << 24) + (r << 16) + (g << 8) + (b << 0)).
- toString(16).substr(-6).toUpperCase();
+ return convertRGBToHex(r, g, b);
});
};
Css.rgbToHSL = function(value)
{
- return value.replace(/\brgba?\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})(,\s*(\d.\d+|\d))?\)/gi,
- function(_, r, g, b, _, a)
- {
- r = parseInt(r);
- g = parseInt(g);
- b = parseInt(b);
+ function convertRGBToHSL(r, g, b, a)
+ {
+ r = parseInt(r);
+ g = parseInt(g);
+ b = parseInt(b);
- var gray = (r == g && g == b);
+ var gray = (r == g && g == b);
- r /= 255;
- g /= 255;
- b /= 255;
+ r /= 255;
+ g /= 255;
+ b /= 255;
- var max = Math.max(r, g, b);
- var min = Math.min(r, g, b);
+ var max = Math.max(r, g, b);
+ var min = Math.min(r, g, b);
- var h = 0;
- var s = 0;
- var l = (max+min)/2;
+ var h = 0;
+ var s = 0;
+ var l = (max+min)/2;
- if (!gray)
- {
- var delta = max - min;
- s = l > 0.5 ? delta/(2-max-min) : delta/(max+min);
+ if (!gray)
+ {
+ var delta = max - min;
+ s = l > 0.5 ? delta/(2-max-min) : delta/(max+min);
- switch (max)
- {
- case r:
- h = (g-b)/delta + (g < b ? 6 : 0);
- break;
+ switch (max)
+ {
+ case r:
+ h = (g-b)/delta + (g < b ? 6 : 0);
+ break;
- case g:
- h = (b-r)/delta + 2;
- break;
+ case g:
+ h = (b-r)/delta + 2;
+ break;
- case b:
- h = (r-g)/delta + 4;
- break;
- }
+ case b:
+ h = (r-g)/delta + 4;
+ break;
}
+ }
- h = Math.round(h * 60);
- s = Math.round(s * 100);
- l = Math.round(l * 100);
+ h = Math.round(h * 60);
+ s = Math.round(s * 100);
+ l = Math.round(l * 100);
+
+ if (a)
+ return "hsla("+h+", "+s+"%, "+l+"%, "+a+")";
+ else
+ return "hsl("+h+", "+s+"%, "+l+"%)";
+ }
- if (a)
- return "hsla("+h+", "+s+"%, "+l+"%, "+a+")";
- else
- return "hsl("+h+", "+s+"%, "+l+"%)";
+ try
+ {
+ var rgbValue = domUtils.colorNameToRGB(value);
+ return convertRGBToHSL(rgbValue.r, rgbValue.g, rgbValue.b);
+ }
+ catch(e) {}
+
+ return value.replace(/\brgba?\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})(,\s*(\d.\d+|\d))?\)/gi,
+ function(_, r, g, b, _, a)
+ {
+ return convertRGBToHSL(r, g, b, a);
});
};
@@ -2607,6 +2649,37 @@ Css.charsets =
"Windows-1258"
];
+// http://www.w3.org/TR/CSS21/media.html#media-types
+Css.mediaTypes =
+[
+ "all",
+ "aural",
+ "braille",
+ "embossed",
+ "handheld",
+ "print",
+ "projection",
+ "screen",
+ "tty",
+ "tv"
+];
+
+// https://developer.mozilla.org/en-US/docs/CSS/@document
+Css.documentConditions =
+[
+ "url()",
+ "url-prefix()",
+ "domain()",
+ "regexp()"
+];
+
+// https://developer.mozilla.org/en-US/docs/CSS/@keyframes#Values
+Css.keyframeKeys =
+{
+ "from": "0%",
+ "to": "100%"
+};
+
// http://mxr.mozilla.org/mozilla-central/source/layout/style/nsCSSPseudoClassList.h
// Also http://mxr.mozilla.org/mozilla-central/source/layout/style/nsCSSAnonBoxList.h
// but that's not relevant for our purposes.
View
13 extension/content/firebug/lib/events.js
@@ -311,7 +311,8 @@ const eventTypes =
"DOMFocusOut"
],
- xul: [
+ // xxxHonza: As Simon says, XUL events must die!
+ /*xul: [
"popupshowing",
"popupshown",
"popuphiding",
@@ -320,7 +321,7 @@ const eventTypes =
"command",
"broadcast",
"commandupdate"
- ],
+ ],*/
clipboard: [
"cut",
@@ -338,6 +339,14 @@ const eventTypes =
]
};
+Events.getEventFamilies = function()
+{
+ var families = [];
+ for (var eventFamily in eventTypes)
+ families.push(eventFamily);
+ return families;
+};
+
Events.getEventTypes = function(family)
{
var types = [];
View
2 extension/install.rdf
@@ -5,7 +5,7 @@
<Description about="urn:mozilla:install-manifest">
<em:id>firebug@software.joehewitt.com</em:id>
- <em:version>1.12.0a4</em:version>
+ <em:version>1.12.0a5</em:version>
<em:type>2</em:type>
<em:bootstrap>true</em:bootstrap>
View
1 extension/locale/en-US/cookies.properties
@@ -169,6 +169,7 @@ cookies.header.name.tooltip=Name of the cookie
cookies.header.value.tooltip=Value stored for the cookie
cookies.header.rawValue.tooltip=Raw value stored for the cookie
cookies.header.domain.tooltip=Domain that has stored the cookie
+cookies.header.rawSize.tooltip=Raw size of the stored cookie
cookies.header.size.tooltip=Size of the stored cookie
cookies.header.path.tooltip=Directory where the cookie is active
cookies.header.expires.tooltip=Expiration date for the cookie
View
5 extension/locale/en-US/firebug.properties
@@ -82,6 +82,11 @@ firebug.menu.Right=Right
firebug.menu.tip.Right=Align Firebug to the right of the user agent window
firebug.uiLocation=Firebug UI Location
firebug.menu.tip.UI_Location=Position of the Firebug user interface
+
+# LOCALIZATION NOTE (annotations.confirm.clear):
+# Used in a confirmation dialog when all Firebug annotations are going to be deleted
+annotations.confirm.clear=Do you want to clear the list of Firebug annotations for all websites?
+
# LOCALIZATION NOTE (firebug_options): Tooltip text used for Firebug icon menu (them left
# most button on Firebug main toolbar)
firebug_options=Firebug Options
View
23 extension/modules/storageService.js
@@ -158,7 +158,13 @@ var StorageService =
removeStorage: function(leafName)
{
- ObjectPersister.deleteObject(leafname);
+ ObjectPersister.deleteObject(leafName);
+ },
+
+ hasStorage: function(leafName)
+ {
+ var file = ObjectPersister.getFile(leafName);
+ return file.exists();
}
};
@@ -175,7 +181,7 @@ var ObjectPersister =
if (FBTrace.DBG_STORAGE)
FBTrace.sysout("ObjectPersister read from leafName "+leafName);
- var file = FileUtils.getFile("ProfD", ["firebug", leafName]);
+ var file = this.getFile(leafName);
if (!file.exists())
{
@@ -235,6 +241,11 @@ var ObjectPersister =
}
},
+ getFile: function(leafName)
+ {
+ return FileUtils.getFile("ProfD", ["firebug", leafName]);
+ },
+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Batch the writes for each event loop
@@ -276,7 +287,7 @@ var ObjectPersister =
{
// Convert data to JSON.
var jsonString = JSON.stringify(obj);
- var file = FileUtils.getFile("ProfD", ["firebug", leafName]);
+ var file = this.getFile(leafName);
ObjectPersister.writeTextToFile(file, jsonString);
}
catch(exc)
@@ -313,6 +324,12 @@ var ObjectPersister =
}
},
+ deleteObject: function(leafName)
+ {
+ var file = this.getFile(leafName);
+ return file.remove(false);
+ },
+
// xxxHonza: this entire method is duplicated from firebug/lib/privacy module
// As soon as this JSM is AMD we should just use firebug/lib/privacy.
isPrivateBrowsing: function(win)
View
3 extension/skin/classic/breakOn.svg
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-
+<!-- See license.txt for terms of usage -->
<svg