Merge remote-tracking branch 'origin/tracking' into custom

This commit is contained in:
roytam1 2024-03-21 15:25:04 +08:00
commit d8ac621203
3 changed files with 73 additions and 44 deletions

View file

@ -214,8 +214,7 @@ public:
RefPtr<T>& RefPtr<T>&
operator=(RefPtr<T> && aRefPtr) operator=(RefPtr<T> && aRefPtr)
{ {
assign_assuming_AddRef(aRefPtr.mRawPtr); assign_assuming_AddRef(aRefPtr.forget().take());
aRefPtr.mRawPtr = nullptr;
return *this; return *this;
} }

View file

@ -330,6 +330,8 @@ nsHtml5TreeOperation::AddAttributes(nsIContent* aNode,
nsHtml5HtmlAttributes* aAttributes, nsHtml5HtmlAttributes* aAttributes,
nsHtml5DocumentBuilder* aBuilder) nsHtml5DocumentBuilder* aBuilder)
{ {
MOZ_ASSERT(aNode->IsAnyOfHTMLElements(nsGkAtoms::body, nsGkAtoms::html));
dom::Element* node = aNode->AsElement(); dom::Element* node = aNode->AsElement();
nsHtml5OtherDocUpdate update(node->OwnerDoc(), nsHtml5OtherDocUpdate update(node->OwnerDoc(),
aBuilder->GetDocument()); aBuilder->GetDocument());
@ -342,7 +344,8 @@ nsHtml5TreeOperation::AddAttributes(nsIContent* aNode,
nsCOMPtr<nsIAtom> localName = nsCOMPtr<nsIAtom> localName =
Reget(aAttributes->getLocalNameNoBoundsCheck(i)); Reget(aAttributes->getLocalNameNoBoundsCheck(i));
int32_t nsuri = aAttributes->getURINoBoundsCheck(i); int32_t nsuri = aAttributes->getURINoBoundsCheck(i);
if (!node->HasAttr(nsuri, localName)) { if (!node->HasAttr(nsuri, localName) &&
!(nsuri == kNameSpaceID_None && localName == nsGkAtoms::nonce)) {
// prefix doesn't need regetting. it is always null or a static atom // prefix doesn't need regetting. it is always null or a static atom
// local name is never null // local name is never null
nsString value; // Not Auto, because using it to hold nsStringBuffer* nsString value; // Not Auto, because using it to hold nsStringBuffer*

View file

@ -737,6 +737,7 @@
</handler> </handler>
<handler event="MozSwipeGesture" preventdefault="true"> <handler event="MozSwipeGesture" preventdefault="true">
<![CDATA[ <![CDATA[
if (!this.view) return;
// Figure out which row to show // Figure out which row to show
let targetRow = 0; let targetRow = 0;
@ -756,6 +757,7 @@
<handler event="focus"> <handler event="focus">
<![CDATA[ <![CDATA[
this.treeBoxObject.focused = true; this.treeBoxObject.focused = true;
if (!this.view) return;
if (this.currentIndex == -1 && this.view.rowCount > 0) { if (this.currentIndex == -1 && this.view.rowCount > 0) {
this.currentIndex = this.treeBoxObject.getFirstVisibleRow(); this.currentIndex = this.treeBoxObject.getFirstVisibleRow();
} }
@ -778,7 +780,7 @@
<!-- Use F2 key to enter text editing. --> <!-- Use F2 key to enter text editing. -->
<handler event="keydown" keycode="VK_F2"> <handler event="keydown" keycode="VK_F2">
<![CDATA[ <![CDATA[
if (!this._cellSelType) if (!this.view || !this._cellSelType)
return; return;
var row = this.currentIndex; var row = this.currentIndex;
var column = this.view.selection.currentColumn; var column = this.view.selection.currentColumn;
@ -900,112 +902,112 @@
</handler> </handler>
<handler event="keydown" keycode="VK_UP" modifiers="accel any"> <handler event="keydown" keycode="VK_UP" modifiers="accel any">
<![CDATA[ <![CDATA[
if (this._editingColumn) if (!this.view || this._editingColumn)
return; return;
_moveByOffset(-1, 0, event); _moveByOffset(-1, 0, event);
]]> ]]>
</handler> </handler>
<handler event="keydown" keycode="VK_DOWN" modifiers="accel any"> <handler event="keydown" keycode="VK_DOWN" modifiers="accel any">
<![CDATA[ <![CDATA[
if (this._editingColumn) if (!this.view || this._editingColumn)
return; return;
_moveByOffset(1, this.view.rowCount - 1, event); _moveByOffset(1, this.view.rowCount - 1, event);
]]> ]]>
</handler> </handler>
<handler event="keydown" keycode="VK_UP" modifiers="accel any, shift"> <handler event="keydown" keycode="VK_UP" modifiers="accel any, shift">
<![CDATA[ <![CDATA[
if (this._editingColumn) if (!this.view || this._editingColumn)
return; return;
_moveByOffsetShift(-1, 0, event); _moveByOffsetShift(-1, 0, event);
]]> ]]>
</handler> </handler>
<handler event="keydown" keycode="VK_DOWN" modifiers="accel any, shift"> <handler event="keydown" keycode="VK_DOWN" modifiers="accel any, shift">
<![CDATA[ <![CDATA[
if (this._editingColumn) if (!this.view || this._editingColumn)
return; return;
_moveByOffsetShift(1, this.view.rowCount - 1, event); _moveByOffsetShift(1, this.view.rowCount - 1, event);
]]> ]]>
</handler> </handler>
<handler event="keydown" keycode="VK_PAGE_UP" modifiers="accel any"> <handler event="keydown" keycode="VK_PAGE_UP" modifiers="accel any">
<![CDATA[ <![CDATA[
if (this._editingColumn) if (!this.view || this._editingColumn)
return; return;
_moveByPage(-1, 0, event); _moveByPage(-1, 0, event);
]]> ]]>
</handler> </handler>
<handler event="keydown" keycode="VK_PAGE_DOWN" modifiers="accel any"> <handler event="keydown" keycode="VK_PAGE_DOWN" modifiers="accel any">
<![CDATA[ <![CDATA[
if (this._editingColumn) if (!this.view || this._editingColumn)
return; return;
_moveByPage(1, this.view.rowCount - 1, event); _moveByPage(1, this.view.rowCount - 1, event);
]]> ]]>
</handler> </handler>
<handler event="keydown" keycode="VK_PAGE_UP" modifiers="accel any, shift"> <handler event="keydown" keycode="VK_PAGE_UP" modifiers="accel any, shift">
<![CDATA[ <![CDATA[
if (this._editingColumn) if (!this.view || this._editingColumn)
return; return;
_moveByPageShift(-1, 0, event); _moveByPageShift(-1, 0, event);
]]> ]]>
</handler> </handler>
<handler event="keydown" keycode="VK_PAGE_DOWN" modifiers="accel any, shift"> <handler event="keydown" keycode="VK_PAGE_DOWN" modifiers="accel any, shift">
<![CDATA[ <![CDATA[
if (this._editingColumn) if (!this.view || this._editingColumn)
return; return;
_moveByPageShift(1, this.view.rowCount - 1, event); _moveByPageShift(1, this.view.rowCount - 1, event);
]]> ]]>
</handler> </handler>
<handler event="keydown" keycode="VK_HOME" modifiers="accel any"> <handler event="keydown" keycode="VK_HOME" modifiers="accel any">
<![CDATA[ <![CDATA[
if (this._editingColumn) if (!this.view || this._editingColumn)
return; return;
_moveToEdge(0, event); _moveToEdge(0, event);
]]> ]]>
</handler> </handler>
<handler event="keydown" keycode="VK_END" modifiers="accel any"> <handler event="keydown" keycode="VK_END" modifiers="accel any">
<![CDATA[ <![CDATA[
if (this._editingColumn) if (!this.view || this._editingColumn)
return; return;
_moveToEdge(this.view.rowCount - 1, event); _moveToEdge(this.view.rowCount - 1, event);
]]> ]]>
</handler> </handler>
<handler event="keydown" keycode="VK_HOME" modifiers="accel any, shift"> <handler event="keydown" keycode="VK_HOME" modifiers="accel any, shift">
<![CDATA[ <![CDATA[
if (this._editingColumn) if (!this.view || this._editingColumn)
return; return;
_moveToEdgeShift(0, event); _moveToEdgeShift(0, event);
]]> ]]>
</handler> </handler>
<handler event="keydown" keycode="VK_END" modifiers="accel any, shift"> <handler event="keydown" keycode="VK_END" modifiers="accel any, shift">
<![CDATA[ <![CDATA[
if (this._editingColumn) if (!this.view || this._editingColumn)
return; return;
_moveToEdgeShift(this.view.rowCount - 1, event); _moveToEdgeShift(this.view.rowCount - 1, event);
]]> ]]>
</handler> </handler>
<handler event="keypress"> <handler event="keypress">
<![CDATA[ <![CDATA[
if (this._editingColumn) if (!this.view || this._editingColumn)
return; return;
if (event.charCode == ' '.charCodeAt(0)) { if (event.charCode == ' '.charCodeAt(0)) {
var c = this.currentIndex; var c = this.currentIndex;
if (!this.view.selection.isSelected(c) || if (!this.view.selection.isSelected(c) ||
(!this.view.selection.single && this._isAccelPressed(event))) { (!this.view.selection.single && this._isAccelPressed(event))) {
this.view.selection.toggleSelect(c); this.view.selection.toggleSelect(c);
event.preventDefault(); event.preventDefault();
} }
} }
else if (!this.disableKeyNavigation && event.charCode > 0 && else if (!this.disableKeyNavigation && event.charCode > 0 &&
!event.altKey && !this._isAccelPressed(event) && !event.altKey && !this._isAccelPressed(event) &&
!event.metaKey && !event.ctrlKey) { !event.metaKey && !event.ctrlKey) {
var l = this._keyNavigate(event); var l = this._keyNavigate(event);
if (l >= 0) { if (l >= 0) {
this.view.selection.timedSelect(l, this._selectDelay); this.view.selection.timedSelect(l, this._selectDelay);
this.treeBoxObject.ensureRowIsVisible(l); this.treeBoxObject.ensureRowIsVisible(l);
} }
event.preventDefault(); event.preventDefault();
} }
]]> ]]>
</handler> </handler>
</handlers> </handlers>
</binding> </binding>
@ -1495,12 +1497,13 @@
var refChild = aPopup.firstChild; var refChild = aPopup.firstChild;
var tree = this.parentNode.parentNode; var tree = this.parentNode.parentNode;
for (var currCol = tree.columns.getFirstColumn(); currCol; if (tree.columns)
currCol = currCol.getNext()) { for (var currCol = tree.columns.getFirstColumn(); currCol = currCol.getNext(); ) {
// Construct an entry for each column in the row, unless // Construct an entry for each column in the row, unless
// it is not being shown. // it is not being shown.
var currElement = currCol.element; var currElement = currCol.element;
if (!currElement.hasAttribute("ignoreincolumnpicker")) { if (currElement.hasAttribute("ignoreincolumnpicker"))
continue;
var popupChild = document.createElement("menuitem"); var popupChild = document.createElement("menuitem");
popupChild.setAttribute("type", "checkbox"); popupChild.setAttribute("type", "checkbox");
var columnName = currElement.getAttribute("display") || var columnName = currElement.getAttribute("display") ||
@ -1513,6 +1516,30 @@
popupChild.setAttribute("disabled", "true"); popupChild.setAttribute("disabled", "true");
aPopup.insertBefore(popupChild, refChild); aPopup.insertBefore(popupChild, refChild);
} }
else {
if (!tree.firstChild || tree.firstChild.nodeName != "treecols")
return;
var columns = [];
tree.firstChild.childNodes.forEach(function (currElement) {
if (currElement.nodeName != "treecol" ||
currElement.hasAttribute("ignoreincolumnpicker"))
return;
var popupChild = document.createElement("menuitem");
popupChild.setAttribute("type", "checkbox");
var columnName = currElement.getAttribute("display") ||
currElement.getAttribute("label");
popupChild.setAttribute("label", columnName);
if (currElement.getAttribute("hidden") != "true")
popupChild.setAttribute("checked", "true");
if (currElement.getAttribute("primary") == "true")
popupChild.setAttribute("disabled", "true");
columns[currElement.getAttribute("ordinal")] = popupChild;
});
columns.filter(function (e, i) {
e.setAttribute("colindex", i);
aPopup.insertBefore(e, refChild);
return false;
});
} }
var hidden = !tree.enableColumnDrag; var hidden = !tree.enableColumnDrag;