merge mozilla-central to mozilla-inbound. r=merge a=merge
|
@ -781,7 +781,7 @@ html|input.urlbar-input[textoverflow]:not([focused]) {
|
|||
margin-inline-end: 0.25em !important;
|
||||
}
|
||||
|
||||
#main-window[customizing] :-moz-any(#urlbar, .searchbar-textbox) > .autocomplete-textbox-container > .textbox-input-box {
|
||||
#main-window[customizing] :-moz-any(#urlbar, .searchbar-textbox) > .urlbar-textbox-container > .textbox-input-box {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,11 +2,17 @@
|
|||
* 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/. */
|
||||
|
||||
|
||||
#viewGroup > radio {
|
||||
-moz-binding: url("chrome://browser/content/pageinfo/pageInfo.xml#viewbutton");
|
||||
#viewGroup > radio > .radio-label-box {
|
||||
-moz-box-orient: vertical;
|
||||
-moz-box-align: center;
|
||||
}
|
||||
|
||||
/* Hide the radio button for the section headers */
|
||||
#viewGroup > radio > .radio-check {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
richlistitem[feed] {
|
||||
-moz-binding: url("chrome://browser/content/pageinfo/feeds.xml#feed");
|
||||
}
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- 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/. -->
|
||||
|
||||
|
||||
<bindings id="pageInfoBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<!-- based on preferences.xml paneButton -->
|
||||
<binding id="viewbutton" extends="chrome://global/content/bindings/radio.xml#radio" role="xullistitem">
|
||||
<content>
|
||||
<xul:image class="viewButtonIcon" xbl:inherits="src"/>
|
||||
<xul:label class="viewButtonLabel" xbl:inherits="value=label"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
|
@ -81,7 +81,6 @@
|
|||
oncommand="showTab('perm');"/>
|
||||
<radio id="securityTab" label="&securityTab;" accesskey="&securityTab.accesskey;"
|
||||
oncommand="showTab('security');"/>
|
||||
<!-- Others added by overlay -->
|
||||
</radiogroup>
|
||||
</windowdragbox>
|
||||
|
||||
|
|
|
@ -26,9 +26,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|||
<binding id="urlbar" extends="chrome://global/content/bindings/autocomplete.xml#autocomplete">
|
||||
|
||||
<content sizetopopup="pref">
|
||||
<xul:hbox anonid="textbox-container"
|
||||
class="autocomplete-textbox-container urlbar-textbox-container"
|
||||
flex="1" xbl:inherits="focused">
|
||||
<xul:hbox flex="1" class="urlbar-textbox-container">
|
||||
<children includes="image|deck|stack|box"/>
|
||||
<xul:hbox anonid="textbox-input-box"
|
||||
class="textbox-input-box urlbar-input-box"
|
||||
|
|
|
@ -113,7 +113,6 @@ browser.jar:
|
|||
* content/browser/pageinfo/pageInfo.xul (content/pageinfo/pageInfo.xul)
|
||||
content/browser/pageinfo/pageInfo.js (content/pageinfo/pageInfo.js)
|
||||
content/browser/pageinfo/pageInfo.css (content/pageinfo/pageInfo.css)
|
||||
content/browser/pageinfo/pageInfo.xml (content/pageinfo/pageInfo.xml)
|
||||
content/browser/pageinfo/feeds.js (content/pageinfo/feeds.js)
|
||||
content/browser/pageinfo/feeds.xml (content/pageinfo/feeds.xml)
|
||||
content/browser/pageinfo/permissions.js (content/pageinfo/permissions.js)
|
||||
|
|
|
@ -566,10 +566,7 @@
|
|||
<hbox id="PanelUI-panic-timeframe">
|
||||
<image id="PanelUI-panic-timeframe-icon" alt=""/>
|
||||
<vbox flex="1">
|
||||
<hbox id="PanelUI-panic-header">
|
||||
<image id="PanelUI-panic-timeframe-icon-small" alt=""/>
|
||||
<description id="PanelUI-panic-mainDesc" flex="1">&panicButton.view.mainTimeframeDesc;</description>
|
||||
</hbox>
|
||||
<description id="PanelUI-panic-mainDesc">&panicButton.view.mainTimeframeDesc;</description>
|
||||
<radiogroup id="PanelUI-panic-timeSpan" aria-labelledby="PanelUI-panic-mainDesc" closemenu="none">
|
||||
<radio id="PanelUI-panic-5min" label="&panicButton.view.5min;" selected="true"
|
||||
value="5" class="subviewradio"/>
|
||||
|
|
|
@ -375,7 +375,7 @@ FormAutofillHandler.prototype = {
|
|||
}
|
||||
|
||||
let element = fieldDetail.elementWeakRef.get();
|
||||
if (!(element instanceof Ci.nsIDOMHTMLSelectElement)) {
|
||||
if (ChromeUtils.getClassName(element) !== "HTMLSelectElement") {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -515,7 +515,7 @@ FormAutofillHandler.prototype = {
|
|||
}
|
||||
}
|
||||
|
||||
if (element instanceof Ci.nsIDOMHTMLSelectElement) {
|
||||
if (ChromeUtils.getClassName(element) === "HTMLSelectElement") {
|
||||
let cache = this._cacheValue.matchingSelectOption.get(element) || {};
|
||||
let option = cache[value] && cache[value].get();
|
||||
if (!option) {
|
||||
|
@ -595,7 +595,7 @@ FormAutofillHandler.prototype = {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (element instanceof Ci.nsIDOMHTMLSelectElement) {
|
||||
if (ChromeUtils.getClassName(element) === "HTMLSelectElement") {
|
||||
// Unlike text input, select element is always previewed even if
|
||||
// the option is already selected.
|
||||
if (value) {
|
||||
|
@ -745,7 +745,7 @@ FormAutofillHandler.prototype = {
|
|||
// Try to abbreviate the value of select element.
|
||||
if (type == "address" &&
|
||||
detail.fieldName == "address-level1" &&
|
||||
element instanceof Ci.nsIDOMHTMLSelectElement) {
|
||||
ChromeUtils.getClassName(element) === "HTMLSelectElement") {
|
||||
// Don't save the record when the option value is empty *OR* there
|
||||
// are multiple options being selected. The empty option is usually
|
||||
// assumed to be default along with a meaningless text to users.
|
||||
|
|
|
@ -310,7 +310,7 @@ this.FormAutofillHeuristics = {
|
|||
* the current element.
|
||||
*/
|
||||
_isExpirationMonthLikely(element) {
|
||||
if (!(element instanceof Ci.nsIDOMHTMLSelectElement)) {
|
||||
if (ChromeUtils.getClassName(element) !== "HTMLSelectElement") {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -337,7 +337,7 @@ this.FormAutofillHeuristics = {
|
|||
* the current element.
|
||||
*/
|
||||
_isExpirationYearLikely(element) {
|
||||
if (!(element instanceof Ci.nsIDOMHTMLSelectElement)) {
|
||||
if (ChromeUtils.getClassName(element) !== "HTMLSelectElement") {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -551,7 +551,7 @@ TESTCASES.forEach(testcase => {
|
|||
let input = MOCK_DOC.getElementById(key);
|
||||
let value = testcase.formValue[key];
|
||||
|
||||
if (input instanceof Ci.nsIDOMHTMLSelectElement && value) {
|
||||
if (ChromeUtils.getClassName(input) === "HTMLSelectElement" && value) {
|
||||
input.multiple = Array.isArray(value);
|
||||
[...input.options].forEach(option => {
|
||||
option.selected = value.includes(option.value);
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
/* View buttons */
|
||||
#viewGroup > radio {
|
||||
list-style-image: url("chrome://browser/skin/pageInfo.png");
|
||||
-moz-box-orient: vertical;
|
||||
-moz-box-align: center;
|
||||
-moz-appearance: none;
|
||||
min-width: 4.5em;
|
||||
margin: 0;
|
||||
|
|
|
@ -2,10 +2,6 @@
|
|||
* 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/. */
|
||||
|
||||
.autocomplete-textbox-container {
|
||||
-moz-box-align: stretch;
|
||||
}
|
||||
|
||||
.searchbar-engine-image {
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
|
|
|
@ -696,7 +696,7 @@ html|span.ac-emphasize-text-url {
|
|||
}
|
||||
}
|
||||
|
||||
#editBMPanel_tagsField > .autocomplete-textbox-container > .textbox-input-box > html|*.textbox-input::placeholder {
|
||||
#editBMPanel_tagsField > .textbox-input-box > html|*.textbox-input::placeholder {
|
||||
opacity: 1.0;
|
||||
color: #bbb;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ browser.jar:
|
|||
skin/classic/browser/panel-expander-open@2x.png
|
||||
skin/classic/browser/panel-plus-sign.png
|
||||
skin/classic/browser/page-livemarks.png
|
||||
skin/classic/browser/pageInfo.css
|
||||
* skin/classic/browser/pageInfo.css
|
||||
skin/classic/browser/searchbar.css
|
||||
skin/classic/browser/slowStartup-16.png
|
||||
skin/classic/browser/toolbarbutton-dropmarker.png
|
||||
|
|
|
@ -4,13 +4,37 @@
|
|||
|
||||
@import "chrome://global/skin/";
|
||||
|
||||
/* View buttons */
|
||||
@import "chrome://global/skin/viewbuttons.css";
|
||||
%include shared.inc
|
||||
|
||||
/* Extensions will provide icons because the view buttons have icons
|
||||
on the windows and linux themes. We don't want to display them */
|
||||
.viewButtonIcon {
|
||||
display: none;
|
||||
#topBar {
|
||||
-moz-appearance: toolbar;
|
||||
}
|
||||
|
||||
.viewGroupWrapper {
|
||||
-moz-box-align: center;
|
||||
-moz-box-pack: center;
|
||||
}
|
||||
|
||||
#viewGroup {
|
||||
margin: 4px 0 9px;
|
||||
}
|
||||
|
||||
#viewGroup > radio,
|
||||
#viewGroup > toolbarbutton {
|
||||
-moz-box-orient: vertical;
|
||||
-moz-box-align: center;
|
||||
-moz-appearance: toolbarbutton;
|
||||
font: menu;
|
||||
text-shadow: @loweredShadow@;
|
||||
margin: 0;
|
||||
padding: 0 1px;
|
||||
height: 22px;
|
||||
}
|
||||
|
||||
#viewGroup > radio[selected=true],
|
||||
#viewGroup > toolbarbutton[checked=true] {
|
||||
color: #FFF !important;
|
||||
text-shadow: rgba(0, 0, 0, 0.4) 0 1px;
|
||||
}
|
||||
|
||||
deck {
|
||||
|
|
|
@ -1378,8 +1378,7 @@ menuitem[checked="true"].subviewbutton > .menu-iconic-left {
|
|||
}
|
||||
|
||||
#panic-button-success-icon,
|
||||
#PanelUI-panic-timeframe-icon,
|
||||
#PanelUI-panic-timeframe-icon-small {
|
||||
#PanelUI-panic-timeframe-icon {
|
||||
background-color: transparent;
|
||||
margin-inline-end: 10px;
|
||||
}
|
||||
|
@ -1391,32 +1390,11 @@ menuitem[checked="true"].subviewbutton > .menu-iconic-left {
|
|||
width: 48px;
|
||||
}
|
||||
|
||||
#PanelUI-panic-timeframe-icon-small {
|
||||
list-style-image: url(chrome://browser/skin/panic-panel/header-small.png);
|
||||
max-height: 32px;
|
||||
width: 32px;
|
||||
}
|
||||
|
||||
/* current attribute is only set when in use as a subview instead of a main view */
|
||||
#PanelUI-panicView[current] #PanelUI-panic-timeframe-icon {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#PanelUI-panicView.cui-widget-panelview #PanelUI-panic-timeframe-icon-small {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#panic-button-success-header,
|
||||
#PanelUI-panic-header {
|
||||
#panic-button-success-header {
|
||||
-moz-box-align: center;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
#PanelUI-panicView.cui-widget-panelview #PanelUI-panic-header {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
#PanelUI-panic-timeframe-icon-small:-moz-locale-dir(rtl),
|
||||
#PanelUI-panic-timeframe-icon:-moz-locale-dir(rtl) {
|
||||
transform: scaleX(-1);
|
||||
}
|
||||
|
@ -1560,10 +1538,6 @@ menuitem[checked="true"].subviewbutton > .menu-iconic-left {
|
|||
list-style-image: url(chrome://browser/skin/panic-panel/header@2x.png);
|
||||
}
|
||||
|
||||
#PanelUI-panic-timeframe-icon-small {
|
||||
list-style-image: url(chrome://browser/skin/panic-panel/header-small@2x.png);
|
||||
}
|
||||
|
||||
#PanelUI-panic-actionlist-cookies {
|
||||
background-image: -moz-image-rect(url(chrome://browser/skin/panic-panel/icons@2x.png), 0, 32, 32, 0);
|
||||
}
|
||||
|
|
|
@ -217,8 +217,6 @@
|
|||
skin/classic/browser/readerMode.svg (../shared/reader/readerMode.svg)
|
||||
skin/classic/browser/panic-panel/header.png (../shared/panic-panel/header.png)
|
||||
skin/classic/browser/panic-panel/header@2x.png (../shared/panic-panel/header@2x.png)
|
||||
skin/classic/browser/panic-panel/header-small.png (../shared/panic-panel/header-small.png)
|
||||
skin/classic/browser/panic-panel/header-small@2x.png (../shared/panic-panel/header-small@2x.png)
|
||||
skin/classic/browser/panic-panel/icons.png (../shared/panic-panel/icons.png)
|
||||
skin/classic/browser/panic-panel/icons@2x.png (../shared/panic-panel/icons@2x.png)
|
||||
skin/classic/browser/places/bookmarks-notification-finish.png (../shared/places/bookmarks-notification-finish.png)
|
||||
|
|
Двоичные данные
browser/themes/shared/panic-panel/header-small.png
До Ширина: | Высота: | Размер: 1.3 KiB |
Двоичные данные
browser/themes/shared/panic-panel/header-small@2x.png
До Ширина: | Высота: | Размер: 2.9 KiB |
|
@ -524,7 +524,7 @@ menuitem.bookmark-item {
|
|||
}
|
||||
|
||||
html|*.urlbar-input:-moz-lwtheme::placeholder,
|
||||
.searchbar-textbox:-moz-lwtheme > .autocomplete-textbox-container > .textbox-input-box > html|*.textbox-input::placeholder {
|
||||
.searchbar-textbox:-moz-lwtheme > .urlbar-textbox-container > .textbox-input-box > html|*.textbox-input::placeholder {
|
||||
opacity: 1.0;
|
||||
color: #777;
|
||||
}
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
|
||||
#viewGroup > radio {
|
||||
list-style-image: url("chrome://browser/skin/pageInfo.png");
|
||||
-moz-box-orient: vertical;
|
||||
-moz-box-align: center;
|
||||
-moz-appearance: none;
|
||||
padding: 5px 3px 1px 3px;
|
||||
margin: 0 1px;
|
||||
|
|
|
@ -2,10 +2,6 @@
|
|||
* 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/. */
|
||||
|
||||
.autocomplete-textbox-container {
|
||||
-moz-box-align: stretch;
|
||||
}
|
||||
|
||||
.searchbar-engine-image {
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
|
|
|
@ -42,7 +42,7 @@ if not CONFIG['MOZ_SYSTEM_PNG']:
|
|||
external_dirs += ['media/libpng']
|
||||
|
||||
if CONFIG['CPU_ARCH'] == 'arm':
|
||||
external_dirs += ['media/openmax_dl']
|
||||
external_dirs += ['media/openmax_dl/dl']
|
||||
|
||||
if CONFIG['MOZ_FFVPX']:
|
||||
external_dirs += ['media/ffvpx']
|
||||
|
|
|
@ -160,8 +160,7 @@ devtools.jar:
|
|||
skin/images/breakpoint.svg (themes/images/breakpoint.svg)
|
||||
skin/webconsole.css (themes/webconsole.css)
|
||||
skin/images/webconsole.svg (themes/images/webconsole.svg)
|
||||
skin/images/breadcrumbs-scrollbutton.png (themes/images/breadcrumbs-scrollbutton.png)
|
||||
skin/images/breadcrumbs-scrollbutton@2x.png (themes/images/breadcrumbs-scrollbutton@2x.png)
|
||||
skin/images/breadcrumbs-scrollbutton.svg (themes/images/breadcrumbs-scrollbutton.svg)
|
||||
skin/animation.css (themes/animation.css)
|
||||
skin/animationinspector.css (themes/animationinspector.css)
|
||||
skin/canvasdebugger.css (themes/canvasdebugger.css)
|
||||
|
|
|
@ -33,27 +33,22 @@
|
|||
.scrollbutton-up > .toolbarbutton-icon,
|
||||
.scrollbutton-down > .toolbarbutton-icon {
|
||||
-moz-appearance: none;
|
||||
width: 7px;
|
||||
width: 20px;
|
||||
height: 16px;
|
||||
background-size: 14px 16px;
|
||||
background-position: 0 center;
|
||||
background-size: 16px;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
background-image: url("images/breadcrumbs-scrollbutton.png");
|
||||
background-image: url("images/breadcrumbs-scrollbutton.svg");
|
||||
list-style-image: none;
|
||||
margin: 0 8px;
|
||||
padding: 0;
|
||||
|
||||
-moz-context-properties: fill;
|
||||
fill: var(--theme-toolbar-color);
|
||||
}
|
||||
|
||||
@media (min-resolution: 1.1dppx) {
|
||||
.scrollbutton-up > .toolbarbutton-icon,
|
||||
.scrollbutton-down > .toolbarbutton-icon {
|
||||
background-image: url("images/breadcrumbs-scrollbutton@2x.png");
|
||||
}
|
||||
}
|
||||
|
||||
.scrollbutton-up:not([disabled]):active:hover > .toolbarbutton-icon,
|
||||
.scrollbutton-down:not([disabled]):active:hover > .toolbarbutton-icon {
|
||||
background-position: -7px center;
|
||||
.scrollbutton-up:not([disabled]):active:hover,
|
||||
.scrollbutton-down:not([disabled]):active:hover {
|
||||
background-color: var(--theme-toolbar-hover);
|
||||
}
|
||||
|
||||
.scrollbutton-up[disabled] > .toolbarbutton-icon,
|
||||
|
@ -242,8 +237,3 @@ widgets.css is overwritten. */
|
|||
.theme-firebug .breadcrumbs-widget-container .scrollbutton-down:active {
|
||||
background: none !important;
|
||||
}
|
||||
|
||||
.theme-firebug .breadcrumbs-widget-container .scrollbutton-up:not([disabled]):active:hover > .toolbarbutton-icon,
|
||||
.theme-firebug .breadcrumbs-widget-container .scrollbutton-down:not([disabled]):active:hover > .toolbarbutton-icon {
|
||||
background-position: 0 center;
|
||||
}
|
||||
|
|
Двоичные данные
devtools/client/themes/images/breadcrumbs-scrollbutton.png
До Ширина: | Высота: | Размер: 260 B |
|
@ -0,0 +1,6 @@
|
|||
<!-- 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/. -->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
||||
<path fill="context-fill" d="M6.414 8l4.293-4.293a1 1 0 0 0-1.414-1.414l-5 5a1 1 0 0 0 0 1.414l5 5a1 1 0 0 0 1.414-1.414z"></path>
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 436 B |
Двоичные данные
devtools/client/themes/images/breadcrumbs-scrollbutton@2x.png
До Ширина: | Высота: | Размер: 627 B |
|
@ -1154,6 +1154,25 @@ Element::GetSlot(nsAString& aName)
|
|||
GetAttr(kNameSpaceID_None, nsGkAtoms::slot, aName);
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-element-shadowroot
|
||||
ShadowRoot*
|
||||
Element::GetShadowRootByMode() const
|
||||
{
|
||||
/**
|
||||
* 1. Let shadow be context object’s shadow root.
|
||||
* 2. If shadow is null or its mode is "closed", then return null.
|
||||
*/
|
||||
ShadowRoot* shadowRoot = GetShadowRoot();
|
||||
if (!shadowRoot || shadowRoot->IsClosed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 3. Return shadow.
|
||||
*/
|
||||
return shadowRoot;
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-element-attachshadow
|
||||
already_AddRefed<ShadowRoot>
|
||||
Element::AttachShadow(const ShadowRootInit& aInit, ErrorResult& aError)
|
||||
|
|
|
@ -1088,6 +1088,7 @@ public:
|
|||
// Shadow DOM v1
|
||||
already_AddRefed<ShadowRoot> AttachShadow(const ShadowRootInit& aInit,
|
||||
ErrorResult& aError);
|
||||
ShadowRoot* GetShadowRootByMode() const;
|
||||
void SetSlot(const nsAString& aName, ErrorResult& aError);
|
||||
void GetSlot(nsAString& aName);
|
||||
|
||||
|
|
|
@ -155,6 +155,36 @@ nsIContent::FindFirstNonChromeOnlyAccessContent() const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-slotable-assignedslot
|
||||
HTMLSlotElement*
|
||||
nsIContent::GetAssignedSlotByMode() const
|
||||
{
|
||||
/**
|
||||
* Get slotable's assigned slot for the result of
|
||||
* find a slot with open flag UNSET [1].
|
||||
*
|
||||
* [1] https://dom.spec.whatwg.org/#assign-a-slot
|
||||
*/
|
||||
HTMLSlotElement* slot = GetAssignedSlot();
|
||||
if (!slot) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(GetParent());
|
||||
MOZ_ASSERT(GetParent()->GetShadowRoot());
|
||||
|
||||
/**
|
||||
* Additional check for open flag SET:
|
||||
* If slotable’s parent’s shadow root's mode is not "open",
|
||||
* then return null.
|
||||
*/
|
||||
if (GetParent()->GetShadowRoot()->IsClosed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return slot;
|
||||
}
|
||||
|
||||
nsINode*
|
||||
nsIContent::GetFlattenedTreeParentNodeInternal(FlattenedParentType aType) const
|
||||
{
|
||||
|
|
|
@ -216,9 +216,13 @@ public:
|
|||
mOffset = mozilla::Some(aOffset);
|
||||
}
|
||||
void
|
||||
Set(const nsIContent* aChild)
|
||||
Set(const nsINode* aChild)
|
||||
{
|
||||
MOZ_ASSERT(aChild);
|
||||
if (!aChild->IsContent()) {
|
||||
Clear();
|
||||
return;
|
||||
}
|
||||
mParent = aChild->GetParentNode();
|
||||
mRef = aChild->GetPreviousSibling();
|
||||
if (!mRef) {
|
||||
|
@ -246,12 +250,14 @@ public:
|
|||
* If the container can have children and there is no next sibling, this
|
||||
* outputs warning and does nothing. So, callers need to check if there is
|
||||
* next sibling which you need to refer.
|
||||
*
|
||||
* @return true if there is a next sibling to refer.
|
||||
*/
|
||||
void
|
||||
bool
|
||||
AdvanceOffset()
|
||||
{
|
||||
if (NS_WARN_IF(!mParent)) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
EnsureRef();
|
||||
if (!mRef) {
|
||||
|
@ -260,30 +266,31 @@ public:
|
|||
MOZ_ASSERT(mOffset.isSome());
|
||||
if (NS_WARN_IF(mOffset.value() == mParent->Length())) {
|
||||
// Already referring the end of the node.
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
mOffset = mozilla::Some(mOffset.value() + 1);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
mRef = mParent->GetFirstChild();
|
||||
if (NS_WARN_IF(!mRef)) {
|
||||
// No children in the container.
|
||||
mOffset = mozilla::Some(0);
|
||||
} else {
|
||||
mOffset = mozilla::Some(1);
|
||||
return false;
|
||||
}
|
||||
return;
|
||||
mOffset = mozilla::Some(1);
|
||||
return true;
|
||||
}
|
||||
|
||||
nsIContent* nextSibling = mRef->GetNextSibling();
|
||||
if (NS_WARN_IF(!nextSibling)) {
|
||||
// Already referring the end of the container.
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
mRef = nextSibling;
|
||||
if (mOffset.isSome()) {
|
||||
mOffset = mozilla::Some(mOffset.value() + 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -293,34 +300,37 @@ public:
|
|||
* If the container can have children and there is no next previous, this
|
||||
* outputs warning and does nothing. So, callers need to check if there is
|
||||
* previous sibling which you need to refer.
|
||||
*
|
||||
* @return true if there is a previous sibling to refer.
|
||||
*/
|
||||
void
|
||||
bool
|
||||
RewindOffset()
|
||||
{
|
||||
if (NS_WARN_IF(!mParent)) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
EnsureRef();
|
||||
if (!mRef) {
|
||||
if (NS_WARN_IF(mParent->IsContainerNode())) {
|
||||
// Already referring the start of the container
|
||||
mOffset = mozilla::Some(0);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
// In text node or something, just decrement the offset.
|
||||
MOZ_ASSERT(mOffset.isSome());
|
||||
if (NS_WARN_IF(mOffset.value() == 0)) {
|
||||
// Already referring the start of the node.
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
mOffset = mozilla::Some(mOffset.value() - 1);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
mRef = mRef->GetPreviousSibling();
|
||||
if (mOffset.isSome()) {
|
||||
mOffset = mozilla::Some(mOffset.value() - 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/EventStates.h"
|
||||
#include "mozilla/HTMLEditor.h"
|
||||
#include "mozilla/RangeBoundary.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
|
@ -2544,13 +2545,13 @@ NS_IMETHODIMP
|
|||
Selection::Collapse(nsIDOMNode* aContainer, int32_t aOffset)
|
||||
{
|
||||
nsCOMPtr<nsINode> container = do_QueryInterface(aContainer);
|
||||
return Collapse(container, aOffset);
|
||||
return Collapse(RawRangeBoundary(container, aOffset));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Selection::CollapseNative(nsINode* aContainer, int32_t aOffset)
|
||||
{
|
||||
return Collapse(aContainer, aOffset);
|
||||
return Collapse(RawRangeBoundary(aContainer, aOffset));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2562,56 +2563,52 @@ Selection::CollapseJS(nsINode* aContainer, uint32_t aOffset, ErrorResult& aRv)
|
|||
RemoveAllRanges(aRv);
|
||||
return;
|
||||
}
|
||||
Collapse(*aContainer, aOffset, aRv);
|
||||
}
|
||||
|
||||
nsresult
|
||||
Selection::Collapse(nsINode* aContainer, int32_t aOffset)
|
||||
{
|
||||
if (!aContainer) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
ErrorResult result;
|
||||
Collapse(*aContainer, static_cast<uint32_t>(aOffset), result);
|
||||
return result.StealNSResult();
|
||||
Collapse(RawRangeBoundary(aContainer, aOffset), aRv);
|
||||
}
|
||||
|
||||
void
|
||||
Selection::Collapse(nsINode& aContainer, uint32_t aOffset, ErrorResult& aRv)
|
||||
Selection::Collapse(const RawRangeBoundary& aPoint, ErrorResult& aRv)
|
||||
{
|
||||
if (!mFrameSelection) {
|
||||
aRv.Throw(NS_ERROR_NOT_INITIALIZED); // Can't do selection
|
||||
return;
|
||||
}
|
||||
|
||||
if (aContainer.NodeType() == nsIDOMNode::DOCUMENT_TYPE_NODE) {
|
||||
if (!aPoint.IsSet()) {
|
||||
aRv.Throw(NS_ERROR_INVALID_ARG);
|
||||
return;
|
||||
}
|
||||
|
||||
if (aPoint.Container()->NodeType() == nsIDOMNode::DOCUMENT_TYPE_NODE) {
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_NODE_TYPE_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (aOffset > aContainer.Length()) {
|
||||
// RawRangeBoundary::IsSetAndValid() checks if the point actually refers
|
||||
// a child of the container when IsSet() is true. If its offset hasn't been
|
||||
// computed yet, this just checks it with its mRef. So, we can avoid
|
||||
// computing offset here.
|
||||
if (!aPoint.IsSetAndValid()) {
|
||||
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!HasSameRoot(aContainer)) {
|
||||
if (!HasSameRoot(*aPoint.Container())) {
|
||||
// Return with no error
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsINode> container = &aContainer;
|
||||
|
||||
RefPtr<nsFrameSelection> frameSelection = mFrameSelection;
|
||||
frameSelection->InvalidateDesiredPos();
|
||||
if (!IsValidSelectionPoint(frameSelection, container)) {
|
||||
if (!IsValidSelectionPoint(frameSelection, aPoint.Container())) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return;
|
||||
}
|
||||
nsresult result;
|
||||
|
||||
RefPtr<nsPresContext> presContext = GetPresContext();
|
||||
if (!presContext || presContext->Document() != container->OwnerDoc()) {
|
||||
if (!presContext ||
|
||||
presContext->Document() != aPoint.Container()->OwnerDoc()) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return;
|
||||
}
|
||||
|
@ -2627,16 +2624,21 @@ Selection::Collapse(nsINode& aContainer, uint32_t aOffset, ErrorResult& aRv)
|
|||
|
||||
// Hack to display the caret on the right line (bug 1237236).
|
||||
if (frameSelection->GetHint() != CARET_ASSOCIATE_AFTER &&
|
||||
container->IsContent()) {
|
||||
aPoint.Container()->IsContent()) {
|
||||
int32_t frameOffset;
|
||||
nsTextFrame* f =
|
||||
do_QueryFrame(nsCaret::GetFrameAndOffset(this, container,
|
||||
aOffset, &frameOffset));
|
||||
do_QueryFrame(nsCaret::GetFrameAndOffset(this, aPoint.Container(),
|
||||
aPoint.Offset(), &frameOffset));
|
||||
if (f && f->IsAtEndOfLine() && f->HasSignificantTerminalNewline()) {
|
||||
if ((container->AsContent() == f->GetContent() &&
|
||||
f->GetContentEnd() == int32_t(aOffset)) ||
|
||||
(container == f->GetContent()->GetParentNode() &&
|
||||
container->IndexOf(f->GetContent()) + 1 == int32_t(aOffset))) {
|
||||
// RawRangeBounary::Offset() causes computing offset if it's not been
|
||||
// done yet. However, it's called only when the container is a text
|
||||
// node. In such case, offset has always been set since it cannot have
|
||||
// any children. So, this doesn't cause computing offset with expensive
|
||||
// method, nsINode::IndexOf().
|
||||
if ((aPoint.Container()->AsContent() == f->GetContent() &&
|
||||
f->GetContentEnd() == static_cast<int32_t>(aPoint.Offset())) ||
|
||||
(aPoint.Container() == f->GetContent()->GetParentNode() &&
|
||||
f->GetContent() == aPoint.GetPreviousSiblingOfChildAtOffset())) {
|
||||
frameSelection->SetHint(CARET_ASSOCIATE_AFTER);
|
||||
}
|
||||
}
|
||||
|
@ -2650,21 +2652,21 @@ Selection::Collapse(nsINode& aContainer, uint32_t aOffset, ErrorResult& aRv)
|
|||
} else if (mCachedRange) {
|
||||
range = Move(mCachedRange);
|
||||
} else {
|
||||
range = new nsRange(container);
|
||||
range = new nsRange(aPoint.Container());
|
||||
}
|
||||
result = range->CollapseTo(container, aOffset);
|
||||
result = range->CollapseTo(aPoint);
|
||||
if (NS_FAILED(result)) {
|
||||
aRv.Throw(result);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_SELECTION
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(container);
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(container);
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aPoint.Container());
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(aPoint.Container());
|
||||
printf ("Sel. Collapse to %p %s %d\n", container.get(),
|
||||
content ? nsAtomCString(content->NodeInfo()->NameAtom()).get()
|
||||
: (doc ? "DOCUMENT" : "???"),
|
||||
aOffset);
|
||||
aPoint.Offset());
|
||||
#endif
|
||||
|
||||
int32_t rangeIndex = -1;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "nsIWeakReference.h"
|
||||
|
||||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/RangeBoundary.h"
|
||||
#include "mozilla/TextRange.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsISelection.h"
|
||||
|
@ -132,7 +133,19 @@ public:
|
|||
nsresult RemoveItem(nsRange* aRange);
|
||||
nsresult RemoveCollapsedRanges();
|
||||
nsresult Clear(nsPresContext* aPresContext);
|
||||
nsresult Collapse(nsINode* aContainer, int32_t aOffset);
|
||||
nsresult Collapse(nsINode* aContainer, int32_t aOffset)
|
||||
{
|
||||
if (!aContainer) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
return Collapse(RawRangeBoundary(aContainer, aOffset));
|
||||
}
|
||||
nsresult Collapse(const RawRangeBoundary& aPoint)
|
||||
{
|
||||
ErrorResult result;
|
||||
Collapse(aPoint, result);
|
||||
return result.StealNSResult();
|
||||
}
|
||||
nsresult Extend(nsINode* aContainer, int32_t aOffset);
|
||||
nsRange* GetRangeAt(int32_t aIndex) const;
|
||||
|
||||
|
@ -291,7 +304,11 @@ public:
|
|||
void ResetColors(mozilla::ErrorResult& aRv);
|
||||
|
||||
// Non-JS callers should use the following methods.
|
||||
void Collapse(nsINode& aContainer, uint32_t aOffset, ErrorResult& aRv);
|
||||
void Collapse(nsINode& aContainer, uint32_t aOffset, ErrorResult& aRv)
|
||||
{
|
||||
Collapse(RawRangeBoundary(&aContainer, aOffset), aRv);
|
||||
}
|
||||
void Collapse(const RawRangeBoundary& aPoint, ErrorResult& aRv);
|
||||
void CollapseToStart(mozilla::ErrorResult& aRv);
|
||||
void CollapseToEnd(mozilla::ErrorResult& aRv);
|
||||
void Extend(nsINode& aContainer, uint32_t aOffset, ErrorResult& aRv);
|
||||
|
|
|
@ -51,6 +51,10 @@ public:
|
|||
{
|
||||
return mMode;
|
||||
}
|
||||
bool IsClosed()
|
||||
{
|
||||
return mMode == ShadowRootMode::Closed;
|
||||
}
|
||||
|
||||
// [deprecated] Shadow DOM v0
|
||||
void AddToIdTable(Element* aElement, nsAtom* aId);
|
||||
|
|
|
@ -758,6 +758,15 @@ public:
|
|||
*/
|
||||
virtual void SetAssignedSlot(mozilla::dom::HTMLSlotElement* aSlot) = 0;
|
||||
|
||||
/**
|
||||
* Gets the assigned slot associated with this content based on parent's
|
||||
* shadow root mode. Returns null if parent's shadow root is "closed".
|
||||
* https://dom.spec.whatwg.org/#dom-slotable-assignedslot
|
||||
*
|
||||
* @return The assigned slot element or null.
|
||||
*/
|
||||
mozilla::dom::HTMLSlotElement* GetAssignedSlotByMode() const;
|
||||
|
||||
nsIContent* GetXBLInsertionParent() const
|
||||
{
|
||||
nsIContent* ip = GetXBLInsertionPoint();
|
||||
|
|
|
@ -220,7 +220,11 @@ public:
|
|||
*/
|
||||
nsresult CollapseTo(nsINode* aContainer, uint32_t aOffset)
|
||||
{
|
||||
return SetStartAndEnd(aContainer, aOffset, aContainer, aOffset);
|
||||
return CollapseTo(RawRangeBoundary(aContainer, aOffset));
|
||||
}
|
||||
nsresult CollapseTo(const RawRangeBoundary& aPoint)
|
||||
{
|
||||
return SetStartAndEnd(aPoint, aPoint);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
// Notify/query select frame for selected state
|
||||
#include "nsIFormControlFrame.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMHTMLSelectElement.h"
|
||||
#include "nsNodeInfoManager.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "mozilla/EventStates.h"
|
||||
|
|
|
@ -97,16 +97,13 @@ NS_INTERFACE_TABLE_HEAD(HTMLOptionsCollection)
|
|||
NS_WRAPPERCACHE_INTERFACE_TABLE_ENTRY
|
||||
NS_INTERFACE_TABLE(HTMLOptionsCollection,
|
||||
nsIHTMLCollection,
|
||||
nsIDOMHTMLOptionsCollection,
|
||||
nsIDOMHTMLCollection)
|
||||
NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(HTMLOptionsCollection)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(HTMLOptionsCollection)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(HTMLOptionsCollection)
|
||||
|
||||
|
||||
JSObject*
|
||||
HTMLOptionsCollection::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
{
|
||||
|
@ -121,14 +118,15 @@ HTMLOptionsCollection::GetLength(uint32_t* aLength)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLOptionsCollection::SetLength(uint32_t aLength)
|
||||
void
|
||||
HTMLOptionsCollection::SetLength(uint32_t aLength, ErrorResult& aError)
|
||||
{
|
||||
if (!mSelect) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
aError.Throw(NS_ERROR_UNEXPECTED);
|
||||
return;
|
||||
}
|
||||
|
||||
return mSelect->SetLength(aLength);
|
||||
mSelect->SetLength(aLength, aError);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -153,11 +151,8 @@ HTMLOptionsCollection::IndexedSetter(uint32_t aIndex,
|
|||
if (aIndex > mElements.Length()) {
|
||||
// Fill our array with blank options up to (but not including, since we're
|
||||
// about to change it) aIndex, for compat with other browsers.
|
||||
nsresult rv = SetLength(aIndex);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
aError.Throw(rv);
|
||||
return;
|
||||
}
|
||||
SetLength(aIndex, aError);
|
||||
ENSURE_SUCCESS_VOID(aError);
|
||||
}
|
||||
|
||||
NS_ASSERTION(aIndex <= mElements.Length(), "SetLength lied");
|
||||
|
@ -191,17 +186,7 @@ HTMLOptionsCollection::GetSelectedIndex(ErrorResult& aError)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32_t selectedIndex;
|
||||
aError = mSelect->GetSelectedIndex(&selectedIndex);
|
||||
return selectedIndex;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLOptionsCollection::GetSelectedIndex(int32_t* aSelectedIndex)
|
||||
{
|
||||
ErrorResult rv;
|
||||
*aSelectedIndex = GetSelectedIndex(rv);
|
||||
return rv.StealNSResult();
|
||||
return mSelect->SelectedIndex();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -213,15 +198,7 @@ HTMLOptionsCollection::SetSelectedIndex(int32_t aSelectedIndex,
|
|||
return;
|
||||
}
|
||||
|
||||
aError = mSelect->SetSelectedIndex(aSelectedIndex);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLOptionsCollection::SetSelectedIndex(int32_t aSelectedIndex)
|
||||
{
|
||||
ErrorResult rv;
|
||||
SetSelectedIndex(aSelectedIndex, rv);
|
||||
return rv.StealNSResult();
|
||||
mSelect->SetSelectedIndex(aSelectedIndex, aError);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -310,29 +287,6 @@ HTMLOptionsCollection::GetSupportedNames(nsTArray<nsString>& aNames)
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLOptionsCollection::GetSelect(nsIDOMHTMLSelectElement** aReturn)
|
||||
{
|
||||
NS_IF_ADDREF(*aReturn = mSelect);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLOptionsCollection::Add(nsIDOMHTMLOptionElement* aOption,
|
||||
nsIVariant* aBefore)
|
||||
{
|
||||
if (!aOption) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
if (!mSelect) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLElement> elem = do_QueryInterface(aOption);
|
||||
return mSelect->Add(elem, aBefore);
|
||||
}
|
||||
|
||||
void
|
||||
HTMLOptionsCollection::Add(const HTMLOptionOrOptGroupElement& aElement,
|
||||
const Nullable<HTMLElementOrLong>& aBefore,
|
||||
|
@ -354,20 +308,11 @@ HTMLOptionsCollection::Remove(int32_t aIndex, ErrorResult& aError)
|
|||
return;
|
||||
}
|
||||
|
||||
uint32_t len = 0;
|
||||
mSelect->GetLength(&len);
|
||||
uint32_t len = mSelect->Length();
|
||||
if (aIndex < 0 || (uint32_t)aIndex >= len)
|
||||
aIndex = 0;
|
||||
|
||||
aError = mSelect->Remove(aIndex);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLOptionsCollection::Remove(int32_t aIndex)
|
||||
{
|
||||
ErrorResult rv;
|
||||
Remove(aIndex, rv);
|
||||
return rv.StealNSResult();
|
||||
mSelect->Remove(aIndex);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsIHTMLCollection.h"
|
||||
#include "nsIDOMHTMLOptionsCollection.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
#include "mozilla/dom/HTMLOptionElement.h"
|
||||
|
@ -32,7 +31,6 @@ class HTMLSelectElement;
|
|||
* select.options in DOM)
|
||||
*/
|
||||
class HTMLOptionsCollection final : public nsIHTMLCollection
|
||||
, public nsIDOMHTMLOptionsCollection
|
||||
, public nsWrapperCache
|
||||
{
|
||||
typedef HTMLOptionElementOrHTMLOptGroupElement HTMLOptionOrOptGroupElement;
|
||||
|
@ -40,6 +38,7 @@ public:
|
|||
explicit HTMLOptionsCollection(HTMLSelectElement* aSelect);
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_NSIDOMHTMLCOLLECTION
|
||||
|
||||
// nsWrapperCache
|
||||
using nsWrapperCache::GetWrapperPreserveColor;
|
||||
|
@ -59,12 +58,6 @@ protected:
|
|||
}
|
||||
public:
|
||||
|
||||
// nsIDOMHTMLOptionsCollection interface
|
||||
NS_DECL_NSIDOMHTMLOPTIONSCOLLECTION
|
||||
|
||||
// nsIDOMHTMLCollection interface, all its methods are defined in
|
||||
// nsIDOMHTMLOptionsCollection
|
||||
|
||||
virtual Element* GetElementAt(uint32_t aIndex) override;
|
||||
virtual nsINode* GetParentObject() override;
|
||||
|
||||
|
@ -147,7 +140,6 @@ public:
|
|||
{
|
||||
return NamedGetter(aName, aFound);
|
||||
}
|
||||
|
||||
void Add(const HTMLOptionOrOptGroupElement& aElement,
|
||||
const Nullable<HTMLElementOrLong>& aBefore,
|
||||
ErrorResult& aError);
|
||||
|
@ -157,6 +149,7 @@ public:
|
|||
void IndexedSetter(uint32_t aIndex, HTMLOptionElement* aOption,
|
||||
ErrorResult& aError);
|
||||
virtual void GetSupportedNames(nsTArray<nsString>& aNames) override;
|
||||
void SetLength(uint32_t aLength, ErrorResult& aError);
|
||||
|
||||
private:
|
||||
/** The list of options (holds strong references). This is infallible, so
|
||||
|
|
|
@ -167,7 +167,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
|||
|
||||
NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(HTMLSelectElement,
|
||||
nsGenericHTMLFormElementWithState,
|
||||
nsIDOMHTMLSelectElement,
|
||||
nsIConstraintValidation)
|
||||
|
||||
|
||||
|
@ -204,12 +203,6 @@ HTMLSelectElement::GetAutocompleteInfo(AutocompleteInfo& aInfo)
|
|||
true);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLSelectElement::GetForm(nsIDOMHTMLFormElement** aForm)
|
||||
{
|
||||
return nsGenericHTMLFormElementWithState::GetForm(aForm);
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLSelectElement::InsertChildAt(nsIContent* aKid,
|
||||
uint32_t aIndex,
|
||||
|
@ -605,74 +598,18 @@ HTMLSelectElement::Add(nsGenericHTMLElement& aElement,
|
|||
parent->InsertBefore(aElement, refNode, aError);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLSelectElement::Add(nsIDOMHTMLElement* aElement,
|
||||
nsIVariant* aBefore)
|
||||
{
|
||||
uint16_t dataType;
|
||||
nsresult rv = aBefore->GetDataType(&dataType);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIContent> element = do_QueryInterface(aElement);
|
||||
nsGenericHTMLElement* htmlElement =
|
||||
nsGenericHTMLElement::FromContentOrNull(element);
|
||||
if (!htmlElement) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
// aBefore is omitted, undefined or null
|
||||
if (dataType == nsIDataType::VTYPE_EMPTY ||
|
||||
dataType == nsIDataType::VTYPE_VOID) {
|
||||
ErrorResult error;
|
||||
Add(*htmlElement, (nsGenericHTMLElement*)nullptr, error);
|
||||
return error.StealNSResult();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupports> supports;
|
||||
|
||||
// whether aBefore is nsIDOMHTMLElement...
|
||||
if (NS_SUCCEEDED(aBefore->GetAsISupports(getter_AddRefs(supports)))) {
|
||||
nsCOMPtr<nsIContent> beforeElement = do_QueryInterface(supports);
|
||||
nsGenericHTMLElement* beforeHTMLElement =
|
||||
nsGenericHTMLElement::FromContentOrNull(beforeElement);
|
||||
|
||||
NS_ENSURE_TRUE(beforeHTMLElement, NS_ERROR_DOM_SYNTAX_ERR);
|
||||
|
||||
ErrorResult error;
|
||||
Add(*htmlElement, beforeHTMLElement, error);
|
||||
return error.StealNSResult();
|
||||
}
|
||||
|
||||
// otherwise, whether aBefore is long
|
||||
int32_t index;
|
||||
NS_ENSURE_SUCCESS(aBefore->GetAsInt32(&index), NS_ERROR_DOM_SYNTAX_ERR);
|
||||
|
||||
ErrorResult error;
|
||||
Add(*htmlElement, index, error);
|
||||
return error.StealNSResult();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
HTMLSelectElement::Remove(int32_t aIndex)
|
||||
{
|
||||
nsCOMPtr<nsINode> option = Item(static_cast<uint32_t>(aIndex));
|
||||
if (!option) {
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
option->Remove();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLSelectElement::GetOptions(nsIDOMHTMLOptionsCollection** aValue)
|
||||
{
|
||||
NS_IF_ADDREF(*aValue = GetOptions());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
HTMLSelectElement::GetType(nsAString& aType)
|
||||
{
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::multiple)) {
|
||||
|
@ -681,26 +618,10 @@ HTMLSelectElement::GetType(nsAString& aType)
|
|||
else {
|
||||
aType.AssignLiteral("select-one");
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLSelectElement::GetLength(uint32_t* aLength)
|
||||
{
|
||||
return mOptions->GetLength(aLength);
|
||||
}
|
||||
|
||||
#define MAX_DYNAMIC_SELECT_LENGTH 10000
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLSelectElement::SetLength(uint32_t aLength)
|
||||
{
|
||||
ErrorResult rv;
|
||||
SetLength(aLength, rv);
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
void
|
||||
HTMLSelectElement::SetLength(uint32_t aLength, ErrorResult& aRv)
|
||||
{
|
||||
|
@ -708,7 +629,7 @@ HTMLSelectElement::SetLength(uint32_t aLength, ErrorResult& aRv)
|
|||
|
||||
if (curlen > aLength) { // Remove extra options
|
||||
for (uint32_t i = curlen; i > aLength; --i) {
|
||||
MOZ_ALWAYS_SUCCEEDS(Remove(i - 1));
|
||||
Remove(i - 1);
|
||||
}
|
||||
} else if (aLength > curlen) {
|
||||
if (aLength > MAX_DYNAMIC_SELECT_LENGTH) {
|
||||
|
@ -768,23 +689,6 @@ HTMLSelectElement::SelectedOptions()
|
|||
return mSelectedOptions;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLSelectElement::GetSelectedOptions(nsIDOMHTMLCollection** aSelectedOptions)
|
||||
{
|
||||
NS_ADDREF(*aSelectedOptions = SelectedOptions());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//NS_IMPL_INT_ATTR(HTMLSelectElement, SelectedIndex, selectedindex)
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLSelectElement::GetSelectedIndex(int32_t* aValue)
|
||||
{
|
||||
*aValue = SelectedIndex();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLSelectElement::SetSelectedIndexInternal(int32_t aIndex, bool aNotify)
|
||||
{
|
||||
|
@ -807,12 +711,6 @@ HTMLSelectElement::SetSelectedIndexInternal(int32_t aIndex, bool aNotify)
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLSelectElement::SetSelectedIndex(int32_t aIndex)
|
||||
{
|
||||
return SetSelectedIndexInternal(aIndex, true);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLSelectElement::GetOptionIndex(nsIDOMHTMLOptionElement* aOption,
|
||||
int32_t aStartIndex, bool aForward,
|
||||
|
@ -1119,15 +1017,6 @@ HTMLSelectElement::IsOptionDisabled(HTMLOptionElement* aOption) const
|
|||
return false;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLSelectElement::GetValue(nsAString& aValue)
|
||||
{
|
||||
DOMString value;
|
||||
GetValue(value);
|
||||
value.ToString(aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
HTMLSelectElement::GetValue(DOMString& aValue)
|
||||
{
|
||||
|
@ -1147,7 +1036,7 @@ HTMLSelectElement::GetValue(DOMString& aValue)
|
|||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
HTMLSelectElement::SetValue(const nsAString& aValue)
|
||||
{
|
||||
uint32_t length = Length();
|
||||
|
@ -1162,22 +1051,13 @@ HTMLSelectElement::SetValue(const nsAString& aValue)
|
|||
option->GetValue(optionVal);
|
||||
if (optionVal.Equals(aValue)) {
|
||||
SetSelectedIndexInternal(int32_t(i), true);
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
}
|
||||
// No matching option was found.
|
||||
SetSelectedIndexInternal(-1, true);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMPL_BOOL_ATTR(HTMLSelectElement, Autofocus, autofocus)
|
||||
NS_IMPL_BOOL_ATTR(HTMLSelectElement, Disabled, disabled)
|
||||
NS_IMPL_BOOL_ATTR(HTMLSelectElement, Multiple, multiple)
|
||||
NS_IMPL_STRING_ATTR(HTMLSelectElement, Name, name)
|
||||
NS_IMPL_BOOL_ATTR(HTMLSelectElement, Required, required)
|
||||
NS_IMPL_UINT_ATTR(HTMLSelectElement, Size, size)
|
||||
|
||||
int32_t
|
||||
HTMLSelectElement::TabIndexDefault()
|
||||
{
|
||||
|
@ -1199,18 +1079,6 @@ HTMLSelectElement::IsHTMLFocusable(bool aWithMouse,
|
|||
return false;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLSelectElement::Item(uint32_t aIndex, nsIDOMNode** aReturn)
|
||||
{
|
||||
return mOptions->Item(aIndex, aReturn);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLSelectElement::NamedItem(const nsAString& aName, nsIDOMNode** aReturn)
|
||||
{
|
||||
return mOptions->NamedItem(aName, aReturn);
|
||||
}
|
||||
|
||||
bool
|
||||
HTMLSelectElement::CheckSelectSomething(bool aNotify)
|
||||
{
|
||||
|
@ -1230,8 +1098,7 @@ HTMLSelectElement::SelectSomething(bool aNotify)
|
|||
return false;
|
||||
}
|
||||
|
||||
uint32_t count;
|
||||
GetLength(&count);
|
||||
uint32_t count = Length();
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
bool disabled;
|
||||
nsresult rv = IsOptionDisabled(i, &disabled);
|
||||
|
@ -1586,7 +1453,8 @@ HTMLSelectElement::RestoreState(nsPresState* aState)
|
|||
}
|
||||
|
||||
if (aState->IsDisabledSet() && !aState->GetDisabled()) {
|
||||
SetDisabled(false);
|
||||
IgnoredErrorResult rv;
|
||||
SetDisabled(false, rv);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsIDOMHTMLSelectElement.h"
|
||||
#include "nsIConstraintValidation.h"
|
||||
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
#include "mozilla/dom/HTMLOptionsCollection.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "nsCheapSets.h"
|
||||
|
@ -120,7 +120,6 @@ private:
|
|||
* Implementation of <select>
|
||||
*/
|
||||
class HTMLSelectElement final : public nsGenericHTMLFormElementWithState,
|
||||
public nsIDOMHTMLSelectElement,
|
||||
public nsIConstraintValidation
|
||||
{
|
||||
public:
|
||||
|
@ -164,9 +163,6 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
// nsIDOMHTMLSelectElement
|
||||
NS_DECL_NSIDOMHTMLSELECTELEMENT
|
||||
|
||||
// WebIdl HTMLSelectElement
|
||||
bool Autofocus() const
|
||||
{
|
||||
|
@ -204,7 +200,11 @@ public:
|
|||
{
|
||||
SetHTMLBoolAttr(nsGkAtoms::multiple, aVal, aRv);
|
||||
}
|
||||
// Uses XPCOM GetName.
|
||||
|
||||
void GetName(DOMString& aValue)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::name, aValue);
|
||||
}
|
||||
void SetName(const nsAString& aName, ErrorResult& aRv)
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::name, aName, aRv);
|
||||
|
@ -226,7 +226,7 @@ public:
|
|||
SetUnsignedIntAttr(nsGkAtoms::size, aSize, 0, aRv);
|
||||
}
|
||||
|
||||
// Uses XPCOM GetType.
|
||||
void GetType(nsAString& aValue);
|
||||
|
||||
HTMLOptionsCollection* Options() const
|
||||
{
|
||||
|
@ -252,7 +252,7 @@ public:
|
|||
void Add(const HTMLOptionElementOrHTMLOptGroupElement& aElement,
|
||||
const Nullable<HTMLElementOrLong>& aBefore,
|
||||
ErrorResult& aRv);
|
||||
// Uses XPCOM Remove.
|
||||
void Remove(int32_t aIndex);
|
||||
void IndexedSetter(uint32_t aIndex, HTMLOptionElement* aOption,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
|
@ -273,7 +273,7 @@ public:
|
|||
aRv = SetSelectedIndexInternal(aIdx, true);
|
||||
}
|
||||
void GetValue(DOMString& aValue);
|
||||
// Uses XPCOM SetValue.
|
||||
void SetValue(const nsAString& aValue);
|
||||
|
||||
// Override SetCustomValidity so we update our state properly when it's called
|
||||
// via bindings.
|
||||
|
|
|
@ -195,7 +195,7 @@ HTML_TAG("s", "");
|
|||
HTML_TAG("samp", "");
|
||||
HTML_TAG("script", "Script", [ "nsIScriptLoaderObserver" ], []);
|
||||
HTML_TAG("section", "")
|
||||
HTML_TAG("select", "Select", ["nsIDOMHTMLSelectElement"]);
|
||||
HTML_TAG("select", "Select");
|
||||
HTML_TAG("small", "");
|
||||
HTML_TAG("span", "Span");
|
||||
HTML_TAG("strike", "");
|
||||
|
|
|
@ -17,9 +17,7 @@ XPIDL_SOURCES += [
|
|||
'nsIDOMHTMLInputElement.idl',
|
||||
'nsIDOMHTMLMediaElement.idl',
|
||||
'nsIDOMHTMLOptionElement.idl',
|
||||
'nsIDOMHTMLOptionsCollection.idl',
|
||||
'nsIDOMHTMLScriptElement.idl',
|
||||
'nsIDOMHTMLSelectElement.idl',
|
||||
'nsIDOMMozBrowserFrame.idl',
|
||||
'nsIDOMTimeRanges.idl',
|
||||
'nsIDOMValidityState.idl',
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#include "nsIDOMHTMLElement.idl"
|
||||
#include "nsIDOMHTMLCollection.idl"
|
||||
|
||||
interface nsIDOMHTMLOptionElement;
|
||||
interface nsIDOMHTMLSelectElement;
|
||||
|
||||
/**
|
||||
* The nsIDOMHTMLOptionsCollection interface is the interface to a
|
||||
* collection of [X]HTML option elements.
|
||||
*
|
||||
* This interface is trying to follow the DOM Level 2 HTML specification:
|
||||
* http://www.w3.org/TR/DOM-Level-2-HTML/
|
||||
*
|
||||
* with changes from the work-in-progress WHATWG HTML specification:
|
||||
* http://www.whatwg.org/specs/web-apps/current-work/
|
||||
*/
|
||||
|
||||
// Introduced in DOM Level 2:
|
||||
[uuid(4173cc53-30f6-4d12-a770-981ba53164e2)]
|
||||
interface nsIDOMHTMLOptionsCollection : nsISupports
|
||||
{
|
||||
attribute unsigned long length;
|
||||
// raises(DOMException) on setting
|
||||
|
||||
// FIXME item should just be inherited from nsIDOMHTMLCollection
|
||||
nsIDOMNode item(in unsigned long index);
|
||||
|
||||
// FIXME namedItem (and getNamedItem) should return a NodeList if there are
|
||||
// multiple matching items
|
||||
nsIDOMNode namedItem(in DOMString name);
|
||||
|
||||
attribute long selectedIndex;
|
||||
|
||||
[noscript] readonly attribute nsIDOMHTMLSelectElement select;
|
||||
|
||||
// This add method implementation means the following
|
||||
// since IDL doesn't support overloading.
|
||||
// void add(in nsIDOMHTMLOptionElement,
|
||||
// [optional] in nsIDOMHTMLOptionElement)
|
||||
// void add(in nsIDOMHTMLOptionElement, in long)
|
||||
void add(in nsIDOMHTMLOptionElement option,
|
||||
[optional] in nsIVariant before);
|
||||
void remove(in long index);
|
||||
};
|
|
@ -1,52 +0,0 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#include "nsIDOMHTMLElement.idl"
|
||||
#include "nsIDOMHTMLOptionsCollection.idl"
|
||||
|
||||
/**
|
||||
* The nsIDOMHTMLSelectElement interface is the interface to a [X]HTML
|
||||
* select element.
|
||||
*
|
||||
* This interface is trying to follow the DOM Level 2 HTML specification:
|
||||
* http://www.w3.org/TR/DOM-Level-2-HTML/
|
||||
*
|
||||
* with changes from the work-in-progress WHATWG HTML specification:
|
||||
* http://www.whatwg.org/specs/web-apps/current-work/
|
||||
*/
|
||||
|
||||
interface nsIDOMValidityState;
|
||||
|
||||
[uuid(d8914a2d-3556-4b66-911c-a84c4394e7fa)]
|
||||
interface nsIDOMHTMLSelectElement : nsISupports
|
||||
{
|
||||
attribute boolean autofocus;
|
||||
attribute boolean disabled;
|
||||
readonly attribute nsIDOMHTMLFormElement form;
|
||||
attribute boolean multiple;
|
||||
attribute DOMString name;
|
||||
attribute unsigned long size;
|
||||
|
||||
readonly attribute DOMString type;
|
||||
|
||||
readonly attribute nsIDOMHTMLOptionsCollection options;
|
||||
attribute unsigned long length;
|
||||
nsIDOMNode item(in unsigned long index);
|
||||
nsIDOMNode namedItem(in DOMString name);
|
||||
// This add method implementation means the following
|
||||
// since IDL doesn't support overfload.
|
||||
// void add(in nsIDOMHTMLElement, [optional] in nsIDOMHTMLElement)
|
||||
// void add(in nsIDOMHTMLElement, in long)
|
||||
void add(in nsIDOMHTMLElement element,
|
||||
[optional] in nsIVariant before)
|
||||
raises(DOMException);
|
||||
void remove(in long index);
|
||||
|
||||
readonly attribute nsIDOMHTMLCollection selectedOptions;
|
||||
attribute long selectedIndex;
|
||||
attribute DOMString value;
|
||||
|
||||
attribute boolean required;
|
||||
};
|
|
@ -245,9 +245,9 @@ partial interface Element {
|
|||
// Shadow DOM v1
|
||||
[Throws, Pref="dom.webcomponents.enabled"]
|
||||
ShadowRoot attachShadow(ShadowRootInit shadowRootInitDict);
|
||||
[Pref="dom.webcomponents.enabled"]
|
||||
[BinaryName="shadowRootByMode", Pref="dom.webcomponents.enabled"]
|
||||
readonly attribute ShadowRoot? shadowRoot;
|
||||
[Pref="dom.webcomponents.enabled"]
|
||||
[BinaryName="assignedSlotByMode", Pref="dom.webcomponents.enabled"]
|
||||
readonly attribute HTMLSlotElement? assignedSlot;
|
||||
[CEReactions, Unscopable, SetterThrows, Pref="dom.webcomponents.enabled"]
|
||||
attribute DOMString slot;
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
*/
|
||||
|
||||
interface HTMLOptionsCollection : HTMLCollection {
|
||||
[CEReactions]
|
||||
attribute unsigned long length;
|
||||
[CEReactions, SetterThrows]
|
||||
attribute unsigned long length;
|
||||
[CEReactions, Throws]
|
||||
setter void (unsigned long index, HTMLOptionElement? option);
|
||||
[CEReactions, Throws]
|
||||
|
@ -20,5 +20,5 @@ interface HTMLOptionsCollection : HTMLCollection {
|
|||
[CEReactions, Throws]
|
||||
void remove(long index);
|
||||
[Throws]
|
||||
attribute long selectedIndex;
|
||||
attribute long selectedIndex;
|
||||
};
|
||||
|
|
|
@ -10,21 +10,21 @@
|
|||
[HTMLConstructor]
|
||||
interface HTMLSelectElement : HTMLElement {
|
||||
[CEReactions, SetterThrows, Pure]
|
||||
attribute boolean autofocus;
|
||||
attribute boolean autofocus;
|
||||
[CEReactions, Pref="dom.forms.autocomplete.formautofill", SetterThrows, Pure]
|
||||
attribute DOMString autocomplete;
|
||||
attribute DOMString autocomplete;
|
||||
[CEReactions, SetterThrows, Pure]
|
||||
attribute boolean disabled;
|
||||
attribute boolean disabled;
|
||||
[Pure]
|
||||
readonly attribute HTMLFormElement? form;
|
||||
[CEReactions, SetterThrows, Pure]
|
||||
attribute boolean multiple;
|
||||
attribute boolean multiple;
|
||||
[CEReactions, SetterThrows, Pure]
|
||||
attribute DOMString name;
|
||||
attribute DOMString name;
|
||||
[CEReactions, SetterThrows, Pure]
|
||||
attribute boolean required;
|
||||
attribute boolean required;
|
||||
[CEReactions, SetterThrows, Pure]
|
||||
attribute unsigned long size;
|
||||
attribute unsigned long size;
|
||||
|
||||
[Pure]
|
||||
readonly attribute DOMString type;
|
||||
|
@ -32,7 +32,7 @@ interface HTMLSelectElement : HTMLElement {
|
|||
[Constant]
|
||||
readonly attribute HTMLOptionsCollection options;
|
||||
[CEReactions, SetterThrows, Pure]
|
||||
attribute unsigned long length;
|
||||
attribute unsigned long length;
|
||||
getter Element? item(unsigned long index);
|
||||
HTMLOptionElement? namedItem(DOMString name);
|
||||
[CEReactions, Throws]
|
||||
|
@ -44,9 +44,9 @@ interface HTMLSelectElement : HTMLElement {
|
|||
|
||||
readonly attribute HTMLCollection selectedOptions;
|
||||
[SetterThrows, Pure]
|
||||
attribute long selectedIndex;
|
||||
attribute long selectedIndex;
|
||||
[Pure]
|
||||
attribute DOMString value;
|
||||
attribute DOMString value;
|
||||
|
||||
readonly attribute boolean willValidate;
|
||||
readonly attribute ValidityState validity;
|
||||
|
|
|
@ -19,7 +19,7 @@ interface Text : CharacterData {
|
|||
};
|
||||
|
||||
partial interface Text {
|
||||
[Pref="dom.webcomponents.enabled"]
|
||||
[BinaryName="assignedSlotByMode", Pref="dom.webcomponents.enabled"]
|
||||
readonly attribute HTMLSlotElement? assignedSlot;
|
||||
};
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include "mozilla/Casting.h"
|
||||
#include "mozilla/EditorBase.h"
|
||||
#include "mozilla/EditorDOMPoint.h"
|
||||
|
||||
#include "nsAlgorithm.h"
|
||||
#include "nsAString.h"
|
||||
|
@ -103,7 +104,14 @@ CreateElementTransaction::DoTransaction()
|
|||
RefPtr<Selection> selection = mEditorBase->GetSelection();
|
||||
NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
|
||||
|
||||
rv = selection->Collapse(mParent, mParent->IndexOf(mNewNode) + 1);
|
||||
EditorRawDOMPoint afterNewNode(mNewNode);
|
||||
if (NS_WARN_IF(!afterNewNode.AdvanceOffset())) {
|
||||
// If mutation observer or mutation event listener moved or removed the
|
||||
// new node, we hit this case. Should we use script blocker while we're
|
||||
// in this method?
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
rv = selection->Collapse(afterNewNode);
|
||||
NS_ASSERTION(!rv.Failed(),
|
||||
"selection could not be collapsed after insert");
|
||||
return NS_OK;
|
||||
|
|
|
@ -4278,22 +4278,30 @@ EditorBase::DeleteSelectionAndPrepareToCreateNode()
|
|||
uint32_t offset = selection->AnchorOffset();
|
||||
|
||||
if (!offset) {
|
||||
nsresult rv = selection->Collapse(node->GetParentNode(),
|
||||
node->GetParentNode()->IndexOf(node));
|
||||
EditorRawDOMPoint atNode(node);
|
||||
if (NS_WARN_IF(!atNode.IsSetAndValid())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsresult rv = selection->Collapse(atNode);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else if (offset == node->Length()) {
|
||||
nsresult rv =
|
||||
selection->Collapse(node->GetParentNode(),
|
||||
node->GetParentNode()->IndexOf(node) + 1);
|
||||
EditorRawDOMPoint afterNode(node);
|
||||
if (NS_WARN_IF(!afterNode.AdvanceOffset())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsresult rv = selection->Collapse(afterNode);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else {
|
||||
nsCOMPtr<nsIDOMNode> tmp;
|
||||
nsresult rv = SplitNode(node->AsDOMNode(), offset, getter_AddRefs(tmp));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = selection->Collapse(node->GetParentNode(),
|
||||
node->GetParentNode()->IndexOf(node));
|
||||
EditorRawDOMPoint atNode(node);
|
||||
if (NS_WARN_IF(!atNode.IsSetAndValid())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
rv = selection->Collapse(atNode);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
|
|
@ -49,15 +49,17 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Different from RangeBoundary, aReferenceChild should be a child node
|
||||
* Different from RangeBoundary, aPointedNode should be a child node
|
||||
* which you want to refer. So, set non-nullptr if offset is
|
||||
* 0 - Length() - 1. Otherwise, set nullptr, i.e., if offset is same as
|
||||
* Length().
|
||||
*/
|
||||
EditorDOMPointBase(nsINode* aContainer,
|
||||
nsIContent* aPointedNode)
|
||||
: RangeBoundaryBase<ParentType, RefType>(aContainer,
|
||||
GetRef(aPointedNode))
|
||||
explicit EditorDOMPointBase(nsINode* aPointedNode)
|
||||
: RangeBoundaryBase<ParentType, RefType>(
|
||||
aPointedNode && aPointedNode->IsContent() ?
|
||||
aPointedNode->GetParentNode() : nullptr,
|
||||
aPointedNode && aPointedNode->IsContent() ?
|
||||
GetRef(aPointedNode->AsContent()) : nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -1265,9 +1265,8 @@ HTMLEditRules::WillInsert(Selection& aSelection,
|
|||
// If we are here then the selection is right after a mozBR that is in
|
||||
// the same block as the selection. We need to move the selection start
|
||||
// to be before the mozBR.
|
||||
selNode = priorNode->GetParentNode();
|
||||
selOffset = selNode->IndexOf(priorNode);
|
||||
nsresult rv = aSelection.Collapse(selNode, selOffset);
|
||||
EditorRawDOMPoint point(priorNode);
|
||||
nsresult rv = aSelection.Collapse(point.AsRaw());
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
}
|
||||
}
|
||||
|
@ -1493,7 +1492,9 @@ HTMLEditRules::WillInsertText(EditAction aAction,
|
|||
}
|
||||
}
|
||||
aSelection->SetInterlinePosition(false);
|
||||
if (curNode) aSelection->Collapse(curNode, curOffset);
|
||||
if (curNode) {
|
||||
aSelection->Collapse(curNode, curOffset);
|
||||
}
|
||||
// manually update the doc changed range so that AfterEdit will clean up
|
||||
// the correct portion of the document.
|
||||
if (!mDocChangeRange) {
|
||||
|
@ -1802,15 +1803,16 @@ HTMLEditRules::StandardBreakImpl(nsINode& aNode,
|
|||
}
|
||||
node = brNode->GetParentNode();
|
||||
NS_ENSURE_TRUE(node, NS_ERROR_NULL_POINTER);
|
||||
int32_t offset = node->IndexOf(brNode);
|
||||
if (bAfterBlock && bBeforeBlock) {
|
||||
// We just placed a br between block boundaries. This is the one case
|
||||
// where we want the selection to be before the br we just placed, as the
|
||||
// br will be on a new line, rather than at end of prior line.
|
||||
aSelection.SetInterlinePosition(true);
|
||||
nsresult rv = aSelection.Collapse(node, offset);
|
||||
EditorRawDOMPoint point(brNode);
|
||||
nsresult rv = aSelection.Collapse(point.AsRaw());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else {
|
||||
int32_t offset = node->IndexOf(brNode);
|
||||
WSRunObject wsObj(htmlEditor, node, offset + 1);
|
||||
nsCOMPtr<nsINode> secondBR;
|
||||
int32_t visOffset = 0;
|
||||
|
@ -2309,7 +2311,7 @@ HTMLEditRules::WillDeleteSelection(Selection* aSelection,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
// Fix up selection
|
||||
rv = aSelection->Collapse(pt.Container(), pt.Offset());
|
||||
rv = aSelection->Collapse(pt.AsRaw());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
rv = InsertBRIfNeeded(aSelection);
|
||||
|
@ -2380,7 +2382,7 @@ HTMLEditRules::WillDeleteSelection(Selection* aSelection,
|
|||
if (NS_WARN_IF(!newSel.IsSet())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
aSelection->Collapse(newSel.Container(), newSel.Offset());
|
||||
aSelection->Collapse(newSel.AsRaw());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2572,7 +2574,7 @@ HTMLEditRules::WillDeleteSelection(Selection* aSelection,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
// Fix up selection
|
||||
rv = aSelection->Collapse(pt.Container(), pt.Offset());
|
||||
rv = aSelection->Collapse(pt.AsRaw());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2792,7 +2794,7 @@ HTMLEditRules::GetGoodSelPointForNode(nsINode& aNode,
|
|||
return EditorDOMPoint();
|
||||
}
|
||||
|
||||
EditorDOMPoint ret(aNode.GetParentNode(), aNode.AsContent());
|
||||
EditorDOMPoint ret(&aNode);
|
||||
if ((!aNode.IsHTMLElement(nsGkAtoms::br) ||
|
||||
mHTMLEditor->IsVisibleBRElement(&aNode)) && isPreviousAction) {
|
||||
ret.AdvanceOffset();
|
||||
|
@ -4552,25 +4554,22 @@ HTMLEditRules::WillOutdent(Selection& aSelection,
|
|||
NS_ENSURE_TRUE(aSelection.GetRangeAt(0), NS_OK);
|
||||
nsCOMPtr<nsINode> startNode =
|
||||
aSelection.GetRangeAt(0)->GetStartContainer();
|
||||
int32_t startOffset = aSelection.GetRangeAt(0)->StartOffset();
|
||||
if (rememberedLeftBQ &&
|
||||
(startNode == rememberedLeftBQ ||
|
||||
EditorUtils::IsDescendantOf(*startNode, *rememberedLeftBQ))) {
|
||||
// Selection is inside rememberedLeftBQ - push it past it.
|
||||
startNode = rememberedLeftBQ->GetParentNode();
|
||||
startOffset = startNode ? 1 + startNode->IndexOf(rememberedLeftBQ) : 0;
|
||||
aSelection.Collapse(startNode, startOffset);
|
||||
EditorRawDOMPoint afterRememberedLeftBQ(rememberedLeftBQ);
|
||||
afterRememberedLeftBQ.AdvanceOffset();
|
||||
aSelection.Collapse(afterRememberedLeftBQ);
|
||||
}
|
||||
// And pull selection before beginning of rememberedRightBQ
|
||||
startNode = aSelection.GetRangeAt(0)->GetStartContainer();
|
||||
startOffset = aSelection.GetRangeAt(0)->StartOffset();
|
||||
if (rememberedRightBQ &&
|
||||
(startNode == rememberedRightBQ ||
|
||||
EditorUtils::IsDescendantOf(*startNode, *rememberedRightBQ))) {
|
||||
// Selection is inside rememberedRightBQ - push it before it.
|
||||
startNode = rememberedRightBQ->GetParentNode();
|
||||
startOffset = startNode ? startNode->IndexOf(rememberedRightBQ) : -1;
|
||||
aSelection.Collapse(startNode, startOffset);
|
||||
EditorRawDOMPoint atRememberedRightBQ(rememberedRightBQ);
|
||||
aSelection.Collapse(atRememberedRightBQ);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -5188,37 +5187,45 @@ HTMLEditRules::CheckForEmptyBlock(nsINode* aStartNode,
|
|||
// AfterEdit()
|
||||
}
|
||||
} else {
|
||||
int32_t offset = blockParent->IndexOf(emptyBlock);
|
||||
|
||||
if (aAction == nsIEditor::eNext || aAction == nsIEditor::eNextWord ||
|
||||
aAction == nsIEditor::eToEndOfLine) {
|
||||
// Move to the start of the next node, if any
|
||||
nsINode* child = emptyBlock->GetNextSibling();
|
||||
int32_t offset = blockParent->IndexOf(emptyBlock);
|
||||
nsCOMPtr<nsIContent> nextNode =
|
||||
htmlEditor->GetNextNode(blockParent, offset + 1, child, true);
|
||||
if (nextNode) {
|
||||
EditorDOMPoint pt = GetGoodSelPointForNode(*nextNode, aAction);
|
||||
nsresult rv = aSelection->Collapse(pt.Container(), pt.Offset());
|
||||
nsresult rv = aSelection->Collapse(pt.AsRaw());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else {
|
||||
// Adjust selection to be right after it.
|
||||
nsresult rv = aSelection->Collapse(blockParent, offset + 1);
|
||||
EditorRawDOMPoint afterEmptyBlock(emptyBlock);
|
||||
if (NS_WARN_IF(!afterEmptyBlock.AdvanceOffset())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsresult rv = aSelection->Collapse(afterEmptyBlock);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
} else if (aAction == nsIEditor::ePrevious ||
|
||||
aAction == nsIEditor::ePreviousWord ||
|
||||
aAction == nsIEditor::eToBeginningOfLine) {
|
||||
// Move to the end of the previous node
|
||||
int32_t offset = blockParent->IndexOf(emptyBlock);
|
||||
nsCOMPtr<nsIContent> priorNode = htmlEditor->GetPriorNode(blockParent,
|
||||
offset,
|
||||
emptyBlock,
|
||||
true);
|
||||
if (priorNode) {
|
||||
EditorDOMPoint pt = GetGoodSelPointForNode(*priorNode, aAction);
|
||||
nsresult rv = aSelection->Collapse(pt.Container(), pt.Offset());
|
||||
nsresult rv = aSelection->Collapse(pt.AsRaw());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else {
|
||||
nsresult rv = aSelection->Collapse(blockParent, offset + 1);
|
||||
EditorRawDOMPoint afterEmptyBlock(emptyBlock);
|
||||
if (NS_WARN_IF(!afterEmptyBlock.AdvanceOffset())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsresult rv = aSelection->Collapse(afterEmptyBlock);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
} else if (aAction != nsIEditor::eNone) {
|
||||
|
@ -6625,10 +6632,12 @@ HTMLEditRules::ReturnInHeader(Selection& aSelection,
|
|||
rv = aSelection.Collapse(pNode, 0);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else {
|
||||
headerParent = sibling->GetParentNode();
|
||||
offset = headerParent ? headerParent->IndexOf(sibling) : -1;
|
||||
EditorRawDOMPoint afterSibling(sibling);
|
||||
if (NS_WARN_IF(!afterSibling.AdvanceOffset())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
// Put selection after break
|
||||
rv = aSelection.Collapse(headerParent, offset + 1);
|
||||
rv = aSelection.Collapse(afterSibling);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
} else {
|
||||
|
@ -6825,15 +6834,13 @@ HTMLEditRules::SplitParagraph(nsIDOMNode *aPara,
|
|||
// look inside any containers that are up front.
|
||||
nsCOMPtr<nsINode> rightParaNode = do_QueryInterface(rightPara);
|
||||
NS_ENSURE_STATE(mHTMLEditor && rightParaNode);
|
||||
nsCOMPtr<nsIDOMNode> child =
|
||||
GetAsDOMNode(mHTMLEditor->GetLeftmostChild(rightParaNode, true));
|
||||
nsIContent* child = mHTMLEditor->GetLeftmostChild(rightParaNode, true);
|
||||
if (EditorBase::IsTextNode(child) ||
|
||||
mHTMLEditor->IsContainer(child)) {
|
||||
aSelection->Collapse(child,0);
|
||||
} else {
|
||||
int32_t offset;
|
||||
nsCOMPtr<nsIDOMNode> parent = EditorBase::GetNodeLocation(child, &offset);
|
||||
aSelection->Collapse(parent,offset);
|
||||
EditorRawDOMPoint atChild(child);
|
||||
aSelection->Collapse(atChild);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -6959,9 +6966,11 @@ HTMLEditRules::ReturnInListItem(Selection& aSelection,
|
|||
getter_AddRefs(brNode));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (brNode) {
|
||||
nsCOMPtr<nsINode> brParent = brNode->GetParentNode();
|
||||
int32_t offset = brParent ? brParent->IndexOf(brNode) : -1;
|
||||
rv = aSelection.Collapse(brParent, offset);
|
||||
EditorRawDOMPoint atBrNode(brNode);
|
||||
if (NS_WARN_IF(!atBrNode.IsSetAndValid())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
rv = aSelection.Collapse(atBrNode);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -6974,9 +6983,11 @@ HTMLEditRules::ReturnInListItem(Selection& aSelection,
|
|||
&visOffset, &wsType);
|
||||
if (wsType == WSType::special || wsType == WSType::br ||
|
||||
visNode->IsHTMLElement(nsGkAtoms::hr)) {
|
||||
nsCOMPtr<nsINode> parent = visNode->GetParentNode();
|
||||
int32_t offset = parent ? parent->IndexOf(visNode) : -1;
|
||||
rv = aSelection.Collapse(parent, offset);
|
||||
EditorRawDOMPoint atVisNode(visNode);
|
||||
if (NS_WARN_IF(!atVisNode.IsSetAndValid())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
rv = aSelection.Collapse(atVisNode);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return NS_OK;
|
||||
} else {
|
||||
|
@ -7681,36 +7692,42 @@ HTMLEditRules::PinSelectionToNewBlock(Selection* aSelection)
|
|||
|
||||
if (nodeBefore && nodeAfter) {
|
||||
return NS_OK; // selection is inside block
|
||||
} else if (nodeBefore) {
|
||||
}
|
||||
|
||||
if (nodeBefore) {
|
||||
// selection is after block. put at end of block.
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
nsCOMPtr<nsINode> tmp = mHTMLEditor->GetLastEditableChild(*mNewBlock);
|
||||
if (!tmp) {
|
||||
tmp = mNewBlock;
|
||||
}
|
||||
uint32_t endPoint;
|
||||
EditorRawDOMPoint endPoint;
|
||||
if (EditorBase::IsTextNode(tmp) ||
|
||||
mHTMLEditor->IsContainer(tmp)) {
|
||||
endPoint = tmp->Length();
|
||||
endPoint.Set(tmp, tmp->Length());
|
||||
} else {
|
||||
tmp = EditorBase::GetNodeLocation(tmp, (int32_t*)&endPoint);
|
||||
endPoint++; // want to be after this node
|
||||
endPoint.Set(tmp);
|
||||
if (NS_WARN_IF(!endPoint.AdvanceOffset())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
return aSelection->Collapse(tmp, (int32_t)endPoint);
|
||||
} else {
|
||||
// selection is before block. put at start of block.
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
nsCOMPtr<nsINode> tmp = mHTMLEditor->GetFirstEditableChild(*mNewBlock);
|
||||
if (!tmp) {
|
||||
tmp = mNewBlock;
|
||||
}
|
||||
int32_t offset;
|
||||
if (EditorBase::IsTextNode(tmp) ||
|
||||
mHTMLEditor->IsContainer(tmp)) {
|
||||
tmp = EditorBase::GetNodeLocation(tmp, &offset);
|
||||
}
|
||||
return aSelection->Collapse(tmp, 0);
|
||||
return aSelection->Collapse(endPoint);
|
||||
}
|
||||
|
||||
// selection is before block. put at start of block.
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
nsCOMPtr<nsINode> tmp = mHTMLEditor->GetFirstEditableChild(*mNewBlock);
|
||||
if (!tmp) {
|
||||
tmp = mNewBlock;
|
||||
}
|
||||
EditorRawDOMPoint atStartOfBlock;
|
||||
if (EditorBase::IsTextNode(tmp) ||
|
||||
mHTMLEditor->IsContainer(tmp)) {
|
||||
atStartOfBlock.Set(tmp);
|
||||
} else {
|
||||
atStartOfBlock.Set(tmp, 0);
|
||||
}
|
||||
return aSelection->Collapse(atStartOfBlock);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -7904,7 +7921,7 @@ HTMLEditRules::AdjustSelection(Selection* aSelection,
|
|||
return NS_OK;
|
||||
}
|
||||
EditorDOMPoint pt = GetGoodSelPointForNode(*nearNode, aAction);
|
||||
rv = aSelection->Collapse(pt.Container(), pt.Offset());
|
||||
rv = aSelection->Collapse(pt.AsRaw());
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -1086,10 +1086,18 @@ HTMLEditor::InsertBR(nsCOMPtr<nsIDOMNode>* outBRNode)
|
|||
rv = CreateBR(selNode, selOffset, outBRNode);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// position selection after br
|
||||
selNode = GetNodeLocation(*outBRNode, &selOffset);
|
||||
selection->SetInterlinePosition(true);
|
||||
return selection->Collapse(selNode, selOffset+1);
|
||||
|
||||
// position selection after br
|
||||
nsCOMPtr<nsINode> brNode = do_QueryInterface(*outBRNode);
|
||||
if (NS_WARN_IF(!brNode)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
EditorRawDOMPoint afterBrNode(brNode);
|
||||
if (NS_WARN_IF(!afterBrNode.AdvanceOffset())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return selection->Collapse(afterBrNode);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1692,9 +1700,12 @@ HTMLEditor::SetCaretAfterElement(nsIDOMElement* aElement)
|
|||
nsresult rv = aElement->GetParentNode(getter_AddRefs(parent));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(parent, NS_ERROR_NULL_POINTER);
|
||||
int32_t offsetInParent = GetChildOffset(aElement, parent);
|
||||
// Collapse selection to just after desired element,
|
||||
return selection->Collapse(parent, offsetInParent + 1);
|
||||
EditorRawDOMPoint afterElement(element);
|
||||
if (NS_WARN_IF(!afterElement.AdvanceOffset())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return selection->Collapse(afterElement);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/Base64.h"
|
||||
#include "mozilla/BasicEvents.h"
|
||||
#include "mozilla/EditorDOMPoint.h"
|
||||
#include "mozilla/EditorUtils.h"
|
||||
#include "mozilla/OwningNonNull.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
@ -657,8 +658,10 @@ HTMLEditor::DoInsertHTMLWithContext(const nsAString& aInputString,
|
|||
SplitNodeDeep(*linkContent, *selContent, selOffset,
|
||||
EmptyContainers::no, getter_AddRefs(leftLink));
|
||||
if (leftLink) {
|
||||
selNode = GetNodeLocation(GetAsDOMNode(leftLink), &selOffset);
|
||||
selection->Collapse(selNode, selOffset+1);
|
||||
EditorRawDOMPoint afterLeftLink(leftLink);
|
||||
if (afterLeftLink.AdvanceOffset()) {
|
||||
selection->Collapse(afterLeftLink);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1898,10 +1901,9 @@ HTMLEditor::InsertAsPlaintextQuotation(const nsAString& aQuotedText,
|
|||
|
||||
// Set the selection to just after the inserted node:
|
||||
if (NS_SUCCEEDED(rv) && newNode) {
|
||||
nsCOMPtr<nsINode> parent = newNode->GetParentNode();
|
||||
int32_t offset = parent ? parent->IndexOf(newNode) : -1;
|
||||
if (parent) {
|
||||
selection->Collapse(parent, offset + 1);
|
||||
EditorRawDOMPoint afterNewNode(newNode);
|
||||
if (afterNewNode.AdvanceOffset()) {
|
||||
selection->Collapse(afterNewNode);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
|
@ -1978,10 +1980,9 @@ HTMLEditor::InsertAsCitedQuotation(const nsAString& aQuotedText,
|
|||
|
||||
// Set the selection to just after the inserted node:
|
||||
if (NS_SUCCEEDED(rv) && newNode) {
|
||||
nsCOMPtr<nsINode> parent = newNode->GetParentNode();
|
||||
int32_t offset = parent ? parent->IndexOf(newNode) : -1;
|
||||
if (parent) {
|
||||
selection->Collapse(parent, offset + 1);
|
||||
EditorRawDOMPoint afterNewNode(newNode);
|
||||
if (afterNewNode.AdvanceOffset()) {
|
||||
selection->Collapse(afterNewNode);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "HTMLEditUtils.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/EditorDOMPoint.h"
|
||||
#include "mozilla/EditorUtils.h"
|
||||
#include "mozilla/FlushType.h"
|
||||
#include "mozilla/dom/Selection.h"
|
||||
|
@ -3157,8 +3158,15 @@ HTMLEditor::SetSelectionAfterTableEdit(nsIDOMElement* aTable,
|
|||
nsCOMPtr<nsIDOMNode> tableParent;
|
||||
nsresult rv = aTable->GetParentNode(getter_AddRefs(tableParent));
|
||||
if (NS_SUCCEEDED(rv) && tableParent) {
|
||||
int32_t tableOffset = GetChildOffset(aTable, tableParent);
|
||||
selection->Collapse(tableParent, tableOffset);
|
||||
nsCOMPtr<nsIContent> table = do_QueryInterface(aTable);
|
||||
if (NS_WARN_IF(!table)) {
|
||||
return;
|
||||
}
|
||||
EditorRawDOMPoint atTable(table);
|
||||
if (NS_WARN_IF(!atTable.IsSetAndValid())) {
|
||||
return;
|
||||
}
|
||||
selection->Collapse(atTable);
|
||||
return;
|
||||
}
|
||||
// Last resort: Set selection to start of doc
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "TextEditUtils.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/EditorDOMPoint.h"
|
||||
#include "mozilla/EditorUtils.h"
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
@ -494,8 +495,11 @@ TextEditRules::CollapseSelectionToTrailingBRIfNeeded(Selection* aSelection)
|
|||
|
||||
nsINode* nextNode = selNode->GetNextSibling();
|
||||
if (nextNode && TextEditUtils::IsMozBR(nextNode)) {
|
||||
int32_t offsetInParent = EditorBase::GetChildOffset(selNode, parentNode);
|
||||
rv = aSelection->Collapse(parentNode, offsetInParent + 1);
|
||||
EditorRawDOMPoint afterSelNode(selNode);
|
||||
if (NS_WARN_IF(!afterSelNode.AdvanceOffset())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
rv = aSelection->Collapse(afterSelNode);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -778,6 +782,8 @@ TextEditRules::WillInsertText(EditAction aAction,
|
|||
!outString->IsEmpty() && outString->Last() == nsCRT::LF;
|
||||
aSelection->SetInterlinePosition(endsWithLF);
|
||||
|
||||
MOZ_ASSERT(!selChild,
|
||||
"After inserting text into a text node, selChild should be nullptr");
|
||||
aSelection->Collapse(curNode, curOffset);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "TextEditUtils.h"
|
||||
#include "gfxFontUtils.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/EditorDOMPoint.h"
|
||||
#include "mozilla/EditorUtils.h" // AutoPlaceholderBatch, AutoRules
|
||||
#include "mozilla/HTMLEditor.h"
|
||||
#include "mozilla/mozalloc.h"
|
||||
|
@ -476,19 +477,24 @@ TextEditor::CreateBRImpl(nsCOMPtr<nsIDOMNode>* aInOutParent,
|
|||
|
||||
*outBRNode = GetAsDOMNode(brNode);
|
||||
if (*outBRNode && (aSelect != eNone)) {
|
||||
int32_t offset;
|
||||
nsCOMPtr<nsINode> parent = GetNodeLocation(brNode, &offset);
|
||||
|
||||
RefPtr<Selection> selection = GetSelection();
|
||||
NS_ENSURE_STATE(selection);
|
||||
if (aSelect == eNext) {
|
||||
selection->SetInterlinePosition(true);
|
||||
// position selection after br
|
||||
selection->SetInterlinePosition(true);
|
||||
selection->Collapse(parent, offset + 1);
|
||||
EditorRawDOMPoint afterBrNode(brNode);
|
||||
if (NS_WARN_IF(!afterBrNode.AdvanceOffset())) {
|
||||
return NS_OK;
|
||||
}
|
||||
selection->Collapse(afterBrNode);
|
||||
} else if (aSelect == ePrevious) {
|
||||
// position selection before br
|
||||
selection->SetInterlinePosition(true);
|
||||
selection->Collapse(parent, offset);
|
||||
// position selection before br
|
||||
EditorRawDOMPoint atBrNode(brNode);
|
||||
if (NS_WARN_IF(!atBrNode.IsSetAndValid())) {
|
||||
return NS_OK;
|
||||
}
|
||||
selection->Collapse(atBrNode);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -729,7 +735,9 @@ TextEditor::InsertLineBreak()
|
|||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// set the selection to the correct location
|
||||
rv = selection->Collapse(selNode, selOffset);
|
||||
MOZ_ASSERT(!selChild,
|
||||
"After inserting text into a text node, selChild should be nullptr");
|
||||
rv = selection->Collapse(EditorRawDOMPoint(selNode, selOffset));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// see if we're at the end of the editor range
|
||||
nsCOMPtr<nsIDOMNode> endNode;
|
||||
|
|
|
@ -375,9 +375,6 @@ interface nsIXPConnect : nsISupports
|
|||
getWrappedNativeOfJSObject(in JSContextPtr aJSContext,
|
||||
in JSObjectPtr aJSObj);
|
||||
|
||||
// Will return null if there is no JS stack right now.
|
||||
readonly attribute nsIStackFrame CurrentJSStack;
|
||||
|
||||
void debugDump(in short depth);
|
||||
void debugDumpObject(in nsISupports aCOMObj, in short depth);
|
||||
void debugDumpJSStack(in boolean showArgs,
|
||||
|
|
|
@ -1726,8 +1726,7 @@ AssembleSandboxMemoryReporterName(JSContext* cx, nsCString& sandboxName)
|
|||
NS_ENSURE_TRUE(cc, NS_ERROR_INVALID_ARG);
|
||||
|
||||
// Get the current source info from xpc.
|
||||
nsCOMPtr<nsIStackFrame> frame;
|
||||
nsXPConnect::XPConnect()->GetCurrentJSStack(getter_AddRefs(frame));
|
||||
nsCOMPtr<nsIStackFrame> frame = dom::GetCurrentJSStack();
|
||||
|
||||
// Append the caller's location information.
|
||||
if (frame) {
|
||||
|
|
|
@ -2235,13 +2235,8 @@ nsXPCComponents_Utils::EvalInSandbox(const nsAString& source,
|
|||
if (!filenameArg.IsVoid()) {
|
||||
filename.Assign(filenameArg);
|
||||
} else {
|
||||
// Get the current source info from xpc.
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIXPConnect> xpc = do_GetService(nsIXPConnect::GetCID(), &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIStackFrame> frame;
|
||||
xpc->GetCurrentJSStack(getter_AddRefs(frame));
|
||||
// Get the current source info.
|
||||
nsCOMPtr<nsIStackFrame> frame = dom::GetCurrentJSStack();
|
||||
if (frame) {
|
||||
nsString frameFile;
|
||||
frame->GetFilename(cx, frameFile);
|
||||
|
@ -3294,12 +3289,11 @@ nsXPCComponentsBase::IsSuccessCode(nsresult result, bool* out)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXPCComponents::GetStack(nsIStackFrame * *aStack)
|
||||
nsXPCComponents::GetStack(nsIStackFrame** aStack)
|
||||
{
|
||||
nsresult rv;
|
||||
nsXPConnect* xpc = nsXPConnect::XPConnect();
|
||||
rv = xpc->GetCurrentJSStack(aStack);
|
||||
return rv;
|
||||
nsCOMPtr<nsIStackFrame> frame = dom::GetCurrentJSStack();
|
||||
frame.forget(aStack);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -802,17 +802,6 @@ nsXPConnect::GetWrappedNativeOfNativeObject(JSContext * aJSContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXPConnect::GetCurrentJSStack(nsIStackFrame * *aCurrentJSStack)
|
||||
{
|
||||
MOZ_ASSERT(aCurrentJSStack, "bad param");
|
||||
|
||||
nsCOMPtr<nsIStackFrame> currentStack = dom::GetCurrentJSStack();
|
||||
currentStack.forget(aCurrentJSStack);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXPConnect::SetFunctionThisTranslator(const nsIID & aIID,
|
||||
nsIXPCFunctionThisTranslator* aTranslator)
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "nsListControlFrame.h"
|
||||
#include "nsCheckboxRadioFrame.h" // for COMPARE macro
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsIDOMHTMLSelectElement.h"
|
||||
#include "nsIDOMHTMLOptionElement.h"
|
||||
#include "nsComboboxControlFrame.h"
|
||||
#include "nsIPresShell.h"
|
||||
|
@ -1054,10 +1053,9 @@ nsListControlFrame::ResetList(bool aAllowScrolling)
|
|||
// Scroll to the selected index
|
||||
int32_t indexToSelect = kNothingSelected;
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> selectElement(do_QueryInterface(mContent));
|
||||
NS_ASSERTION(selectElement, "No select element!");
|
||||
HTMLSelectElement* selectElement = HTMLSelectElement::FromContent(mContent);
|
||||
if (selectElement) {
|
||||
selectElement->GetSelectedIndex(&indexToSelect);
|
||||
indexToSelect = selectElement->SelectedIndex();
|
||||
AutoWeakFrame weakFrame(this);
|
||||
ScrollToIndex(indexToSelect);
|
||||
if (!weakFrame.IsAlive()) {
|
||||
|
|
|
@ -8495,6 +8495,14 @@ nsDisplayTransform::GetLayerState(nsDisplayListBuilder* aBuilder,
|
|||
bool nsDisplayTransform::ComputeVisibility(nsDisplayListBuilder *aBuilder,
|
||||
nsRegion *aVisibleRegion)
|
||||
{
|
||||
// nsDisplayTransform::GetBounds() returns an empty rect in nested 3d context.
|
||||
// Calling mStoredList.RecomputeVisibility below for such transform causes the
|
||||
// child display items to end up with empty visible rect.
|
||||
// We avoid this by bailing out always if we are dealing with a 3d context.
|
||||
if (mFrame->Extend3DContext() || mFrame->Combines3DTransformWithAncestors()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* As we do this, we need to be sure to
|
||||
* untransform the visible rect, since we want everything that's painting to
|
||||
* think that it's painting in its original rectangular coordinate space.
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Green square</title>
|
||||
<style>
|
||||
.filter {
|
||||
filter: brightness(0.75);
|
||||
}
|
||||
|
||||
.container {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
|
||||
background-color: green;
|
||||
}
|
||||
|
||||
.square {
|
||||
position: absolute;
|
||||
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
|
||||
background-color: green;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="filter">
|
||||
<div class="container">
|
||||
<div class="square"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,38 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Green square</title>
|
||||
<style>
|
||||
.filter {
|
||||
filter: brightness(0.75);
|
||||
}
|
||||
|
||||
.container {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
|
||||
transform-style: preserve-3d;
|
||||
background-color: red;
|
||||
}
|
||||
|
||||
.square {
|
||||
position: absolute;
|
||||
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
|
||||
transform-style: preserve-3d;
|
||||
background-color: green;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="filter">
|
||||
<div class="container">
|
||||
<div class="square"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -90,3 +90,4 @@ fuzzy-if(winWidget,150,120) == component-alpha-1.html component-alpha-1-ref.html
|
|||
== nested-transform-1.html nested-transform-1-ref.html
|
||||
== transform-geometry-1.html transform-geometry-1-ref.html
|
||||
== intermediate-1.html intermediate-1-ref.html
|
||||
== preserves3d-nested-filter-1.html preserves3d-nested-filter-1-ref.html
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
Version 1.3.3 (2017 November 7)
|
||||
|
||||
* Fix and issue with corrupt continued packet handling.
|
||||
* Update Windows projects and build settings.
|
||||
* Remove Mac OS 9 build support.
|
||||
|
||||
Version 1.3.2 (2014 May 27)
|
||||
|
||||
* Fix an bug in oggpack_writecopy().
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Version: 1.3.2
|
||||
Version: 1.3.3
|
||||
|
||||
The source from this directory was extracted from the official source
|
||||
package downloaded from xiph.org and copied using the update.sh script.
|
||||
|
|
|
@ -16,10 +16,10 @@
|
|||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
typedef short ogg_int16_t;
|
||||
typedef unsigned short ogg_uint16_t;
|
||||
typedef int ogg_int32_t;
|
||||
typedef unsigned int ogg_uint32_t;
|
||||
typedef long long ogg_int64_t;
|
||||
typedef int16_t ogg_int16_t;
|
||||
typedef uint16_t ogg_uint16_t;
|
||||
typedef int32_t ogg_int32_t;
|
||||
typedef uint32_t ogg_uint32_t;
|
||||
typedef int64_t ogg_int64_t;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
********************************************************************
|
||||
|
||||
function: toplevel libogg include
|
||||
last mod: $Id: ogg.h 18044 2011-08-01 17:55:20Z gmaxwell $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
#ifndef _OGG_H
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
********************************************************************
|
||||
|
||||
function: #ifdef jail to whip a few platforms into the UNIX ideal.
|
||||
last mod: $Id: os_types.h 19098 2014-02-26 19:06:45Z giles $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
#ifndef _OS_TYPES_H
|
||||
|
@ -70,23 +70,24 @@ extern ogg_free_function_type *ogg_free_func;
|
|||
typedef short ogg_int16_t;
|
||||
typedef unsigned short ogg_uint16_t;
|
||||
# else
|
||||
/* MSVC/Borland */
|
||||
typedef __int64 ogg_int64_t;
|
||||
typedef __int32 ogg_int32_t;
|
||||
typedef unsigned __int32 ogg_uint32_t;
|
||||
typedef __int16 ogg_int16_t;
|
||||
typedef unsigned __int16 ogg_uint16_t;
|
||||
# if defined(_MSC_VER) && (_MSC_VER >= 1800) /* MSVC 2013 and newer */
|
||||
# include <stdint.h>
|
||||
typedef int16_t ogg_int16_t;
|
||||
typedef uint16_t ogg_uint16_t;
|
||||
typedef int32_t ogg_int32_t;
|
||||
typedef uint32_t ogg_uint32_t;
|
||||
typedef int64_t ogg_int64_t;
|
||||
typedef uint64_t ogg_uint64_t;
|
||||
# else
|
||||
/* MSVC/Borland */
|
||||
typedef __int64 ogg_int64_t;
|
||||
typedef __int32 ogg_int32_t;
|
||||
typedef unsigned __int32 ogg_uint32_t;
|
||||
typedef __int16 ogg_int16_t;
|
||||
typedef unsigned __int16 ogg_uint16_t;
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#elif defined(__MACOS__)
|
||||
|
||||
# include <sys/types.h>
|
||||
typedef SInt16 ogg_int16_t;
|
||||
typedef UInt16 ogg_uint16_t;
|
||||
typedef SInt32 ogg_int32_t;
|
||||
typedef UInt32 ogg_uint32_t;
|
||||
typedef SInt64 ogg_int64_t;
|
||||
|
||||
#elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */
|
||||
|
||||
# include <inttypes.h>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
********************************************************************
|
||||
|
||||
function: packing variable sized words into an octet stream
|
||||
last mod: $Id: bitwise.c 19149 2014-05-27 16:26:23Z giles $
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
function: code raw packets into framed OggSquish stream and
|
||||
decode Ogg streams back into raw packets
|
||||
last mod: $Id: framing.c 18758 2013-01-08 16:29:56Z tterribe $
|
||||
last mod: $Id$
|
||||
|
||||
note: The CRC code is directly derived from public domain code by
|
||||
Ross Williams (ross@guest.adelaide.edu.au). See docs/framing.html
|
||||
|
@ -875,6 +875,7 @@ int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og){
|
|||
some segments */
|
||||
if(continued){
|
||||
if(os->lacing_fill<1 ||
|
||||
(os->lacing_vals[os->lacing_fill-1]&0xff)<255 ||
|
||||
os->lacing_vals[os->lacing_fill-1]==0x400){
|
||||
bos=0;
|
||||
for(;segptr<segments;segptr++){
|
||||
|
@ -1492,6 +1493,34 @@ const int head3_7[] = {0x4f,0x67,0x67,0x53,0,0x05,
|
|||
1,
|
||||
0};
|
||||
|
||||
int compare_packet(const ogg_packet *op1, const ogg_packet *op2){
|
||||
if(op1->packet!=op2->packet){
|
||||
fprintf(stderr,"op1->packet != op2->packet\n");
|
||||
return(1);
|
||||
}
|
||||
if(op1->bytes!=op2->bytes){
|
||||
fprintf(stderr,"op1->bytes != op2->bytes\n");
|
||||
return(1);
|
||||
}
|
||||
if(op1->b_o_s!=op2->b_o_s){
|
||||
fprintf(stderr,"op1->b_o_s != op2->b_o_s\n");
|
||||
return(1);
|
||||
}
|
||||
if(op1->e_o_s!=op2->e_o_s){
|
||||
fprintf(stderr,"op1->e_o_s != op2->e_o_s\n");
|
||||
return(1);
|
||||
}
|
||||
if(op1->granulepos!=op2->granulepos){
|
||||
fprintf(stderr,"op1->granulepos != op2->granulepos\n");
|
||||
return(1);
|
||||
}
|
||||
if(op1->packetno!=op2->packetno){
|
||||
fprintf(stderr,"op1->packetno != op2->packetno\n");
|
||||
return(1);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
void test_pack(const int *pl, const int **headers, int byteskip,
|
||||
int pageskip, int packetskip){
|
||||
unsigned char *data=_ogg_malloc(1024*1024); /* for scripted test cases only */
|
||||
|
@ -1600,7 +1629,7 @@ void test_pack(const int *pl, const int **headers, int byteskip,
|
|||
ogg_stream_packetout(&os_de,&op_de); /* just catching them all */
|
||||
|
||||
/* verify peek and out match */
|
||||
if(memcmp(&op_de,&op_de2,sizeof(op_de))){
|
||||
if(compare_packet(&op_de,&op_de2)){
|
||||
fprintf(stderr,"packetout != packetpeek! pos=%ld\n",
|
||||
depacket);
|
||||
exit(1);
|
||||
|
|
|
@ -10,6 +10,9 @@ with Files("**"):
|
|||
with Files("update-libjpeg.sh"):
|
||||
BUG_COMPONENT = ("Core", "ImageLib")
|
||||
|
||||
with Files("openmax_dl/**"):
|
||||
BUG_COMPONENT = ("Core", "Web Audio")
|
||||
|
||||
with Files("openmax_il/**"):
|
||||
BUG_COMPONENT = ("Core", "Audio/Video: Playback")
|
||||
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
# 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/.
|
||||
|
||||
ifeq (WINNT,$(OS_TARGET))
|
||||
VISIBILITY_FLAGS =
|
||||
endif
|
|
@ -1,10 +0,0 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
with Files("**"):
|
||||
BUG_COMPONENT = ("Core", "Web Audio")
|
||||
|
||||
DIRS += ['dl']
|
|
@ -173,7 +173,6 @@ android {
|
|||
if (mozconfig.substs.MOZ_ANDROID_DISTRIBUTION_DIRECTORY) {
|
||||
srcDir "${mozconfig.substs.MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets"
|
||||
}
|
||||
srcDir "${topsrcdir}/mobile/android/app/assets"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -568,3 +567,14 @@ android.applicationVariants.all { variant ->
|
|||
|
||||
assembleTask.dependsOn dumpTask
|
||||
}
|
||||
|
||||
// Bug 1415298: make Robolectric find assets. Fix adapted from
|
||||
// https://github.com/robolectric/robolectric/issues/2647.
|
||||
android.applicationVariants.all { variant ->
|
||||
def productFlavor = ""
|
||||
variant.productFlavors.each {
|
||||
productFlavor += "${it.name.capitalize()}"
|
||||
}
|
||||
def buildType = "${variant.buildType.name.capitalize()}"
|
||||
tasks["compile${productFlavor}${buildType}UnitTestSources"].dependsOn(tasks["merge${productFlavor}${buildType}Assets"])
|
||||
}
|
||||
|
|
|
@ -19,12 +19,12 @@ with Files('mobile*'):
|
|||
with Files('ua-update.json.in'):
|
||||
BUG_COMPONENT = ('Firefox for Android', 'General')
|
||||
|
||||
with Files('assets/**'):
|
||||
BUG_COMPONENT = ('Firefox for Android', 'General')
|
||||
|
||||
with Files('omnijar/**'):
|
||||
BUG_COMPONENT = ('Firefox for Android', 'Build Config & IDE Support')
|
||||
|
||||
with Files('src/main/**'):
|
||||
BUG_COMPONENT = ('Firefox for Android', 'General')
|
||||
|
||||
with Files('src/androidTest/**'):
|
||||
BUG_COMPONENT = ('Firefox for Android', 'Testing')
|
||||
|
||||
|
|
До Ширина: | Высота: | Размер: 2.8 KiB После Ширина: | Высота: | Размер: 2.8 KiB |
|
@ -1408,7 +1408,7 @@ ANDROID_GENERATED_RESFILES += [
|
|||
]
|
||||
|
||||
ANDROID_ASSETS_DIRS += [
|
||||
'/mobile/android/app/assets',
|
||||
'/mobile/android/app/src/main/assets',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_ANDROID_DISTRIBUTION_DIRECTORY']:
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
{
|
||||
"ach": {
|
||||
"platforms": [
|
||||
"android",
|
||||
"android-api-16"
|
||||
],
|
||||
"revision": "default"
|
||||
},
|
||||
"an": {
|
||||
"platforms": [
|
||||
"android",
|
||||
|
@ -79,6 +86,13 @@
|
|||
],
|
||||
"revision": "default"
|
||||
},
|
||||
"bs": {
|
||||
"platforms": [
|
||||
"android",
|
||||
"android-api-16"
|
||||
],
|
||||
"revision": "default"
|
||||
},
|
||||
"ca": {
|
||||
"platforms": [
|
||||
"android",
|
||||
|
@ -343,6 +357,13 @@
|
|||
],
|
||||
"revision": "default"
|
||||
},
|
||||
"ia": {
|
||||
"platforms": [
|
||||
"android",
|
||||
"android-api-16"
|
||||
],
|
||||
"revision": "default"
|
||||
},
|
||||
"id": {
|
||||
"platforms": [
|
||||
"android",
|
||||
|
@ -431,6 +452,13 @@
|
|||
],
|
||||
"revision": "default"
|
||||
},
|
||||
"ltg": {
|
||||
"platforms": [
|
||||
"android",
|
||||
"android-api-16"
|
||||
],
|
||||
"revision": "default"
|
||||
},
|
||||
"lv": {
|
||||
"platforms": [
|
||||
"android",
|
||||
|
@ -511,6 +539,13 @@
|
|||
],
|
||||
"revision": "default"
|
||||
},
|
||||
"oc": {
|
||||
"platforms": [
|
||||
"android",
|
||||
"android-api-16"
|
||||
],
|
||||
"revision": "default"
|
||||
},
|
||||
"or": {
|
||||
"platforms": [
|
||||
"android",
|
||||
|
|
|
@ -108,7 +108,10 @@ def moz_debug(debug):
|
|||
|
||||
set_config('MOZ_DEBUG', moz_debug)
|
||||
set_define('MOZ_DEBUG', moz_debug)
|
||||
add_old_configure_assignment('MOZ_DEBUG', moz_debug)
|
||||
# Override any value MOZ_DEBUG may have from the environment when passing it
|
||||
# down to old-configure.
|
||||
add_old_configure_assignment('MOZ_DEBUG',
|
||||
depends('--enable-debug')(lambda x: bool(x)))
|
||||
|
||||
js_option('--enable-rust-debug',
|
||||
help='Build Rust code with debug assertions turned on.')
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "mozilla/Casting.h"
|
||||
#include "nsDependentString.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMHTMLSelectElement.h"
|
||||
#include "nsIDOMHTMLElement.h"
|
||||
#include "nsIGenKeypairInfoDlg.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsITokenDialogs.h"
|
||||
|
|
|
@ -1199,25 +1199,23 @@ SyncEngine.prototype = {
|
|||
backfilledItems.sort = "newest";
|
||||
backfilledItems.full = true;
|
||||
|
||||
// `get` includes the list of IDs as a query parameter, so we need to fetch
|
||||
// `getBatched` includes the list of IDs as a query parameter, so we need to fetch
|
||||
// records in chunks to avoid exceeding URI length limits.
|
||||
for (let ids of PlacesSyncUtils.chunkArray(idsToBackfill, this.guidFetchBatchSize)) {
|
||||
backfilledItems.ids = ids;
|
||||
|
||||
let resp = await backfilledItems.get();
|
||||
if (!resp.success) {
|
||||
resp.failureCode = ENGINE_DOWNLOAD_FAIL;
|
||||
throw resp;
|
||||
let {response, records} = await backfilledItems.getBatched(this.downloadBatchSize);
|
||||
if (!response.success) {
|
||||
response.failureCode = ENGINE_DOWNLOAD_FAIL;
|
||||
throw response;
|
||||
}
|
||||
|
||||
let maybeYield = Async.jankYielder();
|
||||
let backfilledRecordsToApply = [];
|
||||
let failedInBackfill = [];
|
||||
|
||||
for (let json of resp.obj) {
|
||||
for (let record of records) {
|
||||
await maybeYield();
|
||||
let record = new this._recordObj();
|
||||
record.deserialize(json);
|
||||
|
||||
let { shouldApply, error } = await this._maybeReconcile(record);
|
||||
if (error) {
|
||||
|
|
|
@ -1395,20 +1395,6 @@ dependencies = [
|
|||
"rayon 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "js"
|
||||
version = "0.1.6"
|
||||
source = "git+https://github.com/servo/rust-mozjs#cdb9570900b74cf4e0ba129eeb8bf527cee3ddb5"
|
||||
dependencies = [
|
||||
"cmake 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mozjs_sys 0.0.0 (git+https://github.com/servo/mozjs)",
|
||||
"num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jstraceable_derive"
|
||||
version = "0.0.1"
|
||||
|
@ -1680,7 +1666,7 @@ dependencies = [
|
|||
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.15.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hashglobe 0.1.0",
|
||||
"js 0.1.6 (git+https://github.com/servo/rust-mozjs)",
|
||||
"mozjs 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"servo_arc 0.0.1",
|
||||
"smallbitvec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1828,10 +1814,23 @@ name = "mitochondria"
|
|||
version = "1.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "mozjs"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cmake 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mozjs_sys 0.50.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mozjs_sys"
|
||||
version = "0.0.0"
|
||||
source = "git+https://github.com/servo/mozjs#424067c8d176bf1ee4c7f90c56916d35542de672"
|
||||
version = "0.50.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libz-sys 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2532,7 +2531,6 @@ dependencies = [
|
|||
"hyper_serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"image 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"js 0.1.6 (git+https://github.com/servo/rust-mozjs)",
|
||||
"jstraceable_derive 0.0.1",
|
||||
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2543,6 +2541,7 @@ dependencies = [
|
|||
"mime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mime_guess 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mitochondria 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mozjs 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"msg 0.0.1",
|
||||
"net_traits 0.0.1",
|
||||
"nonzero 0.0.1",
|
||||
|
@ -3476,7 +3475,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "webrender"
|
||||
version = "0.53.1"
|
||||
source = "git+https://github.com/servo/webrender#24b3fa46ec628e2e07f754d87791114378a842f8"
|
||||
source = "git+https://github.com/servo/webrender#aa74cdfc155d8f5b917332e6ab344fe3253c5a72"
|
||||
dependencies = [
|
||||
"app_units 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bincode 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -3503,7 +3502,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "webrender_api"
|
||||
version = "0.53.1"
|
||||
source = "git+https://github.com/servo/webrender#24b3fa46ec628e2e07f754d87791114378a842f8"
|
||||
source = "git+https://github.com/servo/webrender#aa74cdfc155d8f5b917332e6ab344fe3253c5a72"
|
||||
dependencies = [
|
||||
"app_units 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bincode 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -3776,7 +3775,6 @@ dependencies = [
|
|||
"checksum jemalloc-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "479294d130502fada93c7a957e8d059b632b03d6204aca37af557dee947f30a9"
|
||||
"checksum jemallocator 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "28b211ca65c440322b6d4d9b5b850b01e8e298393b7ebcb8205b7cbb14ea6329"
|
||||
"checksum jpeg-decoder 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2805ccb10ffe4d10e06ef68a158ff94c255211ecbae848fbde2146b098f93ce7"
|
||||
"checksum js 0.1.6 (git+https://github.com/servo/rust-mozjs)" = "<none>"
|
||||
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
||||
"checksum khronos_api 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d5a08e2a31d665af8f1ca437eab6d00a93c9d62a549f73f9ed8fc2e55b5a91a7"
|
||||
"checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a"
|
||||
|
@ -3802,7 +3800,8 @@ dependencies = [
|
|||
"checksum mio 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9e965267d4d58496fc4f740e9861118367f13570cadf66316ed2c3f2f14d87c7"
|
||||
"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
|
||||
"checksum mitochondria 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9de3eca27871df31c33b807f834b94ef7d000956f57aa25c5aed9c5f0aae8f6f"
|
||||
"checksum mozjs_sys 0.0.0 (git+https://github.com/servo/mozjs)" = "<none>"
|
||||
"checksum mozjs 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a77c99a22091d3e6f7cd93caaf18bcb9ce5ff0a5d93c45aa73e443a447ab4296"
|
||||
"checksum mozjs_sys 0.50.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef1e24df9f76502cd4459919098ec1ac3af75ce694ec5b8837aa91f69f2ad0eb"
|
||||
"checksum mp3-metadata 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ab5f1d2693586420208d1200ce5a51cd44726f055b635176188137aff42c7de"
|
||||
"checksum mp4parse 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7b81651f9ede53d59281b54c7eb51ae50a868ac4765dd3bdfbbc79ce3d8aca7a"
|
||||
"checksum multistr 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "90fb6e1b4f6ca2f2098a437e1c7f09c122da62bbf2bde45b3693defc1eb61e2d"
|
||||
|
|
|
@ -9,14 +9,14 @@ publish = false
|
|||
path = "lib.rs"
|
||||
|
||||
[features]
|
||||
servo = ["js", "string_cache", "url", "webrender_api", "xml5ever"]
|
||||
servo = ["mozjs", "string_cache", "url", "webrender_api", "xml5ever"]
|
||||
|
||||
[dependencies]
|
||||
app_units = "0.5.5"
|
||||
cssparser = "0.22.0"
|
||||
euclid = "0.15"
|
||||
hashglobe = { path = "../hashglobe" }
|
||||
js = { git = "https://github.com/servo/rust-mozjs", features = ["promises"], optional = true }
|
||||
mozjs = { version = "0.1.7", features = ["promises"], optional = true }
|
||||
servo_arc = { path = "../servo_arc" }
|
||||
smallbitvec = "1.0.3"
|
||||
smallvec = "0.4"
|
||||
|
|
|
@ -48,7 +48,7 @@ extern crate cssparser;
|
|||
extern crate euclid;
|
||||
extern crate hashglobe;
|
||||
#[cfg(feature = "servo")]
|
||||
extern crate js;
|
||||
extern crate mozjs as js;
|
||||
extern crate servo_arc;
|
||||
extern crate smallbitvec;
|
||||
extern crate smallvec;
|
||||
|
|
|
@ -12,7 +12,7 @@ name = "script"
|
|||
path = "lib.rs"
|
||||
|
||||
[features]
|
||||
debugmozjs = ['js/debugmozjs']
|
||||
debugmozjs = ['mozjs/debugmozjs']
|
||||
unstable = ["servo_allocator/unstable"]
|
||||
unrooted_must_root_lint = ["script_plugins/unrooted_must_root_lint"]
|
||||
default = ["unrooted_must_root_lint"]
|
||||
|
@ -51,7 +51,7 @@ hyper = "0.10"
|
|||
hyper_serde = "0.7"
|
||||
image = "0.16"
|
||||
ipc-channel = "0.9"
|
||||
js = {git = "https://github.com/servo/rust-mozjs", features = ["promises"]}
|
||||
mozjs = { version = "0.1.7", features = ["promises"]}
|
||||
jstraceable_derive = {path = "../jstraceable_derive"}
|
||||
lazy_static = "0.2"
|
||||
libc = "0.2"
|
||||
|
|
|
@ -47,8 +47,6 @@ extern crate hyper_serde;
|
|||
extern crate image;
|
||||
extern crate ipc_channel;
|
||||
#[macro_use]
|
||||
extern crate js;
|
||||
#[macro_use]
|
||||
extern crate jstraceable_derive;
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
|
@ -62,6 +60,8 @@ extern crate metrics;
|
|||
extern crate mime;
|
||||
extern crate mime_guess;
|
||||
extern crate mitochondria;
|
||||
#[macro_use]
|
||||
extern crate mozjs as js;
|
||||
extern crate msg;
|
||||
extern crate net_traits;
|
||||
extern crate nonzero;
|
||||
|
|
|
@ -106,32 +106,25 @@ be applied to every task no matter what. If the template should only be applied
|
|||
to certain kinds of tasks, this needs to be specified in the template itself
|
||||
using JSON-e `condition statements`_.
|
||||
|
||||
The context available to the JSON-e render aims to match that of ``actions``.
|
||||
It looks like this:
|
||||
The context available to the JSON-e render contains attributes from the
|
||||
:py:class:`taskgraph.task.Task` class. It looks like this:
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
{
|
||||
"task": {
|
||||
"payload": {
|
||||
"env": { ... },
|
||||
...
|
||||
}
|
||||
"extra": {
|
||||
"treeherder": { ... },
|
||||
...
|
||||
},
|
||||
"tags": { "kind": "<kind>", ... },
|
||||
...
|
||||
},
|
||||
"input": {
|
||||
"enabled": 1,
|
||||
...
|
||||
},
|
||||
"taskId": "<task id>"
|
||||
"attributes": task.attributes,
|
||||
"kind": task.kind,
|
||||
"label": task.label,
|
||||
"target_tasks": [<tasks from try_task_config.json>],
|
||||
"task": task.task,
|
||||
"taskId": task.task_id,
|
||||
"input": ...
|
||||
}
|
||||
|
||||
See the `existing templates`_ for examples.
|
||||
The ``input`` context can be any arbitrary value or object. What it contains
|
||||
depends on each specific template. Templates must return objects that have have
|
||||
either ``attributes`` or ``task`` as a top level key. All other top level keys
|
||||
will be ignored. See the `existing templates`_ for examples.
|
||||
|
||||
Empty Try
|
||||
:::::::::
|
||||
|
|
|
@ -27,3 +27,4 @@ PYTHON_UNITTEST_MANIFESTS += [
|
|||
'taskgraph/test/python.ini',
|
||||
]
|
||||
SPHINX_TREES['taskcluster'] = 'docs'
|
||||
SPHINX_PYTHON_PACKAGE_DIRS += ['taskgraph']
|
||||
|
|
|
@ -253,8 +253,9 @@ class apply_jsone_templates(object):
|
|||
"""
|
||||
template_dir = os.path.join(here, 'templates')
|
||||
|
||||
def __init__(self, templates):
|
||||
self.templates = templates
|
||||
def __init__(self, try_task_config):
|
||||
self.templates = try_task_config.get('templates')
|
||||
self.target_tasks = try_task_config.get('tasks')
|
||||
|
||||
def __call__(self, taskgraph, label_to_taskid):
|
||||
if not self.templates:
|
||||
|
@ -268,12 +269,19 @@ class apply_jsone_templates(object):
|
|||
'taskId': task.task_id,
|
||||
'kind': task.kind,
|
||||
'input': self.templates[template],
|
||||
# The following context differs from action tasks
|
||||
'attributes': task.attributes,
|
||||
'label': task.label,
|
||||
'target_tasks': self.target_tasks,
|
||||
}
|
||||
|
||||
template_path = os.path.join(self.template_dir, template + '.yml')
|
||||
with open(template_path) as f:
|
||||
template = yaml.load(f)
|
||||
task.task = jsone.render(template, context)
|
||||
result = jsone.render(template, context) or {}
|
||||
for attr in ('task', 'attributes'):
|
||||
if attr in result:
|
||||
setattr(task, attr, result[attr])
|
||||
|
||||
return taskgraph, label_to_taskid
|
||||
|
||||
|
@ -285,7 +293,7 @@ def morph(taskgraph, label_to_taskid, parameters):
|
|||
add_s3_uploader_task,
|
||||
]
|
||||
if parameters['try_mode'] == 'try_task_config':
|
||||
morphs.append(apply_jsone_templates(parameters['try_task_config'].get('templates')))
|
||||
morphs.append(apply_jsone_templates(parameters['try_task_config']))
|
||||
|
||||
for m in morphs:
|
||||
taskgraph, label_to_taskid = m(taskgraph, label_to_taskid)
|
||||
|
|
|
@ -3,16 +3,13 @@ $if: task["tags"]
|
|||
then:
|
||||
$if: task.tags["kind"] == "build"
|
||||
then:
|
||||
$mergeDeep:
|
||||
- $eval: task
|
||||
- extra:
|
||||
treeherder:
|
||||
symbol: Ba
|
||||
- payload:
|
||||
env:
|
||||
USE_ARTIFACT:
|
||||
$eval: input.enabled
|
||||
else:
|
||||
$eval: task
|
||||
else:
|
||||
$eval: task
|
||||
task:
|
||||
$mergeDeep:
|
||||
- $eval: task
|
||||
- extra:
|
||||
treeherder:
|
||||
symbol: Ba
|
||||
- payload:
|
||||
env:
|
||||
USE_ARTIFACT:
|
||||
$eval: input.enabled
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
$mergeDeep:
|
||||
- $eval: task
|
||||
- payload:
|
||||
env:
|
||||
$eval: input
|
||||
task:
|
||||
$mergeDeep:
|
||||
- $eval: task
|
||||
- payload:
|
||||
env:
|
||||
$eval: input
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
$if: label in target_tasks
|
||||
then:
|
||||
attributes:
|
||||
$merge:
|
||||
- $eval: attributes
|
||||
- task_duplicates:
|
||||
$eval: input
|
|
@ -138,7 +138,12 @@ class TestApplyJSONeTemplates(MorphTestCase):
|
|||
t['label']: Task(**t) for t in self.tasks[:]
|
||||
})
|
||||
|
||||
fn = morph.apply_jsone_templates({'artifact': {'enabled': 1}})
|
||||
try_task_config = {
|
||||
'templates': {
|
||||
'artifact': {'enabled': 1}
|
||||
},
|
||||
}
|
||||
fn = morph.apply_jsone_templates(try_task_config)
|
||||
morphed = fn(tg, label_to_taskid)[0]
|
||||
|
||||
self.assertEqual(len(morphed.tasks), 2)
|
||||
|
@ -158,7 +163,15 @@ class TestApplyJSONeTemplates(MorphTestCase):
|
|||
t['label']: Task(**t) for t in self.tasks[:]
|
||||
})
|
||||
|
||||
fn = morph.apply_jsone_templates({'env': {'ENABLED': 1, 'FOO': 'BAZ'}})
|
||||
try_task_config = {
|
||||
'templates': {
|
||||
'env': {
|
||||
'ENABLED': 1,
|
||||
'FOO': 'BAZ',
|
||||
}
|
||||
},
|
||||
}
|
||||
fn = morph.apply_jsone_templates(try_task_config)
|
||||
morphed = fn(tg, label_to_taskid)[0]
|
||||
|
||||
self.assertEqual(len(morphed.tasks), 2)
|
||||
|
@ -167,7 +180,10 @@ class TestApplyJSONeTemplates(MorphTestCase):
|
|||
self.assertEqual(t.task['payload']['env']['ENABLED'], 1)
|
||||
self.assertEqual(t.task['payload']['env']['FOO'], 'BAZ')
|
||||
|
||||
fn = morph.apply_jsone_templates({'env': {'ENABLED': 0}})
|
||||
try_task_config['templates']['env'] = {
|
||||
'ENABLED': 0,
|
||||
}
|
||||
fn = morph.apply_jsone_templates(try_task_config)
|
||||
morphed = fn(tg, label_to_taskid)[0]
|
||||
|
||||
self.assertEqual(len(morphed.tasks), 2)
|
||||
|
@ -176,6 +192,28 @@ class TestApplyJSONeTemplates(MorphTestCase):
|
|||
self.assertEqual(t.task['payload']['env']['ENABLED'], 0)
|
||||
self.assertEqual(t.task['payload']['env']['FOO'], 'BAZ')
|
||||
|
||||
def test_template_rebuild(self):
|
||||
tg, label_to_taskid = self.make_taskgraph({
|
||||
t['label']: Task(**t) for t in self.tasks[:]
|
||||
})
|
||||
|
||||
try_task_config = {
|
||||
'tasks': ['b'],
|
||||
'templates': {
|
||||
'rebuild': 4,
|
||||
},
|
||||
}
|
||||
fn = morph.apply_jsone_templates(try_task_config)
|
||||
tasks = fn(tg, label_to_taskid)[0].tasks.values()
|
||||
self.assertEqual(len(tasks), 2)
|
||||
|
||||
for t in tasks:
|
||||
if t.label == 'a':
|
||||
self.assertNotIn('task_duplicates', t.attributes)
|
||||
elif t.label == 'b':
|
||||
self.assertIn('task_duplicates', t.attributes)
|
||||
self.assertEqual(t.attributes['task_duplicates'], 4)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|