зеркало из https://github.com/mozilla/gecko-dev.git
Merge autoland to mozilla-central. a=merge
This commit is contained in:
Коммит
7ff67ddf24
|
@ -1765,7 +1765,7 @@ MaybeShutdownAccService(uint32_t aFormerConsumer)
|
|||
nsAccessibilityService* accService =
|
||||
nsAccessibilityService::gAccessibilityService;
|
||||
|
||||
if (!accService || accService->IsShutdown()) {
|
||||
if (!accService || nsAccessibilityService::IsShutdown()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1863,7 +1863,7 @@ PrefChanged(const char* aPref, void* aClosure)
|
|||
if (ReadPlatformDisabledState() == ePlatformIsDisabled) {
|
||||
// Force shut down accessibility.
|
||||
nsAccessibilityService* accService = nsAccessibilityService::gAccessibilityService;
|
||||
if (accService && !accService->IsShutdown()) {
|
||||
if (accService && !nsAccessibilityService::IsShutdown()) {
|
||||
accService->Shutdown();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ xpcAccessibilityService::AddRef(void)
|
|||
{
|
||||
MOZ_ASSERT_TYPE_OK_FOR_REFCOUNTING(xpcAccessibilityService)
|
||||
MOZ_ASSERT(int32_t(mRefCnt) >= 0, "illegal refcnt");
|
||||
if (!mRefCnt.isThreadSafe)
|
||||
if (!nsAutoRefCnt::isThreadSafe)
|
||||
NS_ASSERT_OWNINGTHREAD(xpcAccessibilityService);
|
||||
nsrefcnt count = ++mRefCnt;
|
||||
NS_LOG_ADDREF(this, count, "xpcAccessibilityService", sizeof(*this));
|
||||
|
@ -63,7 +63,7 @@ xpcAccessibilityService::Release(void)
|
|||
{
|
||||
MOZ_ASSERT(int32_t(mRefCnt) > 0, "dup release");
|
||||
|
||||
if (!mRefCnt.isThreadSafe) {
|
||||
if (!nsAutoRefCnt::isThreadSafe) {
|
||||
NS_ASSERT_OWNINGTHREAD(xpcAccessibilityService);
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ xpcAccessibilityService::Release(void)
|
|||
NS_LOG_RELEASE(this, count, "xpcAccessibilityService");
|
||||
|
||||
if (count == 0) {
|
||||
if (!mRefCnt.isThreadSafe) {
|
||||
if (!nsAutoRefCnt::isThreadSafe) {
|
||||
NS_ASSERT_OWNINGTHREAD(xpcAccessibilityService);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@ with Files("macbuild/**"):
|
|||
BUG_COMPONENT = ("Core", "Widget: Cocoa")
|
||||
|
||||
with Files("moz.build"):
|
||||
BUG_COMPONENT = ("Core", "Build Config")
|
||||
BUG_COMPONENT = ("Firefox Build System", "General")
|
||||
with Files("Makefile.in"):
|
||||
BUG_COMPONENT = ("Core", "Build Config")
|
||||
BUG_COMPONENT = ("Firefox Build System", "General")
|
||||
|
||||
with Files("profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/**"):
|
||||
BUG_COMPONENT = ("Firefox", "Theme")
|
||||
|
|
|
@ -1084,7 +1084,18 @@ pref("security.sandbox.content.level", 3);
|
|||
#endif
|
||||
|
||||
#if defined(NIGHTLY_BUILD) && defined(XP_MACOSX) && defined(MOZ_SANDBOX)
|
||||
pref("security.sandbox.mac.flash.enabled", false);
|
||||
// Controls whether and how the Mac NPAPI Flash plugin process is sandboxed.
|
||||
// On Mac these levels are:
|
||||
// 0 - "no sandbox"
|
||||
// 1 - "write access to some Flash-specific directories and global
|
||||
// read access triggered by file dialog activity"
|
||||
// 2 - "no global read access, read and write access to some
|
||||
// Flash-specific directories"
|
||||
pref("dom.ipc.plugins.sandbox-level.flash", 0);
|
||||
// Controls the sandbox level used by plugins other than Flash. On Mac,
|
||||
// no other plugins are supported and this pref is only used for test
|
||||
// plugins used in automated tests.
|
||||
pref("dom.ipc.plugins.sandbox-level.default", 0);
|
||||
#endif
|
||||
|
||||
#if defined(XP_LINUX) && defined(MOZ_SANDBOX) && defined(MOZ_CONTENT_SANDBOX)
|
||||
|
|
|
@ -591,7 +591,7 @@ var FullScreen = {
|
|||
|
||||
// Track whether mouse is near the toolbox
|
||||
if (trackMouse && !this.useLionFullScreen) {
|
||||
let rect = gBrowser.mPanelContainer.getBoundingClientRect();
|
||||
let rect = gBrowser.tabpanels.getBoundingClientRect();
|
||||
this._mouseTargetRect = {
|
||||
top: rect.top + 50,
|
||||
bottom: rect.bottom,
|
||||
|
|
|
@ -1321,7 +1321,7 @@ var gBrowserInit = {
|
|||
|
||||
if (!gMultiProcessBrowser) {
|
||||
// There is a Content:Click message manually sent from content.
|
||||
Services.els.addSystemEventListener(gBrowser.mPanelContainer, "click",
|
||||
Services.els.addSystemEventListener(gBrowser.tabpanels, "click",
|
||||
contentAreaClick, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,9 +28,9 @@ window._gBrowser = {
|
|||
this._setupInitialBrowserAndTab();
|
||||
|
||||
if (Services.prefs.getBoolPref("browser.display.use_system_colors")) {
|
||||
this.mPanelContainer.style.backgroundColor = "-moz-default-background-color";
|
||||
this.tabpanels.style.backgroundColor = "-moz-default-background-color";
|
||||
} else if (Services.prefs.getIntPref("browser.display.document_color_use") == 2) {
|
||||
this.mPanelContainer.style.backgroundColor =
|
||||
this.tabpanels.style.backgroundColor =
|
||||
Services.prefs.getCharPref("browser.display.background_color");
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ window._gBrowser = {
|
|||
|
||||
// If this window has remote tabs, switch to our tabpanels fork
|
||||
// which does asynchronous tab switching.
|
||||
this.mPanelContainer.classList.add("tabbrowser-tabpanels");
|
||||
this.tabpanels.classList.add("tabbrowser-tabpanels");
|
||||
} else {
|
||||
this._outerWindowIDBrowserMap.set(this.selectedBrowser.outerWindowID,
|
||||
this.selectedBrowser);
|
||||
|
@ -199,24 +199,24 @@ window._gBrowser = {
|
|||
return this.tabbox = document.getElementById("tabbrowser-tabbox");
|
||||
},
|
||||
|
||||
get mPanelContainer() {
|
||||
delete this.mPanelContainer;
|
||||
return this.mPanelContainer = document.getElementById("tabbrowser-tabpanels");
|
||||
get tabpanels() {
|
||||
delete this.tabpanels;
|
||||
return this.tabpanels = document.getElementById("tabbrowser-tabpanels");
|
||||
},
|
||||
|
||||
get addEventListener() {
|
||||
delete this.addEventListener;
|
||||
return this.addEventListener = this.mPanelContainer.addEventListener.bind(this.mPanelContainer);
|
||||
return this.addEventListener = this.tabpanels.addEventListener.bind(this.tabpanels);
|
||||
},
|
||||
|
||||
get removeEventListener() {
|
||||
delete this.removeEventListener;
|
||||
return this.removeEventListener = this.mPanelContainer.removeEventListener.bind(this.mPanelContainer);
|
||||
return this.removeEventListener = this.tabpanels.removeEventListener.bind(this.tabpanels);
|
||||
},
|
||||
|
||||
get dispatchEvent() {
|
||||
delete this.dispatchEvent;
|
||||
return this.dispatchEvent = this.mPanelContainer.dispatchEvent.bind(this.mPanelContainer);
|
||||
return this.dispatchEvent = this.tabpanels.dispatchEvent.bind(this.tabpanels);
|
||||
},
|
||||
|
||||
get visibleTabs() {
|
||||
|
@ -299,7 +299,7 @@ window._gBrowser = {
|
|||
this._selectedTab = tab;
|
||||
|
||||
let uniqueId = this._generateUniquePanelID();
|
||||
this.mPanelContainer.childNodes[0].id = uniqueId;
|
||||
this.tabpanels.childNodes[0].id = uniqueId;
|
||||
tab.linkedPanel = uniqueId;
|
||||
tab.permanentKey = browser.permanentKey;
|
||||
tab._tPos = 0;
|
||||
|
@ -1025,13 +1025,12 @@ window._gBrowser = {
|
|||
|
||||
// If the new tab is busy, and our current state is not busy, then
|
||||
// we need to fire a start to all progress listeners.
|
||||
const nsIWebProgressListener = Ci.nsIWebProgressListener;
|
||||
if (newTab.hasAttribute("busy") && !this.mIsBusy) {
|
||||
this.mIsBusy = true;
|
||||
this._callProgressListeners(null, "onStateChange",
|
||||
[webProgress, null,
|
||||
nsIWebProgressListener.STATE_START |
|
||||
nsIWebProgressListener.STATE_IS_NETWORK, 0],
|
||||
Ci.nsIWebProgressListener.STATE_START |
|
||||
Ci.nsIWebProgressListener.STATE_IS_NETWORK, 0],
|
||||
true, false);
|
||||
}
|
||||
|
||||
|
@ -1041,8 +1040,8 @@ window._gBrowser = {
|
|||
this.mIsBusy = false;
|
||||
this._callProgressListeners(null, "onStateChange",
|
||||
[webProgress, null,
|
||||
nsIWebProgressListener.STATE_STOP |
|
||||
nsIWebProgressListener.STATE_IS_NETWORK, 0],
|
||||
Ci.nsIWebProgressListener.STATE_STOP |
|
||||
Ci.nsIWebProgressListener.STATE_IS_NETWORK, 0],
|
||||
true, false);
|
||||
}
|
||||
|
||||
|
@ -1800,7 +1799,7 @@ window._gBrowser = {
|
|||
this._preloadedBrowser = browser;
|
||||
|
||||
let notificationbox = this.getNotificationBox(browser);
|
||||
this.mPanelContainer.appendChild(notificationbox);
|
||||
this.tabpanels.appendChild(notificationbox);
|
||||
|
||||
if (remoteType != E10SUtils.NOT_REMOTE) {
|
||||
// For remote browsers, we need to make sure that the webProgress is
|
||||
|
@ -2055,7 +2054,7 @@ window._gBrowser = {
|
|||
// of those notifications can cause code to run that inspects our
|
||||
// state, so it is important that the tab element is fully
|
||||
// initialized by this point.
|
||||
this.mPanelContainer.appendChild(notificationbox);
|
||||
this.tabpanels.appendChild(notificationbox);
|
||||
}
|
||||
|
||||
// wire up a progress listener for the new browser object.
|
||||
|
@ -2146,7 +2145,7 @@ window._gBrowser = {
|
|||
aBrowser.destroy();
|
||||
|
||||
let notificationbox = this.getNotificationBox(aBrowser);
|
||||
this.mPanelContainer.removeChild(notificationbox);
|
||||
this.tabpanels.removeChild(notificationbox);
|
||||
tab.removeAttribute("linkedpanel");
|
||||
|
||||
this._createLazyBrowser(tab);
|
||||
|
@ -3957,13 +3956,10 @@ window._gBrowser = {
|
|||
this._tabListeners.delete(tab);
|
||||
}
|
||||
}
|
||||
const nsIEventListenerService =
|
||||
Ci.nsIEventListenerService;
|
||||
let els = Cc["@mozilla.org/eventlistenerservice;1"]
|
||||
.getService(nsIEventListenerService);
|
||||
els.removeSystemEventListener(document, "keydown", this, false);
|
||||
|
||||
Services.els.removeSystemEventListener(document, "keydown", this, false);
|
||||
if (AppConstants.platform == "macosx") {
|
||||
els.removeSystemEventListener(document, "keypress", this, false);
|
||||
Services.els.removeSystemEventListener(document, "keypress", this, false);
|
||||
}
|
||||
window.removeEventListener("sizemodechange", this);
|
||||
window.removeEventListener("occlusionstatechange", this);
|
||||
|
@ -4251,8 +4247,7 @@ class TabProgressListener {
|
|||
|
||||
// If the state has STATE_STOP, and no requests were in flight, then this
|
||||
// must be the initial "stop" for the initial about:blank document.
|
||||
const nsIWebProgressListener = Ci.nsIWebProgressListener;
|
||||
if (aStateFlags & nsIWebProgressListener.STATE_STOP &&
|
||||
if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
|
||||
this.mRequestCount == 0 &&
|
||||
!aLocation) {
|
||||
return true;
|
||||
|
@ -4290,11 +4285,9 @@ class TabProgressListener {
|
|||
if (!aRequest)
|
||||
return;
|
||||
|
||||
const nsIWebProgressListener = Ci.nsIWebProgressListener;
|
||||
const nsIChannel = Ci.nsIChannel;
|
||||
let location, originalLocation;
|
||||
try {
|
||||
aRequest.QueryInterface(nsIChannel);
|
||||
aRequest.QueryInterface(Ci.nsIChannel);
|
||||
location = aRequest.URI;
|
||||
originalLocation = aRequest.originalURI;
|
||||
} catch (ex) {}
|
||||
|
@ -4307,15 +4300,15 @@ class TabProgressListener {
|
|||
// from here forward. Similarly, if we conclude that this state change
|
||||
// is one that we shouldn't be ignoring, then stop ignoring.
|
||||
if ((ignoreBlank &&
|
||||
aStateFlags & nsIWebProgressListener.STATE_STOP &&
|
||||
aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) ||
|
||||
aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
|
||||
aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK) ||
|
||||
!ignoreBlank && this.mBlank) {
|
||||
this.mBlank = false;
|
||||
}
|
||||
|
||||
if (aStateFlags & nsIWebProgressListener.STATE_START) {
|
||||
if (aStateFlags & Ci.nsIWebProgressListener.STATE_START) {
|
||||
this.mRequestCount++;
|
||||
} else if (aStateFlags & nsIWebProgressListener.STATE_STOP) {
|
||||
} else if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP) {
|
||||
const NS_ERROR_UNKNOWN_HOST = 2152398878;
|
||||
if (--this.mRequestCount > 0 && aStatus == NS_ERROR_UNKNOWN_HOST) {
|
||||
// to prevent bug 235825: wait for the request handled
|
||||
|
@ -4327,8 +4320,8 @@ class TabProgressListener {
|
|||
this.mRequestCount = 0;
|
||||
}
|
||||
|
||||
if (aStateFlags & nsIWebProgressListener.STATE_START &&
|
||||
aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
|
||||
if (aStateFlags & Ci.nsIWebProgressListener.STATE_START &&
|
||||
aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK) {
|
||||
if (aWebProgress.isTopLevel) {
|
||||
// Need to use originalLocation rather than location because things
|
||||
// like about:home and about:privatebrowsing arrive with nsIRequest
|
||||
|
@ -4356,7 +4349,7 @@ class TabProgressListener {
|
|||
}
|
||||
|
||||
if (this._shouldShowProgress(aRequest)) {
|
||||
if (!(aStateFlags & nsIWebProgressListener.STATE_RESTORING) &&
|
||||
if (!(aStateFlags & Ci.nsIWebProgressListener.STATE_RESTORING) &&
|
||||
aWebProgress && aWebProgress.isTopLevel) {
|
||||
this.mTab.setAttribute("busy", "true");
|
||||
this.mTab._notselectedsinceload = !this.mTab.selected;
|
||||
|
@ -4393,8 +4386,8 @@ class TabProgressListener {
|
|||
gBrowser.mIsBusy = true;
|
||||
}
|
||||
}
|
||||
} else if (aStateFlags & nsIWebProgressListener.STATE_STOP &&
|
||||
aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
|
||||
} else if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
|
||||
aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK) {
|
||||
|
||||
if (this.mTab.hasAttribute("busy")) {
|
||||
this.mTab.removeAttribute("busy");
|
||||
|
@ -4478,8 +4471,9 @@ class TabProgressListener {
|
|||
[aWebProgress, aRequest, aStateFlags, aStatus],
|
||||
false);
|
||||
|
||||
if (aStateFlags & (nsIWebProgressListener.STATE_START |
|
||||
nsIWebProgressListener.STATE_STOP)) {
|
||||
if (aStateFlags &
|
||||
(Ci.nsIWebProgressListener.STATE_START |
|
||||
Ci.nsIWebProgressListener.STATE_STOP)) {
|
||||
// reset cached temporary values at beginning and end
|
||||
this.mMessage = "";
|
||||
this.mTotalProgress = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
with Files("**"):
|
||||
BUG_COMPONENT = ("Firefox", "Build Config")
|
||||
BUG_COMPONENT = ("Firefox Build System", "General")
|
||||
|
||||
EXPORTS += [
|
||||
'nsBrowserCompsCID.h',
|
||||
|
|
|
@ -27,10 +27,9 @@ var gSearchResultsPane = {
|
|||
// Initialize other panes in an idle callback.
|
||||
window.requestIdleCallback(() => this.initializeCategories());
|
||||
}
|
||||
let strings = this.strings;
|
||||
this.searchInput.placeholder = AppConstants.platform == "win" ?
|
||||
strings.getString("searchInput.labelWin") :
|
||||
strings.getString("searchInput.labelUnix");
|
||||
let helpUrl = Services.urlFormatter.formatURLPref("app.support.baseURL") + "preferences";
|
||||
let helpContainer = document.getElementById("need-help");
|
||||
helpContainer.querySelector("a").href = helpUrl;
|
||||
},
|
||||
|
||||
handleEvent(event) {
|
||||
|
@ -197,11 +196,6 @@ var gSearchResultsPane = {
|
|||
return selection;
|
||||
},
|
||||
|
||||
get strings() {
|
||||
delete this.strings;
|
||||
return this.strings = document.getElementById("searchResultBundle");
|
||||
},
|
||||
|
||||
/**
|
||||
* Shows or hides content according to search input
|
||||
*
|
||||
|
@ -294,25 +288,15 @@ var gSearchResultsPane = {
|
|||
if (!resultsFound) {
|
||||
let noResultsEl = document.querySelector(".no-results-message");
|
||||
noResultsEl.setAttribute("query", this.query);
|
||||
|
||||
// XXX: This is potentially racy in case where Fluent retranslates the
|
||||
// message and ereases the query within.
|
||||
// The feature is not yet supported, but we should fix for it before
|
||||
// we enable it. See bug 1446389 for details.
|
||||
let msgQueryElem = document.getElementById("sorry-message-query");
|
||||
msgQueryElem.textContent = this.query;
|
||||
|
||||
noResultsEl.hidden = false;
|
||||
|
||||
let strings = this.strings;
|
||||
|
||||
document.getElementById("sorry-message").textContent = AppConstants.platform == "win" ?
|
||||
strings.getFormattedString("searchResults.sorryMessageWin", [this.query]) :
|
||||
strings.getFormattedString("searchResults.sorryMessageUnix", [this.query]);
|
||||
let helpUrl = Services.urlFormatter.formatURLPref("app.support.baseURL") + "preferences";
|
||||
let brandName = document.getElementById("bundleBrand").getString("brandShortName");
|
||||
let helpString = strings.getString("searchResults.needHelp3");
|
||||
let helpContainer = document.getElementById("need-help");
|
||||
let link = document.createElement("label");
|
||||
link.className = "text-link";
|
||||
link.setAttribute("href", helpUrl);
|
||||
link.textContent = strings.getFormattedString("searchResults.needHelpSupportLink", [brandName]);
|
||||
|
||||
helpContainer.innerHTML = "";
|
||||
let fragment = BrowserUtils.getLocalizedFragment(document, helpString, link);
|
||||
helpContainer.appendChild(fragment);
|
||||
} else {
|
||||
// Creating tooltips for all the instances found
|
||||
for (let anchorNode of this.listSearchTooltips) {
|
||||
|
|
|
@ -208,7 +208,7 @@
|
|||
</hbox>
|
||||
<textbox
|
||||
type="search" id="searchInput"
|
||||
data-l10n-id="search-input"
|
||||
data-l10n-id="search-input-box"
|
||||
data-l10n-attrs="style"
|
||||
hidden="true" clickSelectsAll="true"/>
|
||||
</hbox>
|
||||
|
|
|
@ -2,19 +2,21 @@
|
|||
- 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/. -->
|
||||
|
||||
<stringbundle id="searchResultBundle" src="chrome://browser/locale/preferences/preferences.properties"/>
|
||||
|
||||
<hbox id="header-searchResults"
|
||||
class="subcategory"
|
||||
hidden="true"
|
||||
data-category="paneSearchResults">
|
||||
<label class="header-name" flex="1">&paneSearchResults.title;</label>
|
||||
<label class="header-name" flex="1" data-l10n-id="search-results-header" />
|
||||
</hbox>
|
||||
|
||||
<groupbox class="no-results-message" data-category="paneSearchResults" hidden="true">
|
||||
<vbox class="no-results-container">
|
||||
<label id="sorry-message"></label>
|
||||
<label id="need-help"></label>
|
||||
<label id="sorry-message" data-l10n-id="search-results-sorry-message">
|
||||
<html:span id="sorry-message-query"/>
|
||||
</label>
|
||||
<label id="need-help" data-l10n-id="search-results-need-help">
|
||||
<a class="text-link" target="_blank"></a>
|
||||
</label>
|
||||
</vbox>
|
||||
<vbox class="no-results-container" align="center">
|
||||
<image></image>
|
||||
|
|
|
@ -16,14 +16,26 @@ pref-page =
|
|||
*[other] Preferences
|
||||
}
|
||||
|
||||
# This string is currently used only in Firefox 60 and will be removed when not
|
||||
# needed for x-channel. See bug 1445686 for details.
|
||||
search-input =
|
||||
.style = width: 15.4em
|
||||
|
||||
# This is used to determine the width of the search field in about:preferences,
|
||||
# in order to make the entire placeholder string visible
|
||||
#
|
||||
# Please keep the placeholder string short to avoid truncation.
|
||||
#
|
||||
# Notice: The value of the `.style` attribute is a CSS string, and the `width`
|
||||
# is the name of the CSS property. It is intended only to adjust the element's width.
|
||||
# Do not translate.
|
||||
search-input =
|
||||
search-input-box =
|
||||
.style = width: 15.4em
|
||||
.placeholder =
|
||||
{ PLATFORM() ->
|
||||
[windows] Find in Options
|
||||
*[other] Find in Preferences
|
||||
}
|
||||
|
||||
policies-notice =
|
||||
{ PLATFORM() ->
|
||||
|
@ -65,6 +77,19 @@ should-restart-ok = Restart { -brand-short-name } now
|
|||
cancel-no-restart-button = Cancel
|
||||
restart-later = Restart Later
|
||||
|
||||
## Preferences UI Search Results
|
||||
|
||||
search-results-header = Search Results
|
||||
|
||||
# `<span></span>` will be replaced by the search term.
|
||||
search-results-sorry-message =
|
||||
{ PLATFORM() ->
|
||||
[windows] Sorry! There are no results in Options for “<span></span>”.
|
||||
*[other] Sorry! There are no results in Preferences for “<span></span>”.
|
||||
}
|
||||
|
||||
search-results-need-help = Need help? Visit <a>{ -brand-short-name } Support</a>
|
||||
|
||||
## General Section
|
||||
|
||||
startup-header = Startup
|
||||
|
|
|
@ -2,10 +2,8 @@
|
|||
- 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/. -->
|
||||
|
||||
<!ENTITY paneSearchResults.title "Search Results">
|
||||
<!ENTITY paneContainers.title "Container Tabs">
|
||||
|
||||
|
||||
<!ENTITY browserPrivacy.label "Browser Privacy">
|
||||
|
||||
<!-- LOCALIZATION NOTE (paneSync1.title): This should match syncBrand.fxAccount.label in ../syncBrand.dtd -->
|
||||
|
|
|
@ -217,21 +217,6 @@ removeContainerMsg=If you remove this Container now, #S container tab will be cl
|
|||
removeContainerOkButton=Remove this Container
|
||||
removeContainerButton2=Don’t remove this Container
|
||||
|
||||
# Search Input
|
||||
# LOCALIZATION NOTE: Please keep the placeholder string shorter than around 30 characters to avoid truncation.
|
||||
searchInput.labelWin=Find in Options
|
||||
searchInput.labelUnix=Find in Preferences
|
||||
|
||||
# Search Results Pane
|
||||
# LOCALIZATION NOTE %S will be replaced by the word being searched
|
||||
searchResults.sorryMessageWin=Sorry! There are no results in Options for “%S”.
|
||||
searchResults.sorryMessageUnix=Sorry! There are no results in Preferences for “%S”.
|
||||
# LOCALIZATION NOTE (searchResults.needHelp3): %S will be replaced with a link to the support page.
|
||||
# The label of the link is in searchResults.needHelpSupportLink .
|
||||
searchResults.needHelp3=Need help? Visit %S
|
||||
# LOCALIZATION NOTE (searchResults.needHelpSupportLink): %S will be replaced with the browser name.
|
||||
searchResults.needHelpSupportLink=%S Support
|
||||
|
||||
# LOCALIZATION NOTE (extensionControlled.homepage_override):
|
||||
# This string is shown to notify the user that their home page is being controlled by an extension.
|
||||
extensionControlled.homepage_override2 = An extension, %S, is controlling your home page.
|
||||
|
|
|
@ -26,7 +26,7 @@ if CONFIG['MOZ_UPDATER']:
|
|||
LOCALIZED_FILES['..'] += ['!updater.ini']
|
||||
|
||||
with Files("**"):
|
||||
BUG_COMPONENT = ("Toolkit", "Build Config")
|
||||
BUG_COMPONENT = ("Firefox Build System", "General")
|
||||
|
||||
with Files("all-locales"):
|
||||
BUG_COMPONENT = ("Core", "Localization")
|
||||
|
|
|
@ -388,7 +388,7 @@ class AsyncTabSwitcher {
|
|||
|
||||
if (!needSpinner && this.spinnerTab) {
|
||||
this.spinnerHidden();
|
||||
this.tabbrowser.mPanelContainer.removeAttribute("pendingpaint");
|
||||
this.tabbrowser.tabpanels.removeAttribute("pendingpaint");
|
||||
this.spinnerTab.linkedBrowser.removeAttribute("pendingpaint");
|
||||
this.spinnerTab = null;
|
||||
} else if (needSpinner && this.spinnerTab !== showTab) {
|
||||
|
@ -398,7 +398,7 @@ class AsyncTabSwitcher {
|
|||
this.spinnerDisplayed();
|
||||
}
|
||||
this.spinnerTab = showTab;
|
||||
this.tabbrowser.mPanelContainer.setAttribute("pendingpaint", "true");
|
||||
this.tabbrowser.tabpanels.setAttribute("pendingpaint", "true");
|
||||
this.spinnerTab.linkedBrowser.setAttribute("pendingpaint", "true");
|
||||
}
|
||||
|
||||
|
@ -410,7 +410,7 @@ class AsyncTabSwitcher {
|
|||
this.maybeVisibleTabs.add(showTab);
|
||||
|
||||
let tabs = this.tabbrowser.tabbox.tabs;
|
||||
let tabPanel = this.tabbrowser.mPanelContainer;
|
||||
let tabPanel = this.tabbrowser.tabpanels;
|
||||
let showPanel = tabs.getRelatedElement(showTab);
|
||||
let index = Array.indexOf(tabPanel.childNodes, showPanel);
|
||||
if (index != -1) {
|
||||
|
|
|
@ -65,34 +65,34 @@ with Files("**"):
|
|||
BUG_COMPONENT = ("Firefox", "General")
|
||||
|
||||
with Files("Makefile.in"):
|
||||
BUG_COMPONENT = ("Core", "Build Config")
|
||||
BUG_COMPONENT = ("Firefox Build System", "General")
|
||||
|
||||
with Files("*.mk"):
|
||||
BUG_COMPONENT = ("Core", "Build Config")
|
||||
BUG_COMPONENT = ("Firefox Build System", "General")
|
||||
|
||||
with Files("**/moz.build"):
|
||||
BUG_COMPONENT = ("Core", "Build Config")
|
||||
BUG_COMPONENT = ("Firefox Build System", "General")
|
||||
|
||||
with Files("moz.configure"):
|
||||
BUG_COMPONENT = ("Core", "Build Config")
|
||||
BUG_COMPONENT = ("Firefox Build System", "General")
|
||||
|
||||
with Files("app.mozbuild"):
|
||||
BUG_COMPONENT = ("Core", "Build Config")
|
||||
BUG_COMPONENT = ("Firefox Build System", "General")
|
||||
|
||||
with Files("moz.build"):
|
||||
BUG_COMPONENT = ("Core", "Build Config")
|
||||
BUG_COMPONENT = ("Firefox Build System", "General")
|
||||
|
||||
with Files("confvars.sh"):
|
||||
BUG_COMPONENT = ("Core", "Build Config")
|
||||
BUG_COMPONENT = ("Firefox Build System", "General")
|
||||
|
||||
with Files("LICENSE"):
|
||||
BUG_COMPONENT = ("Core", "Build Config")
|
||||
BUG_COMPONENT = ("Firefox Build System", "General")
|
||||
|
||||
with Files("branding/**"):
|
||||
BUG_COMPONENT = ("Firefox", "General")
|
||||
|
||||
with Files("config/**"):
|
||||
BUG_COMPONENT = ("Core", "Build Config")
|
||||
BUG_COMPONENT = ("Firefox Build System", "General")
|
||||
|
||||
with Files("docs/**"):
|
||||
BUG_COMPONENT = ("Toolkit", "Telemetry")
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
%filter substitution
|
||||
%define navbarTabsShadowSize 1px
|
||||
%define themeTransition background-color 0.1s cubic-bezier(.17,.67,.83,.67)
|
||||
|
||||
:root {
|
||||
/* Note: Setting this to 0 (without px) breaks CSS calculations for OSX. */
|
||||
|
@ -16,6 +17,10 @@
|
|||
--space-above-tabbar: 8px;
|
||||
}
|
||||
|
||||
:root:-moz-lwtheme {
|
||||
transition: @themeTransition@;
|
||||
}
|
||||
|
||||
/* Toolbar / content area border */
|
||||
|
||||
#navigator-toolbox::after {
|
||||
|
@ -28,12 +33,16 @@
|
|||
border-bottom-style: none;
|
||||
}
|
||||
|
||||
#nav-bar:-moz-lwtheme {
|
||||
transition: @themeTransition@;
|
||||
}
|
||||
|
||||
/* Bookmark toolbar */
|
||||
|
||||
#navigator-toolbox > toolbar:not(#toolbar-menubar):not(#TabsToolbar):not(#nav-bar) {
|
||||
overflow: -moz-hidden-unscrollable;
|
||||
max-height: 4em;
|
||||
transition: min-height 170ms ease-out, max-height 170ms ease-out;
|
||||
transition: min-height 170ms ease-out, max-height 170ms ease-out, @themeTransition@;
|
||||
padding: 0 6px 2px;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,11 +17,11 @@ Files metadata is defined by using the
|
|||
files. e.g.::
|
||||
|
||||
with Files('**/Makefile.in'):
|
||||
BUG_COMPONENT = ('Core', 'Build Config')
|
||||
BUG_COMPONENT = ('Firefox Build System', 'General')
|
||||
|
||||
This working example says, *for all Makefile.in files in every directory
|
||||
underneath this one - including this directory - set the Bugzilla
|
||||
component to Core :: Build Config*.
|
||||
component to Firefox Build System :: General*.
|
||||
|
||||
For more info, read the
|
||||
:ref:`docs on Files <mozbuild_subcontext_Files>`.
|
||||
|
@ -135,7 +135,7 @@ possible to finalize the ``BUG_COMPONENT`` value.::
|
|||
|
||||
# /moz.build
|
||||
with Files('**/Makefile.in'):
|
||||
BUG_COMPONENT = ('Core', 'Build Config')
|
||||
BUG_COMPONENT = ('Firefox Build System', 'General')
|
||||
FINAL = True
|
||||
|
||||
# /foo/moz.build
|
||||
|
@ -146,7 +146,7 @@ If we query for metadata of ``/foo/Makefile.in``, both ``Files``
|
|||
sub-contexts match the file pattern. However, since ``BUG_COMPONENT`` is
|
||||
marked as finalized by ``/moz.build``, the assignment from
|
||||
``/foo/moz.build`` is ignored. The final value for ``BUG_COMPONENT``
|
||||
is ``('Core', 'Build Config')``.
|
||||
is ``('Firefox Build System', 'General')``.
|
||||
|
||||
Here is another example::
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
with Files('**'):
|
||||
BUG_COMPONENT = ('Core', 'Build Config')
|
||||
BUG_COMPONENT = ('Firefox Build System', 'General')
|
||||
|
||||
# This cannot be named "build" because of bug 922191.
|
||||
SPHINX_TREES['buildsystem'] = 'docs'
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
with Files('**'):
|
||||
BUG_COMPONENT = ('Core', 'Build Config')
|
||||
BUG_COMPONENT = ('Firefox Build System', 'General')
|
||||
|
||||
with Files('mozunit.py'):
|
||||
BUG_COMPONENT = ('Testing', 'Python Test')
|
||||
|
|
|
@ -20,7 +20,8 @@ class FlexboxInspector {
|
|||
this.store = inspector.store;
|
||||
this.walker = inspector.walker;
|
||||
|
||||
this.onHighlighterChange = this.onHighlighterChange.bind(this);
|
||||
this.onHighlighterShown = this.onHighlighterShown.bind(this);
|
||||
this.onHighlighterHidden = this.onHighlighterHidden.bind(this);
|
||||
this.onReflow = throttle(this.onReflow, 500, this);
|
||||
this.onSidebarSelect = this.onSidebarSelect.bind(this);
|
||||
this.onToggleFlexboxHighlighter = this.onToggleFlexboxHighlighter.bind(this);
|
||||
|
@ -43,16 +44,16 @@ class FlexboxInspector {
|
|||
return;
|
||||
}
|
||||
|
||||
this.highlighters.on("flexbox-highlighter-hidden", this.onHighlighterChange);
|
||||
this.highlighters.on("flexbox-highlighter-shown", this.onHighlighterChange);
|
||||
this.highlighters.on("flexbox-highlighter-hidden", this.onHighlighterHidden);
|
||||
this.highlighters.on("flexbox-highlighter-shown", this.onHighlighterShown);
|
||||
this.inspector.sidebar.on("select", this.onSidebarSelect);
|
||||
|
||||
this.onSidebarSelect();
|
||||
}
|
||||
|
||||
destroy() {
|
||||
this.highlighters.off("flexbox-highlighter-hidden", this.onHighlighterChange);
|
||||
this.highlighters.off("flexbox-highlighter-shown", this.onHighlighterChange);
|
||||
this.highlighters.off("flexbox-highlighter-hidden", this.onHighlighterHidden);
|
||||
this.highlighters.off("flexbox-highlighter-shown", this.onHighlighterShown);
|
||||
this.inspector.selection.off("new-node-front", this.onUpdatePanel);
|
||||
this.inspector.sidebar.off("select", this.onSidebarSelect);
|
||||
this.inspector.off("new-root", this.onUpdatePanel);
|
||||
|
@ -82,21 +83,47 @@ class FlexboxInspector {
|
|||
this.inspector.toolbox.currentToolId === "inspector" &&
|
||||
this.inspector.sidebar.getCurrentTabID() === "layoutview";
|
||||
}
|
||||
/**
|
||||
* Handler for "flexbox-highlighter-shown" events emitted from the
|
||||
* HighlightersOverlay. Passes nodefront and highlight status to
|
||||
* handleHighlighterChange. Required since on and off events need
|
||||
* the same reference object.
|
||||
*
|
||||
* @param {NodeFront} nodeFront
|
||||
* The NodeFront of the flex container element for which the flexbox
|
||||
* highlighter is shown for.
|
||||
*/
|
||||
onHighlighterShown(nodeFront) {
|
||||
return this.onHighlighterChange(true, nodeFront);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler for "flexbox-highlighter-hidden" events emitted from the
|
||||
* HighlightersOverlay. Passes nodefront and highlight status to
|
||||
* handleHighlighterChange. Required since on and off events need
|
||||
* the same reference object.
|
||||
*
|
||||
* @param {NodeFront} nodeFront
|
||||
* The NodeFront of the flex container element for which the flexbox
|
||||
* highlighter is shown for.
|
||||
*/
|
||||
onHighlighterHidden(nodeFront) {
|
||||
return this.onHighlighterChange(false, nodeFront);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler for "flexbox-highlighter-shown" and "flexbox-highlighter-hidden" events
|
||||
* emitted from the HighlightersOverlay. Updates the flex container highlighted state
|
||||
* only if the provided NodeFront is the current selected flex container.
|
||||
*
|
||||
* @param {Event} event
|
||||
* Event that was triggered.
|
||||
* @param {Boolean} highlighted
|
||||
* If the change is to highlight or hide the overlay.
|
||||
* @param {NodeFront} nodeFront
|
||||
* The NodeFront of the flex container element for which the flexbox
|
||||
* highlighter is shown for.
|
||||
*/
|
||||
onHighlighterChange(event, nodeFront) {
|
||||
onHighlighterChange(highlighted, nodeFront) {
|
||||
const { flexbox } = this.store.getState();
|
||||
const highlighted = event === "flexbox-highlighter-shown";
|
||||
|
||||
if (flexbox.nodeFront === nodeFront && flexbox.highlighted !== highlighted) {
|
||||
this.store.dispatch(updateFlexboxHighlighted(highlighted));
|
||||
|
|
|
@ -10,6 +10,8 @@ const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
|
|||
|
||||
const FontPreview = createFactory(require("./FontPreview"));
|
||||
|
||||
loader.lazyRequireGetter(this, "clipboardHelper", "devtools/shared/platform/clipboard");
|
||||
|
||||
const { getStr } = require("../utils/l10n");
|
||||
const Types = require("../types");
|
||||
|
||||
|
@ -30,6 +32,7 @@ class Font extends PureComponent {
|
|||
};
|
||||
|
||||
this.onFontFaceRuleToggle = this.onFontFaceRuleToggle.bind(this);
|
||||
this.onCopyURL = this.onCopyURL.bind(this);
|
||||
}
|
||||
|
||||
componentWillReceiveProps(newProps) {
|
||||
|
@ -42,6 +45,10 @@ class Font extends PureComponent {
|
|||
});
|
||||
}
|
||||
|
||||
onCopyURL() {
|
||||
clipboardHelper.copyString(this.props.font.URI);
|
||||
}
|
||||
|
||||
onFontFaceRuleToggle(event) {
|
||||
this.setState({
|
||||
isFontFaceRuleExpanded: !this.state.isFontFaceRuleExpanded
|
||||
|
@ -81,11 +88,11 @@ class Font extends PureComponent {
|
|||
);
|
||||
}
|
||||
|
||||
renderFontTypeAndURL(url, format) {
|
||||
renderFontOrigin(url) {
|
||||
if (!url) {
|
||||
return dom.p(
|
||||
{
|
||||
className: "font-format-url"
|
||||
className: "font-origin system"
|
||||
},
|
||||
getStr("fontinspector.system")
|
||||
);
|
||||
|
@ -93,15 +100,21 @@ class Font extends PureComponent {
|
|||
|
||||
return dom.p(
|
||||
{
|
||||
className: "font-format-url"
|
||||
className: "font-origin remote",
|
||||
},
|
||||
getStr("fontinspector.remote"),
|
||||
dom.a(
|
||||
dom.span(
|
||||
{
|
||||
className: "font-url",
|
||||
href: url
|
||||
className: "url",
|
||||
title: url
|
||||
},
|
||||
format
|
||||
url
|
||||
),
|
||||
dom.button(
|
||||
{
|
||||
className: "copy-icon",
|
||||
onClick: this.onCopyURL,
|
||||
title: getStr("fontinspector.copyURL"),
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -139,7 +152,6 @@ class Font extends PureComponent {
|
|||
let { previewText } = fontOptions;
|
||||
|
||||
let {
|
||||
format,
|
||||
name,
|
||||
previewUrl,
|
||||
rule,
|
||||
|
@ -153,7 +165,7 @@ class Font extends PureComponent {
|
|||
},
|
||||
this.renderFontName(name),
|
||||
FontPreview({ previewText, previewUrl, onPreviewFonts }),
|
||||
this.renderFontTypeAndURL(URI, format),
|
||||
this.renderFontOrigin(URI),
|
||||
this.renderFontCSSCode(rule, ruleText)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@ support-files =
|
|||
!/devtools/client/shared/test/test-actor-registry.js
|
||||
|
||||
[browser_fontinspector.js]
|
||||
[browser_fontinspector_copy-URL.js]
|
||||
subsuite = clipboard
|
||||
[browser_fontinspector_edit-previews.js]
|
||||
[browser_fontinspector_expand-css-code.js]
|
||||
[browser_fontinspector_other-fonts.js]
|
||||
|
|
|
@ -10,25 +10,21 @@ const FONTS = [{
|
|||
name: "Ostrich Sans Medium",
|
||||
remote: true,
|
||||
url: URL_ROOT + "ostrich-regular.ttf",
|
||||
format: "truetype",
|
||||
cssName: "bar"
|
||||
}, {
|
||||
name: "Ostrich Sans Black",
|
||||
remote: true,
|
||||
url: URL_ROOT + "ostrich-black.ttf",
|
||||
format: "",
|
||||
cssName: "bar"
|
||||
}, {
|
||||
name: "Ostrich Sans Black",
|
||||
remote: true,
|
||||
url: URL_ROOT + "ostrich-black.ttf",
|
||||
format: "",
|
||||
cssName: "bar"
|
||||
}, {
|
||||
name: "Ostrich Sans Medium",
|
||||
remote: true,
|
||||
url: URL_ROOT + "ostrich-regular.ttf",
|
||||
format: "",
|
||||
cssName: "barnormal"
|
||||
}];
|
||||
|
||||
|
@ -43,16 +39,7 @@ add_task(function* () {
|
|||
});
|
||||
|
||||
function isRemote(fontLi) {
|
||||
return fontLi.querySelectorAll(".font-format-url a").length === 1;
|
||||
}
|
||||
|
||||
function getFormat(fontLi) {
|
||||
let link = fontLi.querySelector(".font-format-url a");
|
||||
if (!link) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return link.textContent;
|
||||
return fontLi.querySelector(".font-origin").classList.contains("remote");
|
||||
}
|
||||
|
||||
function* testBodyFonts(inspector, viewDoc) {
|
||||
|
@ -63,10 +50,9 @@ function* testBodyFonts(inspector, viewDoc) {
|
|||
let li = lis[i];
|
||||
let font = FONTS[i];
|
||||
|
||||
is(getName(li), font.name, "font " + i + " right font name");
|
||||
is(isRemote(li), font.remote, "font " + i + " remote value correct");
|
||||
is(li.querySelector(".font-url").href, font.url, "font " + i + " url correct");
|
||||
is(getFormat(li), font.format, "font " + i + " format correct");
|
||||
is(getName(li), font.name, `font ${i} right font name`);
|
||||
is(isRemote(li), font.remote, `font ${i} remote value correct`);
|
||||
is(li.querySelector(".font-origin").textContent, font.url, `font ${i} url correct`);
|
||||
}
|
||||
|
||||
// test that the bold and regular fonts have different previews
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Test that an icon appears next to web font URLs, and that clicking it copies the URL
|
||||
// to the clipboard thanks to it.
|
||||
|
||||
const TEST_URI = URL_ROOT + "browser_fontinspector.html";
|
||||
|
||||
add_task(async function() {
|
||||
let { view } = await openFontInspectorForURL(TEST_URI);
|
||||
let viewDoc = view.document;
|
||||
|
||||
let fontEl = getUsedFontsEls(viewDoc)[0];
|
||||
let linkEl = fontEl.querySelector(".font-origin");
|
||||
let iconEl = linkEl.querySelector(".copy-icon");
|
||||
|
||||
ok(iconEl, "The icon is displayed");
|
||||
is(iconEl.getAttribute("title"), "Copy URL", "This is the right icon");
|
||||
|
||||
info("Clicking the button and waiting for the clipboard to receive the URL");
|
||||
await waitForClipboardPromise(() => iconEl.click(), linkEl.textContent);
|
||||
});
|
|
@ -57,7 +57,8 @@ class GridInspector {
|
|||
this.getSwatchColorPickerTooltip = this.getSwatchColorPickerTooltip.bind(this);
|
||||
this.updateGridPanel = this.updateGridPanel.bind(this);
|
||||
|
||||
this.onHighlighterChange = this.onHighlighterChange.bind(this);
|
||||
this.onHighlighterShown = this.onHighlighterShown.bind(this);
|
||||
this.onHighlighterHidden = this.onHighlighterHidden.bind(this);
|
||||
this.onNavigate = this.onNavigate.bind(this);
|
||||
this.onReflow = throttle(this.onReflow, 500, this);
|
||||
this.onSetGridOverlayColor = this.onSetGridOverlayColor.bind(this);
|
||||
|
@ -95,8 +96,8 @@ class GridInspector {
|
|||
}
|
||||
);
|
||||
|
||||
this.highlighters.on("grid-highlighter-hidden", this.onHighlighterChange);
|
||||
this.highlighters.on("grid-highlighter-shown", this.onHighlighterChange);
|
||||
this.highlighters.on("grid-highlighter-hidden", this.onHighlighterHidden);
|
||||
this.highlighters.on("grid-highlighter-shown", this.onHighlighterShown);
|
||||
this.inspector.sidebar.on("select", this.onSidebarSelect);
|
||||
this.inspector.on("new-root", this.onNavigate);
|
||||
|
||||
|
@ -108,8 +109,8 @@ class GridInspector {
|
|||
* and cleans up references.
|
||||
*/
|
||||
destroy() {
|
||||
this.highlighters.off("grid-highlighter-hidden", this.onHighlighterChange);
|
||||
this.highlighters.off("grid-highlighter-shown", this.onHighlighterChange);
|
||||
this.highlighters.off("grid-highlighter-hidden", this.onHighlighterHidden);
|
||||
this.highlighters.off("grid-highlighter-shown", this.onHighlighterShown);
|
||||
this.inspector.sidebar.off("select", this.onSidebarSelect);
|
||||
this.inspector.off("new-root", this.onNavigate);
|
||||
|
||||
|
@ -355,21 +356,49 @@ class GridInspector {
|
|||
this.store.dispatch(updateGrids(grids));
|
||||
this.inspector.emit("grid-panel-updated");
|
||||
}
|
||||
/**
|
||||
* Handler for "grid-highlighter-shown" events emitted from the
|
||||
* HighlightersOverlay. Passes nodefront and event name to handleHighlighterChange.
|
||||
* Required since on and off events need the same reference object.
|
||||
*
|
||||
* @param {NodeFront} nodeFront
|
||||
* The NodeFront of the flex container element for which the flexbox
|
||||
* highlighter is shown for.
|
||||
* @param {Object} options
|
||||
* The highlighter options used for the highlighter being shown/hidden.
|
||||
*/
|
||||
onHighlighterShown(nodeFront, options) {
|
||||
return this.onHighlighterChange(true, nodeFront, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler for "grid-highlighter-hidden" events emitted from the
|
||||
* HighlightersOverlay. Passes nodefront and event name to handleHighlighterChange.
|
||||
* Required since on and off events need the same reference object.
|
||||
*
|
||||
* @param {NodeFront} nodeFront
|
||||
* The NodeFront of the flex container element for which the flexbox
|
||||
* highlighter is shown for.
|
||||
* @param {Object} options
|
||||
* The highlighter options used for the highlighter being shown/hidden.
|
||||
*/
|
||||
onHighlighterHidden(nodeFront, options) {
|
||||
return this.onHighlighterChange(false, nodeFront, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler for "grid-highlighter-shown" and "grid-highlighter-hidden" events emitted
|
||||
* from the HighlightersOverlay. Updates the NodeFront's grid highlighted state.
|
||||
*
|
||||
* @param {Event} event
|
||||
* Event that was triggered.
|
||||
* @param {Boolean} highlighted
|
||||
* If the grid should be updated to highlight or hide.
|
||||
* @param {NodeFront} nodeFront
|
||||
* The NodeFront of the grid container element for which the grid highlighter
|
||||
* is shown for.
|
||||
* @param {Object} options
|
||||
* The highlighter options used for the highlighter being shown/hidden.
|
||||
*/
|
||||
onHighlighterChange(event, nodeFront, options = {}) {
|
||||
let highlighted = event === "grid-highlighter-shown";
|
||||
onHighlighterChange(highlighted, nodeFront, options = {}) {
|
||||
let { color } = options;
|
||||
|
||||
// Only tell the store that the highlighter changed if it did change.
|
||||
|
|
|
@ -62,7 +62,7 @@ add_task(function* () {
|
|||
|
||||
info("Toggling ON the CSS grid highlighter from the rule-view.");
|
||||
let onHighlighterShown = highlighters.once("grid-highlighter-shown",
|
||||
(event, nodeFront, options) => {
|
||||
(nodeFront, options) => {
|
||||
info("Checking the grid highlighter display settings.");
|
||||
let {
|
||||
color,
|
||||
|
|
|
@ -55,7 +55,7 @@ add_task(function* () {
|
|||
|
||||
info("Hovering over grid cell A in the grid outline.");
|
||||
let onCellAHighlight = highlighters.once("grid-highlighter-shown",
|
||||
(event, nodeFront, options) => {
|
||||
(nodeFront, options) => {
|
||||
info("Checking the grid highlighter options for the show grid area" +
|
||||
"and cell parameters.");
|
||||
const { showGridCell, showGridArea } = options;
|
||||
|
|
|
@ -46,7 +46,7 @@ add_task(function* () {
|
|||
|
||||
info("Hovering over grid cell A in the grid outline.");
|
||||
let onCellAHighlight = highlighters.once("grid-highlighter-shown",
|
||||
(event, nodeFront, options) => {
|
||||
(nodeFront, options) => {
|
||||
info("Checking show grid cell options are correct.");
|
||||
const { showGridCell } = options;
|
||||
const { gridFragmentIndex, rowNumber, columnNumber } = showGridCell;
|
||||
|
|
|
@ -48,7 +48,7 @@ add_task(function* () {
|
|||
|
||||
info("Toggling ON the CSS grid highlighter from the rule-view.");
|
||||
let onHighlighterShown = highlighters.once("grid-highlighter-shown",
|
||||
(event, nodeFront, options) => {
|
||||
(nodeFront, options) => {
|
||||
info("Checking the grid highlighter display settings.");
|
||||
let {
|
||||
color,
|
||||
|
|
|
@ -9,7 +9,7 @@ const Services = require("Services");
|
|||
const {Task} = require("devtools/shared/task");
|
||||
const nodeConstants = require("devtools/shared/dom-node-constants");
|
||||
const nodeFilterConstants = require("devtools/shared/dom-node-filter-constants");
|
||||
const EventEmitter = require("devtools/shared/old-event-emitter");
|
||||
const EventEmitter = require("devtools/shared/event-emitter");
|
||||
const {LocalizationHelper} = require("devtools/shared/l10n");
|
||||
const {PluralForm} = require("devtools/shared/plural-form");
|
||||
const AutocompletePopup = require("devtools/client/shared/autocomplete-popup");
|
||||
|
@ -1441,7 +1441,7 @@ MarkupView.prototype = {
|
|||
this.htmlEditor = new HTMLEditor(this.doc);
|
||||
}
|
||||
this.htmlEditor.show(container.tagLine, oldValue);
|
||||
this.htmlEditor.once("popuphidden", (e, commit, value) => {
|
||||
this.htmlEditor.once("popuphidden", (commit, value) => {
|
||||
// Need to focus the <html> element instead of the frame / window
|
||||
// in order to give keyboard focus back to doc (from editor).
|
||||
this.doc.documentElement.focus();
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
const Editor = require("devtools/client/sourceeditor/editor");
|
||||
const Services = require("Services");
|
||||
const EventEmitter = require("devtools/shared/old-event-emitter");
|
||||
const EventEmitter = require("devtools/shared/event-emitter");
|
||||
|
||||
/**
|
||||
* A wrapper around the Editor component, that allows editing of HTML.
|
||||
|
|
|
@ -32,7 +32,7 @@ const StyleInspectorMenu = require("devtools/client/inspector/shared/style-inspe
|
|||
const TooltipsOverlay = require("devtools/client/inspector/shared/tooltips-overlay");
|
||||
const {createChild, promiseWarn} = require("devtools/client/inspector/shared/utils");
|
||||
const {debounce} = require("devtools/shared/debounce");
|
||||
const EventEmitter = require("devtools/shared/old-event-emitter");
|
||||
const EventEmitter = require("devtools/shared/event-emitter");
|
||||
const KeyShortcuts = require("devtools/client/shared/key-shortcuts");
|
||||
const clipboardHelper = require("devtools/shared/platform/clipboard");
|
||||
const AutocompletePopup = require("devtools/client/shared/autocomplete-popup");
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const EventEmitter = require("devtools/shared/old-event-emitter");
|
||||
const EventEmitter = require("devtools/shared/event-emitter");
|
||||
const {LocalizationHelper} = require("devtools/shared/l10n");
|
||||
|
||||
const L10N = new LocalizationHelper("devtools/client/locales/inspector.properties");
|
||||
|
|
|
@ -28,7 +28,7 @@ const {
|
|||
} = require("devtools/shared/css/parsing-utils");
|
||||
const promise = require("promise");
|
||||
const Services = require("Services");
|
||||
const EventEmitter = require("devtools/shared/old-event-emitter");
|
||||
const EventEmitter = require("devtools/shared/event-emitter");
|
||||
const {Task} = require("devtools/shared/task");
|
||||
const {Tools} = require("devtools/client/definitions");
|
||||
const {gDevTools} = require("devtools/client/framework/devtools");
|
||||
|
|
|
@ -1043,7 +1043,7 @@ TextPropertyEditor.prototype = {
|
|||
* @param {String} point
|
||||
* The point to highlight.
|
||||
*/
|
||||
_onHoverShapePoint: function(event, point) {
|
||||
_onHoverShapePoint: function(point) {
|
||||
// If there is no shape toggle, or it is not active, return.
|
||||
let shapeToggle = this.valueSpan.querySelector(".ruleview-shapeswatch.active");
|
||||
if (!shapeToggle) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"use strict";
|
||||
|
||||
const {Task} = require("devtools/shared/task");
|
||||
const EventEmitter = require("devtools/shared/old-event-emitter");
|
||||
const EventEmitter = require("devtools/shared/event-emitter");
|
||||
const {createNode} = require("devtools/client/animationinspector/utils");
|
||||
const { LocalizationHelper } = require("devtools/shared/l10n");
|
||||
|
||||
|
@ -255,7 +255,7 @@ DomNodePreview.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
onHighlighterLocked: function(e, domNodePreview) {
|
||||
onHighlighterLocked: function(domNodePreview) {
|
||||
if (domNodePreview !== this) {
|
||||
this.highlightNodeEl.classList.remove("selected");
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
"use strict";
|
||||
|
||||
const Services = require("Services");
|
||||
const EventEmitter = require("devtools/shared/old-event-emitter");
|
||||
const EventEmitter = require("devtools/shared/event-emitter");
|
||||
const {
|
||||
VIEW_NODE_VALUE_TYPE,
|
||||
VIEW_NODE_SHAPE_POINT_TYPE
|
||||
|
|
|
@ -123,6 +123,7 @@ devtools.jar:
|
|||
skin/images/pseudo-class.svg (themes/images/pseudo-class.svg)
|
||||
skin/images/controls.png (themes/images/controls.png)
|
||||
skin/images/controls@2x.png (themes/images/controls@2x.png)
|
||||
skin/images/copy.svg (themes/images/copy.svg)
|
||||
skin/images/animation-fast-track.svg (themes/images/animation-fast-track.svg)
|
||||
skin/images/performance-details-waterfall.svg (themes/images/performance-details-waterfall.svg)
|
||||
skin/images/performance-details-call-tree.svg (themes/images/performance-details-call-tree.svg)
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
# system font.
|
||||
fontinspector.system=system
|
||||
|
||||
# LOCALIZATION NOTE (fontinspector.remote) This label indicates that the font is a remote
|
||||
# font.
|
||||
fontinspector.remote=remote
|
||||
|
||||
# LOCALIZATION NOTE (fontinspector.noFontsOnSelectedElement): This label is shown when
|
||||
# no fonts found on the selected element.
|
||||
fontinspector.noFontsOnSelectedElement=No fonts were found for the current element.
|
||||
|
@ -25,3 +21,8 @@ fontinspector.otherFontsInPageHeader=Other fonts in page
|
|||
# tooltip on hover of a font preview string. Clicking on the string opens a text input
|
||||
# where users can type to change the preview text.
|
||||
fontinspector.editPreview=Click to edit preview
|
||||
|
||||
# LOCALIZATION NOTE (fontinspector.copyURL): This is the text that appears in a tooltip
|
||||
# displayed when the user hovers over the copy icon next to the font URL.
|
||||
# Clicking the copy icon copies the full font URL to the user's clipboard
|
||||
fontinspector.copyURL=Copy URL
|
||||
|
|
|
@ -16,7 +16,7 @@ const require = window.windowRequire = BrowserLoader({
|
|||
window,
|
||||
}).require;
|
||||
|
||||
const EventEmitter = require("devtools/shared/old-event-emitter");
|
||||
const EventEmitter = require("devtools/shared/event-emitter");
|
||||
const { createFactory } = require("devtools/client/shared/vendor/react");
|
||||
const { render, unmountComponentAtNode } = require("devtools/client/shared/vendor/react-dom");
|
||||
const Provider = createFactory(require("devtools/client/shared/vendor/react-redux").Provider);
|
||||
|
@ -119,7 +119,7 @@ window.Netmonitor = {
|
|||
* Support for `devtools.network.onRequestFinished`. A hook for
|
||||
* every finished HTTP request used by WebExtensions API.
|
||||
*/
|
||||
onRequestAdded(event, requestId) {
|
||||
onRequestAdded(requestId) {
|
||||
let listeners = this.toolbox.getRequestFinishedListeners();
|
||||
if (!listeners.size) {
|
||||
return;
|
||||
|
|
|
@ -49,7 +49,7 @@ ToolboxOverlay.prototype = {
|
|||
/**
|
||||
* Executed when the toolbox is destroyed.
|
||||
*/
|
||||
onDestroy: function(eventId, toolbox) {
|
||||
onDestroy: function(toolbox) {
|
||||
this.destroyAutomation();
|
||||
},
|
||||
|
||||
|
|
|
@ -77,21 +77,9 @@ async function performRequestAndWait(tab, monitor) {
|
|||
* Execute simple GET request
|
||||
*/
|
||||
async function performPausedRequest(connector, tab, monitor) {
|
||||
let wait = waitForWebConsoleNetworkEvent(connector);
|
||||
let wait = connector.connector.webConsoleClient.once("networkEvent");
|
||||
await ContentTask.spawn(tab.linkedBrowser, SIMPLE_SJS, async function(url) {
|
||||
await content.wrappedJSObject.performRequests(url);
|
||||
});
|
||||
await wait;
|
||||
}
|
||||
|
||||
/**
|
||||
* Listen for events fired by the console client since the Firefox
|
||||
* connector (data provider) is paused.
|
||||
*/
|
||||
function waitForWebConsoleNetworkEvent(connector) {
|
||||
return new Promise(resolve => {
|
||||
connector.connector.webConsoleClient.once("networkEvent", (type, networkInfo) => {
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ function waitForTimelineMarkers(monitor) {
|
|||
return new Promise(resolve => {
|
||||
let markers = [];
|
||||
|
||||
function handleTimelineEvent(_, marker) {
|
||||
function handleTimelineEvent(marker) {
|
||||
info(`Got marker: ${marker.name}`);
|
||||
markers.push(marker);
|
||||
if (markers.length == 2) {
|
||||
|
@ -184,14 +184,14 @@ function waitForAllRequestsFinished(monitor) {
|
|||
// Key is the request id, value is a boolean - is request finished or not?
|
||||
let requests = new Map();
|
||||
|
||||
function onRequest(_, id) {
|
||||
function onRequest(id) {
|
||||
let networkInfo = getNetworkRequest(id);
|
||||
let { url } = networkInfo.request;
|
||||
info(`Request ${id} for ${url} not yet done, keep waiting...`);
|
||||
requests.set(id, false);
|
||||
}
|
||||
|
||||
function onTimings(_, id) {
|
||||
function onTimings(id) {
|
||||
let networkInfo = getNetworkRequest(id);
|
||||
let { url } = networkInfo.request;
|
||||
info(`Request ${id} for ${url} done`);
|
||||
|
@ -242,13 +242,13 @@ let updatedTypes = [
|
|||
// Start collecting all networkEventUpdate event when panel is opened.
|
||||
// removeTab() should be called once all corresponded RECEIVED_* events finished.
|
||||
function startNetworkEventUpdateObserver(panelWin) {
|
||||
updatingTypes.forEach((type) => panelWin.on(type, (event, actor) => {
|
||||
let key = actor + "-" + updatedTypes[updatingTypes.indexOf(event)];
|
||||
updatingTypes.forEach((type) => panelWin.on(type, actor => {
|
||||
let key = actor + "-" + updatedTypes[updatingTypes.indexOf(type)];
|
||||
finishedQueue[key] = finishedQueue[key] ? finishedQueue[key] + 1 : 1;
|
||||
}));
|
||||
|
||||
updatedTypes.forEach((type) => panelWin.on(type, (event, actor) => {
|
||||
let key = actor + "-" + event;
|
||||
updatedTypes.forEach((type) => panelWin.on(type, actor => {
|
||||
let key = actor + "-" + type;
|
||||
finishedQueue[key] = finishedQueue[key] ? finishedQueue[key] - 1 : -1;
|
||||
}));
|
||||
}
|
||||
|
@ -353,7 +353,7 @@ function waitForNetworkEvents(monitor, getRequests) {
|
|||
let networkEvent = 0;
|
||||
let payloadReady = 0;
|
||||
|
||||
function onNetworkEvent(event, actor) {
|
||||
function onNetworkEvent(actor) {
|
||||
let networkInfo = getNetworkRequest(actor);
|
||||
if (!networkInfo) {
|
||||
// Must have been related to reloading document to disable cache.
|
||||
|
@ -361,10 +361,10 @@ function waitForNetworkEvents(monitor, getRequests) {
|
|||
return;
|
||||
}
|
||||
networkEvent++;
|
||||
maybeResolve(event, actor, networkInfo);
|
||||
maybeResolve(EVENTS.NETWORK_EVENT, actor, networkInfo);
|
||||
}
|
||||
|
||||
function onPayloadReady(event, actor) {
|
||||
function onPayloadReady(actor) {
|
||||
let networkInfo = getNetworkRequest(actor);
|
||||
if (!networkInfo) {
|
||||
// Must have been related to reloading document to disable cache.
|
||||
|
@ -372,7 +372,7 @@ function waitForNetworkEvents(monitor, getRequests) {
|
|||
return;
|
||||
}
|
||||
payloadReady++;
|
||||
maybeResolve(event, actor, networkInfo);
|
||||
maybeResolve(EVENTS.PAYLOAD_READY, actor, networkInfo);
|
||||
}
|
||||
|
||||
function maybeResolve(event, actor, networkInfo) {
|
||||
|
|
|
@ -84,7 +84,7 @@ let webpackConfig = {
|
|||
|
||||
"devtools/client/sourceeditor/editor": "devtools-source-editor/src/source-editor",
|
||||
|
||||
"devtools/shared/old-event-emitter": "devtools-modules/src/utils/event-emitter",
|
||||
"devtools/shared/event-emitter": "devtools-modules/src/utils/event-emitter",
|
||||
"devtools/shared/fronts/timeline": path.join(__dirname, "../../client/shared/webpack/shims/fronts-timeline-shim"),
|
||||
"devtools/shared/platform/clipboard": path.join(__dirname, "../../client/shared/webpack/shims/platform-clipboard-stub"),
|
||||
"devtools/client/netmonitor/src/utils/firefox/open-request-in-tab": path.join(__dirname, "src/utils/open-request-in-tab"),
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
border-width: 0 1px 1px 0;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto;
|
||||
grid-column-gap: 10px;
|
||||
padding: 10px 20px;
|
||||
}
|
||||
|
||||
|
@ -108,33 +109,42 @@
|
|||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.font-format-url {
|
||||
text-transform: capitalize;
|
||||
.font-origin {
|
||||
margin-top: .2em;
|
||||
color: var(--grey-50);
|
||||
justify-self: start;
|
||||
}
|
||||
|
||||
.font-url {
|
||||
margin-inline-start: .5em;
|
||||
text-decoration: underline;
|
||||
color: var(--theme-highlight-blue);
|
||||
background: transparent;
|
||||
border: none;
|
||||
.font-origin.system {
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
.font-origin.remote {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 20px;
|
||||
}
|
||||
|
||||
.font-origin.remote .url {
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.font-origin .copy-icon {
|
||||
border: 0;
|
||||
padding: 0;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
}
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
place-self: center;
|
||||
|
||||
.font-url::after {
|
||||
content: "";
|
||||
display: inline-block;
|
||||
height: 13px;
|
||||
width: 13px;
|
||||
margin: -.3rem .15rem 0 0.25rem;
|
||||
vertical-align: middle;
|
||||
background-image: url(chrome://devtools-shim/content/aboutdevtools/images/external-link.svg);
|
||||
background-repeat: no-repeat;
|
||||
background-size: 13px 13px;
|
||||
background: url(chrome://devtools/skin/images/copy.svg) no-repeat;
|
||||
background-size: 12px;
|
||||
background-position-x: -1px;
|
||||
-moz-context-properties: fill;
|
||||
fill: var(--blue-60);
|
||||
fill: var(--theme-toolbar-color);
|
||||
|
||||
}
|
||||
|
||||
#font-container .devtools-sidepanel-no-result + .accordion {
|
||||
|
|
|
@ -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" viewBox="0 0 12 12" fill="context-fill #0b0b0b">
|
||||
<path d="M5.70001221,11.125 L5.70001221,4.625 L7.66001225,4.625 L7.66001225,6.94642857 C7.66001225,7.20271429 7.87953225,7.41071429 8.15001225,7.41071429 L10.6000123,7.41071429 L10.6000123,11.125 L5.70001221,11.125 Z M4.7,5.475 L4.7,7.275 L2,7.275 L2,0.975 L3.8,0.975 L3.8,3.225 C3.8,3.4734 4.0016,3.675 4.25,3.675 L6.5,3.675 C5.5064,3.675 4.7,4.4814 4.7,5.475 Z M6.84002447,3.00050006 L4.65002441,3.00050006 L4.65002441,0.8105 L6.84002447,3.00050006 Z M10.5,6.6000061 L8.5,6.6000061 L8.5,4.6000061 L10.5,6.6000061 Z M11.28025,6.21975 L9.03025,3.96975 C8.89,3.82875 8.6995,3.75 8.5,3.75 L7.75,3.75 L7.75,3 C7.75,2.80125 7.67125,2.61 7.53025,2.46975 L5.28025,0.21975 C5.14,0.07875 4.94875,0 4.75,0 L2.5,0 C1.672,0 1,0.672 1,1.5 L1,6.75 C1,7.578 1.672,8.25 2.5,8.25 L4.75,8.25 L4.75,10.5 C4.75,11.328 5.422,12 6.25,12 L10,12 C10.828,12 11.5,11.328 11.5,10.5 L11.5,6.75 C11.5,6.55125 11.42125,6.36 11.28025,6.21975 Z"></path>
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 1.2 KiB |
|
@ -244,11 +244,11 @@ ul.children + .tag-line::before {
|
|||
}
|
||||
|
||||
.newattr {
|
||||
display: inline-block;
|
||||
width: 1em;
|
||||
height: 1ex;
|
||||
margin-right: -1em;
|
||||
padding: 1px 0;
|
||||
margin-right: -13px;
|
||||
}
|
||||
|
||||
.newattr:before {
|
||||
content: "\00a0\00a0";
|
||||
}
|
||||
|
||||
.attr-value .link {
|
||||
|
|
|
@ -184,7 +184,7 @@ Link::TryDNSPrefetchOrPreconnectOrPrefetchOrPreloadOrPrerender()
|
|||
nsCOMPtr<nsIURI> uri(GetURI());
|
||||
if (uri && mElement->OwnerDoc()) {
|
||||
mElement->OwnerDoc()->MaybePreconnect(uri,
|
||||
mElement->AttrValueToCORSMode(mElement->GetParsedAttr(nsGkAtoms::crossorigin)));
|
||||
Element::AttrValueToCORSMode(mElement->GetParsedAttr(nsGkAtoms::crossorigin)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -329,7 +329,7 @@ nsDOMWindowUtils::GetPhysicalMillimeterInCSSPixels(float* aPhysicalMillimeter)
|
|||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
*aPhysicalMillimeter = presContext->AppUnitsToFloatCSSPixels(
|
||||
*aPhysicalMillimeter = nsPresContext::AppUnitsToFloatCSSPixels(
|
||||
presContext->PhysicalMillimetersToAppUnits(1));
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -6149,7 +6149,7 @@ nsGlobalWindowOuter::EnterModalState()
|
|||
nsContentUtils::ContentIsCrossDocDescendantOf(mDoc, activeShell->GetDocument()))) {
|
||||
EventStateManager::ClearGlobalActiveContent(activeESM);
|
||||
|
||||
activeShell->SetCapturingContent(nullptr, 0);
|
||||
nsIPresShell::SetCapturingContent(nullptr, 0);
|
||||
|
||||
if (activeShell) {
|
||||
RefPtr<nsFrameSelection> frameSelection = activeShell->FrameSelection();
|
||||
|
|
|
@ -4042,7 +4042,7 @@ CanvasRenderingContext2D::SetFontInternal(const nsAString& aFont,
|
|||
// pixels to CSS pixels, to adjust for the difference in expectations from
|
||||
// other nsFontMetrics clients.
|
||||
resizedFont.size =
|
||||
(fontStyle->mSize * c->AppUnitsPerDevPixel()) / c->AppUnitsPerCSSPixel();
|
||||
(fontStyle->mSize * c->AppUnitsPerDevPixel()) / nsPresContext::AppUnitsPerCSSPixel();
|
||||
|
||||
nsFontMetrics::Params params;
|
||||
params.language = fontStyle->mLanguage;
|
||||
|
|
|
@ -1157,7 +1157,7 @@ protected:
|
|||
pc = ps->GetPresContext();
|
||||
if (!pc) goto FINISH;
|
||||
devPixel = pc->AppUnitsPerDevPixel();
|
||||
cssPixel = pc->AppUnitsPerCSSPixel();
|
||||
cssPixel = nsPresContext::AppUnitsPerCSSPixel();
|
||||
|
||||
FINISH:
|
||||
if (aPerDevPixel)
|
||||
|
|
|
@ -233,7 +233,7 @@ ImageBitmapRenderingContext::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
|
|||
|
||||
RefPtr<ImageContainer> imageContainer = imageLayer->GetContainer();
|
||||
if (!imageContainer) {
|
||||
imageContainer = aManager->CreateImageContainer();
|
||||
imageContainer = LayerManager::CreateImageContainer();
|
||||
imageLayer->SetContainer(imageContainer);
|
||||
}
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ WebGLRenderbuffer::RenderbufferStorage(const char* funcName, uint32_t samples,
|
|||
|
||||
const GLenum error = DoRenderbufferStorage(samples, usage, width, height);
|
||||
if (error) {
|
||||
const char* errorName = mContext->ErrorName(error);
|
||||
const char* errorName = WebGLContext::ErrorName(error);
|
||||
mContext->GenerateWarning("%s generated error %s", funcName, errorName);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -451,7 +451,7 @@ bool
|
|||
InputType::ParseTime(const nsAString& aValue, uint32_t* aResult) const
|
||||
{
|
||||
// see comment in InputType::ParseDate().
|
||||
return mInputElement->ParseTime(aValue, aResult);
|
||||
return mozilla::dom::HTMLInputElement::ParseTime(aValue, aResult);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -9965,7 +9965,7 @@ SerializeStructuredCloneFiles(
|
|||
MOZ_ASSERT(fileId > 0);
|
||||
|
||||
nsCOMPtr<nsIFile> nativeFile =
|
||||
fileManager->GetCheckedFileForId(directory, fileId);
|
||||
mozilla::dom::indexedDB::FileManager::GetCheckedFileForId(directory, fileId);
|
||||
if (NS_WARN_IF(!nativeFile)) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
|
@ -11507,7 +11507,7 @@ UpdateRefcountFunction::Reset()
|
|||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIFile> file = aFileManager->GetFileForId(mDirectory, aId);
|
||||
nsCOMPtr<nsIFile> file = FileManager::GetFileForId(mDirectory, aId);
|
||||
if (NS_WARN_IF(!file)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -11537,7 +11537,7 @@ UpdateRefcountFunction::Reset()
|
|||
fileSize);
|
||||
}
|
||||
|
||||
file = aFileManager->GetFileForId(mJournalDirectory, aId);
|
||||
file = FileManager::GetFileForId(mJournalDirectory, aId);
|
||||
if (NS_WARN_IF(!file)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -11665,7 +11665,7 @@ UpdateRefcountFunction::CreateJournals()
|
|||
int64_t id = mJournalsToCreateBeforeCommit[i];
|
||||
|
||||
nsCOMPtr<nsIFile> file =
|
||||
mFileManager->GetFileForId(journalDirectory, id);
|
||||
FileManager::GetFileForId(journalDirectory, id);
|
||||
if (NS_WARN_IF(!file)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -11698,7 +11698,7 @@ UpdateRefcountFunction::RemoveJournals(const nsTArray<int64_t>& aJournals)
|
|||
|
||||
for (uint32_t index = 0; index < aJournals.Length(); index++) {
|
||||
nsCOMPtr<nsIFile> file =
|
||||
mFileManager->GetFileForId(journalDirectory, aJournals[index]);
|
||||
FileManager::GetFileForId(journalDirectory, aJournals[index]);
|
||||
if (NS_WARN_IF(!file)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
|
|
@ -263,7 +263,7 @@ FileInfo::GetFileForFileInfo(FileInfo* aFileInfo)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIFile> file = fileManager->GetFileForId(directory,
|
||||
nsCOMPtr<nsIFile> file = FileManager::GetFileForId(directory,
|
||||
aFileInfo->Id());
|
||||
if (NS_WARN_IF(!file)) {
|
||||
return nullptr;
|
||||
|
|
|
@ -31,7 +31,7 @@ NS_IMETHODIMP
|
|||
ColorPickerParent::ColorPickerShownCallback::Done(const nsAString& aColor)
|
||||
{
|
||||
if (mColorPickerParent) {
|
||||
Unused << mColorPickerParent->Send__delete__(mColorPickerParent,
|
||||
Unused << ColorPickerParent::Send__delete__(mColorPickerParent,
|
||||
nsString(aColor));
|
||||
}
|
||||
return NS_OK;
|
||||
|
|
|
@ -1724,7 +1724,7 @@ TabChild::HandleRealMouseButtonEvent(const WidgetMouseEvent& aEvent,
|
|||
|
||||
InputAPZContext context(aGuid, aInputBlockId, nsEventStatus_eIgnore);
|
||||
if (pendingLayerization) {
|
||||
context.SetPendingLayerization();
|
||||
InputAPZContext::SetPendingLayerization();
|
||||
}
|
||||
|
||||
WidgetMouseEvent localEvent(aEvent);
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsILineInputStream.h"
|
||||
#include "nsIWeakReferenceUtils.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "mozilla/EventStateManager.h"
|
||||
#include "mozilla/MozPromise.h"
|
||||
|
@ -152,8 +153,6 @@ using media::Refcountable;
|
|||
|
||||
static Atomic<bool> sHasShutdown;
|
||||
|
||||
typedef media::Pledge<bool, dom::MediaStreamError*> PledgeVoid;
|
||||
|
||||
struct DeviceState {
|
||||
DeviceState(const RefPtr<MediaDevice>& aDevice, bool aOffWhileDisabled)
|
||||
: mOffWhileDisabled(aOffWhileDisabled)
|
||||
|
@ -243,6 +242,7 @@ FromCaptureState(CaptureState aState)
|
|||
*/
|
||||
class SourceListener : public SupportsWeakPtr<SourceListener> {
|
||||
public:
|
||||
typedef MozPromise<bool /* aIgnored */, Maybe<nsString>, true> ApplyConstraintsPromise;
|
||||
typedef MozPromise<bool /* aIgnored */, RefPtr<MediaMgrError>, true> InitPromise;
|
||||
|
||||
MOZ_DECLARE_WEAKREFERENCE_TYPENAME(SourceListener)
|
||||
|
@ -373,7 +373,7 @@ public:
|
|||
|
||||
CaptureState CapturingSource(MediaSourceEnum aSource) const;
|
||||
|
||||
already_AddRefed<PledgeVoid>
|
||||
RefPtr<ApplyConstraintsPromise>
|
||||
ApplyConstraintsToTrack(nsPIDOMWindowInner* aWindow,
|
||||
TrackID aTrackID,
|
||||
const dom::MediaTrackConstraints& aConstraints,
|
||||
|
@ -1247,21 +1247,62 @@ public:
|
|||
return mPeerIdentity;
|
||||
}
|
||||
|
||||
|
||||
already_AddRefed<PledgeVoid>
|
||||
ApplyConstraints(nsPIDOMWindowInner* aWindow,
|
||||
const MediaTrackConstraints& aConstraints,
|
||||
dom::CallerType aCallerType) override
|
||||
{
|
||||
RefPtr<PledgeVoid> p = new PledgeVoid();
|
||||
if (sHasShutdown || !mListener) {
|
||||
// Track has been stopped, or we are in shutdown. In either case
|
||||
// there's no observable outcome, so pretend we succeeded.
|
||||
RefPtr<PledgeVoid> p = new PledgeVoid();
|
||||
p->Resolve(false);
|
||||
return p.forget();
|
||||
}
|
||||
return mListener->ApplyConstraintsToTrack(aWindow, mTrackID,
|
||||
aConstraints, aCallerType);
|
||||
|
||||
mListener->ApplyConstraintsToTrack(aWindow, mTrackID,
|
||||
aConstraints, aCallerType)
|
||||
->Then(GetMainThreadSerialEventTarget(), __func__,
|
||||
[p]()
|
||||
{
|
||||
if (!MediaManager::Exists()) {
|
||||
return;
|
||||
}
|
||||
|
||||
p->Resolve(false);
|
||||
},
|
||||
[p, weakWindow = nsWeakPtr(do_GetWeakReference(aWindow)),
|
||||
listener = mListener, trackID = mTrackID]
|
||||
(Maybe<nsString>&& aBadConstraint)
|
||||
{
|
||||
if (!MediaManager::Exists()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!weakWindow->IsAlive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (aBadConstraint.isNothing()) {
|
||||
// Unexpected error during reconfig that left the source
|
||||
// stopped. We resolve the promise and end the track.
|
||||
if (listener) {
|
||||
listener->StopTrack(trackID);
|
||||
}
|
||||
p->Resolve(false);
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryReferent(weakWindow);
|
||||
auto error = MakeRefPtr<MediaStreamError>(
|
||||
window,
|
||||
NS_LITERAL_STRING("OverConstrainedError"),
|
||||
NS_LITERAL_STRING(""),
|
||||
aBadConstraint.valueOr(nsString()));
|
||||
p->Reject(error);
|
||||
});
|
||||
|
||||
return p.forget();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -4302,7 +4343,7 @@ SourceListener::CapturingSource(MediaSourceEnum aSource) const
|
|||
return CaptureState::Disabled;
|
||||
}
|
||||
|
||||
already_AddRefed<PledgeVoid>
|
||||
RefPtr<SourceListener::ApplyConstraintsPromise>
|
||||
SourceListener::ApplyConstraintsToTrack(
|
||||
nsPIDOMWindowInner* aWindow,
|
||||
TrackID aTrackID,
|
||||
|
@ -4310,20 +4351,15 @@ SourceListener::ApplyConstraintsToTrack(
|
|||
dom::CallerType aCallerType)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
RefPtr<PledgeVoid> p = new PledgeVoid();
|
||||
|
||||
MOZ_ASSERT(aTrackID == kAudioTrack || aTrackID == kVideoTrack,
|
||||
"Unknown track id");
|
||||
|
||||
DeviceState& state = GetDeviceStateFor(aTrackID);
|
||||
if (mStopped || state.mStopped) {
|
||||
LOG(("gUM track %d applyConstraints, but we don't have type %s",
|
||||
aTrackID, aTrackID == kAudioTrack ? "audio" : "video"));
|
||||
p->Resolve(false);
|
||||
return p.forget();
|
||||
}
|
||||
MediaTrackConstraints c(aConstraintsPassedIn); // use a modifiable copy
|
||||
|
||||
if (mStopped || state.mStopped) {
|
||||
LOG(("gUM %s track %d applyConstraints, but source is stopped",
|
||||
aTrackID == kAudioTrack ? "audio" : "video", aTrackID));
|
||||
return ApplyConstraintsPromise::CreateAndResolve(false, __func__);
|
||||
}
|
||||
|
||||
MediaTrackConstraints c(aConstraintsPassedIn); // use a modifiable copy
|
||||
MediaConstraintsHelper::ConvertOldWithWarning(c.mMozAutoGainControl,
|
||||
c.mAutoGainControl,
|
||||
"MozAutoGainControlWarning",
|
||||
|
@ -4335,63 +4371,40 @@ SourceListener::ApplyConstraintsToTrack(
|
|||
|
||||
MediaManager* mgr = MediaManager::GetIfExists();
|
||||
if (!mgr) {
|
||||
return p.forget();
|
||||
return ApplyConstraintsPromise::CreateAndResolve(false, __func__);
|
||||
}
|
||||
uint32_t id = mgr->mOutstandingVoidPledges.Append(*p);
|
||||
uint64_t windowId = aWindow->WindowID();
|
||||
bool isChrome = (aCallerType == dom::CallerType::System);
|
||||
|
||||
MediaManager::PostTask(NewTaskFrom([id, windowId,
|
||||
device = state.mDevice,
|
||||
c, isChrome]() mutable {
|
||||
return MediaManager::PostTask<ApplyConstraintsPromise>(__func__,
|
||||
[device = state.mDevice, c,
|
||||
isChrome = aCallerType == dom::CallerType::System]
|
||||
(MozPromiseHolder<ApplyConstraintsPromise>& aHolder) mutable {
|
||||
MOZ_ASSERT(MediaManager::IsInMediaThread());
|
||||
MediaManager* mgr = MediaManager::GetIfExists();
|
||||
MOZ_RELEASE_ASSERT(mgr); // Must exist while media thread is alive
|
||||
const char* badConstraint = nullptr;
|
||||
|
||||
nsresult rv = device->Reconfigure(c, mgr->mPrefs, &badConstraint);
|
||||
if (rv == NS_ERROR_NOT_AVAILABLE && !badConstraint) {
|
||||
nsTArray<RefPtr<MediaDevice>> devices;
|
||||
devices.AppendElement(device);
|
||||
badConstraint = MediaConstraintsHelper::SelectSettings(
|
||||
NormalizedConstraints(c), devices, isChrome);
|
||||
if (rv == NS_ERROR_INVALID_ARG) {
|
||||
// Reconfigure failed due to constraints
|
||||
if (!badConstraint) {
|
||||
nsTArray<RefPtr<MediaDevice>> devices;
|
||||
devices.AppendElement(device);
|
||||
badConstraint = MediaConstraintsHelper::SelectSettings(
|
||||
NormalizedConstraints(c), devices, isChrome);
|
||||
}
|
||||
|
||||
aHolder.Reject(Some(NS_ConvertASCIItoUTF16(badConstraint)), __func__);
|
||||
return;
|
||||
}
|
||||
NS_DispatchToMainThread(NewRunnableFrom([id, windowId, rv,
|
||||
badConstraint]() mutable {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MediaManager* mgr = MediaManager::GetIfExists();
|
||||
if (!mgr) {
|
||||
return NS_OK;
|
||||
}
|
||||
RefPtr<PledgeVoid> p = mgr->mOutstandingVoidPledges.Remove(id);
|
||||
if (p) {
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
p->Resolve(false);
|
||||
} else {
|
||||
auto* window = nsGlobalWindowInner::GetInnerWindowWithId(windowId);
|
||||
if (window) {
|
||||
if (badConstraint) {
|
||||
nsString constraint;
|
||||
constraint.AssignASCII(badConstraint);
|
||||
RefPtr<MediaStreamError> error =
|
||||
new MediaStreamError(window->AsInner(),
|
||||
NS_LITERAL_STRING("OverconstrainedError"),
|
||||
NS_LITERAL_STRING(""),
|
||||
constraint);
|
||||
p->Reject(error);
|
||||
} else {
|
||||
RefPtr<MediaStreamError> error =
|
||||
new MediaStreamError(window->AsInner(),
|
||||
NS_LITERAL_STRING("InternalError"));
|
||||
p->Reject(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}));
|
||||
}));
|
||||
return p.forget();
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
// Reconfigure failed unexpectedly
|
||||
aHolder.Reject(Nothing(), __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
// Reconfigure was successful
|
||||
aHolder.Resolve(false, __func__);
|
||||
});
|
||||
}
|
||||
|
||||
PrincipalHandle
|
||||
|
|
|
@ -288,7 +288,6 @@ private:
|
|||
|
||||
media::CoatCheck<PledgeSourceSet> mOutstandingPledges;
|
||||
media::CoatCheck<PledgeChar> mOutstandingCharPledges;
|
||||
media::CoatCheck<PledgeVoid> mOutstandingVoidPledges;
|
||||
nsTArray<nsString> mDeviceIDs;
|
||||
public:
|
||||
media::CoatCheck<media::Pledge<nsCString>> mGetPrincipalKeyPledges;
|
||||
|
|
|
@ -74,22 +74,22 @@ public:
|
|||
~CamerasSingleton();
|
||||
|
||||
static OffTheBooksMutex& Mutex() {
|
||||
return gTheInstance.get()->mCamerasMutex;
|
||||
return Singleton<mozilla::camera::CamerasSingleton>::get()->mCamerasMutex;
|
||||
}
|
||||
|
||||
static CamerasChild*& Child() {
|
||||
Mutex().AssertCurrentThreadOwns();
|
||||
return gTheInstance.get()->mCameras;
|
||||
return Singleton<mozilla::camera::CamerasSingleton>::get()->mCameras;
|
||||
}
|
||||
|
||||
static nsCOMPtr<nsIThread>& Thread() {
|
||||
Mutex().AssertCurrentThreadOwns();
|
||||
return gTheInstance.get()->mCamerasChildThread;
|
||||
return Singleton<mozilla::camera::CamerasSingleton>::get()->mCamerasChildThread;
|
||||
}
|
||||
|
||||
static nsCOMPtr<nsIThread>& FakeDeviceChangeEventThread() {
|
||||
Mutex().AssertCurrentThreadOwns();
|
||||
return gTheInstance.get()->mFakeDeviceChangeEventThread;
|
||||
return Singleton<mozilla::camera::CamerasSingleton>::get()->mFakeDeviceChangeEventThread;
|
||||
}
|
||||
|
||||
static bool InShutdown() {
|
||||
|
|
|
@ -72,7 +72,7 @@ class OriginKeyStore : public nsISupports
|
|||
OriginKey* key;
|
||||
if (!mKeys.Get(principalString, &key)) {
|
||||
nsCString salt; // Make a new one
|
||||
nsresult rv = GenerateRandomName(salt, key->EncodedLength);
|
||||
nsresult rv = GenerateRandomName(salt, OriginKey::EncodedLength);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -102,10 +102,7 @@ int HRTFPanner::calculateDesiredAzimuthIndexAndBlend(double azimuth, double& azi
|
|||
if (azimuth < 0)
|
||||
azimuth += 360.0;
|
||||
|
||||
HRTFDatabase* database = m_databaseLoader->database();
|
||||
MOZ_ASSERT(database);
|
||||
|
||||
int numberOfAzimuths = database->numberOfAzimuths();
|
||||
int numberOfAzimuths = HRTFDatabase::numberOfAzimuths();
|
||||
const double angleBetweenAzimuths = 360.0 / numberOfAzimuths;
|
||||
|
||||
// Calculate the azimuth index and the blend (0 -> 1) for interpolation.
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "CamerasChild.h"
|
||||
#include "MediaManager.h"
|
||||
#include "MediaTrackConstraints.h"
|
||||
#include "mozilla/ErrorNames.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "VideoFrameUtils.h"
|
||||
|
@ -333,6 +334,7 @@ MediaEngineRemoteVideoSource::Stop(const RefPtr<const AllocationHandle>& aHandle
|
|||
if (camera::GetChildAndCall(&camera::CamerasChild::StopCapture,
|
||||
mCapEngine, mCaptureIndex)) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(false, "Stopping a started capture failed");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -366,7 +368,7 @@ MediaEngineRemoteVideoSource::Reconfigure(const RefPtr<AllocationHandle>& aHandl
|
|||
if (!ChooseCapability(constraints, aPrefs, aDeviceId, newCapability, kFitness)) {
|
||||
*aOutBadConstraint =
|
||||
MediaConstraintsHelper::FindBadConstraint(constraints, this, aDeviceId);
|
||||
return NS_ERROR_FAILURE;
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
LOG(("ChooseCapability(kFitness) for mTargetCapability (Reconfigure) --"));
|
||||
|
||||
|
@ -374,23 +376,34 @@ MediaEngineRemoteVideoSource::Reconfigure(const RefPtr<AllocationHandle>& aHandl
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
bool started = mState == kStarted;
|
||||
if (started) {
|
||||
// Allocate always returns a null AllocationHandle.
|
||||
// We can safely pass nullptr below.
|
||||
nsresult rv = Stop(nullptr);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
nsAutoCString name;
|
||||
GetErrorName(rv, name);
|
||||
LOG(("Video source %p for video device %d Reconfigure() failed "
|
||||
"unexpectedly in Stop(). rv=%s", this, mCaptureIndex, name.Data()));
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
// Start() applies mCapability on the device.
|
||||
mCapability = newCapability;
|
||||
}
|
||||
|
||||
if (mState == kStarted) {
|
||||
// Allocate always returns a null AllocationHandle.
|
||||
// We can safely pass nullptr below.
|
||||
nsresult rv = Stop(nullptr);
|
||||
if (started) {
|
||||
nsresult rv = Start(nullptr);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = Start(nullptr);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
nsAutoCString name;
|
||||
GetErrorName(rv, name);
|
||||
LOG(("Video source %p for video device %d Reconfigure() failed "
|
||||
"unexpectedly in Start(). rv=%s", this, mCaptureIndex, name.Data()));
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -158,6 +158,14 @@ public:
|
|||
* Should the constraints lead to choosing a new capability while the device
|
||||
* is actively being captured, the device will restart using the new
|
||||
* capability.
|
||||
*
|
||||
* We return one of the following:
|
||||
* NS_OK - Successful reconfigure.
|
||||
* NS_ERROR_INVALID_ARG - Couldn't find a capability fitting aConstraints.
|
||||
* See aBadConstraint for details.
|
||||
* NS_ERROR_UNEXPECTED - Reconfiguring the underlying device failed
|
||||
* unexpectedly. This leaves the device in a stopped
|
||||
* state.
|
||||
*/
|
||||
virtual nsresult Reconfigure(const RefPtr<AllocationHandle>& aHandle,
|
||||
const dom::MediaTrackConstraints& aConstraints,
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "MediaStreamGraphImpl.h"
|
||||
#include "MediaTrackConstraints.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/ErrorNames.h"
|
||||
#include "mtransport/runnable_utils.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
|
@ -232,8 +233,22 @@ MediaEngineWebRTCMicrophoneSource::Reconfigure(const RefPtr<AllocationHandle>& a
|
|||
LOG(("Mic source %p allocation %p Reconfigure()", this, aHandle.get()));
|
||||
|
||||
NormalizedConstraints constraints(aConstraints);
|
||||
return ReevaluateAllocation(aHandle, &constraints, aPrefs, aDeviceId,
|
||||
aOutBadConstraint);
|
||||
nsresult rv = ReevaluateAllocation(aHandle, &constraints, aPrefs, aDeviceId,
|
||||
aOutBadConstraint);
|
||||
if (NS_FAILED(rv)) {
|
||||
if (aOutBadConstraint) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
nsAutoCString name;
|
||||
GetErrorName(rv, name);
|
||||
LOG(("Mic source %p Reconfigure() failed unexpectedly. rv=%s",
|
||||
this, name.Data()));
|
||||
Stop(aHandle);
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool operator == (const MediaEnginePrefs& a, const MediaEnginePrefs& b)
|
||||
|
@ -520,7 +535,7 @@ MediaEngineWebRTCMicrophoneSource::ApplySettings(const MediaEnginePrefs& aPrefs)
|
|||
RefPtr<MediaEngineWebRTCMicrophoneSource> that = this;
|
||||
RefPtr<MediaStreamGraphImpl> graph;
|
||||
for (const Allocation& allocation : mAllocations) {
|
||||
if (allocation.mStream) {
|
||||
if (allocation.mStream && allocation.mStream->GraphImpl()) {
|
||||
graph = allocation.mStream->GraphImpl();
|
||||
break;
|
||||
}
|
||||
|
@ -1027,6 +1042,14 @@ MediaEngineWebRTCMicrophoneSource::PacketizeAndProcess(MediaStreamGraph* aGraph,
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!allocation.mStream->GraphImpl()) {
|
||||
// The DOMMediaStream that owns allocation.mStream has been cleaned up
|
||||
// and MediaStream::DestroyImpl() has run in the MSG. This is fine and
|
||||
// can happen before the MediaManager thread gets to stop capture for
|
||||
// this allocation.
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!allocation.mEnabled) {
|
||||
continue;
|
||||
}
|
||||
|
@ -1094,6 +1117,14 @@ MediaEngineWebRTCMicrophoneSource::InsertInGraph(const T* aBuffer,
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!allocation.mStream->GraphImpl()) {
|
||||
// The DOMMediaStream that owns allocation.mStream has been cleaned up
|
||||
// and MediaStream::DestroyImpl() has run in the MSG. This is fine and
|
||||
// can happen before the MediaManager thread gets to stop capture for
|
||||
// this allocation.
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!allocation.mEnabled) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ SpeechSynthesisRequestChild::RecvOnEnd(const bool& aIsError,
|
|||
mTask->DispatchEndImpl(aElapsedTime, aCharIndex);
|
||||
}
|
||||
|
||||
actor->Send__delete__(actor);
|
||||
SpeechSynthesisRequestChild::Send__delete__(actor);
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
|
|
@ -22,6 +22,10 @@
|
|||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/dom/FakePluginTagInitBinding.h"
|
||||
|
||||
#if defined(XP_MACOSX) && defined(MOZ_SANDBOX)
|
||||
#include "mozilla/SandboxSettings.h"
|
||||
#endif
|
||||
|
||||
using mozilla::dom::FakePluginTagInit;
|
||||
using namespace mozilla;
|
||||
|
||||
|
@ -421,22 +425,19 @@ nsPluginTag::InitSandboxLevel()
|
|||
if (mIsFlashPlugin && mSandboxLevel < 2) {
|
||||
mSandboxLevel = 2;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif /* defined(_AMD64_) */
|
||||
|
||||
#if defined(XP_MACOSX) && defined(MOZ_SANDBOX)
|
||||
// At present, the Mac Flash NPAPI plugin sandbox is controlled via
|
||||
// a boolean with no support for different levels. When the sandbox
|
||||
// is enabled, we set the level to 1.
|
||||
#elif defined(XP_MACOSX) && defined(MOZ_SANDBOX)
|
||||
if (mIsFlashPlugin) {
|
||||
// Allow enabling the sandbox via the pref
|
||||
// security.sandbox.mac.flash.enabled or via the environment variable
|
||||
// MOZ_SANDBOX_MAC_FLASH_FORCE (which is useful while the sandbox is
|
||||
// off by default).
|
||||
if (Preferences::GetBool("security.sandbox.mac.flash.enabled") ||
|
||||
PR_GetEnv("MOZ_SANDBOX_MAC_FLASH_FORCE")) {
|
||||
mSandboxLevel = 1;
|
||||
if (PR_GetEnv("MOZ_DISABLE_NPAPI_SANDBOX") ||
|
||||
NS_FAILED(Preferences::GetInt("dom.ipc.plugins.sandbox-level.flash",
|
||||
&mSandboxLevel))) {
|
||||
mSandboxLevel = 0;
|
||||
} else {
|
||||
mSandboxLevel = ClampFlashSandboxLevel(mSandboxLevel);
|
||||
}
|
||||
|
||||
if (mSandboxLevel > 0) {
|
||||
// Enable sandbox logging in the plugin process if it has
|
||||
// been turned on via prefs or environment variables.
|
||||
if (Preferences::GetBool("security.sandbox.logging.enabled") ||
|
||||
|
@ -445,8 +446,14 @@ nsPluginTag::InitSandboxLevel()
|
|||
mIsSandboxLoggingEnabled = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// This isn't the flash plugin. At present, Flash is the only
|
||||
// supported plugin on macOS. Other test plugins are used during
|
||||
// testing and they will use the default plugin sandbox level.
|
||||
mSandboxLevel =
|
||||
Preferences::GetInt("dom.ipc.plugins.sandbox-level.default");
|
||||
}
|
||||
#endif
|
||||
#endif /* defined(XP_MACOSX) && defined(MOZ_SANDBOX) */
|
||||
}
|
||||
|
||||
#if !defined(XP_WIN) && !defined(XP_MACOSX)
|
||||
|
|
|
@ -104,7 +104,7 @@ PluginModuleChild::PluginModuleChild(bool aIsChrome)
|
|||
, mAsyncRenderSupport(false)
|
||||
#endif
|
||||
#if defined(XP_MACOSX) && defined(MOZ_SANDBOX)
|
||||
, mEnableFlashSandbox(false)
|
||||
, mFlashSandboxLevel(0)
|
||||
, mEnableFlashSandboxLogging(false)
|
||||
#endif
|
||||
{
|
||||
|
@ -201,9 +201,9 @@ PluginModuleChild::RecvDisableFlashProtectedMode()
|
|||
|
||||
#if defined(XP_MACOSX) && defined(MOZ_SANDBOX)
|
||||
void
|
||||
PluginModuleChild::EnableFlashSandbox(bool aShouldEnableLogging)
|
||||
PluginModuleChild::EnableFlashSandbox(int aLevel, bool aShouldEnableLogging)
|
||||
{
|
||||
mEnableFlashSandbox = true;
|
||||
mFlashSandboxLevel = aLevel;
|
||||
mEnableFlashSandboxLogging = aShouldEnableLogging;
|
||||
}
|
||||
#endif
|
||||
|
@ -302,11 +302,12 @@ PluginModuleChild::InitForChrome(const std::string& aPluginFilename,
|
|||
#endif
|
||||
|
||||
#if defined(XP_MACOSX) && defined(MOZ_SANDBOX)
|
||||
if (mEnableFlashSandbox) {
|
||||
if (mFlashSandboxLevel > 0) {
|
||||
MacSandboxInfo flashSandboxInfo;
|
||||
flashSandboxInfo.type = MacSandboxType_Plugin;
|
||||
flashSandboxInfo.pluginInfo.type = MacSandboxPluginType_Flash;
|
||||
flashSandboxInfo.pluginInfo.pluginBinaryPath = aPluginFilename;
|
||||
flashSandboxInfo.level = mFlashSandboxLevel;
|
||||
flashSandboxInfo.shouldLog = mEnableFlashSandboxLogging;
|
||||
|
||||
std::string sbError;
|
||||
|
|
|
@ -314,13 +314,13 @@ public: // called by PluginInstanceChild
|
|||
}
|
||||
|
||||
#if defined(OS_MACOSX) && defined(MOZ_SANDBOX)
|
||||
void EnableFlashSandbox(bool aShouldEnableLogging);
|
||||
void EnableFlashSandbox(int aLevel, bool aShouldEnableLogging);
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
#if defined(OS_MACOSX) && defined(MOZ_SANDBOX)
|
||||
bool mEnableFlashSandbox;
|
||||
int mFlashSandboxLevel;
|
||||
bool mEnableFlashSandboxLogging;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -15,6 +15,10 @@
|
|||
#include "nsThreadManager.h"
|
||||
#include "ClearOnShutdown.h"
|
||||
|
||||
#if defined(XP_MACOSX) && defined(MOZ_SANDBOX)
|
||||
#include "mozilla/SandboxSettings.h"
|
||||
#endif
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
#include "nsCocoaFeatures.h"
|
||||
// An undocumented CoreGraphics framework method, present in the same form
|
||||
|
@ -94,12 +98,19 @@ PluginProcessChild::Init(int aArgc, char* aArgv[])
|
|||
pluginFilename = UnmungePluginDsoPath(values[1]);
|
||||
|
||||
#if defined(XP_MACOSX) && defined(MOZ_SANDBOX)
|
||||
if (values.size() >= 3 && values[2] == "-flashSandbox") {
|
||||
int level;
|
||||
if (values.size() >= 4 && values[2] == "-flashSandboxLevel" &&
|
||||
(level = std::stoi(values[3], nullptr)) > 0) {
|
||||
|
||||
level = ClampFlashSandboxLevel(level);
|
||||
MOZ_ASSERT(level > 0);
|
||||
|
||||
bool enableLogging = false;
|
||||
if (values.size() >= 4 && values[3] == "-flashSandboxLogging") {
|
||||
if (values.size() >= 5 && values[4] == "-flashSandboxLogging") {
|
||||
enableLogging = true;
|
||||
}
|
||||
mPlugin.EnableFlashSandbox(enableLogging);
|
||||
|
||||
mPlugin.EnableFlashSandbox(level, enableLogging);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -76,7 +76,8 @@ PluginProcessParent::Launch(mozilla::UniquePtr<LaunchCompleteTask> aLaunchComple
|
|||
|
||||
#if defined(XP_MACOSX) && defined(MOZ_SANDBOX)
|
||||
if (aSandboxLevel > 0) {
|
||||
args.push_back("-flashSandbox");
|
||||
args.push_back("-flashSandboxLevel");
|
||||
args.push_back(std::to_string(aSandboxLevel));
|
||||
if (aIsSandboxLoggingEnabled) {
|
||||
args.push_back("-flashSandboxLogging");
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ PresentationConnectionList::FindConnectionById(
|
|||
}
|
||||
}
|
||||
|
||||
return mConnections.NoIndex;
|
||||
return ConnectionArray::NoIndex;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -106,7 +106,7 @@ PresentationConnectionList::NotifyStateChange(const nsAString& aSessionId,
|
|||
}
|
||||
|
||||
bool connectionFound =
|
||||
FindConnectionById(aSessionId) != mConnections.NoIndex ? true : false;
|
||||
FindConnectionById(aSessionId) != ConnectionArray::NoIndex ? true : false;
|
||||
|
||||
PresentationConnectionListBinding::ClearCachedConnectionsValue(this);
|
||||
switch (aConnection->State()) {
|
||||
|
|
|
@ -28,7 +28,7 @@ WebBrowserPersistRemoteDocument
|
|||
WebBrowserPersistRemoteDocument::~WebBrowserPersistRemoteDocument()
|
||||
{
|
||||
if (mActor) {
|
||||
Unused << mActor->Send__delete__(mActor);
|
||||
Unused << WebBrowserPersistDocumentParent::Send__delete__(mActor);
|
||||
// That will call mActor->ActorDestroy, which calls this->ActorDestroy
|
||||
// (whether or not the IPC send succeeds).
|
||||
}
|
||||
|
|
|
@ -335,7 +335,7 @@ nsBindingManager::RemoveFromAttachedQueue(nsXBLBinding* aBinding)
|
|||
// Don't remove items here as that could mess up an executing
|
||||
// ProcessAttachedQueue. Instead, null the entry in the queue.
|
||||
size_t index = mAttachedStack.IndexOf(aBinding);
|
||||
if (index != mAttachedStack.NoIndex) {
|
||||
if (index != nsBindingList::NoIndex) {
|
||||
mAttachedStack[index] = nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3346,7 +3346,7 @@ XULDocument::OverlayForwardReference::Resolve()
|
|||
return eResolve_Error;
|
||||
}
|
||||
|
||||
rv = mDocument->InsertElement(root, mOverlay, notify);
|
||||
rv = XULDocument::InsertElement(root, mOverlay, notify);
|
||||
if (NS_FAILED(rv)) return eResolve_Error;
|
||||
|
||||
target = mOverlay;
|
||||
|
|
|
@ -4038,32 +4038,6 @@ EditorBase::GetNodeAtRangeOffsetPoint(const RawRangeBoundary& aPoint)
|
|||
return aPoint.GetChildAtOffset();
|
||||
}
|
||||
|
||||
/**
|
||||
* GetStartNodeAndOffset() returns whatever the start parent & offset is of
|
||||
* the first range in the selection.
|
||||
*/
|
||||
nsresult
|
||||
EditorBase::GetStartNodeAndOffset(Selection* aSelection,
|
||||
nsINode** aStartContainer,
|
||||
int32_t* aStartOffset)
|
||||
{
|
||||
MOZ_ASSERT(aSelection);
|
||||
MOZ_ASSERT(aStartContainer);
|
||||
MOZ_ASSERT(aStartOffset);
|
||||
|
||||
*aStartContainer = nullptr;
|
||||
*aStartOffset = 0;
|
||||
|
||||
EditorRawDOMPoint point = EditorBase::GetStartPoint(aSelection);
|
||||
if (!point.IsSet()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_ADDREF(*aStartContainer = point.GetContainer());
|
||||
*aStartOffset = point.Offset();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// static
|
||||
EditorRawDOMPoint
|
||||
EditorBase::GetStartPoint(Selection* aSelection)
|
||||
|
@ -4083,32 +4057,6 @@ EditorBase::GetStartPoint(Selection* aSelection)
|
|||
return EditorRawDOMPoint(range->StartRef());
|
||||
}
|
||||
|
||||
/**
|
||||
* GetEndNodeAndOffset() returns whatever the end parent & offset is of
|
||||
* the first range in the selection.
|
||||
*/
|
||||
nsresult
|
||||
EditorBase::GetEndNodeAndOffset(Selection* aSelection,
|
||||
nsINode** aEndContainer,
|
||||
int32_t* aEndOffset)
|
||||
{
|
||||
MOZ_ASSERT(aSelection);
|
||||
MOZ_ASSERT(aEndContainer);
|
||||
MOZ_ASSERT(aEndOffset);
|
||||
|
||||
*aEndContainer = nullptr;
|
||||
*aEndOffset = 0;
|
||||
|
||||
EditorRawDOMPoint point = EditorBase::GetEndPoint(aSelection);
|
||||
if (!point.IsSet()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_ADDREF(*aEndContainer = point.GetContainer());
|
||||
*aEndOffset = point.Offset();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// static
|
||||
EditorRawDOMPoint
|
||||
EditorBase::GetEndPoint(Selection* aSelection)
|
||||
|
|
|
@ -1121,13 +1121,7 @@ public:
|
|||
}
|
||||
static nsIContent* GetNodeAtRangeOffsetPoint(const RawRangeBoundary& aPoint);
|
||||
|
||||
static nsresult GetStartNodeAndOffset(Selection* aSelection,
|
||||
nsINode** aStartContainer,
|
||||
int32_t* aStartOffset);
|
||||
static EditorRawDOMPoint GetStartPoint(Selection* aSelection);
|
||||
static nsresult GetEndNodeAndOffset(Selection* aSelection,
|
||||
nsINode** aEndContainer,
|
||||
int32_t* aEndOffset);
|
||||
static EditorRawDOMPoint GetEndPoint(Selection* aSelection);
|
||||
|
||||
static nsresult GetEndChildNode(Selection* aSelection,
|
||||
|
|
|
@ -593,6 +593,9 @@ public:
|
|||
if (NS_WARN_IF(!mParent)) {
|
||||
return false;
|
||||
}
|
||||
if (!mParent->IsContainerNode()) {
|
||||
return mOffset.value() == mParent->Length();
|
||||
}
|
||||
if (mIsChildInitialized) {
|
||||
if (!mChild) {
|
||||
NS_WARNING_ASSERTION(!mOffset.isSome() ||
|
||||
|
|
|
@ -215,7 +215,7 @@ HTMLEditor::CreateAnonymousElement(nsAtom* aTag,
|
|||
if (ServoStyleSet* styleSet = ps->StyleSet()->GetAsServo()) {
|
||||
// Sometimes editor likes to append anonymous content to elements
|
||||
// in display:none subtrees, so avoid styling in those cases.
|
||||
if (styleSet->MayTraverseFrom(newContent)) {
|
||||
if (ServoStyleSet::MayTraverseFrom(newContent)) {
|
||||
styleSet->StyleNewSubtree(newContent);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1025,42 +1025,48 @@ HTMLEditRules::GetIndentState(bool* aCanIndent,
|
|||
}
|
||||
}
|
||||
|
||||
if (!*aCanOutdent) {
|
||||
// if we haven't found something to outdent yet, also check the parents
|
||||
// of selection endpoints. We might have a blockquote or list item
|
||||
// in the parent hierarchy.
|
||||
if (*aCanOutdent) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// gather up info we need for test
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
nsCOMPtr<nsINode> parent, root = mHTMLEditor->GetRoot();
|
||||
NS_ENSURE_TRUE(root, NS_ERROR_NULL_POINTER);
|
||||
int32_t selOffset;
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
RefPtr<Selection> selection = mHTMLEditor->GetSelection();
|
||||
NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
|
||||
// if we haven't found something to outdent yet, also check the parents
|
||||
// of selection endpoints. We might have a blockquote or list item
|
||||
// in the parent hierarchy.
|
||||
|
||||
// test start parent hierarchy
|
||||
rv = EditorBase::GetStartNodeAndOffset(selection, getter_AddRefs(parent),
|
||||
&selOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
while (parent && parent != root) {
|
||||
if (HTMLEditUtils::IsNodeThatCanOutdent(parent)) {
|
||||
*aCanOutdent = true;
|
||||
break;
|
||||
}
|
||||
parent = parent->GetParentNode();
|
||||
if (NS_WARN_IF(!mHTMLEditor)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
Element* rootElement = mHTMLEditor->GetRoot();
|
||||
if (NS_WARN_IF(!rootElement)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Test selection start container hierarchy.
|
||||
EditorRawDOMPoint selectionStartPoint(EditorBase::GetStartPoint(selection));
|
||||
if (NS_WARN_IF(!selectionStartPoint.IsSet())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
for (nsINode* node = selectionStartPoint.GetContainer();
|
||||
node && node != rootElement;
|
||||
node = node->GetParentNode()) {
|
||||
if (HTMLEditUtils::IsNodeThatCanOutdent(node)) {
|
||||
*aCanOutdent = true;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
// test end parent hierarchy
|
||||
rv = EditorBase::GetEndNodeAndOffset(selection, getter_AddRefs(parent),
|
||||
&selOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
while (parent && parent != root) {
|
||||
if (HTMLEditUtils::IsNodeThatCanOutdent(parent)) {
|
||||
*aCanOutdent = true;
|
||||
break;
|
||||
}
|
||||
parent = parent->GetParentNode();
|
||||
// Test selection end container hierarchy.
|
||||
EditorRawDOMPoint selectionEndPoint(EditorBase::GetEndPoint(selection));
|
||||
if (NS_WARN_IF(!selectionEndPoint.IsSet())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
for (nsINode* node = selectionEndPoint.GetContainer();
|
||||
node && node != rootElement;
|
||||
node = node->GetParentNode()) {
|
||||
if (HTMLEditUtils::IsNodeThatCanOutdent(node)) {
|
||||
*aCanOutdent = true;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -1102,16 +1108,18 @@ HTMLEditRules::GetParagraphState(bool* aMixed,
|
|||
// we might have an empty node list. if so, find selection parent
|
||||
// and put that on the list
|
||||
if (arrayOfNodes.IsEmpty()) {
|
||||
nsCOMPtr<nsINode> selNode;
|
||||
int32_t selOffset;
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
RefPtr<Selection> selection = mHTMLEditor->GetSelection();
|
||||
NS_ENSURE_STATE(selection);
|
||||
rv = EditorBase::GetStartNodeAndOffset(selection, getter_AddRefs(selNode),
|
||||
&selOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(selNode, NS_ERROR_NULL_POINTER);
|
||||
arrayOfNodes.AppendElement(*selNode);
|
||||
if (NS_WARN_IF(!mHTMLEditor)) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
Selection* selection = mHTMLEditor->GetSelection();
|
||||
if (NS_WARN_IF(!selection)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
EditorRawDOMPoint selectionStartPoint(EditorBase::GetStartPoint(selection));
|
||||
if (NS_WARN_IF(!selectionStartPoint.IsSet())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
arrayOfNodes.AppendElement(*selectionStartPoint.GetContainer());
|
||||
}
|
||||
|
||||
// remember root node
|
||||
|
@ -1349,8 +1357,7 @@ HTMLEditRules::WillInsertText(EditAction aAction,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
WSRunObject wsObj(mHTMLEditor,
|
||||
pointToInsert.GetContainer(), pointToInsert.Offset());
|
||||
WSRunObject wsObj(mHTMLEditor, pointToInsert);
|
||||
rv = wsObj.InsertText(*doc, *inString, pointToInsert.AsRaw());
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
|
@ -1468,8 +1475,7 @@ HTMLEditRules::WillInsertText(EditAction aAction,
|
|||
|
||||
nsDependentSubstring subStr(tString, oldPos, subStrLen);
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
WSRunObject wsObj(mHTMLEditor, currentPoint.GetContainer(),
|
||||
currentPoint.Offset());
|
||||
WSRunObject wsObj(mHTMLEditor, currentPoint);
|
||||
|
||||
// is it a tab?
|
||||
if (subStr.Equals(tabStr)) {
|
||||
|
@ -1739,7 +1745,7 @@ HTMLEditRules::WillInsertBreak(Selection& aSelection,
|
|||
MOZ_ASSERT(atStartOfSelection.IsSetAndValid());
|
||||
|
||||
blockParent =
|
||||
mHTMLEditor->GetBlock(*atStartOfSelection.GetContainer(), host);
|
||||
HTMLEditor::GetBlock(*atStartOfSelection.GetContainer(), host);
|
||||
if (NS_WARN_IF(!blockParent)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
@ -1857,17 +1863,16 @@ HTMLEditRules::InsertBRElement(Selection& aSelection,
|
|||
}
|
||||
} else {
|
||||
EditorDOMPoint pointToBreak(aPointToBreak);
|
||||
WSRunObject wsObj(htmlEditor, pointToBreak.GetContainer(),
|
||||
pointToBreak.Offset());
|
||||
WSRunObject wsObj(htmlEditor, pointToBreak);
|
||||
int32_t visOffset = 0;
|
||||
WSType wsType;
|
||||
nsCOMPtr<nsINode> visNode;
|
||||
wsObj.PriorVisibleNode(pointToBreak.GetContainer(), pointToBreak.Offset(),
|
||||
wsObj.PriorVisibleNode(pointToBreak,
|
||||
address_of(visNode), &visOffset, &wsType);
|
||||
if (wsType & WSType::block) {
|
||||
brElementIsAfterBlock = true;
|
||||
}
|
||||
wsObj.NextVisibleNode(pointToBreak.GetContainer(), pointToBreak.Offset(),
|
||||
wsObj.NextVisibleNode(pointToBreak,
|
||||
address_of(visNode), &visOffset, &wsType);
|
||||
if (wsType & WSType::block) {
|
||||
brElementIsBeforeBlock = true;
|
||||
|
@ -1923,12 +1928,11 @@ HTMLEditRules::InsertBRElement(Selection& aSelection,
|
|||
DebugOnly<bool> advanced = afterBRElement.AdvanceOffset();
|
||||
NS_WARNING_ASSERTION(advanced,
|
||||
"Failed to advance offset after the new <br> element");
|
||||
WSRunObject wsObj(htmlEditor, afterBRElement.GetContainer(),
|
||||
afterBRElement.Offset());
|
||||
WSRunObject wsObj(htmlEditor, afterBRElement);
|
||||
nsCOMPtr<nsINode> maybeSecondBRNode;
|
||||
int32_t visOffset = 0;
|
||||
WSType wsType;
|
||||
wsObj.NextVisibleNode(afterBRElement.GetContainer(), afterBRElement.Offset(),
|
||||
wsObj.NextVisibleNode(afterBRElement,
|
||||
address_of(maybeSecondBRNode), &visOffset, &wsType);
|
||||
if (wsType == WSType::br) {
|
||||
// The next thing after the break we inserted is another break. Move the
|
||||
|
@ -1987,152 +1991,170 @@ HTMLEditRules::SplitMailCites(Selection* aSelection,
|
|||
}
|
||||
RefPtr<HTMLEditor> htmlEditor(mHTMLEditor);
|
||||
|
||||
nsCOMPtr<nsINode> selNode;
|
||||
nsCOMPtr<Element> citeNode;
|
||||
int32_t selOffset;
|
||||
nsresult rv =
|
||||
EditorBase::GetStartNodeAndOffset(aSelection, getter_AddRefs(selNode),
|
||||
&selOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
citeNode = GetTopEnclosingMailCite(*selNode);
|
||||
if (citeNode) {
|
||||
// If our selection is just before a break, nudge it to be
|
||||
// just after it. This does two things for us. It saves us the trouble of having to add
|
||||
// a break here ourselves to preserve the "blockness" of the inline span mailquote
|
||||
// (in the inline case), and :
|
||||
// it means the break won't end up making an empty line that happens to be inside a
|
||||
// mailquote (in either inline or block case).
|
||||
// The latter can confuse a user if they click there and start typing,
|
||||
// because being in the mailquote may affect wrapping behavior, or font color, etc.
|
||||
WSRunObject wsObj(htmlEditor, selNode, selOffset);
|
||||
EditorRawDOMPoint pointToSplit(EditorBase::GetStartPoint(aSelection));
|
||||
if (NS_WARN_IF(!pointToSplit.IsSet())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
RefPtr<Element> citeNode =
|
||||
GetTopEnclosingMailCite(*pointToSplit.GetContainer());
|
||||
if (!citeNode) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// If our selection is just before a break, nudge it to be just after it.
|
||||
// This does two things for us. It saves us the trouble of having to add
|
||||
// a break here ourselves to preserve the "blockness" of the inline span
|
||||
// mailquote (in the inline case), and :
|
||||
// it means the break won't end up making an empty line that happens to be
|
||||
// inside a mailquote (in either inline or block case).
|
||||
// The latter can confuse a user if they click there and start typing,
|
||||
// because being in the mailquote may affect wrapping behavior, or font
|
||||
// color, etc.
|
||||
WSRunObject wsObj(htmlEditor, pointToSplit);
|
||||
nsCOMPtr<nsINode> visNode;
|
||||
int32_t visOffset=0;
|
||||
WSType wsType;
|
||||
wsObj.NextVisibleNode(pointToSplit, address_of(visNode), &visOffset, &wsType);
|
||||
// If selection start point is before a break and it's inside the mailquote,
|
||||
// let's split it after the visible node.
|
||||
if (wsType == WSType::br &&
|
||||
visNode != citeNode && citeNode->Contains(visNode)) {
|
||||
pointToSplit.Set(visNode);
|
||||
DebugOnly<bool> advanced = pointToSplit.AdvanceOffset();
|
||||
NS_WARNING_ASSERTION(advanced,
|
||||
"Failed to advance offset to after the visible node");
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(!pointToSplit.GetContainerAsContent())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
SplitNodeResult splitCiteNodeResult =
|
||||
htmlEditor->SplitNodeDeep(*citeNode, pointToSplit,
|
||||
SplitAtEdges::eDoNotCreateEmptyContainer);
|
||||
if (NS_WARN_IF(splitCiteNodeResult.Failed())) {
|
||||
return splitCiteNodeResult.Rv();
|
||||
}
|
||||
pointToSplit.Clear();
|
||||
|
||||
// Add an invisible <br> to the end of current cite node (If new left cite
|
||||
// has not been created, we're at the end of it. Otherwise, we're still at
|
||||
// the right node) if it was a <span> of style="display: block". This is
|
||||
// important, since when serializing the cite to plain text, the span which
|
||||
// caused the visual break is discarded. So the added <br> will guarantee
|
||||
// that the serializer will insert a break where the user saw one.
|
||||
// FYI: splitCiteNodeResult grabs the previous node with nsCOMPtr. So, it's
|
||||
// safe to access previousNodeOfSplitPoint even after changing the DOM
|
||||
// tree and/or selection even though it's raw pointer.
|
||||
nsIContent* previousNodeOfSplitPoint =
|
||||
splitCiteNodeResult.GetPreviousNode();
|
||||
if (previousNodeOfSplitPoint &&
|
||||
previousNodeOfSplitPoint->IsHTMLElement(nsGkAtoms::span) &&
|
||||
previousNodeOfSplitPoint->GetPrimaryFrame()->
|
||||
IsFrameOfType(nsIFrame::eBlockFrame)) {
|
||||
nsCOMPtr<nsINode> lastChild =
|
||||
previousNodeOfSplitPoint->GetLastChild();
|
||||
if (lastChild && !lastChild->IsHTMLElement(nsGkAtoms::br)) {
|
||||
// We ignore the result here.
|
||||
EditorRawDOMPoint endOfPreviousNodeOfSplitPoint;
|
||||
endOfPreviousNodeOfSplitPoint.SetToEndOf(previousNodeOfSplitPoint);
|
||||
RefPtr<Element> invisBR =
|
||||
htmlEditor->CreateBR(endOfPreviousNodeOfSplitPoint);
|
||||
}
|
||||
}
|
||||
|
||||
// In most cases, <br> should be inserted after current cite. However, if
|
||||
// left cite hasn't been created because the split point was start of the
|
||||
// cite node, <br> should be inserted before the current cite.
|
||||
EditorRawDOMPoint pointToInsertBrNode(splitCiteNodeResult.SplitPoint());
|
||||
RefPtr<Element> brNode = htmlEditor->CreateBR(pointToInsertBrNode);
|
||||
if (NS_WARN_IF(!brNode)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
// Now, offset of pointToInsertBrNode is invalid. Let's clear it.
|
||||
pointToInsertBrNode.Clear();
|
||||
|
||||
// Want selection before the break, and on same line.
|
||||
EditorDOMPoint atBrNode(brNode);
|
||||
Unused << atBrNode.Offset(); // Needs offset after collapsing the selection.
|
||||
aSelection->SetInterlinePosition(true);
|
||||
ErrorResult error;
|
||||
aSelection->Collapse(atBrNode, error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return error.StealNSResult();
|
||||
}
|
||||
|
||||
// if citeNode wasn't a block, we might also want another break before it.
|
||||
// We need to examine the content both before the br we just added and also
|
||||
// just after it. If we don't have another br or block boundary adjacent,
|
||||
// then we will need a 2nd br added to achieve blank line that user expects.
|
||||
if (IsInlineNode(*citeNode)) {
|
||||
// Use DOM point which we tried to collapse to.
|
||||
EditorRawDOMPoint pointToCreateNewBrNode(atBrNode.GetContainer(),
|
||||
atBrNode.Offset());
|
||||
|
||||
WSRunObject wsObj(htmlEditor, pointToCreateNewBrNode);
|
||||
nsCOMPtr<nsINode> visNode;
|
||||
int32_t visOffset=0;
|
||||
WSType wsType;
|
||||
wsObj.NextVisibleNode(selNode, selOffset, address_of(visNode),
|
||||
&visOffset, &wsType);
|
||||
if (wsType == WSType::br) {
|
||||
// ok, we are just before a break. is it inside the mailquote?
|
||||
if (visNode != citeNode && citeNode->Contains(visNode)) {
|
||||
// it is. so lets reset our selection to be just after it.
|
||||
selNode = EditorBase::GetNodeLocation(visNode, &selOffset);
|
||||
++selOffset;
|
||||
}
|
||||
}
|
||||
|
||||
NS_ENSURE_STATE(selNode->IsContent());
|
||||
SplitNodeResult splitCiteNodeResult =
|
||||
htmlEditor->SplitNodeDeep(*citeNode,
|
||||
EditorRawDOMPoint(selNode, selOffset),
|
||||
SplitAtEdges::eDoNotCreateEmptyContainer);
|
||||
if (NS_WARN_IF(splitCiteNodeResult.Failed())) {
|
||||
return splitCiteNodeResult.Rv();
|
||||
}
|
||||
|
||||
// Add an invisible <br> to the end of current cite node (If new left cite
|
||||
// has not been created, we're at the end of it. Otherwise, we're still at
|
||||
// the right node) if it was a <span> of style="display: block". This is
|
||||
// important, since when serializing the cite to plain text, the span which
|
||||
// caused the visual break is discarded. So the added <br> will guarantee
|
||||
// that the serializer will insert a break where the user saw one.
|
||||
// FYI: splitCiteNodeResult grabs the previous node with nsCOMPtr.
|
||||
// So, it's safe to access previousNodeOfSplitPoint even after
|
||||
// changing the DOM tree and/or selection even though it's raw pointer.
|
||||
nsIContent* previousNodeOfSplitPoint =
|
||||
splitCiteNodeResult.GetPreviousNode();
|
||||
if (previousNodeOfSplitPoint &&
|
||||
previousNodeOfSplitPoint->IsHTMLElement(nsGkAtoms::span) &&
|
||||
previousNodeOfSplitPoint->GetPrimaryFrame()->
|
||||
IsFrameOfType(nsIFrame::eBlockFrame)) {
|
||||
nsCOMPtr<nsINode> lastChild =
|
||||
previousNodeOfSplitPoint->GetLastChild();
|
||||
if (lastChild && !lastChild->IsHTMLElement(nsGkAtoms::br)) {
|
||||
// We ignore the result here.
|
||||
EditorRawDOMPoint endOfPreviousNodeOfSplitPoint;
|
||||
endOfPreviousNodeOfSplitPoint.SetToEndOf(previousNodeOfSplitPoint);
|
||||
RefPtr<Element> invisBR =
|
||||
htmlEditor->CreateBR(endOfPreviousNodeOfSplitPoint);
|
||||
}
|
||||
}
|
||||
|
||||
// In most cases, <br> should be inserted after current cite. However, if
|
||||
// left cite hasn't been created because the split point was start of the
|
||||
// cite node, <br> should be inserted before the current cite.
|
||||
EditorRawDOMPoint pointToInsertBrNode(splitCiteNodeResult.SplitPoint());
|
||||
RefPtr<Element> brNode = htmlEditor->CreateBR(pointToInsertBrNode);
|
||||
if (NS_WARN_IF(!brNode)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
// Now, offset of pointToInsertBrNode is invalid. Let's clear it.
|
||||
pointToInsertBrNode.Clear();
|
||||
|
||||
// Want selection before the break, and on same line.
|
||||
EditorRawDOMPoint atBrNode(brNode);
|
||||
aSelection->SetInterlinePosition(true);
|
||||
ErrorResult error;
|
||||
aSelection->Collapse(atBrNode, error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return error.StealNSResult();
|
||||
}
|
||||
|
||||
selNode = atBrNode.GetContainer();
|
||||
selOffset = atBrNode.Offset();
|
||||
|
||||
// if citeNode wasn't a block, we might also want another break before it.
|
||||
// We need to examine the content both before the br we just added and also
|
||||
// just after it. If we don't have another br or block boundary adjacent,
|
||||
// then we will need a 2nd br added to achieve blank line that user expects.
|
||||
if (IsInlineNode(*citeNode)) {
|
||||
WSRunObject wsObj(htmlEditor, selNode, selOffset);
|
||||
nsCOMPtr<nsINode> visNode;
|
||||
int32_t visOffset=0;
|
||||
WSType wsType;
|
||||
wsObj.PriorVisibleNode(selNode, selOffset, address_of(visNode),
|
||||
&visOffset, &wsType);
|
||||
wsObj.PriorVisibleNode(pointToCreateNewBrNode,
|
||||
address_of(visNode), &visOffset, &wsType);
|
||||
if (wsType == WSType::normalWS || wsType == WSType::text ||
|
||||
wsType == WSType::special) {
|
||||
EditorRawDOMPoint pointAfterNewBrNode(pointToCreateNewBrNode);
|
||||
DebugOnly<bool> advanced = pointAfterNewBrNode.AdvanceOffset();
|
||||
NS_WARNING_ASSERTION(advanced,
|
||||
"Failed to advance offset after the <br> node");
|
||||
WSRunObject wsObjAfterBR(htmlEditor, pointAfterNewBrNode);
|
||||
wsObjAfterBR.NextVisibleNode(pointAfterNewBrNode,
|
||||
address_of(visNode), &visOffset, &wsType);
|
||||
if (wsType == WSType::normalWS || wsType == WSType::text ||
|
||||
wsType == WSType::special) {
|
||||
WSRunObject wsObjAfterBR(htmlEditor, selNode, selOffset + 1);
|
||||
wsObjAfterBR.NextVisibleNode(selNode, selOffset + 1,
|
||||
address_of(visNode), &visOffset, &wsType);
|
||||
if (wsType == WSType::normalWS || wsType == WSType::text ||
|
||||
wsType == WSType::special ||
|
||||
// In case we're at the very end.
|
||||
wsType == WSType::thisBlock) {
|
||||
brNode = htmlEditor->CreateBR(EditorRawDOMPoint(selNode, selOffset));
|
||||
NS_ENSURE_STATE(brNode);
|
||||
wsType == WSType::special ||
|
||||
// In case we're at the very end.
|
||||
wsType == WSType::thisBlock) {
|
||||
brNode = htmlEditor->CreateBR(pointToCreateNewBrNode);
|
||||
if (NS_WARN_IF(!brNode)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
// Now, those points may be invalid.
|
||||
pointToCreateNewBrNode.Clear();
|
||||
pointAfterNewBrNode.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
// delete any empty cites
|
||||
bool bEmptyCite = false;
|
||||
if (previousNodeOfSplitPoint) {
|
||||
rv = htmlEditor->IsEmptyNode(previousNodeOfSplitPoint, &bEmptyCite,
|
||||
true, false);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
if (bEmptyCite) {
|
||||
rv = htmlEditor->DeleteNode(previousNodeOfSplitPoint);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (citeNode) {
|
||||
rv = htmlEditor->IsEmptyNode(citeNode, &bEmptyCite, true, false);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
if (bEmptyCite) {
|
||||
rv = htmlEditor->DeleteNode(citeNode);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
}
|
||||
*aHandled = true;
|
||||
}
|
||||
|
||||
// delete any empty cites
|
||||
bool bEmptyCite = false;
|
||||
if (previousNodeOfSplitPoint) {
|
||||
nsresult rv =
|
||||
htmlEditor->IsEmptyNode(previousNodeOfSplitPoint, &bEmptyCite,
|
||||
true, false);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
if (bEmptyCite) {
|
||||
rv = htmlEditor->DeleteNode(previousNodeOfSplitPoint);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (citeNode) {
|
||||
nsresult rv = htmlEditor->IsEmptyNode(citeNode, &bEmptyCite, true, false);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
if (bEmptyCite) {
|
||||
rv = htmlEditor->DeleteNode(citeNode);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*aHandled = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2206,9 +2228,12 @@ HTMLEditRules::WillDeleteSelection(Selection* aSelection,
|
|||
}
|
||||
|
||||
// Test for distance between caret and text that will be deleted
|
||||
rv = CheckBidiLevelForDeletion(aSelection, startNode,
|
||||
startOffset, aAction, aCancel);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = CheckBidiLevelForDeletion(aSelection,
|
||||
EditorRawDOMPoint(startNode, startOffset),
|
||||
aAction, aCancel);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
if (*aCancel) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2241,11 +2266,11 @@ HTMLEditRules::WillDeleteSelection(Selection* aSelection,
|
|||
|
||||
// Find next visible node
|
||||
if (aAction == nsIEditor::eNext) {
|
||||
wsObj.NextVisibleNode(startNode, startOffset, address_of(visNode),
|
||||
&visOffset, &wsType);
|
||||
wsObj.NextVisibleNode(EditorRawDOMPoint(startNode, startOffset),
|
||||
address_of(visNode), &visOffset, &wsType);
|
||||
} else {
|
||||
wsObj.PriorVisibleNode(startNode, startOffset, address_of(visNode),
|
||||
&visOffset, &wsType);
|
||||
wsObj.PriorVisibleNode(EditorRawDOMPoint(startNode, startOffset),
|
||||
address_of(visNode), &visOffset, &wsType);
|
||||
}
|
||||
|
||||
if (!visNode) {
|
||||
|
@ -2401,7 +2426,8 @@ HTMLEditRules::WillDeleteSelection(Selection* aSelection,
|
|||
nsCOMPtr<nsINode> otherNode;
|
||||
int32_t otherOffset;
|
||||
|
||||
wsObj.NextVisibleNode(startNode, startOffset, address_of(otherNode),
|
||||
wsObj.NextVisibleNode(EditorRawDOMPoint(startNode, startOffset),
|
||||
address_of(otherNode),
|
||||
&otherOffset, &otherWSType);
|
||||
|
||||
if (otherWSType == WSType::br) {
|
||||
|
@ -2475,10 +2501,12 @@ HTMLEditRules::WillDeleteSelection(Selection* aSelection,
|
|||
|
||||
// Find node in other direction
|
||||
if (aAction == nsIEditor::eNext) {
|
||||
wsObj.PriorVisibleNode(startNode, startOffset, address_of(otherNode),
|
||||
wsObj.PriorVisibleNode(EditorRawDOMPoint(startNode, startOffset),
|
||||
address_of(otherNode),
|
||||
&otherOffset, &otherWSType);
|
||||
} else {
|
||||
wsObj.NextVisibleNode(startNode, startOffset, address_of(otherNode),
|
||||
wsObj.NextVisibleNode(EditorRawDOMPoint(startNode, startOffset),
|
||||
address_of(otherNode),
|
||||
&otherOffset, &otherWSType);
|
||||
}
|
||||
|
||||
|
@ -2676,8 +2704,8 @@ HTMLEditRules::WillDeleteSelection(Selection* aSelection,
|
|||
|
||||
// Figure out block parents
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
nsCOMPtr<Element> leftParent = mHTMLEditor->GetBlock(*startNode);
|
||||
nsCOMPtr<Element> rightParent = mHTMLEditor->GetBlock(*endNode);
|
||||
nsCOMPtr<Element> leftParent = HTMLEditor::GetBlock(*startNode);
|
||||
nsCOMPtr<Element> rightParent = HTMLEditor::GetBlock(*endNode);
|
||||
|
||||
// Are endpoint block parents the same? Use default deletion
|
||||
if (leftParent && leftParent == rightParent) {
|
||||
|
@ -2883,8 +2911,7 @@ HTMLEditRules::InsertBRIfNeeded(Selection* aSelection)
|
|||
}
|
||||
|
||||
// examine selection
|
||||
WSRunObject wsObj(htmlEditor, atStartOfSelection.GetContainer(),
|
||||
atStartOfSelection.Offset());
|
||||
WSRunObject wsObj(htmlEditor, atStartOfSelection);
|
||||
if (((wsObj.mStartReason & WSType::block) ||
|
||||
(wsObj.mStartReason & WSType::br)) &&
|
||||
(wsObj.mEndReason & WSType::block)) {
|
||||
|
@ -4067,13 +4094,13 @@ HTMLEditRules::WillCSSIndent(Selection* aSelection,
|
|||
|
||||
nsCOMPtr<Element> liNode;
|
||||
if (aSelection->Collapsed()) {
|
||||
nsCOMPtr<nsINode> node;
|
||||
int32_t offset;
|
||||
nsresult rv =
|
||||
EditorBase::GetStartNodeAndOffset(aSelection,
|
||||
getter_AddRefs(node), &offset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
RefPtr<Element> block = htmlEditor->GetBlock(*node);
|
||||
EditorRawDOMPoint selectionStartPoint(
|
||||
EditorBase::GetStartPoint(aSelection));
|
||||
if (NS_WARN_IF(!selectionStartPoint.IsSet())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
Element* block =
|
||||
htmlEditor->GetBlock(*selectionStartPoint.GetContainer());
|
||||
if (block && HTMLEditUtils::IsListItem(block)) {
|
||||
liNode = block;
|
||||
}
|
||||
|
@ -5551,8 +5578,8 @@ HTMLEditRules::ExpandSelectionForDeletion(Selection& aSelection)
|
|||
if (selStartNode != selCommon && selStartNode != root) {
|
||||
while (true) {
|
||||
WSRunObject wsObj(mHTMLEditor, selStartNode, selStartOffset);
|
||||
wsObj.PriorVisibleNode(selStartNode, selStartOffset, address_of(unused),
|
||||
&visOffset, &wsType);
|
||||
wsObj.PriorVisibleNode(EditorRawDOMPoint(selStartNode, selStartOffset),
|
||||
address_of(unused), &visOffset, &wsType);
|
||||
if (wsType != WSType::thisBlock) {
|
||||
break;
|
||||
}
|
||||
|
@ -5573,8 +5600,8 @@ HTMLEditRules::ExpandSelectionForDeletion(Selection& aSelection)
|
|||
if (selEndNode != selCommon && selEndNode != root) {
|
||||
for (;;) {
|
||||
WSRunObject wsObj(mHTMLEditor, selEndNode, selEndOffset);
|
||||
wsObj.NextVisibleNode(selEndNode, selEndOffset, address_of(unused),
|
||||
&visOffset, &wsType);
|
||||
wsObj.NextVisibleNode(EditorRawDOMPoint(selEndNode, selEndOffset),
|
||||
address_of(unused), &visOffset, &wsType);
|
||||
if (wsType == WSType::br) {
|
||||
if (mHTMLEditor->IsVisibleBRElement(wsObj.mEndReasonNode)) {
|
||||
break;
|
||||
|
@ -5700,7 +5727,7 @@ HTMLEditRules::NormalizeSelection(Selection* inSelection)
|
|||
WSRunObject wsEndObj(htmlEditor, endNode, static_cast<int32_t>(endOffset));
|
||||
// is there any intervening visible whitespace? if so we can't push selection past that,
|
||||
// it would visibly change maening of users selection
|
||||
wsEndObj.PriorVisibleNode(endNode, static_cast<int32_t>(endOffset),
|
||||
wsEndObj.PriorVisibleNode(EditorRawDOMPoint(endNode, endOffset),
|
||||
address_of(unused), &offset, &wsType);
|
||||
if (wsType != WSType::text && wsType != WSType::normalWS) {
|
||||
// eThisBlock and eOtherBlock conveniently distinquish cases
|
||||
|
@ -5742,7 +5769,7 @@ HTMLEditRules::NormalizeSelection(Selection* inSelection)
|
|||
static_cast<int32_t>(startOffset));
|
||||
// is there any intervening visible whitespace? if so we can't push selection past that,
|
||||
// it would visibly change maening of users selection
|
||||
wsStartObj.NextVisibleNode(startNode, static_cast<int32_t>(startOffset),
|
||||
wsStartObj.NextVisibleNode(EditorRawDOMPoint(startNode, startOffset),
|
||||
address_of(unused), &offset, &wsType);
|
||||
if (wsType != WSType::text && wsType != WSType::normalWS) {
|
||||
// eThisBlock and eOtherBlock conveniently distinquish cases
|
||||
|
@ -7310,8 +7337,8 @@ HTMLEditRules::ReturnInListItem(Selection& aSelection,
|
|||
nsCOMPtr<nsINode> visNode;
|
||||
int32_t visOffset = 0;
|
||||
WSType wsType;
|
||||
wsObj.NextVisibleNode(&aListItem, 0, address_of(visNode),
|
||||
&visOffset, &wsType);
|
||||
wsObj.NextVisibleNode(EditorRawDOMPoint(&aListItem, 0),
|
||||
address_of(visNode), &visOffset, &wsType);
|
||||
if (wsType == WSType::special || wsType == WSType::br ||
|
||||
visNode->IsHTMLElement(nsGkAtoms::hr)) {
|
||||
EditorRawDOMPoint atVisNode(visNode);
|
||||
|
@ -7995,17 +8022,16 @@ HTMLEditRules::AdjustSpecialBreaks()
|
|||
nsresult
|
||||
HTMLEditRules::AdjustWhitespace(Selection* aSelection)
|
||||
{
|
||||
// get selection point
|
||||
nsCOMPtr<nsINode> selNode;
|
||||
int32_t selOffset;
|
||||
nsresult rv =
|
||||
EditorBase::GetStartNodeAndOffset(aSelection,
|
||||
getter_AddRefs(selNode), &selOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
EditorRawDOMPoint selectionStartPoint(EditorBase::GetStartPoint(aSelection));
|
||||
if (NS_WARN_IF(!selectionStartPoint.IsSet())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// ask whitespace object to tweak nbsp's
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
return WSRunObject(mHTMLEditor, selNode, selOffset).AdjustWhitespace();
|
||||
// Ask whitespace object to tweak nbsp's
|
||||
if (NS_WARN_IF(!mHTMLEditor)) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
return WSRunObject(mHTMLEditor, selectionStartPoint).AdjustWhitespace();
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -8020,25 +8046,21 @@ HTMLEditRules::PinSelectionToNewBlock(Selection* aSelection)
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
// get the (collapsed) selection location
|
||||
nsCOMPtr<nsINode> selNode;
|
||||
int32_t selOffset;
|
||||
nsresult rv =
|
||||
EditorBase::GetStartNodeAndOffset(aSelection,
|
||||
getter_AddRefs(selNode), &selOffset);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
if (NS_WARN_IF(!selNode)) {
|
||||
EditorRawDOMPoint selectionStartPoint(EditorBase::GetStartPoint(aSelection));
|
||||
if (NS_WARN_IF(!selectionStartPoint.IsSet())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// use ranges and sRangeHelper to compare sel point to new block
|
||||
RefPtr<nsRange> range = new nsRange(selNode);
|
||||
rv = range->CollapseTo(selNode, selOffset);
|
||||
// Use ranges and nsRange::CompareNodeToRange() to compare selection start
|
||||
// to new block.
|
||||
// XXX It's too expensive to use nsRange and set it only for comparing a
|
||||
// DOM point with a node.
|
||||
RefPtr<nsRange> range = new nsRange(selectionStartPoint.GetContainer());
|
||||
nsresult rv = range->CollapseTo(selectionStartPoint);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
bool nodeBefore, nodeAfter;
|
||||
rv = nsRange::CompareNodeToRange(mNewBlock, range, &nodeBefore, &nodeAfter);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -8716,65 +8738,57 @@ HTMLEditRules::RemoveListStructure(Element& aList)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// XXX This method is not necessary because even if selection is outside the
|
||||
// <body> element, the element can be editable.
|
||||
nsresult
|
||||
HTMLEditRules::ConfirmSelectionInBody()
|
||||
{
|
||||
// get the body
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
RefPtr<Element> rootElement = mHTMLEditor->GetRoot();
|
||||
if (NS_WARN_IF(!mHTMLEditor)) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
Element* rootElement = mHTMLEditor->GetRoot();
|
||||
if (NS_WARN_IF(!rootElement)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
// get the selection
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
RefPtr<Selection> selection = mHTMLEditor->GetSelection();
|
||||
Selection* selection = mHTMLEditor->GetSelection();
|
||||
if (NS_WARN_IF(!selection)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
// get the selection start location
|
||||
nsCOMPtr<nsINode> selNode;
|
||||
int32_t selOffset;
|
||||
nsresult rv =
|
||||
EditorBase::GetStartNodeAndOffset(selection,
|
||||
getter_AddRefs(selNode), &selOffset);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
EditorRawDOMPoint selectionStartPoint(EditorBase::GetStartPoint(selection));
|
||||
if (NS_WARN_IF(!selectionStartPoint.IsSet())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsINode* temp = selNode;
|
||||
|
||||
// check that selNode is inside body
|
||||
// Check that selection start container is inside the <body> element.
|
||||
//XXXsmaug this code is insane.
|
||||
nsINode* temp = selectionStartPoint.GetContainer();
|
||||
while (temp && !temp->IsHTMLElement(nsGkAtoms::body)) {
|
||||
temp = temp->GetParentOrHostNode();
|
||||
}
|
||||
|
||||
// if we aren't in the body, force the issue
|
||||
// If we aren't in the <body> element, force the issue.
|
||||
if (!temp) {
|
||||
// uncomment this to see when we get bad selections
|
||||
// NS_NOTREACHED("selection not in body");
|
||||
selection->Collapse(rootElement, 0);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// get the selection end location
|
||||
rv = EditorBase::GetEndNodeAndOffset(selection,
|
||||
getter_AddRefs(selNode), &selOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
temp = selNode;
|
||||
EditorRawDOMPoint selectionEndPoint(EditorBase::GetEndPoint(selection));
|
||||
if (NS_WARN_IF(!selectionEndPoint.IsSet())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// check that selNode is inside body
|
||||
//XXXsmaug this code is insane.
|
||||
temp = selectionEndPoint.GetContainer();
|
||||
while (temp && !temp->IsHTMLElement(nsGkAtoms::body)) {
|
||||
temp = temp->GetParentOrHostNode();
|
||||
}
|
||||
|
||||
// if we aren't in the body, force the issue
|
||||
// If we aren't in the <body> element, force the issue.
|
||||
if (!temp) {
|
||||
// uncomment this to see when we get bad selections
|
||||
// NS_NOTREACHED("selection not in body");
|
||||
selection->Collapse(rootElement, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -596,8 +596,7 @@ HTMLEditor::MaybeCollapseSelectionAtFirstEditableNode(
|
|||
int32_t visOffset = 0;
|
||||
WSType visType;
|
||||
nsCOMPtr<nsINode> visNode;
|
||||
wsObj.NextVisibleNode(pointToPutCaret.GetContainer(),
|
||||
pointToPutCaret.Offset(),
|
||||
wsObj.NextVisibleNode(pointToPutCaret,
|
||||
address_of(visNode), &visOffset, &visType);
|
||||
|
||||
// If we meet a non-editable node first, we should move caret to start of
|
||||
|
@ -1007,8 +1006,8 @@ HTMLEditor::IsVisibleBRElement(nsINode* aNode)
|
|||
nsCOMPtr<nsINode> unused;
|
||||
int32_t visOffset = 0;
|
||||
WSType visType;
|
||||
wsObj.NextVisibleNode(selNode, selOffset, address_of(unused),
|
||||
&visOffset, &visType);
|
||||
wsObj.NextVisibleNode(EditorRawDOMPoint(selNode, selOffset),
|
||||
address_of(unused), &visOffset, &visType);
|
||||
if (visType & WSType::block) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1476,8 +1475,7 @@ HTMLEditor::GetBetterInsertionPointFor(nsINode& aNodeToInsert,
|
|||
nsCOMPtr<nsINode> nextVisibleNode;
|
||||
int32_t nextVisibleOffset = 0;
|
||||
WSType nextVisibleType;
|
||||
wsObj.NextVisibleNode(aPointToInsert.GetContainer(), aPointToInsert.Offset(),
|
||||
address_of(nextVisibleNode),
|
||||
wsObj.NextVisibleNode(aPointToInsert, address_of(nextVisibleNode),
|
||||
&nextVisibleOffset, &nextVisibleType);
|
||||
// So, if the next visible node isn't a <br> element, we can insert the block
|
||||
// level element to the point.
|
||||
|
@ -1493,8 +1491,7 @@ HTMLEditor::GetBetterInsertionPointFor(nsINode& aNodeToInsert,
|
|||
nsCOMPtr<nsINode> previousVisibleNode;
|
||||
int32_t previousVisibleOffset = 0;
|
||||
WSType previousVisibleType;
|
||||
wsObj.PriorVisibleNode(aPointToInsert.GetContainer(), aPointToInsert.Offset(),
|
||||
address_of(previousVisibleNode),
|
||||
wsObj.PriorVisibleNode(aPointToInsert, address_of(previousVisibleNode),
|
||||
&previousVisibleOffset, &previousVisibleType);
|
||||
// So, if there is no previous visible node,
|
||||
// or, if both nodes of the insertion point is <br> elements,
|
||||
|
@ -4007,7 +4004,8 @@ HTMLEditor::IsVisibleTextNode(Text& aText)
|
|||
nsCOMPtr<nsINode> nextVisibleNode;
|
||||
int32_t unused = 0;
|
||||
WSType visibleNodeType;
|
||||
wsRunObj.NextVisibleNode(&aText, 0, address_of(nextVisibleNode),
|
||||
wsRunObj.NextVisibleNode(EditorRawDOMPoint(&aText, 0),
|
||||
address_of(nextVisibleNode),
|
||||
&unused, &visibleNodeType);
|
||||
return (visibleNodeType == WSType::normalWS ||
|
||||
visibleNodeType == WSType::text) &&
|
||||
|
|
|
@ -194,7 +194,7 @@ HTMLEditor::DoInsertHTMLWithContext(const nsAString& aInputString,
|
|||
const nsAString& aInfoStr,
|
||||
const nsAString& aFlavor,
|
||||
nsIDOMDocument* aSourceDoc,
|
||||
nsIDOMNode* aDestNode,
|
||||
nsIDOMNode* aDestDOMNode,
|
||||
int32_t aDestOffset,
|
||||
bool aDeleteSelection,
|
||||
bool aTrustedInput,
|
||||
|
@ -227,39 +227,40 @@ HTMLEditor::DoInsertHTMLWithContext(const nsAString& aInputString,
|
|||
aTrustedInput);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsINode> targetNode;
|
||||
int32_t targetOffset=0;
|
||||
|
||||
if (!aDestNode) {
|
||||
EditorDOMPoint targetPoint;
|
||||
if (!aDestDOMNode) {
|
||||
// if caller didn't provide the destination/target node,
|
||||
// fetch the paste insertion point from our selection
|
||||
rv = GetStartNodeAndOffset(selection, getter_AddRefs(targetNode), &targetOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (!targetNode || !IsEditable(targetNode)) {
|
||||
targetPoint = EditorBase::GetStartPoint(selection);
|
||||
if (NS_WARN_IF(!targetPoint.IsSet()) ||
|
||||
!IsEditable(targetPoint.GetContainer())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
} else {
|
||||
targetNode = do_QueryInterface(aDestNode);
|
||||
targetOffset = aDestOffset;
|
||||
nsCOMPtr<nsINode> destNode = do_QueryInterface(aDestDOMNode);
|
||||
targetPoint.Set(destNode, aDestOffset);
|
||||
}
|
||||
|
||||
// if we have a destination / target node, we want to insert there
|
||||
// rather than in place of the selection
|
||||
// ignore aDeleteSelection here if no aDestNode since deletion will
|
||||
// ignore aDeleteSelection here if no aDestDOMNode since deletion will
|
||||
// also occur later; this block is intended to cover the various
|
||||
// scenarios where we are dropping in an editor (and may want to delete
|
||||
// the selection before collapsing the selection in the new destination)
|
||||
if (aDestNode) {
|
||||
if (aDestDOMNode) {
|
||||
if (aDeleteSelection) {
|
||||
// Use an auto tracker so that our drop point is correctly
|
||||
// positioned after the delete.
|
||||
AutoTrackDOMPoint tracker(mRangeUpdater, &targetNode, &targetOffset);
|
||||
AutoTrackDOMPoint tracker(mRangeUpdater, &targetPoint);
|
||||
rv = DeleteSelection(eNone, eStrip);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
rv = selection->Collapse(targetNode, targetOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
ErrorResult error;
|
||||
selection->Collapse(targetPoint, error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return error.StealNSResult();
|
||||
}
|
||||
}
|
||||
|
||||
// we need to recalculate various things based on potentially new offsets
|
||||
|
@ -347,8 +348,7 @@ HTMLEditor::DoInsertHTMLWithContext(const nsAString& aInputString,
|
|||
// if there are any invisible br's after our insertion point, remove them.
|
||||
// this is because if there is a br at end of what we paste, it will make
|
||||
// the invisible br visible.
|
||||
WSRunObject wsObj(this, pointToInsert.GetContainer(),
|
||||
pointToInsert.Offset());
|
||||
WSRunObject wsObj(this, pointToInsert);
|
||||
if (wsObj.mEndReasonNode &&
|
||||
TextEditUtils::IsBreak(wsObj.mEndReasonNode) &&
|
||||
!IsVisibleBRElement(wsObj.mEndReasonNode)) {
|
||||
|
@ -624,8 +624,8 @@ HTMLEditor::DoInsertHTMLWithContext(const nsAString& aInputString,
|
|||
nsCOMPtr<nsINode> visNode;
|
||||
int32_t outVisOffset=0;
|
||||
WSType visType;
|
||||
wsRunObj.PriorVisibleNode(selNode, selOffset, address_of(visNode),
|
||||
&outVisOffset, &visType);
|
||||
wsRunObj.PriorVisibleNode(EditorRawDOMPoint(selNode, selOffset),
|
||||
address_of(visNode), &outVisOffset, &visType);
|
||||
if (visType == WSType::br) {
|
||||
// we are after a break. Is it visible? Despite the name,
|
||||
// PriorVisibleNode does not make that determination for breaks.
|
||||
|
@ -639,7 +639,8 @@ HTMLEditor::DoInsertHTMLWithContext(const nsAString& aInputString,
|
|||
selOffset = atStartReasonNode.Offset();
|
||||
// we want to be inside any inline style prior to break
|
||||
WSRunObject wsRunObj(this, selNode, selOffset);
|
||||
wsRunObj.PriorVisibleNode(selNode, selOffset, address_of(visNode),
|
||||
wsRunObj.PriorVisibleNode(EditorRawDOMPoint(selNode, selOffset),
|
||||
address_of(visNode),
|
||||
&outVisOffset, &visType);
|
||||
if (visType == WSType::text || visType == WSType::normalWS) {
|
||||
selNode = visNode;
|
||||
|
|
|
@ -463,81 +463,85 @@ TextEditRules::CollapseSelectionToTrailingBRIfNeeded(Selection* aSelection)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_ENSURE_STATE(mTextEditor);
|
||||
if (NS_WARN_IF(!mTextEditor)) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
RefPtr<TextEditor> textEditor(mTextEditor);
|
||||
|
||||
// If there is no selection ranges, we should set to the end of the editor.
|
||||
// This is usually performed in TextEditRules::Init(), however, if the
|
||||
// editor is reframed, this may be called by AfterEdit().
|
||||
if (!aSelection->RangeCount()) {
|
||||
mTextEditor->CollapseSelectionToEnd(aSelection);
|
||||
}
|
||||
|
||||
// if we are at the end of the textarea, we need to set the
|
||||
// selection to stick to the mozBR at the end of the textarea.
|
||||
int32_t selOffset;
|
||||
nsCOMPtr<nsINode> selNode;
|
||||
nsresult rv =
|
||||
EditorBase::GetStartNodeAndOffset(aSelection,
|
||||
getter_AddRefs(selNode), &selOffset);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (!EditorBase::IsTextNode(selNode)) {
|
||||
return NS_OK; // Nothing to do if we're not at a text node.
|
||||
}
|
||||
|
||||
// nothing to do if we're not at the end of the text node
|
||||
if (selOffset != static_cast<int32_t>(selNode->Length())) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_ENSURE_STATE(mTextEditor);
|
||||
nsINode* root = mTextEditor->GetRoot();
|
||||
if (NS_WARN_IF(!root)) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsINode* parentNode = selNode->GetParentNode();
|
||||
if (parentNode != root) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsINode* nextNode = selNode->GetNextSibling();
|
||||
if (nextNode && TextEditUtils::IsMozBR(nextNode)) {
|
||||
EditorRawDOMPoint afterSelNode(selNode);
|
||||
if (NS_WARN_IF(!afterSelNode.AdvanceOffset())) {
|
||||
textEditor->CollapseSelectionToEnd(aSelection);
|
||||
if (!mTextEditor) {
|
||||
// The editor has been destroyed.
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
rv = aSelection->Collapse(afterSelNode);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
// If we are at the end of the <textarea> element, we need to set the
|
||||
// selection to stick to the moz-<br> at the end of the <textarea>.
|
||||
EditorRawDOMPoint selectionStartPoint(EditorBase::GetStartPoint(aSelection));
|
||||
if (NS_WARN_IF(!selectionStartPoint.IsSet())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Nothing to do if we're not at the end of the text node.
|
||||
if (!selectionStartPoint.IsInTextNode() ||
|
||||
!selectionStartPoint.IsEndOfContainer()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Element* rootElement = textEditor->GetRoot();
|
||||
if (NS_WARN_IF(!rootElement)) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsINode* parentNode = selectionStartPoint.GetContainer()->GetParentNode();
|
||||
if (parentNode != rootElement) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsINode* nextNode = selectionStartPoint.GetContainer()->GetNextSibling();
|
||||
if (!nextNode || !TextEditUtils::IsMozBR(nextNode)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
EditorRawDOMPoint afterStartContainer(selectionStartPoint.GetContainer());
|
||||
if (NS_WARN_IF(!afterStartContainer.AdvanceOffset())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
ErrorResult error;
|
||||
aSelection->Collapse(afterStartContainer, error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return error.StealNSResult();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static inline already_AddRefed<nsINode>
|
||||
GetTextNode(Selection* selection)
|
||||
GetTextNode(Selection* aSelection)
|
||||
{
|
||||
int32_t selOffset;
|
||||
nsCOMPtr<nsINode> selNode;
|
||||
nsresult rv =
|
||||
EditorBase::GetStartNodeAndOffset(selection,
|
||||
getter_AddRefs(selNode), &selOffset);
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
if (!EditorBase::IsTextNode(selNode)) {
|
||||
// This should be the root node, walk the tree looking for text nodes
|
||||
RefPtr<NodeIterator> iter =
|
||||
new NodeIterator(selNode, NodeFilterBinding::SHOW_TEXT, nullptr);
|
||||
while (!EditorBase::IsTextNode(selNode)) {
|
||||
selNode = iter->NextNode(IgnoreErrors());
|
||||
if (!selNode) {
|
||||
return nullptr;
|
||||
}
|
||||
EditorRawDOMPoint selectionStartPoint(EditorBase::GetStartPoint(aSelection));
|
||||
if (NS_WARN_IF(!selectionStartPoint.IsSet())) {
|
||||
return nullptr;
|
||||
}
|
||||
if (selectionStartPoint.IsInTextNode()) {
|
||||
nsCOMPtr<nsINode> node = selectionStartPoint.GetContainer();
|
||||
return node.forget();
|
||||
}
|
||||
// This should be the root node, walk the tree looking for text nodes.
|
||||
nsCOMPtr<nsINode> node = selectionStartPoint.GetContainer();
|
||||
RefPtr<NodeIterator> iter =
|
||||
new NodeIterator(node, NodeFilterBinding::SHOW_TEXT, nullptr);
|
||||
while (!EditorBase::IsTextNode(node)) {
|
||||
node = iter->NextNode(IgnoreErrors());
|
||||
if (!node) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
return selNode.forget();
|
||||
return node.forget();
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
#define ASSERT_PASSWORD_LENGTHS_EQUAL() \
|
||||
if (IsPasswordEditor() && mTextEditor->GetRoot()) { \
|
||||
|
@ -1032,22 +1036,22 @@ TextEditRules::WillDeleteSelection(Selection* aSelection,
|
|||
mPasswordText.Cut(start, end-start);
|
||||
}
|
||||
} else {
|
||||
nsCOMPtr<nsINode> startNode;
|
||||
int32_t startOffset;
|
||||
nsresult rv =
|
||||
EditorBase::GetStartNodeAndOffset(aSelection, getter_AddRefs(startNode),
|
||||
&startOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(startNode, NS_ERROR_FAILURE);
|
||||
EditorRawDOMPoint selectionStartPoint(
|
||||
EditorBase::GetStartPoint(aSelection));
|
||||
if (NS_WARN_IF(!selectionStartPoint.IsSet())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (!aSelection->IsCollapsed()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Test for distance between caret and text that will be deleted
|
||||
rv = CheckBidiLevelForDeletion(aSelection, startNode, startOffset,
|
||||
aCollapsedAction, aCancel);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsresult rv = CheckBidiLevelForDeletion(aSelection, selectionStartPoint,
|
||||
aCollapsedAction, aCancel);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
if (*aCancel) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1072,29 +1076,25 @@ TextEditRules::DidDeleteSelection(Selection* aSelection,
|
|||
nsIEditor::EDirection aCollapsedAction,
|
||||
nsresult aResult)
|
||||
{
|
||||
nsCOMPtr<nsINode> startNode;
|
||||
int32_t startOffset;
|
||||
nsresult rv =
|
||||
EditorBase::GetStartNodeAndOffset(aSelection,
|
||||
getter_AddRefs(startNode), &startOffset);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
if (NS_WARN_IF(!startNode)) {
|
||||
EditorRawDOMPoint selectionStartPoint(EditorBase::GetStartPoint(aSelection));
|
||||
if (NS_WARN_IF(!selectionStartPoint.IsSet())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// delete empty text nodes at selection
|
||||
if (EditorBase::IsTextNode(startNode)) {
|
||||
// are we in an empty text node?
|
||||
if (!startNode->Length()) {
|
||||
NS_ENSURE_STATE(mTextEditor);
|
||||
rv = mTextEditor->DeleteNode(startNode);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
// Delete empty text nodes at selection.
|
||||
if (selectionStartPoint.IsInTextNode() &&
|
||||
!selectionStartPoint.GetContainer()->Length()) {
|
||||
if (NS_WARN_IF(!mTextEditor)) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
RefPtr<TextEditor> textEditor(mTextEditor);
|
||||
nsresult rv = textEditor->DeleteNode(selectionStartPoint.GetContainer());
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
// Be aware, mTextEditor may be nullptr here.
|
||||
}
|
||||
|
||||
if (mDidExplicitlySetInterline) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -262,8 +262,7 @@ protected:
|
|||
void UndefineCaretBidiLevel(Selection* aSelection);
|
||||
|
||||
nsresult CheckBidiLevelForDeletion(Selection* aSelection,
|
||||
nsINode* aSelNode,
|
||||
int32_t aSelOffset,
|
||||
const EditorRawDOMPoint& aSelectionPoint,
|
||||
nsIEditor::EDirection aAction,
|
||||
bool* aCancel);
|
||||
|
||||
|
|
|
@ -24,11 +24,11 @@ using namespace dom;
|
|||
|
||||
// Test for distance between caret and text that will be deleted
|
||||
nsresult
|
||||
TextEditRules::CheckBidiLevelForDeletion(Selection* aSelection,
|
||||
nsINode* aSelNode,
|
||||
int32_t aSelOffset,
|
||||
nsIEditor::EDirection aAction,
|
||||
bool* aCancel)
|
||||
TextEditRules::CheckBidiLevelForDeletion(
|
||||
Selection* aSelection,
|
||||
const EditorRawDOMPoint& aSelectionPoint,
|
||||
nsIEditor::EDirection aAction,
|
||||
bool* aCancel)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCancel);
|
||||
*aCancel = false;
|
||||
|
@ -43,10 +43,9 @@ TextEditRules::CheckBidiLevelForDeletion(Selection* aSelection,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
if (!aSelNode || !aSelNode->IsContent()) {
|
||||
if (!aSelectionPoint.GetContainerAsContent()) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsCOMPtr<nsIContent> content = aSelNode->AsContent();
|
||||
|
||||
nsBidiLevel levelBefore;
|
||||
nsBidiLevel levelAfter;
|
||||
|
@ -55,7 +54,8 @@ TextEditRules::CheckBidiLevelForDeletion(Selection* aSelection,
|
|||
NS_ENSURE_TRUE(frameSelection, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsPrevNextBidiLevels levels = frameSelection->
|
||||
GetPrevNextBidiLevels(content, aSelOffset, true);
|
||||
GetPrevNextBidiLevels(aSelectionPoint.GetContainerAsContent(),
|
||||
aSelectionPoint.Offset(), true);
|
||||
|
||||
levelBefore = levels.mLevelBefore;
|
||||
levelAfter = levels.mLevelAfter;
|
||||
|
|
|
@ -39,11 +39,11 @@ using namespace dom;
|
|||
NS_IMPL_CYCLE_COLLECTION_CLASS(TypeInState)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(TypeInState)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mLastSelectionContainer)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mLastSelectionPoint)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(TypeInState)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mLastSelectionContainer)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mLastSelectionPoint)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(TypeInState, AddRef)
|
||||
|
@ -51,7 +51,6 @@ NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(TypeInState, Release)
|
|||
|
||||
TypeInState::TypeInState()
|
||||
: mRelativeFontSize(0)
|
||||
, mLastSelectionOffset(0)
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
@ -67,15 +66,22 @@ TypeInState::~TypeInState()
|
|||
nsresult
|
||||
TypeInState::UpdateSelState(Selection* aSelection)
|
||||
{
|
||||
NS_ENSURE_TRUE(aSelection, NS_ERROR_NULL_POINTER);
|
||||
if (NS_WARN_IF(!aSelection)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
if (!aSelection->Collapsed()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return EditorBase::GetStartNodeAndOffset(
|
||||
aSelection, getter_AddRefs(mLastSelectionContainer),
|
||||
&mLastSelectionOffset);
|
||||
mLastSelectionPoint = EditorBase::GetStartPoint(aSelection);
|
||||
if (!mLastSelectionPoint.IsSet()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
// We need to store only offset because referring child may be removed by
|
||||
// we'll check the point later.
|
||||
AutoEditorDOMPointChildInvalidator saveOnlyOffset(mLastSelectionPoint);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -92,28 +98,23 @@ TypeInState::OnSelectionChange(Selection& aSelection)
|
|||
// XXX: the same location clears the type-in-state.
|
||||
|
||||
if (aSelection.IsCollapsed() && aSelection.RangeCount()) {
|
||||
nsCOMPtr<nsINode> selNode;
|
||||
int32_t selOffset = 0;
|
||||
|
||||
nsresult rv =
|
||||
EditorBase::GetStartNodeAndOffset(&aSelection, getter_AddRefs(selNode),
|
||||
&selOffset);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
EditorRawDOMPoint selectionStartPoint(
|
||||
EditorBase::GetStartPoint(&aSelection));
|
||||
if (NS_WARN_IF(!selectionStartPoint.IsSet())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (selNode &&
|
||||
selNode == mLastSelectionContainer &&
|
||||
selOffset == mLastSelectionOffset) {
|
||||
if (mLastSelectionPoint == selectionStartPoint) {
|
||||
// We got a bogus selection changed notification!
|
||||
return;
|
||||
}
|
||||
|
||||
mLastSelectionContainer = selNode;
|
||||
mLastSelectionOffset = selOffset;
|
||||
mLastSelectionPoint = selectionStartPoint;
|
||||
// We need to store only offset because referring child may be removed by
|
||||
// we'll check the point later.
|
||||
AutoEditorDOMPointChildInvalidator saveOnlyOffset(mLastSelectionPoint);
|
||||
} else {
|
||||
mLastSelectionContainer = nullptr;
|
||||
mLastSelectionOffset = 0;
|
||||
mLastSelectionPoint.Clear();
|
||||
}
|
||||
|
||||
Reset();
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#ifndef TypeInState_h
|
||||
#define TypeInState_h
|
||||
|
||||
#include "mozilla/EditorDOMPoint.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
@ -96,9 +97,8 @@ protected:
|
|||
|
||||
nsTArray<PropItem*> mSetArray;
|
||||
nsTArray<PropItem*> mClearedArray;
|
||||
EditorDOMPoint mLastSelectionPoint;
|
||||
int32_t mRelativeFontSize;
|
||||
nsCOMPtr<nsINode> mLastSelectionContainer;
|
||||
int32_t mLastSelectionOffset;
|
||||
|
||||
friend class HTMLEditRules;
|
||||
};
|
||||
|
|
|
@ -34,6 +34,34 @@ using namespace dom;
|
|||
|
||||
const char16_t kNBSP = 160;
|
||||
|
||||
template WSRunObject::WSRunObject(HTMLEditor* aHTMLEditor,
|
||||
const EditorDOMPoint& aPoint);
|
||||
template WSRunObject::WSRunObject(HTMLEditor* aHTMLEditor,
|
||||
const EditorRawDOMPoint& aPoint);
|
||||
template void WSRunObject::PriorVisibleNode(const EditorDOMPoint& aPoint,
|
||||
nsCOMPtr<nsINode>* outVisNode,
|
||||
int32_t* outVisOffset,
|
||||
WSType* outType);
|
||||
template void WSRunObject::PriorVisibleNode(const EditorRawDOMPoint& aPoint,
|
||||
nsCOMPtr<nsINode>* outVisNode,
|
||||
int32_t* outVisOffset,
|
||||
WSType* outType);
|
||||
template void WSRunObject::NextVisibleNode(const EditorDOMPoint& aPoint,
|
||||
nsCOMPtr<nsINode>* outVisNode,
|
||||
int32_t* outVisOffset,
|
||||
WSType* outType);
|
||||
template void WSRunObject::NextVisibleNode(const EditorRawDOMPoint& aPoint,
|
||||
nsCOMPtr<nsINode>* outVisNode,
|
||||
int32_t* outVisOffset,
|
||||
WSType* outType);
|
||||
|
||||
template<typename PT, typename CT>
|
||||
WSRunObject::WSRunObject(HTMLEditor* aHTMLEditor,
|
||||
const EditorDOMPointBase<PT, CT>& aPoint)
|
||||
: WSRunObject(aHTMLEditor, aPoint.GetContainer(), aPoint.Offset())
|
||||
{
|
||||
}
|
||||
|
||||
WSRunObject::WSRunObject(HTMLEditor* aHTMLEditor,
|
||||
nsINode* aNode,
|
||||
int32_t aOffset)
|
||||
|
@ -504,9 +532,9 @@ WSRunObject::DeleteWSForward()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
template<typename PT, typename CT>
|
||||
void
|
||||
WSRunObject::PriorVisibleNode(nsINode* aNode,
|
||||
int32_t aOffset,
|
||||
WSRunObject::PriorVisibleNode(const EditorDOMPointBase<PT, CT>& aPoint,
|
||||
nsCOMPtr<nsINode>* outVisNode,
|
||||
int32_t* outVisOffset,
|
||||
WSType* outType)
|
||||
|
@ -514,14 +542,14 @@ WSRunObject::PriorVisibleNode(nsINode* aNode,
|
|||
// Find first visible thing before the point. Position
|
||||
// outVisNode/outVisOffset just _after_ that thing. If we don't find
|
||||
// anything return start of ws.
|
||||
MOZ_ASSERT(aNode && outVisNode && outVisOffset && outType);
|
||||
MOZ_ASSERT(aPoint.IsSet() && outVisNode && outVisOffset && outType);
|
||||
|
||||
WSFragment* run = FindNearestRun(EditorRawDOMPoint(aNode, aOffset), false);
|
||||
WSFragment* run = FindNearestRun(aPoint, false);
|
||||
|
||||
// Is there a visible run there or earlier?
|
||||
for (; run; run = run->mLeft) {
|
||||
if (run->mType == WSType::normalWS) {
|
||||
WSPoint point = GetPreviousCharPoint(EditorRawDOMPoint(aNode, aOffset));
|
||||
WSPoint point = GetPreviousCharPoint(aPoint);
|
||||
// When it's a non-empty text node, return it.
|
||||
if (point.mTextNode && point.mTextNode->Length()) {
|
||||
*outVisNode = point.mTextNode;
|
||||
|
@ -544,10 +572,9 @@ WSRunObject::PriorVisibleNode(nsINode* aNode,
|
|||
*outType = mStartReason;
|
||||
}
|
||||
|
||||
|
||||
template<typename PT, typename CT>
|
||||
void
|
||||
WSRunObject::NextVisibleNode(nsINode* aNode,
|
||||
int32_t aOffset,
|
||||
WSRunObject::NextVisibleNode(const EditorDOMPointBase<PT, CT>& aPoint,
|
||||
nsCOMPtr<nsINode>* outVisNode,
|
||||
int32_t* outVisOffset,
|
||||
WSType* outType)
|
||||
|
@ -555,14 +582,14 @@ WSRunObject::NextVisibleNode(nsINode* aNode,
|
|||
// Find first visible thing after the point. Position
|
||||
// outVisNode/outVisOffset just _before_ that thing. If we don't find
|
||||
// anything return end of ws.
|
||||
MOZ_ASSERT(aNode && outVisNode && outVisOffset && outType);
|
||||
MOZ_ASSERT(aPoint.IsSet() && outVisNode && outVisOffset && outType);
|
||||
|
||||
WSFragment* run = FindNearestRun(EditorRawDOMPoint(aNode, aOffset), true);
|
||||
WSFragment* run = FindNearestRun(aPoint, true);
|
||||
|
||||
// Is there a visible run there or later?
|
||||
for (; run; run = run->mRight) {
|
||||
if (run->mType == WSType::normalWS) {
|
||||
WSPoint point = GetNextCharPoint(EditorRawDOMPoint(aNode, aOffset));
|
||||
WSPoint point = GetNextCharPoint(aPoint);
|
||||
// When it's a non-empty text node, return it.
|
||||
if (point.mTextNode && point.mTextNode->Length()) {
|
||||
*outVisNode = point.mTextNode;
|
||||
|
@ -1387,8 +1414,9 @@ WSRunObject::DeleteRange(const EditorRawDOMPoint& aStartPoint,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
template<typename PT, typename CT>
|
||||
WSRunObject::WSPoint
|
||||
WSRunObject::GetNextCharPoint(const EditorRawDOMPoint& aPoint)
|
||||
WSRunObject::GetNextCharPoint(const EditorDOMPointBase<PT, CT>& aPoint)
|
||||
{
|
||||
MOZ_ASSERT(aPoint.IsSetAndValid());
|
||||
|
||||
|
@ -1401,8 +1429,9 @@ WSRunObject::GetNextCharPoint(const EditorRawDOMPoint& aPoint)
|
|||
return GetNextCharPoint(WSPoint(mNodeArray[idx], aPoint.Offset(), 0));
|
||||
}
|
||||
|
||||
template<typename PT, typename CT>
|
||||
WSRunObject::WSPoint
|
||||
WSRunObject::GetPreviousCharPoint(const EditorRawDOMPoint& aPoint)
|
||||
WSRunObject::GetPreviousCharPoint(const EditorDOMPointBase<PT, CT>& aPoint)
|
||||
{
|
||||
MOZ_ASSERT(aPoint.IsSetAndValid());
|
||||
|
||||
|
@ -1592,8 +1621,9 @@ WSRunObject::GetASCIIWhitespacesBounds(int16_t aDir,
|
|||
*outEndOffset = endOffset;
|
||||
}
|
||||
|
||||
template<typename PT, typename CT>
|
||||
WSRunObject::WSFragment*
|
||||
WSRunObject::FindNearestRun(const EditorRawDOMPoint& aPoint,
|
||||
WSRunObject::FindNearestRun(const EditorDOMPointBase<PT, CT>& aPoint,
|
||||
bool aForward)
|
||||
{
|
||||
MOZ_ASSERT(aPoint.IsSetAndValid());
|
||||
|
@ -1645,8 +1675,9 @@ WSRunObject::GetCharAt(Text* aTextNode,
|
|||
return aTextNode->GetText()->CharAt(aOffset);
|
||||
}
|
||||
|
||||
template<typename PT, typename CT>
|
||||
WSRunObject::WSPoint
|
||||
WSRunObject::GetNextCharPointInternal(const EditorRawDOMPoint& aPoint)
|
||||
WSRunObject::GetNextCharPointInternal(const EditorDOMPointBase<PT, CT>& aPoint)
|
||||
{
|
||||
// Note: only to be called if aPoint.GetContainer() is not a ws node.
|
||||
|
||||
|
@ -1693,8 +1724,10 @@ WSRunObject::GetNextCharPointInternal(const EditorRawDOMPoint& aPoint)
|
|||
return GetNextCharPoint(point);
|
||||
}
|
||||
|
||||
template<typename PT, typename CT>
|
||||
WSRunObject::WSPoint
|
||||
WSRunObject::GetPreviousCharPointInternal(const EditorRawDOMPoint& aPoint)
|
||||
WSRunObject::GetPreviousCharPointInternal(
|
||||
const EditorDOMPointBase<PT, CT>& aPoint)
|
||||
{
|
||||
// Note: only to be called if aNode is not a ws node.
|
||||
|
||||
|
|
|
@ -163,6 +163,9 @@ public:
|
|||
enum {eAfter = 1 << 1};
|
||||
enum {eBoth = eBefore | eAfter};
|
||||
|
||||
template<typename PT, typename CT>
|
||||
WSRunObject(HTMLEditor* aHTMLEditor,
|
||||
const EditorDOMPointBase<PT, CT>& aPoint);
|
||||
WSRunObject(HTMLEditor* aHTMLEditor, nsINode* aNode, int32_t aOffset);
|
||||
~WSRunObject();
|
||||
|
||||
|
@ -269,22 +272,22 @@ public:
|
|||
// makes any needed conversion to adjacent ws to retain its significance.
|
||||
nsresult DeleteWSForward();
|
||||
|
||||
// PriorVisibleNode returns the first piece of visible thing before
|
||||
// {aNode,aOffset}. If there is no visible ws qualifying it returns what
|
||||
// is before the ws run. Note that {outVisNode,outVisOffset} is set to
|
||||
// just AFTER the visible object.
|
||||
void PriorVisibleNode(nsINode* aNode,
|
||||
int32_t aOffset,
|
||||
// PriorVisibleNode() returns the first piece of visible thing before aPoint.
|
||||
// If there is no visible ws qualifying it returns what is before the ws run.
|
||||
// Note that {outVisNode,outVisOffset} is set to just AFTER the visible
|
||||
// object.
|
||||
template<typename PT, typename CT>
|
||||
void PriorVisibleNode(const EditorDOMPointBase<PT, CT>& aPoint,
|
||||
nsCOMPtr<nsINode>* outVisNode,
|
||||
int32_t* outVisOffset,
|
||||
WSType* outType);
|
||||
|
||||
// NextVisibleNode returns the first piece of visible thing after
|
||||
// {aNode,aOffset}. If there is no visible ws qualifying it returns what
|
||||
// is after the ws run. Note that {outVisNode,outVisOffset} is set to just
|
||||
// BEFORE the visible object.
|
||||
void NextVisibleNode(nsINode* aNode,
|
||||
int32_t aOffset,
|
||||
// NextVisibleNode() returns the first piece of visible thing after aPoint.
|
||||
// If there is no visible ws qualifying it returns what is after the ws run.
|
||||
// Note that {outVisNode,outVisOffset} is set to just BEFORE the visible
|
||||
// object.
|
||||
template<typename PT, typename CT>
|
||||
void NextVisibleNode(const EditorDOMPointBase<PT, CT>& aPoint,
|
||||
nsCOMPtr<nsINode>* outVisNode,
|
||||
int32_t* outVisOffset,
|
||||
WSType* outType);
|
||||
|
@ -385,14 +388,16 @@ protected:
|
|||
* GetNextCharPoint() returns next character's point of aPoint. If there is
|
||||
* no character after aPoint, mTextNode is set to nullptr.
|
||||
*/
|
||||
WSPoint GetNextCharPoint(const EditorRawDOMPoint& aPoint);
|
||||
template<typename PT, typename CT>
|
||||
WSPoint GetNextCharPoint(const EditorDOMPointBase<PT, CT>& aPoint);
|
||||
WSPoint GetNextCharPoint(const WSPoint& aPoint);
|
||||
|
||||
/**
|
||||
* GetPreviousCharPoint() returns previous character's point of of aPoint.
|
||||
* If there is no character before aPoint, mTextNode is set to nullptr.
|
||||
*/
|
||||
WSPoint GetPreviousCharPoint(const EditorRawDOMPoint& aPoint);
|
||||
template<typename PT, typename CT>
|
||||
WSPoint GetPreviousCharPoint(const EditorDOMPointBase<PT, CT>& aPoint);
|
||||
WSPoint GetPreviousCharPoint(const WSPoint& aPoint);
|
||||
|
||||
/**
|
||||
|
@ -404,8 +409,11 @@ protected:
|
|||
* Then, will call GetNextCharPoint(const WSPoint&) or
|
||||
* GetPreviousCharPoint(const WSPoint&) and returns its result.
|
||||
*/
|
||||
WSPoint GetNextCharPointInternal(const EditorRawDOMPoint& aPoint);
|
||||
WSPoint GetPreviousCharPointInternal(const EditorRawDOMPoint& aPoint);
|
||||
template<typename PT, typename CT>
|
||||
WSPoint GetNextCharPointInternal(const EditorDOMPointBase<PT, CT>& aPoint);
|
||||
template<typename PT, typename CT>
|
||||
WSPoint
|
||||
GetPreviousCharPointInternal(const EditorDOMPointBase<PT, CT>& aPoint);
|
||||
|
||||
/**
|
||||
* InsertNBSPAndRemoveFollowingASCIIWhitespaces() inserts an NBSP first.
|
||||
|
@ -463,7 +471,9 @@ protected:
|
|||
* if aPoint is before the first run, returns nullptr.
|
||||
* if aPoint is after the last run, returns the last run.
|
||||
*/
|
||||
WSFragment* FindNearestRun(const EditorRawDOMPoint& aPoint, bool aForward);
|
||||
template<typename PT, typename CT>
|
||||
WSFragment* FindNearestRun(const EditorDOMPointBase<PT, CT>& aPoint,
|
||||
bool aForward);
|
||||
|
||||
char16_t GetCharAt(dom::Text* aTextNode, int32_t aOffset);
|
||||
nsresult CheckTrailingNBSPOfRun(WSFragment *aRun);
|
||||
|
|
|
@ -1497,7 +1497,7 @@ nsresult mozInlineSpellChecker::DoSpellCheck(mozInlineSpellWordUtil& aWordUtil,
|
|||
|
||||
// check spelling and add to selection if misspelled
|
||||
bool isMisspelled;
|
||||
aWordUtil.NormalizeWord(wordText);
|
||||
mozInlineSpellWordUtil::NormalizeWord(wordText);
|
||||
nsresult rv = mSpellCheck->CheckCurrentWordNoSuggest(wordText,
|
||||
&isMisspelled);
|
||||
if (NS_FAILED(rv))
|
||||
|
|
|
@ -53,7 +53,7 @@ mozSpellChecker::~mozSpellChecker()
|
|||
|
||||
if (mEngine) {
|
||||
MOZ_ASSERT(XRE_IsContentProcess());
|
||||
mEngine->Send__delete__(mEngine);
|
||||
RemoteSpellcheckEngineChild::Send__delete__(mEngine);
|
||||
MOZ_ASSERT(!mEngine);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ GLReadTexImageHelper::DidGLErrorOccur(const char* str)
|
|||
GLenum error = mGL->fGetError();
|
||||
if (error != LOCAL_GL_NO_ERROR) {
|
||||
printf_stderr("GL ERROR: %s (0x%04x) %s\n",
|
||||
mGL->GLErrorToString(error), error, str);
|
||||
GLContext::GLErrorToString(error), error, str);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ SharedDIB::IsValid()
|
|||
if (!mShMem)
|
||||
return false;
|
||||
|
||||
return mShMem->IsHandleValid(mShMem->handle());
|
||||
return base::SharedMemory::IsHandleValid(mShMem->handle());
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -138,7 +138,7 @@ nsFontMetrics::nsFontMetrics(const nsFont& aFont, const Params& aParams,
|
|||
aFont.AddFontVariationsToStyle(&style);
|
||||
|
||||
gfxFloat devToCssSize = gfxFloat(mP2A) /
|
||||
gfxFloat(mDeviceContext->AppUnitsPerCSSPixel());
|
||||
gfxFloat(nsDeviceContext::AppUnitsPerCSSPixel());
|
||||
mFontGroup = gfxPlatform::GetPlatform()->
|
||||
CreateFontGroup(aFont.fontlist, &style, aParams.textPerf,
|
||||
aParams.userFontSet, devToCssSize);
|
||||
|
|
|
@ -29,10 +29,7 @@ impl Example for App {
|
|||
_document_id: DocumentId,
|
||||
) {
|
||||
let bounds = (0, 0).to(1920, 1080);
|
||||
let info = LayoutPrimitiveInfo {
|
||||
local_clip: LocalClip::Rect(bounds),
|
||||
.. LayoutPrimitiveInfo::new(bounds)
|
||||
};
|
||||
let info = LayoutPrimitiveInfo::new(bounds);
|
||||
|
||||
builder.push_stacking_context(
|
||||
&info,
|
||||
|
|
|
@ -41,20 +41,12 @@ impl Example for App {
|
|||
) {
|
||||
// Create a 200x200 stacking context with an animated transform property.
|
||||
let bounds = (0, 0).to(200, 200);
|
||||
let complex_clip = ComplexClipRegion {
|
||||
rect: bounds,
|
||||
radii: BorderRadius::uniform(50.0),
|
||||
mode: ClipMode::Clip,
|
||||
};
|
||||
let info = LayoutPrimitiveInfo {
|
||||
local_clip: LocalClip::RoundedRect(bounds, complex_clip),
|
||||
.. LayoutPrimitiveInfo::new(bounds)
|
||||
};
|
||||
|
||||
let filters = vec![
|
||||
FilterOp::Opacity(PropertyBinding::Binding(self.opacity_key), self.opacity),
|
||||
];
|
||||
|
||||
let info = LayoutPrimitiveInfo::new(bounds);
|
||||
builder.push_stacking_context(
|
||||
&info,
|
||||
ScrollPolicy::Scrollable,
|
||||
|
@ -65,9 +57,19 @@ impl Example for App {
|
|||
filters,
|
||||
);
|
||||
|
||||
let complex_clip = ComplexClipRegion {
|
||||
rect: bounds,
|
||||
radii: BorderRadius::uniform(50.0),
|
||||
mode: ClipMode::Clip,
|
||||
};
|
||||
let clip_id = builder.define_clip(bounds, vec![complex_clip], None);
|
||||
builder.push_clip_id(clip_id);
|
||||
|
||||
// Fill it with a white rect
|
||||
builder.push_rect(&info, ColorF::new(0.0, 1.0, 0.0, 1.0));
|
||||
|
||||
builder.pop_clip_id();
|
||||
|
||||
builder.pop_stacking_context();
|
||||
}
|
||||
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче