зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-central to mozilla-inbound. a=merge CLOSED TREE
This commit is contained in:
Коммит
dd4888c82d
|
@ -1114,10 +1114,8 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|||
}
|
||||
}
|
||||
|
||||
if (openUILinkWhere == "current") {
|
||||
// Ensure the start of the URL is visible for usability reasons.
|
||||
this.selectionStart = this.selectionEnd = 0;
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const DBG_XUL = "chrome://devtools/content/framework/toolbox-process-window.xul";
|
||||
const DBG_XUL = "chrome://devtools/content/framework/toolbox-process-window.html";
|
||||
const CHROME_DEBUGGER_PROFILE_NAME = "chrome_debugger_profile";
|
||||
|
||||
const { require, DevToolsLoader } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
/**
|
||||
* The main content of the BrowserToolbox runs within an iframe.
|
||||
*/
|
||||
#toolbox-iframe {
|
||||
border: 0;
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Status message shows connection (to the backend) info messages.
|
||||
*/
|
||||
#status-message-container {
|
||||
width: calc(100% - 10px);
|
||||
font-family: var(--monospace-font-family);
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper for hiding/showing the status message.
|
||||
*/
|
||||
#status-message-container[hidden="true"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#status-message-title {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#status-message {
|
||||
font-size: 12px;
|
||||
width: 100%;
|
||||
height: 200px;
|
||||
overflow: auto;
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<!DOCTYPE html>
|
||||
<html id="devtools-toolbox-window"
|
||||
windowtype="devtools:toolbox"
|
||||
width="900" height="350"
|
||||
persist="screenX screenY width height sizemode"
|
||||
minwidth="50">
|
||||
<head>
|
||||
<link rel="stylesheet" href="chrome://global/skin/"/>
|
||||
<link rel="stylesheet" href="resource://devtools/client/themes/common.css"/>
|
||||
<link rel="stylesheet" href="chrome://devtools/content/framework/toolbox-process-window.css"/>
|
||||
<script type="text/javascript" src="chrome://global/content/globalOverlay.js"></script>
|
||||
<script type="text/javascript" src="toolbox-process-window.js"></script>
|
||||
<script type="text/javascript" src="chrome://global/content/viewSourceUtils.js"></script>
|
||||
<script type="text/javascript" src="chrome://browser/content/utilityOverlay.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="status-message-container" hidden="true">
|
||||
<div id="status-message-title"></div>
|
||||
<pre id="status-message"></pre>
|
||||
</div>
|
||||
<iframe id="toolbox-iframe"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -7,6 +7,7 @@
|
|||
"use strict";
|
||||
|
||||
var { loader, require } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
|
||||
|
||||
// Require this module to setup core modules
|
||||
loader.require("devtools/client/framework/devtools-browser");
|
||||
|
||||
|
@ -16,6 +17,9 @@ var { Toolbox } = require("devtools/client/framework/toolbox");
|
|||
var Services = require("Services");
|
||||
var { DebuggerClient } = require("devtools/shared/client/debugger-client");
|
||||
var { PrefsHelper } = require("devtools/client/shared/prefs");
|
||||
const KeyShortcuts = require("devtools/client/shared/key-shortcuts");
|
||||
const { LocalizationHelper } = require("devtools/shared/l10n");
|
||||
const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties");
|
||||
|
||||
// Timeout to wait before we assume that a connect() timed out without an error.
|
||||
// In milliseconds. (With the Debugger pane open, this has been reported to last
|
||||
|
@ -30,19 +34,23 @@ var Prefs = new PrefsHelper("devtools.debugger", {
|
|||
chromeDebuggingWebSocket: ["Bool", "chrome-debugging-websocket"],
|
||||
});
|
||||
|
||||
var gToolbox, gClient;
|
||||
var gToolbox, gClient, gShortcuts;
|
||||
|
||||
function appendStatusMessage(msg) {
|
||||
const statusMessage = document.getElementById("status-message");
|
||||
statusMessage.value += msg + "\n";
|
||||
statusMessage.textContent += msg + "\n";
|
||||
if (msg.stack) {
|
||||
statusMessage.value += msg.stack + "\n";
|
||||
statusMessage.textContent += msg.stack + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
function toggleStatusMessage(visible = true) {
|
||||
const statusMessageContainer = document.getElementById("status-message-container");
|
||||
statusMessageContainer.hidden = !visible;
|
||||
if (visible) {
|
||||
statusMessageContainer.removeAttribute("hidden");
|
||||
} else {
|
||||
statusMessageContainer.setAttribute("hidden", "true");
|
||||
}
|
||||
}
|
||||
|
||||
function revealStatusMessage() {
|
||||
|
@ -62,7 +70,7 @@ var connect = async function() {
|
|||
|
||||
// A port needs to be passed in from the environment, for instance:
|
||||
// MOZ_BROWSER_TOOLBOX_PORT=6080 ./mach run -chrome \
|
||||
// chrome://devtools/content/framework/toolbox-process-window.xul
|
||||
// chrome://devtools/content/framework/toolbox-process-window.html
|
||||
if (!port) {
|
||||
throw new Error("Must pass a port in an env variable with MOZ_BROWSER_TOOLBOX_PORT");
|
||||
}
|
||||
|
@ -108,9 +116,14 @@ function setPrefDefaults() {
|
|||
}
|
||||
|
||||
window.addEventListener("load", async function() {
|
||||
const cmdClose = document.getElementById("toolbox-cmd-close");
|
||||
cmdClose.addEventListener("command", onCloseCommand);
|
||||
gShortcuts = new KeyShortcuts({window});
|
||||
gShortcuts.on("CmdOrCtrl+W", onCloseCommand);
|
||||
|
||||
const statusMessageContainer = document.getElementById("status-message-title");
|
||||
statusMessageContainer.textContent = L10N.getStr("browserToolbox.statusMessage");
|
||||
|
||||
setPrefDefaults();
|
||||
|
||||
// Reveal status message if connecting is slow or if an error occurs.
|
||||
const delayedStatusReveal = setTimeout(revealStatusMessage, STATUS_REVEAL_TIME);
|
||||
try {
|
||||
|
@ -222,8 +235,6 @@ function updateBadgeText(paused) {
|
|||
function onUnload() {
|
||||
window.removeEventListener("unload", onUnload);
|
||||
window.removeEventListener("message", onMessage);
|
||||
const cmdClose = document.getElementById("toolbox-cmd-close");
|
||||
cmdClose.removeEventListener("command", onCloseCommand);
|
||||
gToolbox.destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<!DOCTYPE window [
|
||||
<!ENTITY % toolboxDTD SYSTEM "chrome://devtools/locale/toolbox.dtd" >
|
||||
%toolboxDTD;
|
||||
]>
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
|
||||
<!-- minwidth=50 is sum width of chevron and meatball menu button. -->
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
id="devtools-toolbox-window"
|
||||
macanimationtype="document"
|
||||
fullscreenbutton="true"
|
||||
windowtype="devtools:toolbox"
|
||||
width="900" height="600"
|
||||
persist="screenX screenY width height sizemode"
|
||||
minwidth="50">
|
||||
|
||||
<script type="text/javascript" src="chrome://global/content/globalOverlay.js"/>
|
||||
<script type="text/javascript" src="toolbox-process-window.js"/>
|
||||
<script type="text/javascript" src="chrome://global/content/viewSourceUtils.js"/>
|
||||
<script type="text/javascript" src="chrome://browser/content/utilityOverlay.js"/>
|
||||
|
||||
<commandset id="toolbox-commandset">
|
||||
<command id="toolbox-cmd-close"/>
|
||||
</commandset>
|
||||
|
||||
<keyset id="toolbox-keyset">
|
||||
<key id="toolbox-key-close"
|
||||
key="&closeCmd.key;"
|
||||
command="toolbox-cmd-close"
|
||||
modifiers="accel"/>
|
||||
</keyset>
|
||||
|
||||
<!-- This will be used by the Web Console to hold any popups it may create,
|
||||
for example when viewing network request details. -->
|
||||
<popupset id="mainPopupSet"></popupset>
|
||||
|
||||
<vbox id="status-message-container" hidden="true" flex="1">
|
||||
<box>&browserToolboxStatusMessage;</box>
|
||||
<textbox multiline="true" id="status-message" flex="1"></textbox>
|
||||
</vbox>
|
||||
|
||||
<tooltip id="aHTMLTooltip" page="true"/>
|
||||
<iframe id="toolbox-iframe" flex="1" tooltip="aHTMLTooltip"></iframe>
|
||||
</window>
|
|
@ -74,7 +74,8 @@ devtools.jar:
|
|||
* content/framework/toolbox.xul (framework/toolbox.xul)
|
||||
content/framework/toolbox-init.js (framework/toolbox-init.js)
|
||||
content/framework/options-panel.css (framework/options-panel.css)
|
||||
content/framework/toolbox-process-window.xul (framework/toolbox-process-window.xul)
|
||||
content/framework/toolbox-process-window.html (framework/toolbox-process-window.html)
|
||||
content/framework/toolbox-process-window.css (framework/toolbox-process-window.css)
|
||||
content/framework/toolbox-process-window.js (framework/toolbox-process-window.js)
|
||||
content/inspector/index.xhtml (inspector/index.xhtml)
|
||||
content/framework/connect/connect.xhtml (framework/connect/connect.xhtml)
|
||||
|
|
|
@ -10,11 +10,6 @@
|
|||
<!ENTITY toggleToolboxF12.keycode "VK_F12">
|
||||
<!ENTITY toggleToolboxF12.keytext "F12">
|
||||
|
||||
<!-- LOCALIZATION NOTE (browserToolboxStatusMessage): This is the label
|
||||
- shown next to status details when the Browser Toolbox fails to connect or
|
||||
- appears to be taking a while to do so. -->
|
||||
<!ENTITY browserToolboxStatusMessage "Browser Toolbox connection status:">
|
||||
|
||||
<!-- LOCALIZATION NOTE (options.context.advancedSettings): This is the label for
|
||||
- the heading of the advanced settings group in the options panel. -->
|
||||
<!ENTITY options.context.advancedSettings "Advanced settings">
|
||||
|
|
|
@ -184,3 +184,8 @@ toolbox.sourceMapSourceFailure=Error while fetching an original source: %1$S\nSo
|
|||
# checkbox to enable the new debugger frontend. Displayed only in Nightly and local
|
||||
# builds.
|
||||
toolbox.options.enableNewDebugger.label=Enable new debugger frontend
|
||||
|
||||
# LOCALIZATION NOTE (browserToolbox.statusMessage): This is the label
|
||||
# shown next to status details when the Browser Toolbox fails to connect or
|
||||
# appears to be taking a while to do so.
|
||||
browserToolbox.statusMessage=Browser Toolbox connection status:
|
||||
|
|
|
@ -83,14 +83,6 @@ WebConsole.prototype = {
|
|||
return this.chromeWindow.top;
|
||||
},
|
||||
|
||||
/**
|
||||
* Getter for the xul:popupset that holds any popups we open.
|
||||
* @type Element
|
||||
*/
|
||||
get mainPopupSet() {
|
||||
return this.chromeUtilsWindow.document.getElementById("mainPopupSet");
|
||||
},
|
||||
|
||||
/**
|
||||
* Getter for the output element that holds messages we display.
|
||||
* @type Element
|
||||
|
@ -286,15 +278,6 @@ WebConsole.prototype = {
|
|||
this._destroyer = (async () => {
|
||||
this.hudService.consoles.delete(this.hudId);
|
||||
|
||||
// The document may already be removed
|
||||
if (this.chromeUtilsWindow && this.mainPopupSet) {
|
||||
const popupset = this.mainPopupSet;
|
||||
const panels = popupset.querySelectorAll("panel[hudId=" + this.hudId + "]");
|
||||
for (const panel of panels) {
|
||||
panel.hidePopup();
|
||||
}
|
||||
}
|
||||
|
||||
if (this.ui) {
|
||||
await this.ui.destroy();
|
||||
}
|
||||
|
|
|
@ -413,7 +413,7 @@ class BoxModelHighlighter extends AutoRefreshHighlighter {
|
|||
*/
|
||||
_getOuterQuad(region) {
|
||||
const quads = this.currentQuads[region];
|
||||
if (!quads.length) {
|
||||
if (!quads || !quads.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -595,7 +595,14 @@ class BoxModelHighlighter extends AutoRefreshHighlighter {
|
|||
* @param {String} region The region around which the guides should be shown.
|
||||
*/
|
||||
_showGuides(region) {
|
||||
const {p1, p2, p3, p4} = this._getOuterQuad(region);
|
||||
const quad = this._getOuterQuad(region);
|
||||
|
||||
if (!quad) {
|
||||
// Invisible element such as a script tag.
|
||||
return;
|
||||
}
|
||||
|
||||
const {p1, p2, p3, p4} = quad;
|
||||
|
||||
const allX = [p1.x, p2.x, p3.x, p4.x].sort((a, b) => a - b);
|
||||
const allY = [p1.y, p2.y, p3.y, p4.y].sort((a, b) => a - b);
|
||||
|
@ -694,7 +701,13 @@ class BoxModelHighlighter extends AutoRefreshHighlighter {
|
|||
// by any zoom. Since the infobar can be displayed also for text nodes, we can't
|
||||
// access the computed style for that, and this is why we recalculate them here.
|
||||
const zoom = getCurrentZoom(this.win);
|
||||
const { width, height } = this._getOuterQuad("border").bounds;
|
||||
const quad = this._getOuterQuad("border");
|
||||
|
||||
if (!quad) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { width, height } = quad.bounds;
|
||||
const dim = parseFloat((width / zoom).toPrecision(6)) +
|
||||
" \u00D7 " +
|
||||
parseFloat((height / zoom).toPrecision(6));
|
||||
|
|
|
@ -373,9 +373,12 @@ HTMLEditor::StartMoving()
|
|||
// now, let's create the resizing shadow
|
||||
mPositioningShadow =
|
||||
CreateShadow(*parentContent, *mAbsolutelyPositionedObject);
|
||||
NS_ENSURE_TRUE(mPositioningShadow, NS_ERROR_FAILURE);
|
||||
nsresult rv = SetShadowPosition(mPositioningShadow,
|
||||
mAbsolutelyPositionedObject,
|
||||
if (NS_WARN_IF(!mPositioningShadow) ||
|
||||
NS_WARN_IF(!mAbsolutelyPositionedObject)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsresult rv = SetShadowPosition(*mPositioningShadow,
|
||||
*mAbsolutelyPositionedObject,
|
||||
mPositionedObjectX, mPositionedObjectY);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -493,7 +496,11 @@ HTMLEditor::SetFinalPosition(int32_t aX,
|
|||
mPositionedObjectX = newX;
|
||||
mPositionedObjectY = newY;
|
||||
|
||||
return RefreshResizers();
|
||||
rv = RefreshResizers();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -290,8 +290,8 @@ HTMLEditor::HideAnonymousEditingUIs()
|
|||
NS_ASSERTION(!mAbsolutelyPositionedObject, "HideGrabber failed");
|
||||
}
|
||||
if (mInlineEditedCell) {
|
||||
HideInlineTableEditingUI();
|
||||
NS_ASSERTION(!mInlineEditedCell, "HideInlineTableEditingUI failed");
|
||||
HideInlineTableEditingUIInternal();
|
||||
NS_ASSERTION(!mInlineEditedCell, "HideInlineTableEditingUIInternal failed");
|
||||
}
|
||||
if (mResizedObject) {
|
||||
DebugOnly<nsresult> rv = HideResizersInternal();
|
||||
|
@ -315,8 +315,8 @@ HTMLEditor::HideAnonymousEditingUIsIfUnnecessary()
|
|||
if (!IsInlineTableEditorEnabled() && mInlineEditedCell) {
|
||||
// XXX If we're resizing a table element, we need to cancel or commit the
|
||||
// operation now.
|
||||
HideInlineTableEditingUI();
|
||||
NS_ASSERTION(!mInlineEditedCell, "HideInlineTableEditingUI failed");
|
||||
HideInlineTableEditingUIInternal();
|
||||
NS_ASSERTION(!mInlineEditedCell, "HideInlineTableEditingUIInternal failed");
|
||||
}
|
||||
if (!IsObjectResizerEnabled() && mResizedObject) {
|
||||
// XXX If we're resizing something, we need to cancel or commit the
|
||||
|
@ -438,10 +438,8 @@ HTMLEditor::RefereshEditingUI(Selection& aSelection)
|
|||
|
||||
if (IsInlineTableEditorEnabled() && mInlineEditedCell &&
|
||||
mInlineEditedCell != cellElement) {
|
||||
// XXX HideInlineTableEditingUI() won't return error. Should be change it
|
||||
// void later.
|
||||
HideInlineTableEditingUI();
|
||||
NS_ASSERTION(!mInlineEditedCell, "HideInlineTableEditingUI failed");
|
||||
HideInlineTableEditingUIInternal();
|
||||
NS_ASSERTION(!mInlineEditedCell, "HideInlineTableEditingUIInternal failed");
|
||||
}
|
||||
|
||||
// now, let's display all contextual UI for good
|
||||
|
@ -453,7 +451,7 @@ HTMLEditor::RefereshEditingUI(Selection& aSelection)
|
|||
mResizedObjectIsAnImage = true;
|
||||
}
|
||||
if (mResizedObject) {
|
||||
nsresult rv = RefreshResizers();
|
||||
nsresult rv = RefreshResizersInternal();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -483,12 +481,12 @@ HTMLEditor::RefereshEditingUI(Selection& aSelection)
|
|||
if (IsInlineTableEditorEnabled() && cellElement &&
|
||||
IsModifiableNode(*cellElement) && cellElement != hostContent) {
|
||||
if (mInlineEditedCell) {
|
||||
nsresult rv = RefreshInlineTableEditingUI();
|
||||
nsresult rv = RefreshInlineTableEditingUIInternal();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
} else {
|
||||
nsresult rv = ShowInlineTableEditingUI(cellElement);
|
||||
nsresult rv = ShowInlineTableEditingUIInternal(*cellElement);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -3303,50 +3303,6 @@ HTMLEditor::GetStyleSheetForURL(const nsAString& aURL)
|
|||
return mStyleSheets[foundIndex];
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::GetEmbeddedObjects(nsIArray** aNodeList)
|
||||
{
|
||||
if (NS_WARN_IF(!aNodeList)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIMutableArray> nodes = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContentIterator> iter = NS_NewContentIterator();
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = GetDocument();
|
||||
if (NS_WARN_IF(!doc)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
iter->Init(doc->GetRootElement());
|
||||
|
||||
// Loop through the content iterator for each content node.
|
||||
while (!iter->IsDone()) {
|
||||
nsINode* node = iter->GetCurrentNode();
|
||||
if (node->IsElement()) {
|
||||
dom::Element* element = node->AsElement();
|
||||
|
||||
// See if it's an image or an embed and also include all links.
|
||||
// Let mail decide which link to send or not
|
||||
if (element->IsAnyOfHTMLElements(nsGkAtoms::img, nsGkAtoms::embed,
|
||||
nsGkAtoms::a) ||
|
||||
(element->IsHTMLElement(nsGkAtoms::body) &&
|
||||
element->HasAttr(kNameSpaceID_None, nsGkAtoms::background))) {
|
||||
nodes->AppendElement(node);
|
||||
}
|
||||
}
|
||||
iter->Next();
|
||||
}
|
||||
|
||||
nodes.forget(aNodeList);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLEditor::DeleteSelectionWithTransaction(EDirection aAction,
|
||||
EStripWrappers aStripWrappers)
|
||||
|
|
|
@ -43,6 +43,7 @@ class nsRange;
|
|||
|
||||
namespace mozilla {
|
||||
class AutoSelectionSetterAfterTableEdit;
|
||||
class DocumentResizeEventListener;
|
||||
class EmptyEditableFunctor;
|
||||
class ResizerSelectionListener;
|
||||
enum class EditSubAction : int32_t;
|
||||
|
@ -1797,6 +1798,12 @@ protected: // Shouldn't be used by friend classes
|
|||
|
||||
void UpdateRootElement();
|
||||
|
||||
/**
|
||||
* SetAllResizersPosition() moves all resizers to proper position.
|
||||
* If the resizers are hidden or replaced with another set of resizers
|
||||
* while this is running, this returns error. So, callers shouldn't
|
||||
* keep handling the resizers if this returns error.
|
||||
*/
|
||||
nsresult SetAllResizersPosition();
|
||||
|
||||
/**
|
||||
|
@ -1811,15 +1818,31 @@ protected: // Shouldn't be used by friend classes
|
|||
*/
|
||||
nsresult HideResizersInternal();
|
||||
|
||||
/**
|
||||
* RefreshResizersInternal() moves resizers to proper position. This does
|
||||
* nothing if there is no resizing target.
|
||||
*/
|
||||
nsresult RefreshResizersInternal();
|
||||
|
||||
ManualNACPtr CreateResizer(int16_t aLocation, nsIContent& aParentContent);
|
||||
void SetAnonymousElementPosition(int32_t aX, int32_t aY,
|
||||
Element* aResizer);
|
||||
|
||||
ManualNACPtr CreateShadow(nsIContent& aParentContent,
|
||||
Element& aOriginalObject);
|
||||
nsresult SetShadowPosition(Element* aShadow, Element* aOriginalObject,
|
||||
int32_t aOriginalObjectX,
|
||||
int32_t aOriginalObjectY);
|
||||
|
||||
/**
|
||||
* SetShadowPosition() moves the shadow element to proper position.
|
||||
*
|
||||
* @param aShadowElement Must be mResizingShadow or mPositioningShadow.
|
||||
* @param aElement The element which has the shadow.
|
||||
* @param aElementX Left of aElement.
|
||||
* @param aElementY Top of aElement.
|
||||
*/
|
||||
nsresult SetShadowPosition(Element& aShadowElement,
|
||||
Element& aElement,
|
||||
int32_t aElementLeft,
|
||||
int32_t aElementTop);
|
||||
|
||||
ManualNACPtr CreateResizingInfo(nsIContent& aParentContent);
|
||||
nsresult SetResizingInfoPosition(int32_t aX, int32_t aY,
|
||||
|
@ -1904,15 +1927,26 @@ protected: // Shouldn't be used by friend classes
|
|||
nsAString& aReturn);
|
||||
|
||||
/**
|
||||
* Shows inline table editing UI around a table cell
|
||||
* @param aCell [IN] a DOM Element being a table cell, td or th
|
||||
* Shows inline table editing UI around a <table> element which contains
|
||||
* aCellElement. This returns error if creating UI is hidden during this,
|
||||
* or detects another set of UI during this. In such case, callers
|
||||
* shouldn't keep handling anything for the UI.
|
||||
*
|
||||
* @param aCellElement Must be an <td> or <th> element.
|
||||
*/
|
||||
nsresult ShowInlineTableEditingUI(Element* aCell);
|
||||
nsresult ShowInlineTableEditingUIInternal(Element& aCellElement);
|
||||
|
||||
/**
|
||||
* Hide all inline table editing UI
|
||||
* Hide all inline table editing UI.
|
||||
*/
|
||||
void HideInlineTableEditingUI();
|
||||
void HideInlineTableEditingUIInternal();
|
||||
|
||||
/**
|
||||
* RefreshInlineTableEditingUIInternal() moves inline table editing UI to
|
||||
* proper position. This returns error if the UI is hidden or replaced
|
||||
* during moving.
|
||||
*/
|
||||
nsresult RefreshInlineTableEditingUIInternal();
|
||||
|
||||
/**
|
||||
* IsEmptyTextNode() returns true if aNode is a text node and does not have
|
||||
|
@ -2092,6 +2126,7 @@ protected:
|
|||
|
||||
friend class AutoSelectionSetterAfterTableEdit;
|
||||
friend class CSSEditUtils;
|
||||
friend class DocumentResizeEventListener;
|
||||
friend class EditorBase;
|
||||
friend class EmptyEditableFunctor;
|
||||
friend class HTMLEditRules;
|
||||
|
|
|
@ -55,8 +55,12 @@ NS_IMETHODIMP
|
|||
DocumentResizeEventListener::HandleEvent(Event* aMouseEvent)
|
||||
{
|
||||
RefPtr<HTMLEditor> htmlEditor = mHTMLEditorWeak.get();
|
||||
if (htmlEditor) {
|
||||
return htmlEditor->RefreshResizers();
|
||||
if (!htmlEditor) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult rv = htmlEditor->RefreshResizersInternal();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -175,16 +179,15 @@ HTMLEditor::CreateResizingInfo(nsIContent& aParentContent)
|
|||
nsresult
|
||||
HTMLEditor::SetAllResizersPosition()
|
||||
{
|
||||
NS_ENSURE_TRUE(mTopLeftHandle, NS_ERROR_FAILURE);
|
||||
if (NS_WARN_IF(!mTopLeftHandle)) {
|
||||
return NS_ERROR_FAILURE; // There are no resizers.
|
||||
}
|
||||
|
||||
int32_t x = mResizedObjectX;
|
||||
int32_t y = mResizedObjectY;
|
||||
int32_t w = mResizedObjectWidth;
|
||||
int32_t h = mResizedObjectHeight;
|
||||
|
||||
// now let's place all the resizers around the image
|
||||
|
||||
// get the size of resizers
|
||||
nsAutoString value;
|
||||
float resizerWidth, resizerHeight;
|
||||
RefPtr<nsAtom> dummyUnit;
|
||||
|
@ -195,19 +198,54 @@ HTMLEditor::SetAllResizersPosition()
|
|||
value);
|
||||
CSSEditUtils::ParseLength(value, &resizerHeight, getter_AddRefs(dummyUnit));
|
||||
|
||||
int32_t rw = (int32_t)((resizerWidth + 1) / 2);
|
||||
int32_t rh = (int32_t)((resizerHeight+ 1) / 2);
|
||||
int32_t rw = static_cast<int32_t>((resizerWidth + 1) / 2);
|
||||
int32_t rh = static_cast<int32_t>((resizerHeight+ 1) / 2);
|
||||
|
||||
// While moving each resizer, mutation event listener may hide the resizers.
|
||||
// And in worst case, new resizers may be recreated. So, we need to store
|
||||
// all resizers here, and then, if we detect a resizer is removed or replaced,
|
||||
// we should do nothing anymore.
|
||||
// FYI: Note that only checking if mTopLeftHandle is replaced is enough.
|
||||
// We're may be in hot path if user resizes an element a lot. So,
|
||||
// we should just add-ref mTopLeftHandle.
|
||||
RefPtr<Element> topLeftHandle = mTopLeftHandle.get();
|
||||
SetAnonymousElementPosition(x - rw, y - rh, mTopLeftHandle);
|
||||
if (NS_WARN_IF(topLeftHandle != mTopLeftHandle)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
SetAnonymousElementPosition(x + w/2-rw, y - rh, mTopHandle);
|
||||
if (NS_WARN_IF(topLeftHandle != mTopLeftHandle)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
SetAnonymousElementPosition(x + w-rw-1, y - rh, mTopRightHandle);
|
||||
if (NS_WARN_IF(topLeftHandle != mTopLeftHandle)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
SetAnonymousElementPosition(x - rw, y + h / 2 - rh, mLeftHandle);
|
||||
if (NS_WARN_IF(topLeftHandle != mTopLeftHandle)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
SetAnonymousElementPosition(x + w-rw-1, y + h / 2 - rh, mRightHandle);
|
||||
if (NS_WARN_IF(topLeftHandle != mTopLeftHandle)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
SetAnonymousElementPosition(x-rw, y+h-rh-1, mBottomLeftHandle);
|
||||
SetAnonymousElementPosition(x+w/2-rw, y+h-rh-1, mBottomHandle);
|
||||
SetAnonymousElementPosition(x+w-rw-1, y+h-rh-1, mBottomRightHandle);
|
||||
SetAnonymousElementPosition(x - rw, y + h - rh - 1,
|
||||
mBottomLeftHandle);
|
||||
if (NS_WARN_IF(topLeftHandle != mTopLeftHandle)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
SetAnonymousElementPosition(x + w / 2 - rw, y + h - rh - 1,
|
||||
mBottomHandle);
|
||||
if (NS_WARN_IF(topLeftHandle != mTopLeftHandle)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
SetAnonymousElementPosition(x + w - rw - 1, y + h - rh - 1,
|
||||
mBottomRightHandle);
|
||||
if (NS_WARN_IF(topLeftHandle != mTopLeftHandle)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -215,12 +253,24 @@ HTMLEditor::SetAllResizersPosition()
|
|||
NS_IMETHODIMP
|
||||
HTMLEditor::RefreshResizers()
|
||||
{
|
||||
// nothing to do if resizers are not displayed...
|
||||
NS_ENSURE_TRUE(mResizedObject, NS_OK);
|
||||
nsresult rv = RefreshResizersInternal();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv =
|
||||
GetPositionAndDimensions(
|
||||
*mResizedObject,
|
||||
nsresult
|
||||
HTMLEditor::RefreshResizersInternal()
|
||||
{
|
||||
// Don't warn even if resizers are not visible since script cannot check
|
||||
// if they are visible and this is non-virtual method. So, the cost of
|
||||
// calling this can be ignored.
|
||||
if (!mResizedObject) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv = GetPositionAndDimensions(*mResizedObject,
|
||||
mResizedObjectX,
|
||||
mResizedObjectY,
|
||||
mResizedObjectWidth,
|
||||
|
@ -229,19 +279,31 @@ HTMLEditor::RefreshResizers()
|
|||
mResizedObjectBorderTop,
|
||||
mResizedObjectMarginLeft,
|
||||
mResizedObjectMarginTop);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = SetAllResizersPosition();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return SetShadowPosition(mResizingShadow, mResizedObject,
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mResizingShadow,
|
||||
"SetAllResizersPosition() should return error if resizers are hidden");
|
||||
rv = SetShadowPosition(*mResizingShadow, *mResizedObject,
|
||||
mResizedObjectX, mResizedObjectY);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLEditor::ShowResizersInternal(Element& aResizedElement)
|
||||
{
|
||||
// When we have visible resizers, we cannot show new resizers.
|
||||
// So, the caller should call HideResizersInternal() first.
|
||||
// So, the caller should call HideResizersInternal() first if this
|
||||
// returns error.
|
||||
if (NS_WARN_IF(mResizedObject)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
@ -261,48 +323,102 @@ HTMLEditor::ShowResizersInternal(Element& aResizedElement)
|
|||
mResizedObject = &aResizedElement;
|
||||
|
||||
// The resizers and the shadow will be anonymous siblings of the element.
|
||||
mTopLeftHandle =
|
||||
// Note that creating a resizer or shadow may causes calling
|
||||
// HideRisizersInternal() via a mutation event listener. So, we should
|
||||
// store new resizer to a local variable, then, check:
|
||||
// - whether creating resizer is already set to the member or not
|
||||
// - whether resizing element is changed to another element
|
||||
// If showing resizers are canceled, we hit the latter check.
|
||||
// If resizers for another element is shown during this, we hit the latter
|
||||
// check too.
|
||||
// If resizers are just shown again for same element, we hit the former
|
||||
// check.
|
||||
ManualNACPtr newResizer =
|
||||
CreateResizer(nsIHTMLObjectResizer::eTopLeft, *parentContent);
|
||||
if (NS_WARN_IF(!mTopLeftHandle)) {
|
||||
if (NS_WARN_IF(!newResizer)) {
|
||||
break;
|
||||
}
|
||||
mTopHandle = CreateResizer(nsIHTMLObjectResizer::eTop, *parentContent);
|
||||
if (NS_WARN_IF(!mTopHandle)) {
|
||||
if (NS_WARN_IF(mTopLeftHandle) ||
|
||||
NS_WARN_IF(mResizedObject != &aResizedElement)) {
|
||||
// Don't hide current resizers in this case because they are not what
|
||||
// we're creating.
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mTopLeftHandle = std::move(newResizer);
|
||||
newResizer = CreateResizer(nsIHTMLObjectResizer::eTop, *parentContent);
|
||||
if (NS_WARN_IF(!newResizer)) {
|
||||
break;
|
||||
}
|
||||
mTopRightHandle =
|
||||
CreateResizer(nsIHTMLObjectResizer::eTopRight, *parentContent);
|
||||
if (NS_WARN_IF(!mTopRightHandle)) {
|
||||
if (NS_WARN_IF(mTopHandle) ||
|
||||
NS_WARN_IF(mResizedObject != &aResizedElement)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mTopHandle = std::move(newResizer);
|
||||
newResizer = CreateResizer(nsIHTMLObjectResizer::eTopRight, *parentContent);
|
||||
if (NS_WARN_IF(!newResizer)) {
|
||||
break;
|
||||
}
|
||||
if (NS_WARN_IF(mTopRightHandle) ||
|
||||
NS_WARN_IF(mResizedObject != &aResizedElement)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mTopRightHandle = std::move(newResizer);
|
||||
|
||||
mLeftHandle = CreateResizer(nsIHTMLObjectResizer::eLeft, *parentContent);
|
||||
if (NS_WARN_IF(!mLeftHandle)) {
|
||||
newResizer = CreateResizer(nsIHTMLObjectResizer::eLeft, *parentContent);
|
||||
if (NS_WARN_IF(!newResizer)) {
|
||||
break;
|
||||
}
|
||||
mRightHandle = CreateResizer(nsIHTMLObjectResizer::eRight, *parentContent);
|
||||
if (NS_WARN_IF(!mRightHandle)) {
|
||||
if (NS_WARN_IF(mLeftHandle) ||
|
||||
NS_WARN_IF(mResizedObject != &aResizedElement)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mLeftHandle = std::move(newResizer);
|
||||
newResizer = CreateResizer(nsIHTMLObjectResizer::eRight, *parentContent);
|
||||
if (NS_WARN_IF(!newResizer)) {
|
||||
break;
|
||||
}
|
||||
if (NS_WARN_IF(mRightHandle) ||
|
||||
NS_WARN_IF(mResizedObject != &aResizedElement)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mRightHandle = std::move(newResizer);
|
||||
|
||||
mBottomLeftHandle =
|
||||
newResizer =
|
||||
CreateResizer(nsIHTMLObjectResizer::eBottomLeft, *parentContent);
|
||||
if (NS_WARN_IF(!mBottomLeftHandle)) {
|
||||
if (NS_WARN_IF(!newResizer)) {
|
||||
break;
|
||||
}
|
||||
mBottomHandle =
|
||||
CreateResizer(nsIHTMLObjectResizer::eBottom, *parentContent);
|
||||
if (NS_WARN_IF(!mBottomHandle)) {
|
||||
if (NS_WARN_IF(mBottomLeftHandle) ||
|
||||
NS_WARN_IF(mResizedObject != &aResizedElement)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mBottomLeftHandle = std::move(newResizer);
|
||||
newResizer = CreateResizer(nsIHTMLObjectResizer::eBottom, *parentContent);
|
||||
if (NS_WARN_IF(!newResizer)) {
|
||||
break;
|
||||
}
|
||||
mBottomRightHandle =
|
||||
if (NS_WARN_IF(mBottomHandle) ||
|
||||
NS_WARN_IF(mResizedObject != &aResizedElement)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mBottomHandle = std::move(newResizer);
|
||||
newResizer =
|
||||
CreateResizer(nsIHTMLObjectResizer::eBottomRight, *parentContent);
|
||||
if (NS_WARN_IF(!mBottomRightHandle)) {
|
||||
if (NS_WARN_IF(!newResizer)) {
|
||||
break;
|
||||
}
|
||||
if (NS_WARN_IF(mBottomRightHandle) ||
|
||||
NS_WARN_IF(mResizedObject != &aResizedElement)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mBottomRightHandle = std::move(newResizer);
|
||||
|
||||
nsresult rv =
|
||||
GetPositionAndDimensions(aResizedElement,
|
||||
// Store the last resizer which we created. This is useful when we
|
||||
// need to check whether our resizers are hiddedn and recreated another
|
||||
// set of resizers or not.
|
||||
RefPtr<Element> createdBottomRightNalde = mBottomRightHandle.get();
|
||||
|
||||
nsresult rv = GetPositionAndDimensions(aResizedElement,
|
||||
mResizedObjectX,
|
||||
mResizedObjectY,
|
||||
mResizedObjectWidth,
|
||||
|
@ -318,26 +434,43 @@ HTMLEditor::ShowResizersInternal(Element& aResizedElement)
|
|||
// and let's set their absolute positions in the document
|
||||
rv = SetAllResizersPosition();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
if (NS_WARN_IF(mBottomRightHandle.get() != createdBottomRightNalde)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// now, let's create the resizing shadow
|
||||
mResizingShadow = CreateShadow(*parentContent, aResizedElement);
|
||||
if (NS_WARN_IF(!mResizingShadow)) {
|
||||
ManualNACPtr newShadow = CreateShadow(*parentContent, aResizedElement);
|
||||
if (NS_WARN_IF(!newShadow)) {
|
||||
break;
|
||||
}
|
||||
if (NS_WARN_IF(mResizingShadow) ||
|
||||
NS_WARN_IF(mResizedObject != &aResizedElement)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mResizingShadow = std::move(newShadow);
|
||||
|
||||
// and set its position
|
||||
rv = SetShadowPosition(mResizingShadow, &aResizedElement,
|
||||
rv = SetShadowPosition(*mResizingShadow, aResizedElement,
|
||||
mResizedObjectX, mResizedObjectY);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
if (NS_WARN_IF(mBottomRightHandle.get() != createdBottomRightNalde)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// and then the resizing info tooltip
|
||||
mResizingInfo = CreateResizingInfo(*parentContent);
|
||||
if (NS_WARN_IF(!mResizingInfo)) {
|
||||
ManualNACPtr newResizingInfo = CreateResizingInfo(*parentContent);
|
||||
if (NS_WARN_IF(!newResizingInfo)) {
|
||||
break;
|
||||
}
|
||||
if (NS_WARN_IF(mResizingInfo) ||
|
||||
NS_WARN_IF(mResizedObject != &aResizedElement)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mResizingInfo = std::move(newResizingInfo);
|
||||
|
||||
// and listen to the "resize" event on the window first, get the
|
||||
// window from the document...
|
||||
|
@ -388,7 +521,10 @@ HTMLEditor::HideResizers()
|
|||
nsresult
|
||||
HTMLEditor::HideResizersInternal()
|
||||
{
|
||||
if (NS_WARN_IF(!mResizedObject)) {
|
||||
// Don't warn even if resizers are visible since script cannot check
|
||||
// if they are visible and this is non-virtual method. So, the cost of
|
||||
// calling this can be ignored.
|
||||
if (!mResizedObject) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -734,19 +870,33 @@ HTMLEditor::SetResizingInfoPosition(int32_t aX,
|
|||
}
|
||||
|
||||
nsresult
|
||||
HTMLEditor::SetShadowPosition(Element* aShadow,
|
||||
Element* aOriginalObject,
|
||||
int32_t aOriginalObjectX,
|
||||
int32_t aOriginalObjectY)
|
||||
HTMLEditor::SetShadowPosition(Element& aShadowElement,
|
||||
Element& aElement,
|
||||
int32_t aElementX,
|
||||
int32_t aElementY)
|
||||
{
|
||||
SetAnonymousElementPosition(aOriginalObjectX, aOriginalObjectY, aShadow);
|
||||
MOZ_ASSERT(&aShadowElement == mResizingShadow ||
|
||||
&aShadowElement == mPositioningShadow);
|
||||
RefPtr<Element> handlingShadowElement =
|
||||
&aShadowElement == mResizingShadow ?
|
||||
mResizingShadow.get() : mPositioningShadow.get();
|
||||
|
||||
SetAnonymousElementPosition(aElementX, aElementY, &aShadowElement);
|
||||
if (NS_WARN_IF(&aShadowElement != handlingShadowElement)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (!HTMLEditUtils::IsImage(&aElement)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (HTMLEditUtils::IsImage(aOriginalObject)) {
|
||||
nsAutoString imageSource;
|
||||
aOriginalObject->GetAttr(kNameSpaceID_None, nsGkAtoms::src, imageSource);
|
||||
nsresult rv = aShadow->SetAttr(kNameSpaceID_None, nsGkAtoms::src,
|
||||
aElement.GetAttr(kNameSpaceID_None, nsGkAtoms::src, imageSource);
|
||||
nsresult rv = aShadowElement.SetAttr(kNameSpaceID_None, nsGkAtoms::src,
|
||||
imageSource, true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (NS_WARN_IF(NS_FAILED(rv)) ||
|
||||
NS_WARN_IF(&aShadowElement != handlingShadowElement)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -995,15 +1145,8 @@ HTMLEditor::SetFinalSize(int32_t aX,
|
|||
mResizedObjectWidth = width;
|
||||
mResizedObjectHeight = height;
|
||||
|
||||
RefreshResizers();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::GetResizedObject(Element** aResizedObject)
|
||||
{
|
||||
RefPtr<Element> ret = mResizedObject;
|
||||
ret.forget(aResizedObject);
|
||||
return NS_OK;
|
||||
DebugOnly<nsresult> rv = RefreshResizersInternal();
|
||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "Failed ot refresh resizers");
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -21,10 +21,6 @@
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
// Uncomment the following line if you want to disable
|
||||
// table deletion when the only column/row is removed
|
||||
// #define DISABLE_TABLE_DELETION 1
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::SetInlineTableEditingEnabled(bool aIsEnabled)
|
||||
{
|
||||
|
@ -40,45 +36,112 @@ HTMLEditor::GetInlineTableEditingEnabled(bool* aIsEnabled)
|
|||
}
|
||||
|
||||
nsresult
|
||||
HTMLEditor::ShowInlineTableEditingUI(Element* aCell)
|
||||
HTMLEditor::ShowInlineTableEditingUIInternal(Element& aCellElement)
|
||||
{
|
||||
// do nothing if aCell is not a table cell...
|
||||
if (!aCell || !HTMLEditUtils::IsTableCell(aCell)) {
|
||||
if (NS_WARN_IF(!HTMLEditUtils::IsTableCell(&aCellElement))) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(!IsDescendantOfEditorRoot(aCell))) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
if (NS_WARN_IF(!IsDescendantOfEditorRoot(&aCellElement))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (mInlineEditedCell) {
|
||||
NS_ERROR("call HideInlineTableEditingUI first");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
if (NS_WARN_IF(mInlineEditedCell)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mInlineEditedCell = &aCellElement;
|
||||
|
||||
// the resizers and the shadow will be anonymous children of the body
|
||||
RefPtr<Element> bodyElement = GetRoot();
|
||||
NS_ENSURE_TRUE(bodyElement, NS_ERROR_NULL_POINTER);
|
||||
if (NS_WARN_IF(!bodyElement)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mAddColumnBeforeButton =
|
||||
do {
|
||||
// The buttons of inline table editor will be children of the <body>
|
||||
// element. Creating the anonymous elements may cause calling
|
||||
// HideInlineTableEditingUIInternal() via a mutation event listener.
|
||||
// So, we should store new button to a local variable, then, check:
|
||||
// - whether creating a button is already set to the member or not
|
||||
// - whether already created buttons are changed to another set
|
||||
// If creating the buttons are canceled, we hit the latter check.
|
||||
// If buttons for another table are created during this, we hit the latter
|
||||
// check too.
|
||||
// If buttons are just created again for same element, we hit the former
|
||||
// check.
|
||||
ManualNACPtr addColumnBeforeButton =
|
||||
CreateAnonymousElement(nsGkAtoms::a, *bodyElement,
|
||||
NS_LITERAL_STRING("mozTableAddColumnBefore"), false);
|
||||
mRemoveColumnButton =
|
||||
if (NS_WARN_IF(!addColumnBeforeButton)) {
|
||||
break; // Hide unnecessary buttons created above.
|
||||
}
|
||||
if (NS_WARN_IF(mAddColumnBeforeButton) ||
|
||||
NS_WARN_IF(mInlineEditedCell != &aCellElement)) {
|
||||
return NS_ERROR_FAILURE; // Don't hide another set of buttons.
|
||||
}
|
||||
mAddColumnBeforeButton = std::move(addColumnBeforeButton);
|
||||
|
||||
ManualNACPtr removeColumnButton =
|
||||
CreateAnonymousElement(nsGkAtoms::a, *bodyElement,
|
||||
NS_LITERAL_STRING("mozTableRemoveColumn"), false);
|
||||
mAddColumnAfterButton =
|
||||
CreateAnonymousElement(nsGkAtoms::a, *bodyElement,
|
||||
NS_LITERAL_STRING("mozTableAddColumnAfter"), false);
|
||||
if (NS_WARN_IF(!removeColumnButton)) {
|
||||
break;
|
||||
}
|
||||
if (NS_WARN_IF(mRemoveColumnButton) ||
|
||||
NS_WARN_IF(mInlineEditedCell != &aCellElement)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mRemoveColumnButton = std::move(removeColumnButton);
|
||||
|
||||
mAddRowBeforeButton =
|
||||
ManualNACPtr addColumnAfterButton =
|
||||
CreateAnonymousElement(nsGkAtoms::a, *bodyElement,
|
||||
NS_LITERAL_STRING("mozTableAddColumnAfter"),
|
||||
false);
|
||||
if (NS_WARN_IF(!addColumnAfterButton)) {
|
||||
break;
|
||||
}
|
||||
if (NS_WARN_IF(mAddColumnAfterButton) ||
|
||||
NS_WARN_IF(mInlineEditedCell != &aCellElement)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mAddColumnAfterButton = std::move(addColumnAfterButton);
|
||||
|
||||
ManualNACPtr addRowBeforeButton =
|
||||
CreateAnonymousElement(nsGkAtoms::a, *bodyElement,
|
||||
NS_LITERAL_STRING("mozTableAddRowBefore"), false);
|
||||
mRemoveRowButton =
|
||||
if (NS_WARN_IF(!addRowBeforeButton)) {
|
||||
break;
|
||||
}
|
||||
if (NS_WARN_IF(mAddRowBeforeButton) ||
|
||||
NS_WARN_IF(mInlineEditedCell != &aCellElement)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mAddRowBeforeButton = std::move(addRowBeforeButton);
|
||||
|
||||
ManualNACPtr removeRowButton =
|
||||
CreateAnonymousElement(nsGkAtoms::a, *bodyElement,
|
||||
NS_LITERAL_STRING("mozTableRemoveRow"), false);
|
||||
mAddRowAfterButton =
|
||||
if (NS_WARN_IF(!removeRowButton)) {
|
||||
break;
|
||||
}
|
||||
if (NS_WARN_IF(mRemoveRowButton) ||
|
||||
NS_WARN_IF(mInlineEditedCell != &aCellElement)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mRemoveRowButton = std::move(removeRowButton);
|
||||
|
||||
ManualNACPtr addRowAfterButton =
|
||||
CreateAnonymousElement(nsGkAtoms::a, *bodyElement,
|
||||
NS_LITERAL_STRING("mozTableAddRowAfter"), false);
|
||||
if (NS_WARN_IF(!addRowAfterButton)) {
|
||||
break;
|
||||
}
|
||||
if (NS_WARN_IF(mAddRowAfterButton) ||
|
||||
NS_WARN_IF(mInlineEditedCell != &aCellElement)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mAddRowAfterButton = std::move(addRowAfterButton);
|
||||
|
||||
AddMouseClickListener(mAddColumnBeforeButton);
|
||||
AddMouseClickListener(mRemoveColumnButton);
|
||||
|
@ -87,15 +150,21 @@ HTMLEditor::ShowInlineTableEditingUI(Element* aCell)
|
|||
AddMouseClickListener(mRemoveRowButton);
|
||||
AddMouseClickListener(mAddRowAfterButton);
|
||||
|
||||
mInlineEditedCell = aCell;
|
||||
|
||||
mHasShownInlineTableEditor = true;
|
||||
|
||||
return RefreshInlineTableEditingUI();
|
||||
nsresult rv = RefreshInlineTableEditingUIInternal();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
return NS_OK;
|
||||
} while (true);
|
||||
|
||||
HideInlineTableEditingUIInternal();
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
void
|
||||
HTMLEditor::HideInlineTableEditingUI()
|
||||
HTMLEditor::HideInlineTableEditingUIInternal()
|
||||
{
|
||||
mInlineEditedCell = nullptr;
|
||||
|
||||
|
@ -115,7 +184,7 @@ HTMLEditor::HideInlineTableEditingUI()
|
|||
// Calling DeleteRefToAnonymousNode() may cause showing the UI again.
|
||||
// Therefore, we should forget all anonymous contents first.
|
||||
// Otherwise, we could leak the old content because of overwritten by
|
||||
// ShowInlineTableEditingUI().
|
||||
// ShowInlineTableEditingUIInternal().
|
||||
ManualNACPtr addColumnBeforeButton(std::move(mAddColumnBeforeButton));
|
||||
ManualNACPtr removeColumnButton(std::move(mRemoveColumnButton));
|
||||
ManualNACPtr addColumnAfterButton(std::move(mAddColumnAfterButton));
|
||||
|
@ -159,14 +228,10 @@ HTMLEditor::DoInlineTableEditingAction(const Element& aElement)
|
|||
InsertTableRow(1, true);
|
||||
} else if (anonclass.EqualsLiteral("mozTableRemoveColumn")) {
|
||||
DeleteTableColumn(1);
|
||||
#ifndef DISABLE_TABLE_DELETION
|
||||
hideUI = (colCount == 1);
|
||||
#endif
|
||||
} else if (anonclass.EqualsLiteral("mozTableRemoveRow")) {
|
||||
DeleteTableRow(1);
|
||||
#ifndef DISABLE_TABLE_DELETION
|
||||
hideUI = (rowCount == 1);
|
||||
#endif
|
||||
} else {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -179,7 +244,7 @@ HTMLEditor::DoInlineTableEditingAction(const Element& aElement)
|
|||
}
|
||||
|
||||
if (hideUI) {
|
||||
HideInlineTableEditingUI();
|
||||
HideInlineTableEditingUIInternal();
|
||||
if (hideResizersWithInlineTableUI) {
|
||||
DebugOnly<nsresult> rv = HideResizersInternal();
|
||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "Failed to hide resizers");
|
||||
|
@ -209,62 +274,81 @@ HTMLEditor::RemoveMouseClickListener(Element* aElement)
|
|||
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::RefreshInlineTableEditingUI()
|
||||
{
|
||||
nsresult rv = RefreshInlineTableEditingUIInternal();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLEditor::RefreshInlineTableEditingUIInternal()
|
||||
{
|
||||
if (!mInlineEditedCell) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
RefPtr<nsGenericHTMLElement> htmlElement =
|
||||
RefPtr<nsGenericHTMLElement> inlineEditingCellElement =
|
||||
nsGenericHTMLElement::FromNode(mInlineEditedCell);
|
||||
if (!htmlElement) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if (NS_WARN_IF(!inlineEditingCellElement)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
int32_t xCell, yCell, wCell, hCell;
|
||||
GetElementOrigin(*mInlineEditedCell, xCell, yCell);
|
||||
int32_t cellX = 0, cellY = 0;
|
||||
GetElementOrigin(*mInlineEditedCell, cellX, cellY);
|
||||
|
||||
wCell = htmlElement->OffsetWidth();
|
||||
hCell = htmlElement->OffsetHeight();
|
||||
int32_t cellWidth = inlineEditingCellElement->OffsetWidth();
|
||||
int32_t cellHeight = inlineEditingCellElement->OffsetHeight();
|
||||
|
||||
int32_t xHoriz = xCell + wCell/2;
|
||||
int32_t yVert = yCell + hCell/2;
|
||||
int32_t centerOfCellX = cellX + cellWidth / 2;
|
||||
int32_t centerOfCellY = cellY + cellHeight / 2;
|
||||
|
||||
RefPtr<Element> tableElement = GetEnclosingTable(mInlineEditedCell);
|
||||
int32_t rowCount, colCount;
|
||||
int32_t rowCount = 0, colCount = 0;
|
||||
nsresult rv = GetTableSize(tableElement, &rowCount, &colCount);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
SetAnonymousElementPosition(xHoriz-10, yCell-7, mAddColumnBeforeButton);
|
||||
#ifdef DISABLE_TABLE_DELETION
|
||||
if (colCount== 1) {
|
||||
mRemoveColumnButton->SetAttr(kNameSpaceID_None, nsGkAtoms::_class,
|
||||
NS_LITERAL_STRING("hidden"), true);
|
||||
} else {
|
||||
if (mRemoveColumnButton->HasAttr(kNameSpaceID_None, nsGkAtoms::_class)) {
|
||||
mRemoveColumnButton->UnsetAttr(kNameSpaceID_None, nsGkAtoms::_class);
|
||||
RefPtr<Element> addColumunBeforeButton = mAddColumnBeforeButton.get();
|
||||
SetAnonymousElementPosition(centerOfCellX - 10, cellY - 7,
|
||||
addColumunBeforeButton);
|
||||
if (NS_WARN_IF(addColumunBeforeButton != mAddColumnBeforeButton.get())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
#endif
|
||||
SetAnonymousElementPosition(xHoriz-4, yCell-7, mRemoveColumnButton);
|
||||
#ifdef DISABLE_TABLE_DELETION
|
||||
}
|
||||
#endif
|
||||
SetAnonymousElementPosition(xHoriz+6, yCell-7, mAddColumnAfterButton);
|
||||
|
||||
SetAnonymousElementPosition(xCell-7, yVert-10, mAddRowBeforeButton);
|
||||
#ifdef DISABLE_TABLE_DELETION
|
||||
if (rowCount== 1) {
|
||||
mRemoveRowButton->SetAttr(kNameSpaceID_None, nsGkAtoms::_class,
|
||||
NS_LITERAL_STRING("hidden"), true);
|
||||
} else {
|
||||
if (mRemoveRowButton->HasAttr(kNameSpaceID_None, nsGkAtoms::_class)) {
|
||||
mRemoveRowButton->UnsetAttr(kNameSpaceID_None, nsGkAtoms::_class, true);
|
||||
RefPtr<Element> removeColumnButton = mRemoveColumnButton.get();
|
||||
SetAnonymousElementPosition(centerOfCellX - 4, cellY - 7, removeColumnButton);
|
||||
if (NS_WARN_IF(removeColumnButton != mRemoveColumnButton.get())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
#endif
|
||||
SetAnonymousElementPosition(xCell-7, yVert-4, mRemoveRowButton);
|
||||
#ifdef DISABLE_TABLE_DELETION
|
||||
|
||||
RefPtr<Element> addColumnAfterButton = mAddColumnAfterButton.get();
|
||||
SetAnonymousElementPosition(centerOfCellX + 6, cellY - 7,
|
||||
addColumnAfterButton);
|
||||
if (NS_WARN_IF(addColumnAfterButton != mAddColumnAfterButton.get())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
RefPtr<Element> addRowBeforeButton = mAddRowBeforeButton.get();
|
||||
SetAnonymousElementPosition(cellX - 7, centerOfCellY - 10,
|
||||
addRowBeforeButton);
|
||||
if (NS_WARN_IF(addRowBeforeButton != mAddRowBeforeButton.get())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
RefPtr<Element> removeRowButton = mRemoveRowButton.get();
|
||||
SetAnonymousElementPosition(cellX - 7, centerOfCellY - 4, removeRowButton);
|
||||
if (NS_WARN_IF(removeRowButton != mRemoveRowButton.get())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
RefPtr<Element> addRowAfterButton = mAddRowAfterButton.get();
|
||||
SetAnonymousElementPosition(cellX - 7, centerOfCellY + 6, addRowAfterButton);
|
||||
if (NS_WARN_IF(addRowAfterButton != mAddRowAfterButton.get())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
#endif
|
||||
SetAnonymousElementPosition(xCell-7, yVert+6, mAddRowAfterButton);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -58,10 +58,5 @@ interface nsIEditorMailSupport : nsISupports
|
|||
* @param aRespectNewlines Try to maintain newlines in the original?
|
||||
*/
|
||||
void rewrap(in boolean aRespectNewlines);
|
||||
|
||||
/**
|
||||
* Get a list of IMG and OBJECT tags in the current document.
|
||||
*/
|
||||
nsIArray getEmbeddedObjects();
|
||||
};
|
||||
|
||||
|
|
|
@ -19,7 +19,11 @@ interface nsIHTMLInlineTableEditor : nsISupports
|
|||
attribute boolean inlineTableEditingEnabled;
|
||||
|
||||
/**
|
||||
* Refresh already visible inline table editing UI
|
||||
* Refresh already visible inline table editing UI.
|
||||
* If inline table editing UI is not visible, this does nothing.
|
||||
* If the set of inline table editing UI is hidden or replaced with new
|
||||
* one while this is called, this throws an exception.
|
||||
* FYI: Current user in script is only BlueGriffon.
|
||||
*/
|
||||
void refreshInlineTableEditingUI();
|
||||
};
|
||||
|
|
|
@ -23,11 +23,6 @@ interface nsIHTMLObjectResizer : nsISupports
|
|||
const short eBottom = 6;
|
||||
const short eBottomRight = 7;
|
||||
|
||||
/**
|
||||
* the element currently displaying resizers
|
||||
*/
|
||||
readonly attribute Element resizedObject;
|
||||
|
||||
/**
|
||||
* a boolean indicating if object resizing is enabled in the editor
|
||||
*/
|
||||
|
@ -40,7 +35,9 @@ interface nsIHTMLObjectResizer : nsISupports
|
|||
void hideResizers();
|
||||
|
||||
/**
|
||||
* Refresh visible resizers
|
||||
* Refresh positions of resizers. If you change size of target of resizers,
|
||||
* you need to refresh position of resizers with calling this.
|
||||
* FYI: Current user in script is only BlueGriffon.
|
||||
*/
|
||||
void refreshResizers();
|
||||
};
|
||||
|
|
|
@ -560,7 +560,10 @@ nsCORSListenerProxy::CheckRequestApproved(nsIRequest* aRequest)
|
|||
}
|
||||
|
||||
if (NS_FAILED(status)) {
|
||||
if (NS_BINDING_ABORTED != status) {
|
||||
// Don't want to log mere cancellation as an error.
|
||||
LogBlockedRequest(aRequest, "CORSDidNotSucceed", nullptr, topChannel);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ def main():
|
|||
|
||||
schema = luscious.get_jsonschema(mozbuild.telemetry.schema)
|
||||
with open(args.output, 'wb') as f:
|
||||
json.dump(schema, f, indent=4, sort_keys=True)
|
||||
json.dump(schema, f, indent=2, sort_keys=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -7,7 +7,6 @@ head = head.js
|
|||
# Skip this test when FHR/Telemetry aren't available.
|
||||
skip-if = !healthreport || !telemetry
|
||||
[browser_about_studies.js]
|
||||
skip-if = true # bug 1442712
|
||||
[browser_actions_AddonStudyAction.js]
|
||||
[browser_actions_ConsoleLogAction.js]
|
||||
[browser_actions_PreferenceRolloutAction.js]
|
||||
|
|
|
@ -15,7 +15,8 @@ return async (...args) => (
|
|||
decorate_task(
|
||||
withAboutStudies,
|
||||
async function testAboutStudiesWorks(browser) {
|
||||
ok(browser.contentDocumentAsCPOW.getElementById("app"), "App element was found");
|
||||
const appFound = await ContentTask.spawn(browser, null, () => content.document.getElementById("app"));
|
||||
ok(appFound, "App element was found");
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -149,10 +149,6 @@ totalTime
|
|||
~~~~~~~~~
|
||||
A non-monotonic integer representing the number of seconds the session has been alive.
|
||||
|
||||
uptime
|
||||
~~~~~~
|
||||
A non-monotonic integer representing the number of minutes the session has been alive.
|
||||
|
||||
addonManager
|
||||
~~~~~~~~~~~~
|
||||
Only available in the extended set of measures, it contains a set of counters related to Addons. See `here <https://dxr.mozilla.org/mozilla-central/search?q=%22AddonManagerPrivate.recordSimpleMeasure%22&redirect=false&case=true>`__ for a list of recorded measures.
|
||||
|
|
|
@ -745,7 +745,6 @@ var Impl = {
|
|||
let elapsedTime = Date.now() - si.process;
|
||||
var ret = {
|
||||
totalTime: Math.round(elapsedTime / 1000), // totalTime, in seconds
|
||||
uptime: Math.round(elapsedTime / 60000), // uptime in minutes
|
||||
};
|
||||
|
||||
// Look for app-specific timestamps
|
||||
|
|
|
@ -280,7 +280,6 @@ function checkPayload(payload, reason, successfulPings) {
|
|||
checkPayloadInfo(payload.info, reason);
|
||||
|
||||
Assert.ok(payload.simpleMeasurements.totalTime >= 0);
|
||||
Assert.ok(payload.simpleMeasurements.uptime >= 0);
|
||||
Assert.equal(payload.simpleMeasurements.startupInterrupted, 1);
|
||||
Assert.equal(payload.simpleMeasurements.shutdownDuration, SHUTDOWN_TIME);
|
||||
Assert.ok("maximalNumberOfConcurrentThreads" in payload.simpleMeasurements);
|
||||
|
|
|
@ -528,23 +528,31 @@ CreateNotebookWidget()
|
|||
return widget;
|
||||
}
|
||||
|
||||
static GtkWidget*
|
||||
static void
|
||||
CreateHeaderBarWidget(WidgetNodeType aWidgetType)
|
||||
{
|
||||
MOZ_ASSERT(gtk_check_version(3, 10, 0) == nullptr,
|
||||
"GtkHeaderBar is only available on GTK 3.10+.");
|
||||
MOZ_ASSERT(sWidgetStorage[aWidgetType] == nullptr,
|
||||
"Header bar widget is already created!");
|
||||
|
||||
static auto sGtkHeaderBarNewPtr = (GtkWidget* (*)())
|
||||
dlsym(RTLD_DEFAULT, "gtk_header_bar_new");
|
||||
|
||||
GtkWidget* headerbar = sGtkHeaderBarNewPtr();
|
||||
sWidgetStorage[aWidgetType] = headerbar;
|
||||
|
||||
GtkWidget *window = gtk_window_new(GTK_WINDOW_POPUP);
|
||||
GtkStyleContext* style = gtk_widget_get_style_context(window);
|
||||
|
||||
if (aWidgetType == MOZ_GTK_HEADER_BAR_MAXIMIZED) {
|
||||
gtk_style_context_add_class(style, "maximized");
|
||||
MOZ_ASSERT(sWidgetStorage[MOZ_GTK_HEADERBAR_WINDOW_MAXIMIZED] == nullptr,
|
||||
"Window widget is already created!");
|
||||
sWidgetStorage[MOZ_GTK_HEADERBAR_WINDOW_MAXIMIZED] = window;
|
||||
} else {
|
||||
MOZ_ASSERT(sWidgetStorage[MOZ_GTK_HEADERBAR_WINDOW] == nullptr,
|
||||
"Window widget is already created!");
|
||||
sWidgetStorage[MOZ_GTK_HEADERBAR_WINDOW] = window;
|
||||
}
|
||||
|
||||
|
@ -571,8 +579,6 @@ CreateHeaderBarWidget(WidgetNodeType aWidgetType)
|
|||
// We need to fix titlebar size calculation to also include
|
||||
// titlebar button sizes. (Bug 1419442)
|
||||
gtk_style_context_add_class(style, "default-decoration");
|
||||
|
||||
return headerbar;
|
||||
}
|
||||
|
||||
#define ICON_SCALE_VARIANTS 2
|
||||
|
@ -761,15 +767,8 @@ CreateHeaderBarButtons()
|
|||
static void
|
||||
CreateHeaderBar()
|
||||
{
|
||||
MOZ_ASSERT(sWidgetStorage[MOZ_GTK_HEADER_BAR] == nullptr &&
|
||||
sWidgetStorage[MOZ_GTK_HEADER_BAR_MAXIMIZED] == nullptr,
|
||||
"Header bar widget is already created!");
|
||||
|
||||
sWidgetStorage[MOZ_GTK_HEADER_BAR] =
|
||||
CreateHeaderBarWidget(MOZ_GTK_HEADER_BAR);
|
||||
sWidgetStorage[MOZ_GTK_HEADER_BAR_MAXIMIZED] =
|
||||
CreateHeaderBarWidget(MOZ_GTK_HEADER_BAR_MAXIMIZED);
|
||||
|
||||
CreateHeaderBarButtons();
|
||||
}
|
||||
|
||||
|
|
|
@ -428,22 +428,10 @@ GetGtkHeaderBarButtonLayout(WidgetNodeType* aButtonLayout, int aMaxButtonNums)
|
|||
NS_ASSERTION(aMaxButtonNums >= TOOLBAR_BUTTONS,
|
||||
"Requested number of buttons is higher than storage capacity!");
|
||||
|
||||
static auto sGtkHeaderBarGetDecorationLayoutPtr =
|
||||
(const gchar* (*)(GtkWidget*))
|
||||
dlsym(RTLD_DEFAULT, "gtk_header_bar_get_decoration_layout");
|
||||
|
||||
const gchar* decorationLayout = nullptr;
|
||||
if (sGtkHeaderBarGetDecorationLayoutPtr) {
|
||||
GtkWidget* headerBar = GetWidget(MOZ_GTK_HEADER_BAR);
|
||||
decorationLayout = sGtkHeaderBarGetDecorationLayoutPtr(headerBar);
|
||||
if (!decorationLayout) {
|
||||
GtkSettings *settings = gtk_settings_get_for_screen(
|
||||
gdk_screen_get_default());
|
||||
g_object_get(settings, "gtk-decoration-layout",
|
||||
&decorationLayout,
|
||||
nullptr);
|
||||
}
|
||||
}
|
||||
GtkSettings *settings =
|
||||
gtk_settings_get_for_screen(gdk_screen_get_default());
|
||||
g_object_get(settings, "gtk-decoration-layout", &decorationLayout, nullptr);
|
||||
|
||||
// Use a default layout
|
||||
if (!decorationLayout) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче