Merge mozilla-central to autoland

--HG--
rename : browser/base/content/test/general/browser_bug1064280_changeUrlInPinnedTab.js => browser/base/content/test/tabs/browser_navigatePinnedTab.js
rename : js/src/jit-test/tests/wasm/spec.js => js/src/jit-test/tests/wasm/wast.js
extra : rebase_source : 30ebe4e98435a1fd70b26908584d608587d969d9
This commit is contained in:
Carsten "Tomcat" Book 2016-11-24 16:47:36 +01:00
commit 4945f89da4
318 changed files with 18755 additions and 16339 deletions

View File

@ -10,7 +10,7 @@ support-files =
[browser_shutdown_multi_acc_reference_doc.js]
[browser_shutdown_multi_reference.js]
[browser_shutdown_parent_own_reference.js]
skip-if = !e10s # e10s specific test for a11y start/shutdown between parent and content.
skip-if = !e10s || (os == 'win' && os_version == '5.1') # e10s specific test for a11y start/shutdown between parent and content.
[browser_shutdown_proxy_acc_reference.js]
skip-if = !e10s || (os == 'win') # e10s specific test for a11y start/shutdown between parent and content.
[browser_shutdown_proxy_doc_acc_reference.js]
@ -20,10 +20,10 @@ skip-if = !e10s || (os == 'win') # e10s specific test for a11y start/shutdown be
[browser_shutdown_multi_proxy_acc_reference_obj.js]
skip-if = !e10s || (os == 'win') # e10s specific test for a11y start/shutdown between parent and content.
[browser_shutdown_remote_no_reference.js]
skip-if = !e10s # e10s specific test for a11y start/shutdown between parent and content.
skip-if = !e10s || (os == 'win' && os_version == '5.1') # e10s specific test for a11y start/shutdown between parent and content.
[browser_shutdown_remote_only.js]
skip-if = !e10s # e10s specific test for a11y start/shutdown between parent and content.
skip-if = !e10s || (os == 'win' && os_version == '5.1') # e10s specific test for a11y start/shutdown between parent and content.
[browser_shutdown_remote_own_reference.js]
skip-if = !e10s # e10s specific test for a11y start/shutdown between parent and content.
skip-if = !e10s || (os == 'win' && os_version == '5.1') # e10s specific test for a11y start/shutdown between parent and content.
[browser_shutdown_scope_lifecycle.js]
[browser_shutdown_start_restart.js]

View File

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<blocklist lastupdate="1479908016230" xmlns="http://www.mozilla.org/2006/addons-blocklist">
<blocklist lastupdate="1479994717581" xmlns="http://www.mozilla.org/2006/addons-blocklist">
<emItems>
<emItem blockID="i545" id="superlrcs@svenyor.net">
<prefs/>

View File

@ -272,7 +272,6 @@ tags = mcb
[browser_bug970746.js]
[browser_bug1015721.js]
skip-if = os == 'win'
[browser_bug1064280_changeUrlInPinnedTab.js]
[browser_accesskeys.js]
[browser_clipboard.js]
subsuite = clipboard

View File

@ -8,6 +8,7 @@ support-files =
[browser_newtab_block.js]
[browser_newtab_bug721442.js]
[browser_newtab_bug722273.js]
skip-if = (os == "mac" && debug) # temporary skip-if due to increase in intermittent failures on Mac debug - bug 1119906
[browser_newtab_bug723102.js]
[browser_newtab_bug723121.js]
[browser_newtab_bug725996.js]

View File

@ -2,3 +2,4 @@
skip-if = !e10s # Tab spinner is e10s only.
[browser_tabSwitchPrintPreview.js]
skip-if = os == 'mac'
[browser_navigatePinnedTab.js]

View File

@ -29,8 +29,31 @@ add_task(function* () {
is(appTab.linkedBrowser.currentURI.spec, TEST_LINK_CHANGED,
"New page loaded in the app tab");
is(gBrowser.tabs.length, initialTabsNo, "No additional tabs were opened");
// Now check that opening a link that does create a new tab works,
// and also that it nulls out the opener.
let pageLoadPromise = BrowserTestUtils.browserLoaded(appTab.linkedBrowser, "http://example.com/");
yield BrowserTestUtils.loadURI(appTab.linkedBrowser, "http://example.com/");
info("Started loading example.com");
yield pageLoadPromise;
info("Loaded example.com");
let newTabPromise = BrowserTestUtils.waitForNewTab(gBrowser, "http://example.org/");
yield ContentTask.spawn(browser, null, function* () {
let link = content.document.createElement("a");
link.href = "http://example.org/";
content.document.body.appendChild(link);
link.click();
});
info("Created & clicked link");
let extraTab = yield newTabPromise;
info("Got a new tab");
yield ContentTask.spawn(extraTab.linkedBrowser, null, function* () {
is(content.opener, null, "No opener should be available");
});
yield BrowserTestUtils.removeTab(extraTab);
});
registerCleanupFunction(function() {
gBrowser.removeTab(gBrowser.selectedTab);
});

View File

@ -14,7 +14,8 @@
!define URLInfoAbout "https://www.mozilla.org"
!define HelpLink "https://support.mozilla.org"
!define URLStubDownload "http://download.mozilla.org/?os=win&lang=${AB_CD}&product=firefox-aurora-latest"
!define URLStubDownload32 "http://download.mozilla.org/?os=win&lang=${AB_CD}&product=firefox-aurora-latest"
!define URLStubDownload64 "http://download.mozilla.org/?os=win64&lang=${AB_CD}&product=firefox-aurora-latest"
!define URLManualDownload "https://www.mozilla.org/${AB_CD}/firefox/installer-help/?channel=aurora&installer_lang=${AB_CD}"
!define URLSystemRequirements "https://www.mozilla.org/firefox/system-requirements/"
!define Channel "aurora"

View File

@ -13,7 +13,8 @@
!define URLInfoAbout "https://www.mozilla.org"
!define HelpLink "https://support.mozilla.org"
!define URLStubDownload "http://download.mozilla.org/?os=win&lang=${AB_CD}&product=firefox-nightly-latest"
!define URLStubDownload32 "http://download.mozilla.org/?os=win&lang=${AB_CD}&product=firefox-nightly-latest"
!define URLStubDownload64 "http://download.mozilla.org/?os=win64&lang=${AB_CD}&product=firefox-nightly-latest"
!define URLManualDownload "https://www.mozilla.org/${AB_CD}/firefox/installer-help/?channel=nightly&installer_lang=${AB_CD}"
!define URLSystemRequirements "https://www.mozilla.org/firefox/system-requirements/"
!define Channel "nightly"

View File

@ -18,7 +18,8 @@
; Beta since they share the same branding when building with other branches that
; set the update channel to beta.
!define OFFICIAL
!define URLStubDownload "http://download.mozilla.org/?os=win&lang=${AB_CD}&product=firefox-latest"
!define URLStubDownload32 "http://download.mozilla.org/?os=win&lang=${AB_CD}&product=firefox-latest"
!define URLStubDownload64 "http://download.mozilla.org/?os=win64&lang=${AB_CD}&product=firefox-latest"
!define URLManualDownload "https://www.mozilla.org/${AB_CD}/firefox/installer-help/?channel=release&installer_lang=${AB_CD}"
!define URLSystemRequirements "https://www.mozilla.org/firefox/system-requirements/"
!define Channel "release"

View File

@ -13,7 +13,8 @@
!define URLInfoAbout "https://www.mozilla.org"
!define HelpLink "https://support.mozilla.org"
!define URLStubDownload "http://download.mozilla.org/?os=win&lang=${AB_CD}&product=firefox-latest"
!define URLStubDownload32 "http://download.mozilla.org/?os=win&lang=${AB_CD}&product=firefox-latest"
!define URLStubDownload64 "http://download.mozilla.org/?os=win64&lang=${AB_CD}&product=firefox-latest"
!define URLManualDownload "https://www.mozilla.org/${AB_CD}/firefox/installer-help/?channel=release&installer_lang=${AB_CD}"
!define URLSystemRequirements "https://www.mozilla.org/firefox/system-requirements/"
!define Channel "unofficial"

View File

@ -22,13 +22,26 @@ add_task(function* test() {
openTabInUserContext(1);
is(ContextualIdentityService.countContainerTabs(), 1, "1 container tab created");
is(ContextualIdentityService.countContainerTabs(1), 1, "1 container tab created with id 1");
is(ContextualIdentityService.countContainerTabs(2), 0, "0 container tabs created with id 2");
openTabInUserContext(1);
is(ContextualIdentityService.countContainerTabs(), 2, "2 container tab created");
is(ContextualIdentityService.countContainerTabs(), 2, "2 container tabs created");
is(ContextualIdentityService.countContainerTabs(1), 2, "2 container tabs created with id 1");
is(ContextualIdentityService.countContainerTabs(2), 0, "0 container tabs created with id 2");
openTabInUserContext(2);
is(ContextualIdentityService.countContainerTabs(), 3, "3 container tab created");
is(ContextualIdentityService.countContainerTabs(1), 2, "2 container tabs created with id 1");
is(ContextualIdentityService.countContainerTabs(2), 1, "1 container tab created with id 2");
ContextualIdentityService.closeAllContainerTabs();
is(ContextualIdentityService.countContainerTabs(), 0, "0 container tab at the end.");
ContextualIdentityService.closeContainerTabs(1);
is(ContextualIdentityService.countContainerTabs(), 1, "1 container tab created");
is(ContextualIdentityService.countContainerTabs(1), 0, "0 container tabs created with id 1");
is(ContextualIdentityService.countContainerTabs(2), 1, "1 container tab created with id 2");
ContextualIdentityService.closeContainerTabs();
is(ContextualIdentityService.countContainerTabs(), 0, "0 container tabs at the end.");
is(ContextualIdentityService.countContainerTabs(1), 0, "0 container tabs at the end with id 1.");
is(ContextualIdentityService.countContainerTabs(2), 0, "0 container tabs at the end with id 2.");
});

View File

@ -39,10 +39,34 @@ let gContainersPane = {
},
onRemoveClick(button) {
let userContextId = button.getAttribute("value");
let userContextId = parseInt(button.getAttribute("value"), 10);
let count = ContextualIdentityService.countContainerTabs(userContextId);
if (count > 0) {
let bundlePreferences = document.getElementById("bundlePreferences");
let title = bundlePreferences.getString("removeContainerAlertTitle");
let message = PluralForm.get(count, bundlePreferences.getString("removeContainerMsg"))
.replace("#S", count)
let okButton = bundlePreferences.getString("removeContainerOkButton");
let cancelButton = bundlePreferences.getString("removeContainerButton2");
let buttonFlags = (Ci.nsIPrompt.BUTTON_TITLE_IS_STRING * Ci.nsIPrompt.BUTTON_POS_0) +
(Ci.nsIPrompt.BUTTON_TITLE_IS_STRING * Ci.nsIPrompt.BUTTON_POS_1);
let rv = Services.prompt.confirmEx(window, title, message, buttonFlags,
okButton, cancelButton, null, null, {});
if (rv != 0) {
return;
}
ContextualIdentityService.closeContainerTabs(userContextId);
}
ContextualIdentityService.remove(userContextId);
this._rebuildView();
},
onPeferenceClick(button) {
this.openPreferenceDialog(button.getAttribute("value"));
},

View File

@ -104,7 +104,7 @@ var gPrivacyPane = {
let rv = Services.prompt.confirmEx(window, title, message, buttonFlags,
okButton, cancelButton, null, null, {});
if (rv == 0) {
ContextualIdentityService.closeAllContainerTabs();
ContextualIdentityService.closeContainerTabs();
Services.prefs.setBoolPref("privacy.userContext.enabled", false);
return;
}

View File

@ -35,11 +35,10 @@ Var LabelDownloading
Var LabelInstalling
Var LabelFreeSpace
Var CheckboxSetAsDefault
Var CheckboxShortcutOnBar ; Used for Quicklaunch or Taskbar as appropriate
Var CheckboxShortcutInStartMenu
Var CheckboxShortcutOnDesktop
Var CheckboxShortcuts
Var CheckboxSendPing
Var CheckboxInstallMaintSvc
Var DroplistArch
Var DirRequest
Var ButtonBrowse
Var LabelBlurb1
@ -73,7 +72,6 @@ Var InstallStepSize
Var InstallTotalSteps
Var ProgressCompleted
Var ProgressTotal
Var TmpVal
Var ExitCode
Var FirefoxLaunchCode
@ -108,6 +106,8 @@ Var DownloadRetryCount
Var OpenedDownloadPage
Var DownloadServerIP
Var PostSigningData
Var PreviousInstallDir
Var PreviousInstallArch
Var ControlHeightPX
Var ControlRightPX
@ -218,6 +218,9 @@ Var ControlRightPX
!define INVALID_HANDLE_VALUE -1
!endif
!define DefaultInstDir32bit "$PROGRAMFILES32\${BrandFullName}"
!define DefaultInstDir64bit "$PROGRAMFILES64\${BrandFullName}"
!include "nsDialogs.nsh"
!include "LogicLib.nsh"
!include "FileFunc.nsh"
@ -230,6 +233,9 @@ Var ControlRightPX
!insertmacro LineFind
!insertmacro StrFilter
!include "StrFunc.nsh"
${StrTok}
!include "locales.nsi"
!include "branding.nsi"
@ -243,8 +249,10 @@ Var ControlRightPX
; set the update channel to beta.
!ifdef OFFICIAL
!ifdef BETA_UPDATE_CHANNEL
!undef URLStubDownload
!define URLStubDownload "http://download.mozilla.org/?os=win&lang=${AB_CD}&product=firefox-beta-latest"
!undef URLStubDownload32
!undef URLStubDownload64
!define URLStubDownload32 "http://download.mozilla.org/?os=win&lang=${AB_CD}&product=firefox-beta-latest"
!define URLStubDownload64 "http://download.mozilla.org/?os=win64&lang=${AB_CD}&product=firefox-beta-latest"
!undef URLManualDownload
!define URLManualDownload "https://www.mozilla.org/${AB_CD}/firefox/installer-help/?channel=beta&installer_lang=${AB_CD}"
!undef Channel
@ -275,11 +283,6 @@ icon "setup.ico"
XPStyle on
BrandingText " "
ChangeUI all "nsisui.exe"
!ifdef HAVE_64BIT_BUILD
InstallDir "$PROGRAMFILES64\${BrandFullName}\"
!else
InstallDir "$PROGRAMFILES32\${BrandFullName}\"
!endif
!ifdef ${AB_CD}_rtl
LoadLanguageFile "locale-rtl.nlf"
@ -340,9 +343,11 @@ Function .onInit
Quit
${EndIf}
!ifdef HAVE_64BIT_BUILD
SetRegView 64
!endif
${If} ${RunningX64}
StrCpy $INSTDIR "${DefaultInstDir64bit}"
${Else}
StrCpy $INSTDIR "${DefaultInstDir32bit}"
${EndIf}
; Require elevation if the user can elevate
${ElevateUAC}
@ -355,16 +360,25 @@ Function .onInit
${EndIf}
!endif
; If we have any existing installation, use its location as the default
; path for this install, even if it's not the same architecture.
SetRegView 32
SetShellVarContext all ; Set SHCTX to HKLM
${GetSingleInstallPath} "Software\Mozilla\${BrandFullNameInternal}" $R9
${If} "$R9" == "false"
${AndIf} ${RunningX64}
SetRegView 64
${GetSingleInstallPath} "Software\Mozilla\${BrandFullNameInternal}" $R9
${EndIf}
${If} "$R9" == "false"
SetShellVarContext current ; Set SHCTX to HKCU
${GetSingleInstallPath} "Software\Mozilla\${BrandFullNameInternal}" $R9
${If} ${RunningX64}
; In HKCU there is no WOW64 redirection, which means we may have gotten
; the path to a 32-bit install even though we're 64-bit, or vice-versa.
; the path to a 32-bit install even though we're 64-bit.
; In that case, just use the default path instead of offering an upgrade.
; But only do that override if the existing install is in Program Files,
; because that's the only place we can be sure is specific
@ -372,20 +386,36 @@ Function .onInit
; The WordFind syntax below searches for the first occurence of the
; "delimiter" (the Program Files path) in the install path and returns
; anything that appears before that. If nothing appears before that,
; then the install is under Program Files (32 or 64).
!ifdef HAVE_64BIT_BUILD
; then the install is under Program Files.
${WordFind} $R9 $PROGRAMFILES32 "+1{" $0
!else
${WordFind} $R9 $PROGRAMFILES64 "+1{" $0
!endif
${If} $0 == ""
StrCpy $R9 "false"
${EndIf}
${EndIf}
${EndIf}
StrCpy $PreviousInstallDir ""
StrCpy $PreviousInstallArch ""
${If} "$R9" != "false"
StrCpy $INSTDIR "$R9"
; Don't override the default install path with an existing installation
; of a different architecture.
System::Call "*(i)p.r0"
StrCpy $1 "$R9\${FileMainEXE}"
System::Call "Kernel32::GetBinaryTypeW(w r1, p r0)i"
System::Call "*$0(i.r2)"
System::Free $0
${If} $2 == "6" ; 6 == SCS_64BIT_BINARY
${AndIf} ${RunningX64}
StrCpy $PreviousInstallDir "$R9"
StrCpy $PreviousInstallArch "64"
StrCpy $INSTDIR "$PreviousInstallDir"
${ElseIf} $2 == "0" ; 0 == SCS_32BIT_BINARY
${AndIfNot} ${RunningX64}
StrCpy $PreviousInstallDir "$R9"
StrCpy $PreviousInstallArch "32"
StrCpy $INSTDIR "$PreviousInstallDir"
${EndIf}
${EndIf}
; Used to determine if the default installation directory was used.
@ -422,9 +452,7 @@ Function .onInit
StrCpy $InitialInstallRequirementsCode ""
StrCpy $IsDownloadFinished ""
StrCpy $FirefoxLaunchCode "0"
StrCpy $CheckboxShortcutOnBar "1"
StrCpy $CheckboxShortcutInStartMenu "1"
StrCpy $CheckboxShortcutOnDesktop "1"
StrCpy $CheckboxShortcuts "1"
StrCpy $CheckboxSendPing "1"
!ifdef MOZ_MAINTENANCE_SERVICE
StrCpy $CheckboxInstallMaintSvc "1"
@ -432,6 +460,11 @@ Function .onInit
StrCpy $CheckboxInstallMaintSvc "0"
!endif
StrCpy $WasOptionsButtonClicked "0"
${If} ${RunningX64}
StrCpy $DroplistArch "$(VERSION_64BIT)"
${Else}
StrCpy $DroplistArch "$(VERSION_32BIT)"
${EndIf}
StrCpy $0 ""
!ifdef FONT_FILE1
@ -575,11 +608,11 @@ Function SendPing
; completion of all phases.
${GetSecondsElapsed} "$EndInstallPhaseTickCount" "$EndFinishPhaseTickCount" $4
!ifdef HAVE_64BIT_BUILD
StrCpy $R0 "1"
!else
StrCpy $R0 "0"
!endif
${If} $DroplistArch == "$(VERSION_64BIT)"
StrCpy $R0 "1"
${Else}
StrCpy $R0 "0"
${EndIf}
${If} ${RunningX64}
StrCpy $R1 "1"
@ -903,54 +936,13 @@ Function createOptions
; background colors of the Dialog must also be hardcoded.
SetCtlColors $Dialog ${COMMON_TEXT_COLOR_NORMAL} ${COMMON_BKGRD_COLOR}
${NSD_CreateLabel} ${OPTIONS_ITEM_EDGE_DU} 18u ${OPTIONS_ITEM_WIDTH_DU} \
12u "$(CREATE_SHORTCUTS)"
Pop $0
SetCtlColors $0 ${COMMON_TEXT_COLOR_NORMAL} ${COMMON_BKGRD_COLOR}
SendMessage $0 ${WM_SETFONT} $FontNormal 0
${If} ${AtLeastWin7}
StrCpy $0 "$(ADD_SC_TASKBAR)"
${Else}
StrCpy $0 "$(ADD_SC_QUICKLAUNCHBAR)"
${EndIf}
${NSD_CreateCheckbox} ${OPTIONS_SUBITEM_EDGE_DU} 38u \
${OPTIONS_SUBITEM_WIDTH_DU} 12u "$0"
Pop $CheckboxShortcutOnBar
; The uxtheme must be disabled on checkboxes in order to override the system
; font color.
System::Call 'uxtheme::SetWindowTheme(i $CheckboxShortcutOnBar, w " ", w " ")'
SetCtlColors $CheckboxShortcutOnBar ${COMMON_TEXT_COLOR_NORMAL} ${COMMON_BKGRD_COLOR}
SendMessage $CheckboxShortcutOnBar ${WM_SETFONT} $FontNormal 0
${NSD_Check} $CheckboxShortcutOnBar
${NSD_CreateCheckbox} ${OPTIONS_SUBITEM_EDGE_DU} 54u ${OPTIONS_SUBITEM_WIDTH_DU} \
12u "$(ADD_CheckboxShortcutInStartMenu)"
Pop $CheckboxShortcutInStartMenu
; The uxtheme must be disabled on checkboxes in order to override the system
; font color.
System::Call 'uxtheme::SetWindowTheme(i $CheckboxShortcutInStartMenu, w " ", w " ")'
SetCtlColors $CheckboxShortcutInStartMenu ${COMMON_TEXT_COLOR_NORMAL} ${COMMON_BKGRD_COLOR}
SendMessage $CheckboxShortcutInStartMenu ${WM_SETFONT} $FontNormal 0
${NSD_Check} $CheckboxShortcutInStartMenu
${NSD_CreateCheckbox} ${OPTIONS_SUBITEM_EDGE_DU} 70u ${OPTIONS_SUBITEM_WIDTH_DU} \
12u "$(ADD_CheckboxShortcutOnDesktop)"
Pop $CheckboxShortcutOnDesktop
; The uxtheme must be disabled on checkboxes in order to override the system
; font color.
System::Call 'uxtheme::SetWindowTheme(i $CheckboxShortcutOnDesktop, w " ", w " ")'
SetCtlColors $CheckboxShortcutOnDesktop ${COMMON_TEXT_COLOR_NORMAL} ${COMMON_BKGRD_COLOR}
SendMessage $CheckboxShortcutOnDesktop ${WM_SETFONT} $FontNormal 0
${NSD_Check} $CheckboxShortcutOnDesktop
${NSD_CreateLabel} ${OPTIONS_ITEM_EDGE_DU} 100u ${OPTIONS_ITEM_WIDTH_DU} \
${NSD_CreateLabel} ${OPTIONS_ITEM_EDGE_DU} 25u ${OPTIONS_ITEM_WIDTH_DU} \
12u "$(DEST_FOLDER)"
Pop $0
SetCtlColors $0 ${COMMON_TEXT_COLOR_NORMAL} ${COMMON_BKGRD_COLOR}
SendMessage $0 ${WM_SETFONT} $FontNormal 0
${NSD_CreateDirRequest} ${OPTIONS_SUBITEM_EDGE_DU} 116u 159u 14u "$INSTDIR"
${NSD_CreateDirRequest} ${OPTIONS_SUBITEM_EDGE_DU} 41u 159u 14u "$INSTDIR"
Pop $DirRequest
SetCtlColors $DirRequest ${COMMON_TEXT_COLOR_NORMAL} ${COMMON_BKGRD_COLOR}
SendMessage $DirRequest ${WM_SETFONT} $FontNormal 0
@ -966,7 +958,7 @@ Function createOptions
${NSD_AddExStyle} $DirRequest ${WS_EX_LTRREADING}|${WS_EX_LEFT}
!endif
${NSD_CreateBrowseButton} 280u 116u 50u 14u "$(BROWSE_BUTTON)"
${NSD_CreateBrowseButton} 280u 41u 50u 14u "$(BROWSE_BUTTON)"
Pop $ButtonBrowse
SetCtlColors $ButtonBrowse "" ${COMMON_BKGRD_COLOR}
${NSD_OnClick} $ButtonBrowse OnClick_ButtonBrowse
@ -987,13 +979,13 @@ Function createOptions
IntOp $0 $0 + 8 ; Add padding to the control's width
; Make both controls the same width as the widest control
${NSD_CreateLabelCenter} ${OPTIONS_SUBITEM_EDGE_DU} 134u $0 $ControlHeightPX "$(SPACE_REQUIRED)"
${NSD_CreateLabelCenter} ${OPTIONS_SUBITEM_EDGE_DU} 59u $0 $ControlHeightPX "$(SPACE_REQUIRED)"
Pop $5
SetCtlColors $5 ${COMMON_TEXT_COLOR_FADED} ${COMMON_BKGRD_COLOR}
SendMessage $5 ${WM_SETFONT} $FontItalic 0
IntOp $2 $2 + 8 ; Add padding to the control's width
${NSD_CreateLabelCenter} ${OPTIONS_SUBITEM_EDGE_DU} 145u $2 $ControlHeightPX "$(SPACE_AVAILABLE)"
${NSD_CreateLabelCenter} ${OPTIONS_SUBITEM_EDGE_DU} 70u $2 $ControlHeightPX "$(SPACE_AVAILABLE)"
Pop $6
SetCtlColors $6 ${COMMON_TEXT_COLOR_FADED} ${COMMON_BKGRD_COLOR}
SendMessage $6 ${WM_SETFONT} $FontItalic 0
@ -1007,7 +999,7 @@ Function createOptions
IntOp $ControlRightPX $ControlRightPX + 6
${NSD_CreateLabel} $ControlRightPX 134u 100% $ControlHeightPX \
${NSD_CreateLabel} $ControlRightPX 59u 100% $ControlHeightPX \
"${APPROXIMATE_REQUIRED_SPACE_MB} $(MEGA)$(BYTE)"
Pop $7
SetCtlColors $7 ${COMMON_TEXT_COLOR_NORMAL} ${COMMON_BKGRD_COLOR}
@ -1015,14 +1007,29 @@ Function createOptions
; Create the free space label with an empty string and update it by calling
; UpdateFreeSpaceLabel
${NSD_CreateLabel} $ControlRightPX 145u 100% $ControlHeightPX " "
${NSD_CreateLabel} $ControlRightPX 70u 100% $ControlHeightPX " "
Pop $LabelFreeSpace
SetCtlColors $LabelFreeSpace ${COMMON_TEXT_COLOR_NORMAL} ${COMMON_BKGRD_COLOR}
SendMessage $LabelFreeSpace ${WM_SETFONT} $FontNormal 0
Call UpdateFreeSpaceLabel
${NSD_CreateCheckbox} ${OPTIONS_ITEM_EDGE_DU} 168u ${OPTIONS_SUBITEM_WIDTH_DU} \
${If} ${AtLeastWin7}
StrCpy $0 "$(ADD_SC_DESKTOP_TASKBAR)"
${Else}
StrCpy $0 "$(ADD_SC_DESKTOP_QUICKLAUNCHBAR)"
${EndIf}
${NSD_CreateCheckbox} ${OPTIONS_ITEM_EDGE_DU} 100u \
${OPTIONS_ITEM_WIDTH_DU} 12u "$0"
Pop $CheckboxShortcuts
; The uxtheme must be disabled on checkboxes in order to override the system
; font color.
System::Call 'uxtheme::SetWindowTheme(i $CheckboxShortcuts, w " ", w " ")'
SetCtlColors $CheckboxShortcuts ${COMMON_TEXT_COLOR_NORMAL} ${COMMON_BKGRD_COLOR}
SendMessage $CheckboxShortcuts ${WM_SETFONT} $FontNormal 0
${NSD_Check} $CheckboxShortcuts
${NSD_CreateCheckbox} ${OPTIONS_ITEM_EDGE_DU} 116u ${OPTIONS_SUBITEM_WIDTH_DU} \
12u "$(SEND_PING)"
Pop $CheckboxSendPing
; The uxtheme must be disabled on checkboxes in order to override the system
@ -1033,6 +1040,7 @@ Function createOptions
${NSD_Check} $CheckboxSendPing
!ifdef MOZ_MAINTENANCE_SERVICE
StrCpy $CheckboxInstallMaintSvc "0"
; We can only install the maintenance service if the user is an admin.
Call IsUserAdmin
Pop $0
@ -1045,31 +1053,100 @@ Function createOptions
StrCpy $0 "false"
${EndIf}
; Only show the maintenance service checkbox if we have write access to HKLM
ClearErrors
WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" \
"Write Test"
${If} ${Errors}
${OrIf} $0 != "true"
StrCpy $CheckboxInstallMaintSvc "0"
${Else}
${If} $0 == "true"
; Only show the maintenance service checkbox if we have write access to HKLM
DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest"
; Read the registry instead of using ServicesHelper::IsInstalled so the
; plugin isn't included in the stub installer to lessen its size.
ClearErrors
ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\services\MozillaMaintenance" "ImagePath"
${If} ${Errors}
${NSD_CreateCheckbox} ${OPTIONS_ITEM_EDGE_DU} 184u ${OPTIONS_ITEM_WIDTH_DU} \
12u "$(INSTALL_MAINT_SERVICE)"
Pop $CheckboxInstallMaintSvc
System::Call 'uxtheme::SetWindowTheme(i $CheckboxInstallMaintSvc, w " ", w " ")'
SetCtlColors $CheckboxInstallMaintSvc ${COMMON_TEXT_COLOR_NORMAL} ${COMMON_BKGRD_COLOR}
SendMessage $CheckboxInstallMaintSvc ${WM_SETFONT} $FontNormal 0
${NSD_Check} $CheckboxInstallMaintSvc
WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" \
"Write Test"
${IfNot} ${Errors}
DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest"
; Read the registry instead of using ServicesHelper::IsInstalled so the
; plugin isn't included in the stub installer to lessen its size.
ClearErrors
ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\services\MozillaMaintenance" "ImagePath"
${If} ${Errors}
${NSD_CreateCheckbox} ${OPTIONS_ITEM_EDGE_DU} 132u ${OPTIONS_ITEM_WIDTH_DU} \
12u "$(INSTALL_MAINT_SERVICE)"
Pop $CheckboxInstallMaintSvc
System::Call 'uxtheme::SetWindowTheme(i $CheckboxInstallMaintSvc, w " ", w " ")'
SetCtlColors $CheckboxInstallMaintSvc ${COMMON_TEXT_COLOR_NORMAL} ${COMMON_BKGRD_COLOR}
SendMessage $CheckboxInstallMaintSvc ${WM_SETFONT} $FontNormal 0
${NSD_Check} $CheckboxInstallMaintSvc
${EndIf}
${EndIf}
${EndIf}
!endif
${If} ${RunningX64}
; Get the exact pixel width we're going to need for this label.
; The label string has a keyboard accelerator, which is an '&' that's in
; the string but is not rendered, and GetTextExtent doesn't account for
; those, so remove them first. Also handle any escaped &'s ("&&").
StrCpy $R0 "$(ARCH_DROPLIST_LABEL)"
StrCpy $R1 ""
${Do}
${StrTok} $R2 $R0 "&" 0 0
StrCpy $R1 "$R1$R2"
StrLen $R3 $R2
IntOp $R3 $R3 + 1
StrCpy $R0 $R0 "" $R3
StrCpy $R4 $R0 1
${If} $R4 == "&"
StrCpy $R1 "$R1&"
StrCpy $R0 $R0 "" 1
${EndIf}
${LoopUntil} $R0 == ""
${GetTextExtent} $R1 $FontNormal $R0 $R1
${If} $CheckboxInstallMaintSvc == "0"
${NSD_CreateLabel} ${OPTIONS_ITEM_EDGE_DU} 134u $R0 $R1 "$(ARCH_DROPLIST_LABEL)"
${Else}
${NSD_CreateLabel} ${OPTIONS_ITEM_EDGE_DU} 154u $R0 $R1 "$(ARCH_DROPLIST_LABEL)"
${EndIf}
Pop $0
SetCtlColors $0 ${COMMON_TEXT_COLOR_NORMAL} ${COMMON_BKGRD_COLOR}
SendMessage $0 ${WM_SETFONT} $FontNormal 0
; Set the dropdown list size to the same as the larger of the two options.
${GetTextExtent} "$(VERSION_32BIT)" $FontNormal $R0 $R1
${GetTextExtent} "$(VERSION_64BIT)" $FontNormal $R2 $R3
${If} $R0 < $R2
StrCpy $R0 $R2
${EndIf}
${If} $R1 < $R3
StrCpy $R3 $R1
${EndIf}
; Add enough width for the dropdown button. How wide the button is depends
; on he system display scaling setting, which we cannot easily determine,
; so just use a value that works fine for a setting of 200% and adds a
; little too much padding for settings below that.
IntOp $R0 $R0 + 56
; Put the droplist right after the label, with some padding.
${GetDlgItemEndPX} $0 $ControlRightPX
IntOp $ControlRightPX $ControlRightPX + 4
${If} $CheckboxInstallMaintSvc == "0"
${NSD_CreateDropList} $ControlRightPX 132u $R0 $R3 ""
${Else}
${NSD_CreateDropList} $ControlRightPX 152u $R0 $R3 ""
${EndIf}
Pop $DroplistArch
${NSD_CB_AddString} $DroplistArch "$(VERSION_32BIT)"
${NSD_CB_AddString} $DroplistArch "$(VERSION_64BIT)"
${NSD_OnChange} $DroplistArch OnChange_DroplistArch
; The uxtheme must be disabled in order to override the system colors.
System::Call 'uxtheme::SetWindowTheme(i $DroplistArch, w " ", w " ")'
SetCtlColors $DroplistArch ${COMMON_TEXT_COLOR_NORMAL} ${COMMON_BKGRD_COLOR}
SendMessage $DroplistArch ${WM_SETFONT} $FontNormal 0
${If} ${RunningX64}
${NSD_CB_SelectString} $DroplistArch "$(VERSION_64BIT)"
${Else}
${NSD_CB_SelectString} $DroplistArch "$(VERSION_32BIT)"
${EndIf}
${EndIf}
GetDlgItem $0 $HWNDPARENT 1 ; Install button
${If} ${FileExists} "$INSTDIR\${FileMainEXE}"
SendMessage $0 ${WM_SETTEXT} 0 "STR:$(UPGRADE_BUTTON)"
@ -1137,9 +1214,8 @@ Function leaveOptions
IntOp $OptionsPhaseSeconds $OptionsPhaseSeconds + 1
${EndIf}
${NSD_GetState} $CheckboxShortcutOnBar $CheckboxShortcutOnBar
${NSD_GetState} $CheckboxShortcutInStartMenu $CheckboxShortcutInStartMenu
${NSD_GetState} $CheckboxShortcutOnDesktop $CheckboxShortcutOnDesktop
${NSD_GetState} $CheckboxShortcuts $CheckboxShortcuts
${NSD_GetText} $DroplistArch $DroplistArch
${NSD_GetState} $CheckboxSendPing $CheckboxSendPing
!ifdef MOZ_MAINTENANCE_SERVICE
${NSD_GetState} $CheckboxInstallMaintSvc $CheckboxInstallMaintSvc
@ -1334,8 +1410,15 @@ FunctionEnd
Function StartDownload
${NSD_KillTimer} StartDownload
InetBgDL::Get "${URLStubDownload}${URLStubDownloadAppend}" "$PLUGINSDIR\download.exe" \
/CONNECTTIMEOUT 120 /RECEIVETIMEOUT 120 /END
${If} $DroplistArch == "$(VERSION_64BIT)"
InetBgDL::Get "${URLStubDownload64}${URLStubDownloadAppend}" \
"$PLUGINSDIR\download.exe" \
/CONNECTTIMEOUT 120 /RECEIVETIMEOUT 120 /END
${Else}
InetBgDL::Get "${URLStubDownload32}${URLStubDownloadAppend}" \
"$PLUGINSDIR\download.exe" \
/CONNECTTIMEOUT 120 /RECEIVETIMEOUT 120 /END
${EndIf}
StrCpy $4 ""
${NSD_CreateTimer} OnDownload ${DownloadIntervalMS}
${If} ${FileExists} "$INSTDIR\${TO_BE_DELETED}"
@ -1556,23 +1639,18 @@ Function OnDownload
; Don't create the QuickLaunch or Taskbar shortcut from the launched installer
WriteINIStr "$PLUGINSDIR\${CONFIG_INI}" "Install" "QuickLaunchShortcut" "false"
; Either avoid or force adding a taskbar pin based on the checkbox value:
${If} $CheckboxShortcutOnBar == 0
; Always create a start menu shortcut, so the user always has some way
; to access the application.
WriteINIStr "$PLUGINSDIR\${CONFIG_INI}" "Install" "StartMenuShortcuts" "true"
; Either avoid or force adding a taskbar pin and desktop shortcut
; based on the checkbox value.
${If} $CheckboxShortcuts == 0
WriteINIStr "$PLUGINSDIR\${CONFIG_INI}" "Install" "TaskbarShortcut" "false"
WriteINIStr "$PLUGINSDIR\${CONFIG_INI}" "Install" "DesktopShortcut" "false"
${Else}
WriteINIStr "$PLUGINSDIR\${CONFIG_INI}" "Install" "TaskbarShortcut" "true"
${EndIf}
${If} $CheckboxShortcutOnDesktop == 1
WriteINIStr "$PLUGINSDIR\${CONFIG_INI}" "Install" "DesktopShortcut" "true"
${Else}
WriteINIStr "$PLUGINSDIR\${CONFIG_INI}" "Install" "DesktopShortcut" "false"
${EndIf}
${If} $CheckboxShortcutInStartMenu == 1
WriteINIStr "$PLUGINSDIR\${CONFIG_INI}" "Install" "StartMenuShortcuts" "true"
${Else}
WriteINIStr "$PLUGINSDIR\${CONFIG_INI}" "Install" "StartMenuShortcuts" "false"
${EndIf}
!ifdef MOZ_MAINTENANCE_SERVICE
@ -1749,7 +1827,7 @@ Function FinishInstall
${EndIf}
${EndIf}
${If} $CheckboxShortcutOnBar == 1
${If} $CheckboxShortcuts == 1
${If} ${AtMostWinVista}
ClearErrors
${GetParameters} $0
@ -1885,6 +1963,30 @@ Function OnClick_ButtonBrowse
${EndIf}
FunctionEnd
Function OnChange_DroplistArch
; When the user changes the 32/64-bit setting, change the default install path
; to use the correct version of Program Files. But only do that if the user
; hasn't selected their own install path yet, and if we didn't select our
; default as the location of an existing install.
${If} $INSTDIR == $InitialInstallDir
${NSD_GetText} $DroplistArch $0
${If} $0 == "$(VERSION_32BIT)"
${If} $PreviousInstallArch == 32
StrCpy $InitialInstallDir $PreviousInstallDir
${Else}
StrCpy $InitialInstallDir "${DefaultInstDir32bit}"
${EndIf}
${Else}
${If} $PreviousInstallArch == 64
StrCpy $InitialInstallDir $PreviousInstallDir
${Else}
StrCpy $InitialInstallDir "${DefaultInstDir64bit}"
${EndIf}
${EndIf}
${NSD_SetText} $DirRequest $InitialInstallDir
${EndIf}
FunctionEnd
Function CheckSpace
${If} "$ExistingTopDir" != ""
StrLen $0 "$ExistingTopDir"
@ -1949,6 +2051,7 @@ Function CanWrite
GetTempFileName $2 "$0"
Delete $2
CreateDirectory "$2"
${If} ${FileExists} "$2"
${If} ${FileExists} "$INSTDIR"
GetTempFileName $3 "$INSTDIR"

View File

@ -198,3 +198,13 @@ disableContainersMsg=If you disable Container Tabs now, #S container tab will be
disableContainersOkButton=Close #S Container Tab;Close #S Container Tabs
disableContainersButton2=Keep enabled
removeContainerAlertTitle=Remove This Container?
# LOCALIZATION NOTE (removeContainerMsg): Semi-colon list of plural forms.
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
# #S is the number of container tabs
removeContainerMsg=If you remove this Container now, #S container tab will be closed. Are you sure you want to remove this Container?;If you remove this Container now, #S container tabs will be closed. Are you sure you want to remove this Container?
removeContainerOkButton=Remove this Container
removeContainerButton2=Dont remove this Container

View File

@ -41,11 +41,11 @@ CANCEL_BUTTON=Cancel
OPTIONS_BUTTON=&Options
MAKE_DEFAULT=&Make $BrandShortName my default browser
CREATE_SHORTCUTS=Create Shortcuts for $BrandShortName:
ADD_SC_TASKBAR=On my &Task bar
ADD_SC_QUICKLAUNCHBAR=On my &Quick Launch bar
ADD_CheckboxShortcutInStartMenu=In my &Start Menu Programs Folder
ADD_CheckboxShortcutOnDesktop=On my &Desktop
ADD_SC_DESKTOP_TASKBAR=&Create desktop and taskbar shortcuts for $BrandShortName
ADD_SC_DESKTOP_QUICKLAUNCHBAR=&Create desktop and quick launch shortcuts for $BrandShortName
VERSION_32BIT=32-bit $BrandShortName
VERSION_64BIT=64-bit $BrandShortName
ARCH_DROPLIST_LABEL=&Version to install
SPACE_REQUIRED=Space Required:
SPACE_AVAILABLE=Space Available:
ONE_MOMENT_INSTALL=One moment, $BrandShortName will launch as soon as the install is complete…

View File

@ -12,15 +12,32 @@
padding: 0px 1px 0px 1px;
}
#PopupAutoComplete > richlistbox > richlistitem > .ac-site-icon {
margin-inline-start: 4px;
margin-inline-end: 0;
}
#PopupAutoComplete > richlistbox > richlistitem > .ac-title {
font: icon;
margin-inline-start: 6px;
margin-inline-start: 4px;
}
#PopupAutoComplete > richlistbox {
padding: 0;
}
/* Login form autocompletion */
#PopupAutoComplete > richlistbox > richlistitem[originaltype="login"] > .ac-site-icon {
display: initial;
list-style-image: url(chrome://browser/skin/notification-icons.svg#login);
}
#PopupAutoComplete > richlistbox > richlistitem[originaltype="login"] > .ac-site-icon[selected] {
list-style-image: url(chrome://browser/skin/notification-icons.svg#login-highlighted);
}
/* Insecure field warning */
#PopupAutoComplete > richlistbox > richlistitem[originaltype="insecureWarning"] {
background-color: #F6F6F6; /* Bug 1319176 */

View File

@ -21,6 +21,11 @@
clip-path: url(#clip);
}
#login-highlighted {
fill: HighlightText;
fill-opacity: 1;
}
#plugin-blocked,
#plugin-blocked:target ~ #strikeout {
fill: #d92215;
@ -73,6 +78,7 @@
<use id="indexedDB" xlink:href="#indexedDB-icon" />
<use id="indexedDB-blocked" class="blocked" xlink:href="#indexedDB-icon" />
<use id="login" xlink:href="#login-icon" />
<use id="login-highlighted" class="highlighted" xlink:href="#login-icon" />
<use id="login-detailed" xlink:href="#login-detailed-icon" />
<use id="microphone" xlink:href="#microphone-icon" />
<use id="microphone-sharing" xlink:href="#microphone-icon"/>

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

View File

@ -1106,7 +1106,11 @@ toolbar[brighttext] #close-button {
#minimize-button,
#restore-button,
#close-button {
list-style-image: url("chrome://global/skin/icons/windowControls.png");
/* Important to ensure this applies even on toolbar[brighttext] */
list-style-image: url("chrome://global/skin/icons/windowControls.png") !important;
/* Also override background color to a avoid hover background styling
* leaking through around the image. */
background-color: transparent !important;
padding: 0;
}

View File

@ -412,8 +412,8 @@ bool typeIsRefPtr(QualType Q) {
// The method defined in clang for ignoring implicit nodes doesn't work with
// some AST trees. To get around this, we define our own implementation of
// IgnoreImplicit.
const Stmt *IgnoreImplicit(const Stmt *s) {
// IgnoreTrivials.
const Stmt *IgnoreTrivials(const Stmt *s) {
while (true) {
if (auto *ewc = dyn_cast<ExprWithCleanups>(s)) {
s = ewc->getSubExpr();
@ -423,6 +423,8 @@ const Stmt *IgnoreImplicit(const Stmt *s) {
s = bte->getSubExpr();
} else if (auto *ice = dyn_cast<ImplicitCastExpr>(s)) {
s = ice->getSubExpr();
} else if (auto *pe = dyn_cast<ParenExpr>(s)) {
s = pe->getSubExpr();
} else {
break;
}
@ -431,8 +433,8 @@ const Stmt *IgnoreImplicit(const Stmt *s) {
return s;
}
const Expr *IgnoreImplicit(const Expr *e) {
return cast<Expr>(IgnoreImplicit(static_cast<const Stmt *>(e)));
const Expr *IgnoreTrivials(const Expr *e) {
return cast<Expr>(IgnoreTrivials(static_cast<const Stmt *>(e)));
}
}
@ -905,6 +907,8 @@ AST_MATCHER(CXXRecordDecl, needsMemMovableMembers) {
AST_MATCHER(CXXConstructorDecl, isInterestingImplicitCtor) {
const CXXConstructorDecl *Declaration = Node.getCanonicalDecl();
return
// Skip constructors in system headers
!ASTIsInSystemHeader(Declaration->getASTContext(), *Declaration) &&
// Skip ignored namespaces and paths
!isInIgnoredNamespaceForImplicitCtor(Declaration) &&
!isIgnoredPathForImplicitCtor(Declaration) &&
@ -1918,7 +1922,7 @@ void DiagnosticsMatcher::KungFuDeathGripChecker::run(
return;
}
const Expr *E = IgnoreImplicit(D->getInit());
const Expr *E = IgnoreTrivials(D->getInit());
const CXXConstructExpr *CE = dyn_cast<CXXConstructExpr>(E);
if (CE && CE->getNumArgs() == 0) {
// We don't report an error when we construct and don't use a nsCOMPtr /
@ -1931,10 +1935,10 @@ void DiagnosticsMatcher::KungFuDeathGripChecker::run(
// We don't want to look at the single argument conversion constructors
// which are inbetween the declaration and the actual object which we are
// assigning into the nsCOMPtr/RefPtr. To do this, we repeatedly
// IgnoreImplicit, then look at the expression. If it is one of these
// IgnoreTrivials, then look at the expression. If it is one of these
// conversion constructors, we ignore it and continue to dig.
while ((CE = dyn_cast<CXXConstructExpr>(E)) && CE->getNumArgs() == 1) {
E = IgnoreImplicit(CE->getArg(0));
E = IgnoreTrivials(CE->getArg(0));
}
// We allow taking a kungFuDeathGrip of `this` because it cannot change

View File

@ -35,6 +35,7 @@ public:
nsCOMPtr<Type> never_referenced;
nsCOMPtr<Type> kfdg_t1(this);
nsCOMPtr<Type> kfdg_t2 = this;
nsCOMPtr<Type> kfdg_t3 = (this);
nsCOMPtr<Type> kfdg_m1(p); // expected-error {{Unused "kungFuDeathGrip" 'nsCOMPtr<Type>' objects constructed from members are prohibited}} expected-note {{Please switch all accesses to this member to go through 'kfdg_m1', or explicitly pass 'kfdg_m1' to `mozilla::Unused`}}
nsCOMPtr<Type> kfdg_m2 = p; // expected-error {{Unused "kungFuDeathGrip" 'nsCOMPtr<Type>' objects constructed from members are prohibited}} expected-note {{Please switch all accesses to this member to go through 'kfdg_m2', or explicitly pass 'kfdg_m2' to `mozilla::Unused`}}
@ -51,8 +52,9 @@ public:
RefPtr<Type> never_referenced2;
RefPtr<Type> kfdg_t3(this);
RefPtr<Type> kfdg_t4 = this;
RefPtr<Type> kfdg_t4(this);
RefPtr<Type> kfdg_t5 = this;
RefPtr<Type> kfdg_t6 = (this);
RefPtr<Type> kfdg_m5(p); // expected-error {{Unused "kungFuDeathGrip" 'RefPtr<Type>' objects constructed from members are prohibited}} expected-note {{Please switch all accesses to this member to go through 'kfdg_m5', or explicitly pass 'kfdg_m5' to `mozilla::Unused`}}
RefPtr<Type> kfdg_m6 = p; // expected-error {{Unused "kungFuDeathGrip" 'RefPtr<Type>' objects constructed from members are prohibited}} expected-note {{Please switch all accesses to this member to go through 'kfdg_m6', or explicitly pass 'kfdg_m6' to `mozilla::Unused`}}

View File

@ -335,8 +335,11 @@ def lib_path(target, vc_path, windows_sdk_dir, ucrt_sdk_dir, dia_sdk_dir):
atlmfc_dir = os.path.join(vc_path, 'atlmfc', 'lib', *vc_target)
if not os.path.isdir(atlmfc_dir):
die('Cannot find the ATL/MFC libraries in the Visual C++ directory (%s). '
'Please install them.' % vc_path)
# For Visual Studio 2017
atlmfc_dir = os.path.join(vc_path, 'atlmfc', 'lib', sdk_target)
if not os.path.isdir(atlmfc_dir):
die('Cannot find the ATL/MFC libraries in the Visual C++ directory '
'(%s). Please install them.' % vc_path)
libs = []

View File

@ -326,9 +326,12 @@ nsScriptSecurityManager::GetChannelResultPrincipal(nsIChannel* aChannel,
}
nsSecurityFlags securityFlags = loadInfo->GetSecurityMode();
if (securityFlags == nsILoadInfo::SEC_REQUIRE_SAME_ORIGIN_DATA_INHERITS ||
securityFlags == nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS ||
securityFlags == nsILoadInfo::SEC_REQUIRE_CORS_DATA_INHERITS) {
// The data: inheritance flags should only apply to the initial load,
// not to loads that it might have redirected to.
if (loadInfo->RedirectChain().IsEmpty() &&
(securityFlags == nsILoadInfo::SEC_REQUIRE_SAME_ORIGIN_DATA_INHERITS ||
securityFlags == nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS ||
securityFlags == nsILoadInfo::SEC_REQUIRE_CORS_DATA_INHERITS)) {
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_GetFinalChannelURI(aChannel, getter_AddRefs(uri));

View File

@ -87,7 +87,7 @@ included_inclnames_to_ignore = set([
'unicode/udat.h', # ICU
'unicode/udatpg.h', # ICU
'unicode/uenum.h', # ICU
'unicode/unorm.h', # ICU
'unicode/unorm2.h', # ICU
'unicode/unum.h', # ICU
'unicode/unumsys.h', # ICU
'unicode/ustring.h', # ICU

View File

@ -10,7 +10,7 @@ const { createFactory, createElement } = require("devtools/client/shared/vendor/
const { Provider } = require("devtools/client/shared/vendor/react-redux");
const { updateGrids } = require("./actions/grids");
const App = createFactory(require("./components/app"));
const App = createFactory(require("./components/App"));
const Store = require("./store");
const { LocalizationHelper } = require("devtools/shared/l10n");

View File

@ -13785,6 +13785,7 @@ public:
const nsAString& aFileName,
nsIInputStream* aPostDataStream,
nsIInputStream* aHeadersDataStream,
bool aNoOpenerImplied,
bool aIsTrusted);
NS_IMETHOD Run() override
@ -13801,6 +13802,7 @@ public:
mHandler->OnLinkClickSync(mContent, mURI,
mTargetSpec.get(), mFileName,
mPostDataStream, mHeadersDataStream,
mNoOpenerImplied,
nullptr, nullptr);
}
return NS_OK;
@ -13815,6 +13817,7 @@ private:
nsCOMPtr<nsIInputStream> mHeadersDataStream;
nsCOMPtr<nsIContent> mContent;
PopupControlState mPopupState;
bool mNoOpenerImplied;
bool mIsTrusted;
};
@ -13825,6 +13828,7 @@ OnLinkClickEvent::OnLinkClickEvent(nsDocShell* aHandler,
const nsAString& aFileName,
nsIInputStream* aPostDataStream,
nsIInputStream* aHeadersDataStream,
bool aNoOpenerImplied,
bool aIsTrusted)
: mHandler(aHandler)
, mURI(aURI)
@ -13834,6 +13838,7 @@ OnLinkClickEvent::OnLinkClickEvent(nsDocShell* aHandler,
, mHeadersDataStream(aHeadersDataStream)
, mContent(aContent)
, mPopupState(mHandler->mScriptGlobal->GetPopupControlState())
, mNoOpenerImplied(aNoOpenerImplied)
, mIsTrusted(aIsTrusted)
{
}
@ -13871,11 +13876,15 @@ nsDocShell::OnLinkClick(nsIContent* aContent,
nsAutoString target;
nsCOMPtr<nsIWebBrowserChrome3> browserChrome3 = do_GetInterface(mTreeOwner);
bool noOpenerImplied = false;
if (browserChrome3) {
nsCOMPtr<nsIDOMNode> linkNode = do_QueryInterface(aContent);
nsAutoString oldTarget(aTargetSpec);
rv = browserChrome3->OnBeforeLinkTraversal(oldTarget, aURI,
linkNode, mIsAppTab, target);
if (!oldTarget.Equals(target)) {
noOpenerImplied = true;
}
}
if (NS_FAILED(rv)) {
@ -13884,7 +13893,8 @@ nsDocShell::OnLinkClick(nsIContent* aContent,
nsCOMPtr<nsIRunnable> ev =
new OnLinkClickEvent(this, aContent, aURI, target.get(), aFileName,
aPostDataStream, aHeadersDataStream, aIsTrusted);
aPostDataStream, aHeadersDataStream, noOpenerImplied,
aIsTrusted);
return NS_DispatchToCurrentThread(ev);
}
@ -13895,6 +13905,7 @@ nsDocShell::OnLinkClickSync(nsIContent* aContent,
const nsAString& aFileName,
nsIInputStream* aPostDataStream,
nsIInputStream* aHeadersDataStream,
bool aNoOpenerImplied,
nsIDocShell** aDocShell,
nsIRequest** aRequest)
{
@ -13960,6 +13971,9 @@ nsDocShell::OnLinkClickSync(nsIContent* aContent,
flags |= INTERNAL_LOAD_FLAGS_NO_OPENER;
}
}
if (aNoOpenerImplied) {
flags |= INTERNAL_LOAD_FLAGS_NO_OPENER;
}
}
// Get the owner document of the link that was clicked, this will be

View File

@ -207,6 +207,7 @@ public:
const nsAString& aFileName,
nsIInputStream* aPostDataStream = 0,
nsIInputStream* aHeadersDataStream = 0,
bool aNoOpenerImplied = false,
nsIDocShell** aDocShell = 0,
nsIRequest** aRequest = 0) override;
NS_IMETHOD OnOverLink(nsIContent* aContent,

View File

@ -59,6 +59,7 @@ public:
* @param aFileName non-null when the link should be downloaded as the given file
* @param aPostDataStream the POST data to send
* @param aHeadersDataStream ???
* @param aNoOpenerImplied if the link implies "noopener"
* @param aDocShell (out-param) the DocShell that the request was opened on
* @param aRequest the request that was opened
*/
@ -68,6 +69,7 @@ public:
const nsAString& aFileName,
nsIInputStream* aPostDataStream = 0,
nsIInputStream* aHeadersDataStream = 0,
bool aNoOpenerImplied = false,
nsIDocShell** aDocShell = 0,
nsIRequest** aRequest = 0) = 0;

View File

@ -86,6 +86,11 @@ FindAnimationsForCompositor(const nsIFrame* aFrame,
return false;
}
if (aFrame->StyleContext()->StyleSource().IsServoComputedValues()) {
NS_ERROR("stylo: cannot handle compositor-driven animations yet");
return false;
}
// The animation cascade will almost always be up-to-date by this point
// but there are some cases such as when we are restoring the refresh driver
// from test control after seeking where it might not be the case.
@ -203,9 +208,11 @@ EffectCompositor::RequestRestyle(dom::Element* aElement,
if (aRestyleType == RestyleType::Layer) {
// Prompt layers to re-sync their animations.
MOZ_ASSERT(mPresContext->RestyleManager()->IsGecko(),
"stylo: Servo-backed style system should not be using "
if (mPresContext->RestyleManager()->IsServo()) {
NS_ERROR("stylo: Servo-backed style system should not be using "
"EffectCompositor");
return;
}
mPresContext->RestyleManager()->AsGecko()->IncrementAnimationGeneration();
EffectSet* effectSet =
EffectSet::GetEffectSet(aElement, aPseudoType);

View File

@ -170,11 +170,12 @@ DOMIntersectionObserver::UnlinkTarget(Element& aTarget)
if (!mObservationTargets.Contains(&aTarget)) {
return false;
}
if (mObservationTargets.Count() == 1) {
mObservationTargets.RemoveEntry(&aTarget);
if (mObservationTargets.Count() == 0) {
Disconnect();
return false;
}
mObservationTargets.RemoveEntry(&aTarget);
return true;
}
@ -195,6 +196,8 @@ DOMIntersectionObserver::Disconnect()
if (!mConnected) {
return;
}
mConnected = false;
for (auto iter = mObservationTargets.Iter(); !iter.Done(); iter.Next()) {
Element* target = iter.Get()->GetKey();
target->UnregisterIntersectionObserver(this);
@ -204,7 +207,6 @@ DOMIntersectionObserver::Disconnect()
nsIDocument* document = mOwner->GetExtantDoc();
document->RemoveIntersectionObserver(this);
}
mConnected = false;
}
void
@ -278,7 +280,10 @@ DOMIntersectionObserver::Update(nsIDocument* aDocument, DOMHighResTimeStamp time
if (rootFrame) {
nsPresContext* presContext = rootFrame->PresContext();
while (!presContext->IsRootContentDocument()) {
presContext = rootFrame->PresContext()->GetParentPresContext();
presContext = presContext->GetParentPresContext();
if (!presContext) {
break;
}
rootFrame = presContext->PresShell()->GetRootScrollFrame();
}
root = rootFrame->GetContent()->AsElement();

View File

@ -236,50 +236,10 @@ UnwrapObject(JSObject* obj, U& value)
PrototypeTraits<PrototypeID>::Depth);
}
inline bool
IsNotDateOrRegExp(JSContext* cx, JS::Handle<JSObject*> obj,
bool* notDateOrRegExp)
{
MOZ_ASSERT(obj);
js::ESClass cls;
if (!js::GetBuiltinClass(cx, obj, &cls)) {
return false;
}
*notDateOrRegExp = cls != js::ESClass::Date && cls != js::ESClass::RegExp;
return true;
}
MOZ_ALWAYS_INLINE bool
IsObjectValueConvertibleToDictionary(JSContext* cx,
JS::Handle<JS::Value> objVal,
bool* convertible)
IsConvertibleToDictionary(JS::Handle<JS::Value> val)
{
JS::Rooted<JSObject*> obj(cx, &objVal.toObject());
return IsNotDateOrRegExp(cx, obj, convertible);
}
MOZ_ALWAYS_INLINE bool
IsConvertibleToDictionary(JSContext* cx, JS::Handle<JS::Value> val,
bool* convertible)
{
if (val.isNullOrUndefined()) {
*convertible = true;
return true;
}
if (!val.isObject()) {
*convertible = false;
return true;
}
return IsObjectValueConvertibleToDictionary(cx, val, convertible);
}
MOZ_ALWAYS_INLINE bool
IsConvertibleToCallbackInterface(JSContext* cx, JS::Handle<JSObject*> obj,
bool* convertible)
{
return IsNotDateOrRegExp(cx, obj, convertible);
return val.isNullOrUndefined() || val.isObject();
}
// The items in the protoAndIfaceCache are indexed by the prototypes::id::ID,
@ -2309,6 +2269,22 @@ AddStringToIDVector(JSContext* cx, JS::AutoIdVector& vector, const char* name)
AtomizeAndPinJSString(cx, *(vector[vector.length() - 1]).address(), name);
}
// We use one constructor JSNative to represent all DOM interface objects (so
// we can easily detect when we need to wrap them in an Xray wrapper). We store
// the real JSNative in the mNative member of a JSNativeHolder in the
// CONSTRUCTOR_NATIVE_HOLDER_RESERVED_SLOT slot of the JSFunction object for a
// specific interface object. We also store the NativeProperties in the
// JSNativeHolder.
// Note that some interface objects are not yet a JSFunction but a normal
// JSObject with a DOMJSClass, those do not use these slots.
enum {
CONSTRUCTOR_NATIVE_HOLDER_RESERVED_SLOT = 0
};
bool
Constructor(JSContext* cx, unsigned argc, JS::Value* vp);
// Implementation of the bits that XrayWrapper needs
/**
@ -2382,6 +2358,9 @@ XrayGetNativeProto(JSContext* cx, JS::Handle<JSObject*> obj,
} else {
protop.set(JS::GetRealmObjectPrototype(cx));
}
} else if (JS_ObjectIsFunction(cx, obj)) {
MOZ_ASSERT(JS_IsNativeFunction(obj, Constructor));
protop.set(JS::GetRealmFunctionPrototype(cx));
} else {
const js::Class* clasp = js::GetObjectClass(obj);
MOZ_ASSERT(IsDOMIfaceAndProtoClass(clasp));
@ -2448,22 +2427,6 @@ extern const js::ClassOps sBoringInterfaceObjectClassClassOps;
extern const js::ObjectOps sInterfaceObjectClassObjectOps;
// We use one constructor JSNative to represent all DOM interface objects (so
// we can easily detect when we need to wrap them in an Xray wrapper). We store
// the real JSNative in the mNative member of a JSNativeHolder in the
// CONSTRUCTOR_NATIVE_HOLDER_RESERVED_SLOT slot of the JSFunction object for a
// specific interface object. We also store the NativeProperties in the
// JSNativeHolder.
// Note that some interface objects are not yet a JSFunction but a normal
// JSObject with a DOMJSClass, those do not use these slots.
enum {
CONSTRUCTOR_NATIVE_HOLDER_RESERVED_SLOT = 0
};
bool
Constructor(JSContext* cx, unsigned argc, JS::Value* vp);
inline bool
UseDOMXray(JSObject* obj)
{
@ -2480,7 +2443,7 @@ HasConstructor(JSObject* obj)
return JS_IsNativeFunction(obj, Constructor) ||
js::GetObjectClass(obj)->getConstruct();
}
#endif
#endif
// Helpers for creating a const version of a type.
template<typename T>

View File

@ -5783,30 +5783,24 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
exceptionCode=exceptionCode)
if failureCode is not None:
if isDefinitelyObject:
dictionaryTest = "IsObjectValueConvertibleToDictionary"
# This means we're part of an overload or union conversion, and
# should simply skip stuff if our value is not convertible to
# dictionary, instead of trying and throwing. If we're either
# isDefinitelyObject or isNullOrUndefined then we're convertible to
# dictionary and don't need to check here.
if isDefinitelyObject or isNullOrUndefined:
template = conversionCode
else:
dictionaryTest = "IsConvertibleToDictionary"
template = fill("""
{ // scope for isConvertible
bool isConvertible;
if (!${testConvertible}(cx, ${val}, &isConvertible)) {
$*{exceptionCode}
}
if (!isConvertible) {
$*{failureCode}
}
$*{conversionCode}
}
""",
testConvertible=dictionaryTest,
val=val,
exceptionCode=exceptionCode,
failureCode=failureCode,
conversionCode=conversionCode)
template = fill(
"""
if (!IsConvertibleToDictionary(${val})) {
$*{failureCode}
}
$*{conversionCode}
""",
val=val,
failureCode=failureCode,
conversionCode=conversionCode)
else:
template = conversionCode
@ -8030,12 +8024,12 @@ class CGMethodCall(CGThing):
# 1) A platform object that's not a platform array object, being
# passed to an interface or "object" arg.
# 2) A Date object being passed to a Date or "object" arg.
# 3) A RegExp object being passed to a RegExp or "object" arg.
# 4) A callable object being passed to a callback or "object" arg.
# 5) An iterable object being passed to a sequence arg.
# 6) Any non-Date and non-RegExp object being passed to a
# array or callback interface or dictionary or
# "object" arg.
# XXXbz This is actually gone from the spec now, but we still
# have some APIs using Date.
# 3) A callable object being passed to a callback or "object" arg.
# 4) An iterable object being passed to a sequence arg.
# 5) Any object being passed to a array or callback interface or
# dictionary or "object" arg.
# First grab all the overloads that have a non-callback interface
# (which includes typed arrays and arraybuffers) at the
@ -12591,14 +12585,8 @@ class CGDictionary(CGThing):
else:
body += dedent(
"""
{ // scope for isConvertible
bool isConvertible;
if (!IsConvertibleToDictionary(cx, val, &isConvertible)) {
return false;
}
if (!isConvertible) {
return ThrowErrorMessage(cx, MSG_NOT_DICTIONARY, sourceDescription);
}
if (!IsConvertibleToDictionary(val)) {
return ThrowErrorMessage(cx, MSG_NOT_DICTIONARY, sourceDescription);
}
""")

View File

@ -163,7 +163,8 @@ def WebIDLTest(parser, harness):
"Promise<any>", "Promise<any>?",
"USVString", "ArrayBuffer", "ArrayBufferView", "SharedArrayBuffer",
"Uint8Array", "Uint16Array" ]
# When we can parse Date and RegExp, we need to add them here.
# When we can parse Date, we need to add it here.
# XXXbz we can, and should really do that...
# Try to categorize things a bit to keep list lengths down
def allBut(list1, list2):

View File

@ -19,3 +19,4 @@ skip-if = e10s # prerendering doesn't work in e10s yet
skip-if = e10s # prerendering doesn't work in e10s yet
[test_bug1123516_maplikesetlikechrome.xul]
skip-if = debug == false
[test_bug1287912.html]

View File

@ -0,0 +1,37 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1287912
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1287912</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1287912">Mozilla Bug 1287912</a>
<p id="display"></p>
<div id="content" style="display: none">
<iframe id="t" src="http://example.org/tests/dom/bindings/test/"></iframe>
</div>
<pre id="test">
<script type="application/javascript">
function test()
{
var win = document.getElementById("t").contentWindow;
is(Object.getPrototypeOf(win.Image), win.Function.prototype, "The __proto__ of a named constructor is Function.prototype");
is(win.Image.prototype, win.HTMLImageElement.prototype, "The prototype property of a named constructor is the interface prototype object");
is(win.HTMLImageElement['foo'], undefined, "Should not have a property named foo on the HTMLImageElement interface object");
is(win.Image['foo'], undefined, "Should not have a property named foo on the Image named constructor");
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(test);
</script>
</pre>
</body>
</html>

View File

@ -44,9 +44,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=882653
[ 'document.createTreeWalker(document, 0xFFFFFFFF, { acceptNode: 5 }).nextNode()',
"Property 'acceptNode' is not callable.",
"non-callable callback interface operation property" ],
[ '(new TextDecoder).decode(new Uint8Array(), new RegExp())',
[ '(new TextDecoder).decode(new Uint8Array(), 5)',
"Argument 2 of TextDecoder.decode can't be converted to a dictionary.",
"regexp passed for a dictionary" ],
"primitive passed for a dictionary" ],
[ 'URL.createObjectURL(null, null)',
"Argument 1 is not valid for any of the 2-argument overloads of URL.createObjectURL.",
"overload resolution failure" ],

View File

@ -121,7 +121,7 @@ public:
{
const char funcName[] = "compressedTexImage3D";
const uint8_t funcDims = 3;
const TexImageSourceAdapter src(anySrc, viewElemOffset, viewElemLengthOverride);
const TexImageSourceAdapter src(&anySrc, viewElemOffset, viewElemLengthOverride);
CompressedTexImage(funcName, funcDims, target, level, internalFormat, width,
height, depth, border, src);
}
@ -135,7 +135,7 @@ public:
{
const char funcName[] = "compressedTexSubImage3D";
const uint8_t funcDims = 3;
const TexImageSourceAdapter src(anySrc, viewElemOffset, viewElemLengthOverride);
const TexImageSourceAdapter src(&anySrc, viewElemOffset, viewElemLengthOverride);
CompressedTexSubImage(funcName, funcDims, target, level, xOffset, yOffset,
zOffset, width, height, depth, unpackFormat, src);
}
@ -159,7 +159,7 @@ public:
GLsizei height, GLsizei depth, GLint border, GLenum unpackFormat,
GLenum unpackType, const T& anySrc, ErrorResult& out_error)
{
const TexImageSourceAdapter src(anySrc, &out_error);
const TexImageSourceAdapter src(&anySrc, &out_error);
TexImage3D(target, level, internalFormat, width, height, depth, border,
unpackFormat, unpackType, src);
}
@ -169,7 +169,7 @@ public:
GLenum unpackType, const dom::ArrayBufferView& view,
GLuint viewElemOffset, ErrorResult&)
{
const TexImageSourceAdapter src(view, viewElemOffset);
const TexImageSourceAdapter src(&view, viewElemOffset);
TexImage3D(target, level, internalFormat, width, height, depth, border,
unpackFormat, unpackType, src);
}
@ -194,7 +194,7 @@ public:
GLenum unpackFormat, GLenum unpackType, const T& anySrc,
ErrorResult& out_error)
{
const TexImageSourceAdapter src(anySrc, &out_error);
const TexImageSourceAdapter src(&anySrc, &out_error);
TexSubImage3D(target, level, xOffset, yOffset, zOffset, width, height, depth,
unpackFormat, unpackType, src);
}
@ -212,7 +212,7 @@ public:
return;
const auto& srcView = maybeSrcView.Value();
const TexImageSourceAdapter src(srcView, srcElemOffset);
const TexImageSourceAdapter src(&srcView, srcElemOffset);
TexSubImage3D(target, level, xOffset, yOffset, zOffset, width, height, depth,
unpackFormat, unpackType, src);
}

View File

@ -31,15 +31,6 @@ WebGL2Context::CopyBufferSubData(GLenum readTarget, GLenum writeTarget,
if (!writeBuffer)
return;
if (readBuffer->mNumActiveTFOs ||
writeBuffer->mNumActiveTFOs)
{
ErrorInvalidOperation("%s: Buffer is bound to an active transform feedback"
" object.",
funcName);
return;
}
if (!ValidateNonNegative(funcName, "readOffset", readOffset) ||
!ValidateNonNegative(funcName, "writeOffset", writeOffset) ||
!ValidateNonNegative(funcName, "size", size))
@ -129,21 +120,6 @@ WebGL2Context::GetBufferSubData(GLenum target, GLintptr srcByteOffset,
////
if (buffer->mNumActiveTFOs) {
ErrorInvalidOperation("%s: Buffer is bound to an active transform feedback"
" object.",
funcName);
return;
}
if (target == LOCAL_GL_TRANSFORM_FEEDBACK_BUFFER &&
mBoundTransformFeedback->mIsActive)
{
ErrorInvalidOperation("%s: Currently bound transform feedback is active.",
funcName);
return;
}
if (!CheckedInt<GLsizeiptr>(byteLen).isValid()) {
ErrorOutOfMemory("%s: Size too large.", funcName);
return;

View File

@ -18,15 +18,12 @@ WebGLBuffer::WebGLBuffer(WebGLContext* webgl, GLuint buf)
, mContent(Kind::Undefined)
, mUsage(LOCAL_GL_STATIC_DRAW)
, mByteLength(0)
, mNumActiveTFOs(0)
, mBoundForTF(false)
{
mContext->mBuffers.insertBack(this);
}
WebGLBuffer::~WebGLBuffer()
{
MOZ_ASSERT(!mNumActiveTFOs);
DeleteOnce();
}
@ -111,13 +108,6 @@ WebGLBuffer::BufferData(GLenum target, size_t size, const void* data, GLenum usa
if (!ValidateBufferUsageEnum(mContext, funcName, usage))
return;
if (mNumActiveTFOs) {
mContext->ErrorInvalidOperation("%s: Buffer is bound to an active transform"
" feedback object.",
funcName);
return;
}
const auto& gl = mContext->gl;
gl->MakeCurrent();
const ScopedLazyBind lazyBind(gl, target, this);
@ -220,15 +210,6 @@ WebGLBuffer::IsElementArrayUsedWithMultipleTypes() const
bool
WebGLBuffer::ValidateCanBindToTarget(const char* funcName, GLenum target)
{
const bool wouldBeTF = (target == LOCAL_GL_TRANSFORM_FEEDBACK_BUFFER);
if (mWebGLRefCnt && wouldBeTF != mBoundForTF) {
mContext->ErrorInvalidOperation("%s: Buffers cannot be simultaneously bound to "
" transform feedback and bound elsewhere.",
funcName);
return false;
}
mBoundForTF = wouldBeTF;
/* https://www.khronos.org/registry/webgl/specs/latest/2.0/#5.1
*
* In the WebGL 2 API, buffers have their WebGL buffer type

View File

@ -79,8 +79,6 @@ protected:
GLenum mUsage;
size_t mByteLength;
UniquePtr<WebGLElementArrayCache> mCache;
size_t mNumActiveTFOs;
bool mBoundForTF;
};
} // namespace mozilla

View File

@ -120,6 +120,7 @@ WebGLContext::WebGLContext()
, mMaxFetchedInstances(0)
, mLayerIsMirror(false)
, mBypassShaderValidation(false)
, mBuffersForUB_Dirty(true)
, mContextLossHandler(this)
, mNeedsFakeNoAlpha(false)
, mNeedsFakeNoDepth(false)
@ -262,6 +263,7 @@ WebGLContext::DestroyResourcesAndContext()
mQuerySlot_TimeElapsed = nullptr;
mIndexedUniformBufferBindings.clear();
OnUBIndexedBindingsChanged();
//////
@ -2570,6 +2572,42 @@ WebGLContext::ValidateArrayBufferView(const char* funcName,
return true;
}
////
const decltype(WebGLContext::mBuffersForUB)&
WebGLContext::BuffersForUB() const
{
if (mBuffersForUB_Dirty) {
mBuffersForUB.clear();
for (const auto& cur : mIndexedUniformBufferBindings) {
if (cur.mBufferBinding) {
mBuffersForUB.insert(cur.mBufferBinding.get());
}
}
mBuffersForUB_Dirty = false;
}
return mBuffersForUB;
}
////
bool
WebGLContext::ValidateForNonTransformFeedback(const char* funcName, WebGLBuffer* buffer)
{
if (!mBoundTransformFeedback)
return true;
const auto& buffersForTF = mBoundTransformFeedback->BuffersForTF();
if (buffersForTF.count(buffer)) {
ErrorInvalidOperation("%s: Specified WebGLBuffer is currently bound for transform"
" feedback.",
funcName);
return false;
}
return true;
}
////////////////////////////////////////////////////////////////////////////////
// XPCOM goop

View File

@ -220,40 +220,40 @@ protected:
struct TexImageSourceAdapter final : public TexImageSource
{
TexImageSourceAdapter(const dom::Nullable<dom::ArrayBufferView>& maybeView,
TexImageSourceAdapter(const dom::Nullable<dom::ArrayBufferView>* maybeView,
ErrorResult*)
{
if (!maybeView.IsNull()) {
mView = &(maybeView.Value());
if (!maybeView->IsNull()) {
mView = &(maybeView->Value());
}
}
TexImageSourceAdapter(const dom::ArrayBufferView& view, ErrorResult*) {
mView = &view;
TexImageSourceAdapter(const dom::ArrayBufferView* view, ErrorResult*) {
mView = view;
}
TexImageSourceAdapter(const dom::ArrayBufferView& view, GLuint viewElemOffset,
TexImageSourceAdapter(const dom::ArrayBufferView* view, GLuint viewElemOffset,
GLuint viewElemLengthOverride = 0)
{
mView = &view;
mView = view;
mViewElemOffset = viewElemOffset;
mViewElemLengthOverride = viewElemLengthOverride;
}
TexImageSourceAdapter(WebGLsizeiptr pboOffset, GLuint ignored1, GLuint ignored2 = 0) {
mPboOffset = &pboOffset;
TexImageSourceAdapter(const WebGLsizeiptr* pboOffset, GLuint ignored1, GLuint ignored2 = 0) {
mPboOffset = pboOffset;
}
TexImageSourceAdapter(WebGLsizeiptr pboOffset, ErrorResult* ignored) {
mPboOffset = &pboOffset;
TexImageSourceAdapter(const WebGLsizeiptr* pboOffset, ErrorResult* ignored) {
mPboOffset = pboOffset;
}
TexImageSourceAdapter(const dom::ImageData& imageData, ErrorResult*) {
mImageData = &imageData;
TexImageSourceAdapter(const dom::ImageData* imageData, ErrorResult*) {
mImageData = imageData;
}
TexImageSourceAdapter(const dom::Element& domElem, ErrorResult* const out_error) {
mDomElem = &domElem;
TexImageSourceAdapter(const dom::Element* domElem, ErrorResult* const out_error) {
mDomElem = domElem;
mOut_error = out_error;
}
};
@ -1026,7 +1026,7 @@ public:
const char funcName[] = "compressedTexImage2D";
const uint8_t funcDims = 2;
const GLsizei depth = 1;
const TexImageSourceAdapter src(anySrc, viewElemOffset, viewElemLengthOverride);
const TexImageSourceAdapter src(&anySrc, viewElemOffset, viewElemLengthOverride);
CompressedTexImage(funcName, funcDims, target, level, internalFormat, width,
height, depth, border, src);
}
@ -1041,7 +1041,7 @@ public:
const uint8_t funcDims = 2;
const GLint zOffset = 0;
const GLsizei depth = 1;
const TexImageSourceAdapter src(anySrc, viewElemOffset, viewElemLengthOverride);
const TexImageSourceAdapter src(&anySrc, viewElemOffset, viewElemLengthOverride);
CompressedTexSubImage(funcName, funcDims, target, level, xOffset, yOffset,
zOffset, width, height, depth, unpackFormat, src);
}
@ -1115,7 +1115,7 @@ public:
GLsizei height, GLint border, GLenum unpackFormat, GLenum unpackType,
const T& anySrc, ErrorResult& out_error)
{
const TexImageSourceAdapter src(anySrc, &out_error);
const TexImageSourceAdapter src(&anySrc, &out_error);
TexImage2D(target, level, internalFormat, width, height, border, unpackFormat,
unpackType, src);
}
@ -1125,7 +1125,7 @@ public:
const dom::ArrayBufferView& view, GLuint viewElemOffset,
ErrorResult&)
{
const TexImageSourceAdapter src(view, viewElemOffset);
const TexImageSourceAdapter src(&view, viewElemOffset);
TexImage2D(target, level, internalFormat, width, height, border, unpackFormat,
unpackType, src);
}
@ -1155,7 +1155,7 @@ public:
GLsizei width, GLsizei height, GLenum unpackFormat,
GLenum unpackType, const T& anySrc, ErrorResult& out_error)
{
const TexImageSourceAdapter src(anySrc, &out_error);
const TexImageSourceAdapter src(&anySrc, &out_error);
TexSubImage2D(target, level, xOffset, yOffset, width, height, unpackFormat,
unpackType, src);
}
@ -1165,7 +1165,7 @@ public:
GLenum unpackType, const dom::ArrayBufferView& view,
GLuint viewElemOffset, ErrorResult&)
{
const TexImageSourceAdapter src(view, viewElemOffset);
const TexImageSourceAdapter src(&view, viewElemOffset);
TexSubImage2D(target, level, xOffset, yOffset, width, height, unpackFormat,
unpackType, src);
}
@ -1580,7 +1580,9 @@ protected:
}
WebGLRefPtr<WebGLBuffer>* ValidateBufferSlot(const char* funcName, GLenum target);
public:
WebGLBuffer* ValidateBufferSelection(const char* funcName, GLenum target);
protected:
IndexedBufferBinding* ValidateIndexedBufferSlot(const char* funcName, GLenum target,
GLuint index);
@ -1596,6 +1598,8 @@ protected:
return true;
}
bool ValidateForNonTransformFeedback(const char* funcName, WebGLBuffer* buffer);
public:
template<typename T>
bool ValidateNonNull(const char* funcName, const dom::Nullable<T>& maybe) {
@ -1754,6 +1758,17 @@ protected:
////////////////////////////////////
private:
mutable bool mBuffersForUB_Dirty;
mutable std::set<const WebGLBuffer*> mBuffersForUB;
public:
void OnUBIndexedBindingsChanged() const { mBuffersForUB_Dirty = true; }
const decltype(mBuffersForUB)& BuffersForUB() const;
////////////////////////////////////
protected:
// Generic Vertex Attributes
UniquePtr<GLenum[]> mVertexAttribType;
GLfloat mVertexAttrib0Vector[4];

View File

@ -75,6 +75,9 @@ WebGLContext::ValidateBufferSelection(const char* funcName, GLenum target)
return nullptr;
}
if (!ValidateForNonTransformFeedback(funcName, buffer.get()))
return nullptr;
return buffer.get();
}
@ -212,6 +215,15 @@ WebGLContext::BindBufferBase(GLenum target, GLuint index, WebGLBuffer* buffer)
if (buffer) {
buffer->SetContentAfterBind(target);
}
switch (target) {
case LOCAL_GL_TRANSFORM_FEEDBACK_BUFFER:
mBoundTransformFeedback->OnIndexedBindingsChanged();
break;
case LOCAL_GL_UNIFORM:
OnUBIndexedBindingsChanged();
break;
}
}
void
@ -296,6 +308,15 @@ WebGLContext::BindBufferRange(GLenum target, GLuint index, WebGLBuffer* buffer,
if (buffer) {
buffer->SetContentAfterBind(target);
}
switch (target) {
case LOCAL_GL_TRANSFORM_FEEDBACK_BUFFER:
mBoundTransformFeedback->OnIndexedBindingsChanged();
break;
case LOCAL_GL_UNIFORM:
OnUBIndexedBindingsChanged();
break;
}
}
////////////////////////////////////////
@ -383,13 +404,6 @@ WebGLContext::BufferSubDataImpl(GLenum target, WebGLsizeiptr dstByteOffset,
if (!buffer)
return;
if (buffer->mNumActiveTFOs) {
ErrorInvalidOperation("%s: Buffer is bound to an active transform feedback"
" object.",
"bufferSubData");
return;
}
if (!buffer->ValidateRange(funcName, dstByteOffset, dataLen))
return;

View File

@ -19,6 +19,8 @@
#include "WebGLVertexArray.h"
#include "WebGLVertexAttribData.h"
#include <algorithm>
namespace mozilla {
// For a Tegra workaround.
@ -300,6 +302,16 @@ WebGLContext::DrawArrays_check(const char* funcName, GLenum mode, GLint first,
////////////////////////////////////////
template<typename T>
static bool
DoSetsIntersect(const std::set<T>& a, const std::set<T>& b)
{
std::vector<T> intersection;
std::set_intersection(a.begin(), a.end(), b.begin(), b.end(),
std::back_inserter(intersection));
return bool(intersection.size());
}
class ScopedDrawHelper final
{
WebGLContext* const mWebGL;
@ -343,7 +355,7 @@ public:
////
// Check UBO sizes.
const auto& linkInfo = webgl->mActiveProgramLinkInfo;
const auto& linkInfo = mWebGL->mActiveProgramLinkInfo;
for (const auto& cur : linkInfo->uniformBlocks) {
const auto& dataSize = cur->mDataSize;
const auto& binding = cur->mBinding;
@ -366,6 +378,22 @@ public:
////
const auto& tfo = mWebGL->mBoundTransformFeedback;
if (tfo) {
const auto& buffersForTF = tfo->BuffersForTF();
const auto& buffersForUB = mWebGL->BuffersForUB();
if (DoSetsIntersect(buffersForTF, buffersForUB)) {
mWebGL->ErrorInvalidOperation("%s: At least one WebGLBuffer is bound for"
" both transform feedback and as a uniform"
" buffer.",
funcName);
*out_error = true;
return;
}
}
////
mWebGL->RunContextLossTimer();
}

View File

@ -1462,41 +1462,33 @@ void
WebGLContext::ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format,
GLenum type, WebGLsizeiptr offset, ErrorResult& out_error)
{
const char funcName[] = "readPixels";
if (!ReadPixels_SharedPrecheck(&out_error))
return;
if (!mBoundPixelPackBuffer) {
ErrorInvalidOperation("readPixels: PIXEL_PACK_BUFFER must not be null.");
const auto& buffer = ValidateBufferSelection(funcName, LOCAL_GL_PIXEL_PACK_BUFFER);
if (!buffer)
return;
}
if (mBoundPixelPackBuffer->mNumActiveTFOs) {
ErrorInvalidOperation("%s: Buffer is bound to an active transform feedback"
" object.",
"readPixels");
return;
}
//////
if (offset < 0) {
ErrorInvalidValue("readPixels: offset must not be negative.");
if (!ValidateNonNegative(funcName, "offset", offset))
return;
}
{
const auto bytesPerType = webgl::BytesPerPixel({LOCAL_GL_RED, type});
if (offset % bytesPerType != 0) {
ErrorInvalidOperation("readPixels: `offset` must be divisible by the size"
" a `type` in bytes.");
ErrorInvalidOperation("%s: `offset` must be divisible by the size of `type`"
" in bytes.",
funcName);
return;
}
}
//////
const auto bytesAvailable = mBoundPixelPackBuffer->ByteLength();
const auto bytesAvailable = buffer->ByteLength();
const auto checkedBytesAfterOffset = CheckedUint32(bytesAvailable) - offset;
uint32_t bytesAfterOffset = 0;
@ -1505,7 +1497,7 @@ WebGLContext::ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum
}
gl->MakeCurrent();
const ScopedLazyBind lazyBind(gl, LOCAL_GL_PIXEL_PACK_BUFFER, mBoundPixelPackBuffer);
const ScopedLazyBind lazyBind(gl, LOCAL_GL_PIXEL_PACK_BUFFER, buffer);
ReadPixelsImpl(x, y, width, height, format, type, (void*)offset, bytesAfterOffset);
}

View File

@ -1444,7 +1444,7 @@ WebGLProgram::TransformFeedbackVaryings(const dom::Sequence<nsString>& varyings,
GLuint maxAttribs = 0;
gl->GetUIntegerv(LOCAL_GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS,
&maxAttribs);
if (varyings.Length() >= maxAttribs) {
if (varyings.Length() > maxAttribs) {
mContext->ErrorInvalidValue("%s: Length of `varyings` exceeds %s.",
funcName,
"TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS");

View File

@ -185,14 +185,19 @@ FromView(WebGLContext* webgl, const char* funcName, TexImageTarget target,
static UniquePtr<webgl::TexUnpackBytes>
FromPboOffset(WebGLContext* webgl, const char* funcName, TexImageTarget target,
uint32_t width, uint32_t height, uint32_t depth, WebGLsizeiptr pboOffset,
size_t availBufferBytes)
uint32_t width, uint32_t height, uint32_t depth, WebGLsizeiptr pboOffset)
{
if (pboOffset < 0) {
webgl->ErrorInvalidValue("%s: offset cannot be negative.", funcName);
return nullptr;
}
const auto& buffer = webgl->ValidateBufferSelection(funcName,
LOCAL_GL_PIXEL_UNPACK_BUFFER);
if (!buffer)
return nullptr;
size_t availBufferBytes = buffer->ByteLength();
if (size_t(pboOffset) > availBufferBytes) {
webgl->ErrorInvalidOperation("%s: Offset is passed end of buffer.", funcName);
return nullptr;
@ -366,25 +371,12 @@ WebGLContext::From(const char* funcName, TexImageTarget target, GLsizei rawWidth
}
if (src.mPboOffset) {
if (!mBoundPixelUnpackBuffer) {
ErrorInvalidOperation("%s: PACK_BUFFER must be non-null.", funcName);
return nullptr;
}
if (mBoundPixelUnpackBuffer->mNumActiveTFOs) {
ErrorInvalidOperation("%s: Buffer is bound to an active transform feedback"
" object.",
funcName);
return nullptr;
}
const auto& availBytes = mBoundPixelUnpackBuffer->ByteLength();
return FromPboOffset(this, funcName, target, width, height, depth,
*(src.mPboOffset), availBytes);
*(src.mPboOffset));
}
if (mBoundPixelUnpackBuffer) {
ErrorInvalidOperation("%s: PACK_BUFFER must be null.", funcName);
ErrorInvalidOperation("%s: PIXEL_UNPACK_BUFFER must be null.", funcName);
return nullptr;
}
@ -1370,25 +1362,12 @@ WebGLContext::FromCompressed(const char* funcName, TexImageTarget target,
}
if (src.mPboOffset) {
if (!mBoundPixelUnpackBuffer) {
ErrorInvalidOperation("%s: PACK_BUFFER must be non-null.", funcName);
return nullptr;
}
if (mBoundPixelUnpackBuffer->mNumActiveTFOs) {
ErrorInvalidOperation("%s: Buffer is bound to an active transform feedback"
" object.",
funcName);
return nullptr;
}
const auto& availBytes = mBoundPixelUnpackBuffer->ByteLength();
return FromPboOffset(this, funcName, target, width, height, depth,
*(src.mPboOffset), availBytes);
*(src.mPboOffset));
}
if (mBoundPixelUnpackBuffer) {
ErrorInvalidOperation("%s: PACK_BUFFER must be null.", funcName);
ErrorInvalidOperation("%s: PIXEL_UNPACK_BUFFER must be null.", funcName);
return nullptr;
}

View File

@ -17,6 +17,7 @@ WebGLTransformFeedback::WebGLTransformFeedback(WebGLContext* webgl, GLuint tf)
, mIndexedBindings(webgl->mGLMaxTransformFeedbackSeparateAttribs)
, mIsPaused(false)
, mIsActive(false)
, mBuffersForTF_Dirty(true)
{
mContext->mTransformFeedbacks.insertBack(this);
}
@ -36,6 +37,28 @@ WebGLTransformFeedback::Delete()
removeFrom(mContext->mTransformFeedbacks);
}
////
const decltype(WebGLTransformFeedback::mBuffersForTF)&
WebGLTransformFeedback::BuffersForTF() const
{
// The generic bind point cannot incur undefined read/writes because otherwise it
// would be impossible to read back from this. The spec implies that readback from
// the TRANSFORM_FEEDBACK target is possible, just not simultaneously with being
// "bound or in use for transform feedback".
// Therefore, only the indexed bindings of the TFO count.
if (mBuffersForTF_Dirty) {
mBuffersForTF.clear();
for (const auto& cur : mIndexedBindings) {
if (cur.mBufferBinding) {
mBuffersForTF.insert(cur.mBufferBinding.get());
}
}
mBuffersForTF_Dirty = false;
}
return mBuffersForTF;
}
////////////////////////////////////////
void
@ -107,13 +130,6 @@ WebGLTransformFeedback::BeginTransformFeedback(GLenum primMode)
////
for (const auto& cur : mIndexedBindings) {
const auto& buffer = cur.mBufferBinding;
if (buffer) {
buffer->mNumActiveTFOs++;
}
}
mActive_Program->mNumActiveTFOs++;
}
@ -139,13 +155,6 @@ WebGLTransformFeedback::EndTransformFeedback()
////
for (const auto& cur : mIndexedBindings) {
const auto& buffer = cur.mBufferBinding;
if (buffer) {
buffer->mNumActiveTFOs--;
}
}
mActive_Program->mNumActiveTFOs--;
}

View File

@ -37,6 +37,9 @@ private:
MOZ_INIT_OUTSIDE_CTOR size_t mActive_VertPosition;
MOZ_INIT_OUTSIDE_CTOR size_t mActive_VertCapacity;
mutable bool mBuffersForTF_Dirty;
mutable std::set<const WebGLBuffer*> mBuffersForTF;
public:
WebGLTransformFeedback(WebGLContext* webgl, GLuint tf);
private:
@ -50,6 +53,11 @@ public:
WebGLContext* GetParentObject() const { return mContext; }
virtual JSObject* WrapObject(JSContext*, JS::Handle<JSObject*>) override;
////
void OnIndexedBindingsChanged() const { mBuffersForTF_Dirty = true; }
const decltype(mBuffersForTF)& BuffersForTF() const;
// GL Funcs
void BeginTransformFeedback(GLenum primMode);
void EndTransformFeedback();

View File

@ -61,6 +61,8 @@ shouldBe("gl.getIndexedParameter(gl.TRANSFORM_FEEDBACK_BUFFER_SIZE, 0)", "0");
shouldBe("gl.getIndexedParameter(gl.TRANSFORM_FEEDBACK_BUFFER_START, 0)", "0");
gl.bufferData(gl.TRANSFORM_FEEDBACK_BUFFER, 4, gl.STATIC_DRAW);
wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION);
shouldBe("gl.getIndexedParameter(gl.TRANSFORM_FEEDBACK_BUFFER_BINDING, 0)", "buffer1");
shouldBe("gl.getIndexedParameter(gl.TRANSFORM_FEEDBACK_BUFFER_SIZE, 0)", "0");
shouldBe("gl.getIndexedParameter(gl.TRANSFORM_FEEDBACK_BUFFER_START, 0)", "0");
@ -97,11 +99,13 @@ shouldBe("gl.getIndexedParameter(gl.TRANSFORM_FEEDBACK_BUFFER_SIZE, 0)", "8");
shouldBe("gl.getIndexedParameter(gl.TRANSFORM_FEEDBACK_BUFFER_START, 0)", "4");
gl.bufferData(gl.TRANSFORM_FEEDBACK_BUFFER, 4, gl.STATIC_DRAW);
wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION);
shouldBe("gl.getIndexedParameter(gl.TRANSFORM_FEEDBACK_BUFFER_BINDING, 0)", "buffer3");
shouldBe("gl.getIndexedParameter(gl.TRANSFORM_FEEDBACK_BUFFER_SIZE, 0)", "8");
shouldBe("gl.getIndexedParameter(gl.TRANSFORM_FEEDBACK_BUFFER_START, 0)", "4");
gl.bufferData(gl.TRANSFORM_FEEDBACK_BUFFER, 12, gl.STATIC_DRAW);
wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION);
shouldBe("gl.getIndexedParameter(gl.TRANSFORM_FEEDBACK_BUFFER_BINDING, 0)", "buffer3");
shouldBe("gl.getIndexedParameter(gl.TRANSFORM_FEEDBACK_BUFFER_SIZE, 0)", "8");
shouldBe("gl.getIndexedParameter(gl.TRANSFORM_FEEDBACK_BUFFER_START, 0)", "4");

View File

@ -88,7 +88,7 @@ var testBindingFn = function(firstBindFn, secondBindFn, firstTarget, secondTarge
wtu.glErrorShouldBe(gl, gl.NO_ERROR, messagePrefix + "WORK");
else
wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, messagePrefix + "FAIL");
/*
if ((firstTarget == gl.TRANSFORM_FEEDBACK_BUFFER && secondTarget != gl.TRANSFORM_FEEDBACK_BUFFER) ||
(firstTarget != gl.TRANSFORM_FEEDBACK_BUFFER && secondTarget == gl.TRANSFORM_FEEDBACK_BUFFER)) {
bind(firstBindFn, firstTarget, buffer);
@ -98,6 +98,7 @@ var testBindingFn = function(firstBindFn, secondBindFn, firstTarget, secondTarge
+ " and simultaneously binding buffer with " + secondBindFn + " to gl." + secondTargetStr + " should FAIL";
wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, message);
}
*/
}
var testBinding = function(firstTarget, secondTarget) {

View File

@ -144,6 +144,12 @@ public:
bool
ClonableToDifferentThreadOrProcess() const;
nsIFile*
GetInternalNsIFile() const
{
return mFile;
}
private:
Directory(nsISupports* aParent,
nsIFile* aFile,

View File

@ -829,7 +829,7 @@ HTMLFormElement::SubmitSubmission(HTMLFormSubmission* aFormSubmission)
rv = linkHandler->OnLinkClickSync(this, actionURI,
target.get(),
NullString(),
postDataStream, nullptr,
postDataStream, nullptr, false,
getter_AddRefs(docShell),
getter_AddRefs(mSubmittingRequest));
NS_ENSURE_SUBMIT_SUCCESS(rv);

View File

@ -485,28 +485,37 @@ namespace {
* where the file picker can create Blobs.
*/
static already_AddRefed<nsIFile>
DOMFileOrDirectoryToLocalFile(const OwningFileOrDirectory& aData)
LastUsedDirectory(const OwningFileOrDirectory& aData)
{
nsString path;
if (aData.IsFile()) {
ErrorResult rv;
aData.GetAsFile()->GetMozFullPathInternal(path, rv);
if (rv.Failed() || path.IsEmpty()) {
rv.SuppressException();
nsAutoString path;
ErrorResult error;
aData.GetAsFile()->GetMozFullPathInternal(path, error);
if (error.Failed() || path.IsEmpty()) {
error.SuppressException();
return nullptr;
}
} else {
MOZ_ASSERT(aData.IsDirectory());
aData.GetAsDirectory()->GetFullRealPath(path);
nsCOMPtr<nsIFile> localFile;
nsresult rv = NS_NewNativeLocalFile(NS_ConvertUTF16toUTF8(path), true,
getter_AddRefs(localFile));
if (NS_WARN_IF(NS_FAILED(rv))) {
return nullptr;
}
nsCOMPtr<nsIFile> parentFile;
rv = localFile->GetParent(getter_AddRefs(parentFile));
if (NS_WARN_IF(NS_FAILED(rv))) {
return nullptr;
}
return parentFile.forget();
}
nsCOMPtr<nsIFile> localFile;
nsresult rv = NS_NewNativeLocalFile(NS_ConvertUTF16toUTF8(path), true,
getter_AddRefs(localFile));
if (NS_WARN_IF(NS_FAILED(rv))) {
return nullptr;
}
MOZ_ASSERT(aData.IsDirectory());
nsCOMPtr<nsIFile> localFile = aData.GetAsDirectory()->GetInternalNsIFile();
MOZ_ASSERT(localFile);
return localFile.forget();
}
@ -616,12 +625,9 @@ HTMLInputElement::nsFilePickerShownCallback::Done(int16_t aResult)
}
// Store the last used directory using the content pref service:
nsCOMPtr<nsIFile> file =
DOMFileOrDirectoryToLocalFile(newFilesOrDirectories[0]);
nsCOMPtr<nsIFile> lastUsedDir = LastUsedDirectory(newFilesOrDirectories[0]);
if (file) {
nsCOMPtr<nsIFile> lastUsedDir;
file->GetParent(getter_AddRefs(lastUsedDir));
if (lastUsedDir) {
HTMLInputElement::gUploadLastDir->StoreLastUsedDirectory(
mInput->OwnerDoc(), lastUsedDir);
}
@ -994,7 +1000,7 @@ HTMLInputElement::InitFilePicker(FilePickerType aType)
filePicker->AppendFilters(nsIFilePicker::filterAll);
}
// Set default directry and filename
// Set default directory and filename
nsAutoString defaultName;
const nsTArray<OwningFileOrDirectory>& oldFiles =
@ -1005,15 +1011,11 @@ HTMLInputElement::InitFilePicker(FilePickerType aType)
if (!oldFiles.IsEmpty() &&
aType != FILE_PICKER_DIRECTORY) {
nsString path;
nsAutoString path;
nsCOMPtr<nsIFile> localFile = DOMFileOrDirectoryToLocalFile(oldFiles[0]);
if (localFile) {
nsCOMPtr<nsIFile> parentFile;
nsresult rv = localFile->GetParent(getter_AddRefs(parentFile));
if (NS_SUCCEEDED(rv)) {
filePicker->SetDisplayDirectory(parentFile);
}
nsCOMPtr<nsIFile> parentFile = LastUsedDirectory(oldFiles[0]);
if (parentFile) {
filePicker->SetDisplayDirectory(parentFile);
}
// Unfortunately nsIFilePicker doesn't allow multiple files to be

View File

@ -600,10 +600,6 @@ GMPCapability::Supports(const nsTArray<GMPCapability>& aCapabilities,
if (!WMFDecoderModule::HasH264()) {
continue;
}
} else if (capabilities.mAPIName.EqualsLiteral(GMP_API_AUDIO_DECODER)) {
if (!WMFDecoderModule::HasAAC()) {
continue;
}
}
}
#endif

View File

@ -321,6 +321,12 @@ nsSMILAnimationController::DoSample(bool aSkipUnchangedContainers)
bool isStyleFlushNeeded = mResampleNeeded;
mResampleNeeded = false;
if (mDocument->IsStyledByServo()) {
NS_ERROR("stylo: SMIL animations not supported yet");
return;
}
// Set running sample flag -- do this before flushing styles so that when we
// flush styles we don't end up requesting extra samples
AutoRestore<bool> autoRestoreRunningSample(mRunningSample);

View File

@ -12,6 +12,7 @@
#include "Matrix.h"
#include "Quaternion.h"
#include "UserData.h"
#include <vector>
// GenericRefCountedBase allows us to hold on to refcounted objects of any type
// (contrary to RefCounted<T> which requires knowing the type T) and, in particular,
@ -630,6 +631,10 @@ struct Glyph
Point mPosition;
};
static inline bool operator==(const Glyph& aOne, const Glyph& aOther) {
return aOne.mIndex == aOther.mIndex && aOne.mPosition == aOther.mPosition;
}
/** This class functions as a glyph buffer that can be drawn to a DrawTarget.
* @todo XXX - This should probably contain the guts of gfxTextRun in the future as
* roc suggested. But for now it's a simple container for a glyph vector.
@ -664,7 +669,7 @@ struct GlyphMetrics
* at a particular size. It is passed into text drawing calls to describe
* the font used for the drawing call.
*/
class ScaledFont : public RefCounted<ScaledFont>
class ScaledFont : public external::AtomicRefCounted<ScaledFont>
{
public:
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(ScaledFont)
@ -778,6 +783,7 @@ public:
virtual BackendType GetBackendType() const = 0;
virtual bool IsRecording() const { return false; }
virtual bool IsCaptureDT() const { return false; }
/**
* Returns a SourceSurface which is a snapshot of the current contents of the DrawTarget.
@ -1272,6 +1278,17 @@ protected:
class DrawTargetCapture : public DrawTarget
{
public:
virtual bool IsCaptureDT() const { return true; }
/**
* Returns true if the recording only contains FillGlyph calls with
* a single font and color. Returns the list of Glyphs along with
* the font and color as outparams if so.
*/
virtual bool ContainsOnlyColoredGlyphs(RefPtr<ScaledFont>& aScaledFont,
Color& aColor,
std::vector<Glyph>& aGlyphs) = 0;
};
class DrawEventRecorder : public RefCounted<DrawEventRecorder>

View File

@ -46,14 +46,14 @@ public:
virtual bool GetAffectedRect(Rect& aDeviceRect, const Matrix& aTransform) const { return false; }
CommandType GetType() { return mType; }
protected:
explicit DrawingCommand(CommandType aType)
: mType(aType)
{
}
CommandType GetType() { return mType; }
private:
CommandType mType;
};
@ -418,6 +418,7 @@ private:
class FillGlyphsCommand : public DrawingCommand
{
friend class DrawTargetCaptureImpl;
public:
FillGlyphsCommand(ScaledFont* aFont,
const GlyphBuffer& aBuffer,
@ -553,6 +554,7 @@ public:
class SetTransformCommand : public DrawingCommand
{
friend class DrawTargetCaptureImpl;
public:
explicit SetTransformCommand(const Matrix& aTransform)
: DrawingCommand(CommandType::SETTRANSFORM)

View File

@ -197,5 +197,63 @@ DrawTargetCaptureImpl::ReplayToDrawTarget(DrawTarget* aDT, const Matrix& aTransf
}
}
bool
DrawTargetCaptureImpl::ContainsOnlyColoredGlyphs(RefPtr<ScaledFont>& aScaledFont,
Color& aColor,
std::vector<Glyph>& aGlyphs)
{
uint8_t* start = &mDrawCommandStorage.front();
uint8_t* current = start;
while (current < start + mDrawCommandStorage.size()) {
DrawingCommand* command =
reinterpret_cast<DrawingCommand*>(current + sizeof(uint32_t));
current += *(uint32_t*)current;
if (command->GetType() != CommandType::FILLGLYPHS &&
command->GetType() != CommandType::SETTRANSFORM) {
return false;
}
if (command->GetType() == CommandType::SETTRANSFORM) {
SetTransformCommand* transform = static_cast<SetTransformCommand*>(command);
if (transform->mTransform != Matrix()) {
return false;
}
continue;
}
FillGlyphsCommand* fillGlyphs = static_cast<FillGlyphsCommand*>(command);
if (aScaledFont && fillGlyphs->mFont != aScaledFont) {
return false;
}
aScaledFont = fillGlyphs->mFont;
Pattern& pat = fillGlyphs->mPattern;
if (pat.GetType() != PatternType::COLOR) {
return false;
}
ColorPattern* colorPat = static_cast<ColorPattern*>(&pat);
if (aColor != Color() && colorPat->mColor != aColor) {
return false;
}
aColor = colorPat->mColor;
if (fillGlyphs->mOptions.mCompositionOp != CompositionOp::OP_OVER ||
fillGlyphs->mOptions.mAlpha != 1.0f) {
return false;
}
//TODO: Deal with AA on the DrawOptions, and the GlyphRenderingOptions
aGlyphs.insert(aGlyphs.end(),
fillGlyphs->mGlyphs.begin(),
fillGlyphs->mGlyphs.end());
}
return true;
}
} // namespace gfx
} // namespace mozilla

View File

@ -27,6 +27,8 @@ public:
virtual BackendType GetBackendType() const { return mRefDT->GetBackendType(); }
virtual DrawTargetType GetType() const { return mRefDT->GetType(); }
virtual bool IsCaptureDT() const { return true; }
virtual already_AddRefed<SourceSurface> Snapshot();
virtual void DetachAllSnapshots();
@ -136,6 +138,8 @@ public:
void ReplayToDrawTarget(DrawTarget* aDT, const Matrix& aTransform);
bool ContainsOnlyColoredGlyphs(RefPtr<ScaledFont>& aScaledFont, Color& aColor, std::vector<Glyph>& aGlyphs);
protected:
~DrawTargetCaptureImpl();

View File

@ -25,6 +25,7 @@
#include "mozilla/layers/LayersTypes.h"
#include "nsRect.h"
#include "nsRegion.h"
#include "mozilla/Array.h"
#include <stdint.h>
@ -1268,6 +1269,42 @@ struct ParamTraits<mozilla::layers::AsyncDragMetrics>
}
};
template <>
struct ParamTraits<mozilla::gfx::Glyph>
{
typedef mozilla::gfx::Glyph paramType;
static void Write(Message* aMsg, const paramType& aParam) {
WriteParam(aMsg, aParam.mIndex);
WriteParam(aMsg, aParam.mPosition);
}
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) {
return (ReadParam(aMsg, aIter, &aResult->mIndex) &&
ReadParam(aMsg, aIter, &aResult->mPosition)
);
}
};
template<typename T, size_t Length>
struct ParamTraits<mozilla::Array<T, Length>>
{
typedef mozilla::Array<T, Length> paramType;
static void Write(Message* aMsg, const paramType& aParam) {
for (size_t i = 0; i < Length; i++) {
WriteParam(aMsg, aParam[i]);
}
}
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) {
for (size_t i = 0; i < Length; i++) {
if (!ReadParam(aMsg, aIter, &aResult[i])) {
return false;
}
}
return true;
}
};
} /* namespace IPC */
#endif /* __GFXMESSAGEUTILS_H__ */

View File

@ -479,9 +479,9 @@ public:
static ImageHost* GetImageHost(Layer* aLayer)
{
LayerComposite* composite = aLayer->AsLayerComposite();
if (composite) {
return static_cast<ImageHost*>(composite->GetCompositableHost());
HostLayer* compositor = aLayer->AsHostLayer();
if (compositor) {
return static_cast<ImageHost*>(compositor->GetCompositableHost());
}
return nullptr;
}
@ -609,6 +609,8 @@ CloneLayerTreePropertiesInternal(Layer* aRoot, bool aIsMask /* = false */)
case Layer::TYPE_READBACK:
case Layer::TYPE_SHADOW:
case Layer::TYPE_PAINTED:
case Layer::TYPE_TEXT:
case Layer::TYPE_BORDER:
return MakeUnique<LayerPropertiesBase>(aRoot);
}

View File

@ -576,7 +576,7 @@ Layer::CanUseOpaqueSurface()
const Maybe<ParentLayerIntRect>&
Layer::GetLocalClipRect()
{
if (LayerComposite* shadow = AsLayerComposite()) {
if (HostLayer* shadow = AsHostLayer()) {
return shadow->GetShadowClipRect();
}
return GetClipRect();
@ -585,7 +585,7 @@ Layer::GetLocalClipRect()
const LayerIntRegion&
Layer::GetLocalVisibleRegion()
{
if (LayerComposite* shadow = AsLayerComposite()) {
if (HostLayer* shadow = AsHostLayer()) {
return shadow->GetShadowVisibleRegion();
}
return GetVisibleRegion();
@ -782,7 +782,7 @@ Layer::CalculateScissorRect(const RenderTargetIntRect& aCurrentScissorRect)
}
if (GetLocalVisibleRegion().IsEmpty() &&
!(AsLayerComposite() && AsLayerComposite()->NeedToDrawCheckerboarding())) {
!(AsHostLayer() && AsHostLayer()->NeedToDrawCheckerboarding())) {
// When our visible region is empty, our parent may not have created the
// intermediate surface that we would require for correct clipping; however,
// this does not matter since we are invisible.
@ -887,7 +887,7 @@ Layer::GetTransformTyped() const
Matrix4x4
Layer::GetLocalTransform()
{
if (LayerComposite* shadow = AsLayerComposite())
if (HostLayer* shadow = AsHostLayer())
return shadow->GetShadowTransform();
else
return GetTransform();
@ -941,7 +941,7 @@ float
Layer::GetLocalOpacity()
{
float opacity = mOpacity;
if (LayerComposite* shadow = AsLayerComposite())
if (HostLayer* shadow = AsHostLayer())
opacity = shadow->GetShadowOpacity();
return std::min(std::max(opacity, 0.0f), 1.0f);
}
@ -1661,7 +1661,7 @@ LayerManager::BeginTabSwitch()
mTabSwitchStart = TimeStamp::Now();
}
static void PrintInfo(std::stringstream& aStream, LayerComposite* aLayerComposite);
static void PrintInfo(std::stringstream& aStream, HostLayer* aLayerComposite);
#ifdef MOZ_DUMP_PAINTING
template <typename T>
@ -1702,8 +1702,8 @@ Layer::Dump(std::stringstream& aStream, const char* aPrefix,
bool aDumpHtml, bool aSorted)
{
#ifdef MOZ_DUMP_PAINTING
bool dumpCompositorTexture = gfxEnv::DumpCompositorTextures() && AsLayerComposite() &&
AsLayerComposite()->GetCompositableHost();
bool dumpCompositorTexture = gfxEnv::DumpCompositorTextures() && AsHostLayer() &&
AsHostLayer()->GetCompositableHost();
bool dumpClientTexture = gfxEnv::DumpPaint() && AsShadowableLayer() &&
AsShadowableLayer()->GetCompositableClient();
nsCString layerId(Name());
@ -1723,7 +1723,7 @@ Layer::Dump(std::stringstream& aStream, const char* aPrefix,
#ifdef MOZ_DUMP_PAINTING
if (dumpCompositorTexture) {
AsLayerComposite()->GetCompositableHost()->Dump(aStream, aPrefix, aDumpHtml);
AsHostLayer()->GetCompositableHost()->Dump(aStream, aPrefix, aDumpHtml);
} else if (dumpClientTexture) {
if (aDumpHtml) {
aStream << nsPrintfCString(R"(<script>array["%s"]=")", layerId.BeginReading()).get();
@ -1886,7 +1886,7 @@ Layer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
aStream << aPrefix;
aStream << nsPrintfCString("%s%s (0x%p)", mManager->Name(), Name(), this).get();
layers::PrintInfo(aStream, AsLayerComposite());
layers::PrintInfo(aStream, AsHostLayer());
if (mClipRect) {
AppendToString(aStream, *mClipRect, " [clip=", "]");
@ -2030,7 +2030,7 @@ Layer::DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent)
layer->set_ptr(reinterpret_cast<uint64_t>(this));
layer->set_parentptr(reinterpret_cast<uint64_t>(aParent));
// Shadow
if (LayerComposite* lc = AsLayerComposite()) {
if (HostLayer* lc = AsHostLayer()) {
LayersPacket::Layer::Shadow* s = layer->mutable_shadow();
if (const Maybe<ParentLayerIntRect>& clipRect = lc->GetShadowClipRect()) {
DumpRect(s->mutable_clip(), *clipRect);
@ -2200,6 +2200,35 @@ ColorLayer::DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent)
layer->set_color(mColor.ToABGR());
}
void
TextLayer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
{
Layer::PrintInfo(aStream, aPrefix);
AppendToString(aStream, mBounds, " [bounds=", "]");
}
void
TextLayer::DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent)
{
Layer::DumpPacket(aPacket, aParent);
// Get this layer data
using namespace layerscope;
LayersPacket::Layer* layer = aPacket->mutable_layer(aPacket->layer_size()-1);
layer->set_type(LayersPacket::Layer::TextLayer);
}
void
BorderLayer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
{
Layer::PrintInfo(aStream, aPrefix);
}
void
BorderLayer::DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent)
{
Layer::DumpPacket(aPacket, aParent);
}
CanvasLayer::CanvasLayer(LayerManager* aManager, void* aImplData)
: Layer(aManager, aImplData)
, mPreTransCallback(nullptr)
@ -2458,7 +2487,7 @@ LayerManager::ClearPendingScrollInfoUpdate()
}
void
PrintInfo(std::stringstream& aStream, LayerComposite* aLayerComposite)
PrintInfo(std::stringstream& aStream, HostLayer* aLayerComposite)
{
if (!aLayerComposite) {
return;
@ -2500,5 +2529,20 @@ ToOutsideIntRect(const gfxRect &aRect)
return IntRect::RoundOut(aRect.x, aRect.y, aRect.width, aRect.height);
}
TextLayer::TextLayer(LayerManager* aManager, void* aImplData)
: Layer(aManager, aImplData)
{}
TextLayer::~TextLayer()
{}
void
TextLayer::SetGlyphs(nsTArray<GlyphArray>&& aGlyphs)
{
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) Glyphs", this));
mGlyphs = Move(aGlyphs);
Mutated();
}
} // namespace layers
} // namespace mozilla

View File

@ -18,6 +18,7 @@
#include "gfxRect.h" // for gfxRect
#include "gfx2DGlue.h"
#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2, etc
#include "mozilla/Array.h"
#include "mozilla/DebugOnly.h" // for DebugOnly
#include "mozilla/EventForwards.h" // for nsPaintEvent
#include "mozilla/Maybe.h" // for Maybe
@ -85,11 +86,13 @@ class PaintedLayer;
class ContainerLayer;
class ImageLayer;
class ColorLayer;
class TextLayer;
class CanvasLayer;
class BorderLayer;
class ReadbackLayer;
class ReadbackProcessor;
class RefLayer;
class LayerComposite;
class HostLayer;
class ShadowableLayer;
class ShadowLayerForwarder;
class LayerManagerComposite;
@ -97,6 +100,7 @@ class SpecificLayerAttributes;
class Compositor;
class FrameUniformityData;
class PersistentBufferProvider;
class GlyphArray;
namespace layerscope {
class LayersPacket;
@ -400,6 +404,16 @@ public:
* Create a ColorLayer for this manager's layer tree.
*/
virtual already_AddRefed<ColorLayer> CreateColorLayer() = 0;
/**
* CONSTRUCTION PHASE ONLY
* Create a TextLayer for this manager's layer tree.
*/
virtual already_AddRefed<TextLayer> CreateTextLayer() = 0;
/**
* CONSTRUCTION PHASE ONLY
* Create a BorderLayer for this manager's layer tree.
*/
virtual already_AddRefed<BorderLayer> CreateBorderLayer() { return nullptr; }
/**
* CONSTRUCTION PHASE ONLY
* Create a CanvasLayer for this manager's layer tree.
@ -744,6 +758,8 @@ public:
TYPE_COLOR,
TYPE_CONTAINER,
TYPE_IMAGE,
TYPE_TEXT,
TYPE_BORDER,
TYPE_READBACK,
TYPE_REF,
TYPE_SHADOW,
@ -1522,11 +1538,23 @@ public:
*/
virtual ColorLayer* AsColorLayer() { return nullptr; }
/**
* Dynamic cast to a TextLayer. Returns null if this is not a
* TextLayer.
*/
virtual TextLayer* AsTextLayer() { return nullptr; }
/**
* Dynamic cast to a Border. Returns null if this is not a
* ColorLayer.
*/
virtual BorderLayer* AsBorderLayer() { return nullptr; }
/**
* Dynamic cast to a LayerComposite. Return null if this is not a
* LayerComposite. Can be used anytime.
*/
virtual LayerComposite* AsLayerComposite() { return nullptr; }
virtual HostLayer* AsHostLayer() { return nullptr; }
/**
* Dynamic cast to a ShadowableLayer. Return null if this is not a
@ -1946,6 +1974,13 @@ public:
*/
void SetAllowResidualTranslation(bool aAllow) { mAllowResidualTranslation = aAllow; }
void SetValidRegion(const nsIntRegion& aRegion)
{
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) ValidRegion", this));
mValidRegion = aRegion;
Mutated();
}
/**
* Can be used anytime
*/
@ -2315,6 +2350,128 @@ protected:
gfx::Color mColor;
};
/**
* A Layer which renders Glyphs.
*/
class TextLayer : public Layer {
public:
virtual TextLayer* AsTextLayer() override { return this; }
/**
* CONSTRUCTION PHASE ONLY
*/
void SetBounds(const gfx::IntRect& aBounds)
{
if (!mBounds.IsEqualEdges(aBounds)) {
mBounds = aBounds;
Mutated();
}
}
const gfx::IntRect& GetBounds()
{
return mBounds;
}
void SetScaledFont(gfx::ScaledFont* aScaledFont) {
if (aScaledFont != mFont) {
mFont = aScaledFont;
Mutated();
}
}
gfx::ScaledFont* GetScaledFont() { return mFont; }
MOZ_LAYER_DECL_NAME("TextLayer", TYPE_TEXT)
virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) override
{
gfx::Matrix4x4 idealTransform = GetLocalTransform() * aTransformToSurface;
mEffectiveTransform = SnapTransformTranslation(idealTransform, nullptr);
ComputeEffectiveTransformForMaskLayers(aTransformToSurface);
}
virtual void SetGlyphs(nsTArray<GlyphArray>&& aGlyphs);
protected:
TextLayer(LayerManager* aManager, void* aImplData);
~TextLayer();
virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) override;
virtual void DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent) override;
gfx::IntRect mBounds;
nsTArray<GlyphArray> mGlyphs;
RefPtr<gfx::ScaledFont> mFont;
};
/**
* A Layer which renders a rounded rect.
*/
class BorderLayer : public Layer {
public:
virtual BorderLayer* AsBorderLayer() override { return this; }
/**
* CONSTRUCTION PHASE ONLY
* Set the color of the layer.
*/
// Colors of each side as in css::Side
virtual void SetColors(const BorderColors& aColors)
{
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) Colors", this));
PodCopy(&mColors[0], &aColors[0], 4);
Mutated();
}
virtual void SetRect(const LayerRect& aRect)
{
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) Rect", this));
mRect = aRect;
Mutated();
}
// Size of each rounded corner as in css::Corner, 0.0 means a
// rectangular corner.
virtual void SetCornerRadii(const BorderCorners& aCorners)
{
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) Corners", this));
PodCopy(&mCorners[0], &aCorners[0], 4);
Mutated();
}
virtual void SetWidths(const BorderWidths& aWidths)
{
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) Widths", this));
PodCopy(&mWidths[0], &aWidths[0], 4);
Mutated();
}
MOZ_LAYER_DECL_NAME("BorderLayer", TYPE_BORDER)
virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) override
{
gfx::Matrix4x4 idealTransform = GetLocalTransform() * aTransformToSurface;
mEffectiveTransform = SnapTransformTranslation(idealTransform, nullptr);
ComputeEffectiveTransformForMaskLayers(aTransformToSurface);
}
protected:
BorderLayer(LayerManager* aManager, void* aImplData)
: Layer(aManager, aImplData)
{}
virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) override;
virtual void DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent) override;
BorderColors mColors;
LayerRect mRect;
BorderCorners mCorners;
BorderWidths mWidths;
};
/**
* A Layer for HTML Canvas elements. It's backed by either a
* gfxASurface or a GLContext (for WebGL layers), and has some control
@ -2371,6 +2528,8 @@ public:
*/
virtual void Initialize(const Data& aData) = 0;
void SetBounds(gfx::IntRect aBounds) { mBounds = aBounds; }
/**
* Check the data is owned by this layer is still valid for rendering
*/

View File

@ -242,6 +242,10 @@ typedef gfx::Matrix4x4Typed<LayerPixel, CSSTransformedLayerPixel> CSSTransformMa
typedef gfx::Matrix4x4Typed<ParentLayerPixel, ParentLayerPixel> AsyncTransformComponentMatrix;
typedef gfx::Matrix4x4Typed<CSSTransformedLayerPixel, ParentLayerPixel> AsyncTransformMatrix;
typedef Array<gfx::Color, 4> BorderColors;
typedef Array<LayerSize, 4> BorderCorners;
typedef Array<LayerCoord, 4> BorderWidths;
} // namespace layers
} // namespace mozilla

View File

@ -0,0 +1,83 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "BasicLayersImpl.h" // for FillRectWithMask, etc
#include "Layers.h" // for ColorLayer, etc
#include "BasicImplData.h" // for BasicImplData
#include "BasicLayers.h" // for BasicLayerManager
#include "gfxContext.h" // for gfxContext, etc
#include "gfxRect.h" // for gfxRect
#include "gfx2DGlue.h"
#include "mozilla/mozalloc.h" // for operator new
#include "nsCOMPtr.h" // for already_AddRefed
#include "nsDebug.h" // for NS_ASSERTION
#include "nsISupportsImpl.h" // for Layer::AddRef, etc
#include "nsRect.h" // for mozilla::gfx::IntRect
#include "nsRegion.h" // for nsIntRegion
#include "mozilla/gfx/PathHelpers.h"
using namespace mozilla::gfx;
namespace mozilla {
namespace layers {
class BasicBorderLayer : public BorderLayer, public BasicImplData {
public:
explicit BasicBorderLayer(BasicLayerManager* aLayerManager) :
BorderLayer(aLayerManager, static_cast<BasicImplData*>(this))
{
MOZ_COUNT_CTOR(BasicBorderLayer);
}
protected:
virtual ~BasicBorderLayer()
{
MOZ_COUNT_DTOR(BasicBorderLayer);
}
public:
virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override
{
NS_ASSERTION(BasicManager()->InConstruction(),
"Can only set properties in construction phase");
BorderLayer::SetVisibleRegion(aRegion);
}
virtual void Paint(DrawTarget* aDT,
const gfx::Point& aDeviceOffset,
Layer* aMaskLayer) override
{
if (IsHidden()) {
return;
}
// We currently assume that we never have rounded corners,
// and that all borders have the same width and color.
ColorPattern color(mColors[0]);
StrokeOptions strokeOptions(mWidths[0]);
Rect rect = mRect.ToUnknownRect();
rect.Deflate(mWidths[0] / 2.0);
aDT->StrokeRect(rect, color, strokeOptions);
}
protected:
BasicLayerManager* BasicManager()
{
return static_cast<BasicLayerManager*>(mManager);
}
};
already_AddRefed<BorderLayer>
BasicLayerManager::CreateBorderLayer()
{
NS_ASSERTION(InConstruction(), "Only allowed in construction phase");
RefPtr<BorderLayer> layer = new BasicBorderLayer(this);
return layer.forget();
}
} // namespace layers
} // namespace mozilla

View File

@ -114,6 +114,8 @@ public:
virtual already_AddRefed<ImageLayer> CreateImageLayer() override;
virtual already_AddRefed<CanvasLayer> CreateCanvasLayer() override;
virtual already_AddRefed<ColorLayer> CreateColorLayer() override;
virtual already_AddRefed<TextLayer> CreateTextLayer() override;
virtual already_AddRefed<BorderLayer> CreateBorderLayer() override;
virtual already_AddRefed<ReadbackLayer> CreateReadbackLayer() override;
virtual ImageFactory *GetImageFactory();

View File

@ -0,0 +1,86 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "BasicLayersImpl.h" // for FillRectWithMask, etc
#include "Layers.h" // for ColorLayer, etc
#include "BasicImplData.h" // for BasicImplData
#include "BasicLayers.h" // for BasicLayerManager
#include "gfxContext.h" // for gfxContext, etc
#include "gfxRect.h" // for gfxRect
#include "gfx2DGlue.h"
#include "mozilla/mozalloc.h" // for operator new
#include "nsCOMPtr.h" // for already_AddRefed
#include "nsDebug.h" // for NS_ASSERTION
#include "nsISupportsImpl.h" // for Layer::AddRef, etc
#include "nsRect.h" // for mozilla::gfx::IntRect
#include "nsRegion.h" // for nsIntRegion
#include "mozilla/gfx/PathHelpers.h"
using namespace mozilla::gfx;
namespace mozilla {
namespace layers {
class BasicTextLayer : public TextLayer, public BasicImplData {
public:
explicit BasicTextLayer(BasicLayerManager* aLayerManager) :
TextLayer(aLayerManager, static_cast<BasicImplData*>(this))
{
MOZ_COUNT_CTOR(BasicTextLayer);
}
protected:
virtual ~BasicTextLayer()
{
MOZ_COUNT_DTOR(BasicTextLayer);
}
public:
virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override
{
NS_ASSERTION(BasicManager()->InConstruction(),
"Can only set properties in construction phase");
TextLayer::SetVisibleRegion(aRegion);
}
virtual void Paint(DrawTarget* aDT,
const gfx::Point& aDeviceOffset,
Layer* aMaskLayer) override
{
if (IsHidden() || !mFont) {
return;
}
Rect snapped(mBounds.x, mBounds.y, mBounds.width, mBounds.height);
MaybeSnapToDevicePixels(snapped, *aDT, true);
// We don't currently support subpixel-AA in TextLayers since we
// don't check if there's an opaque background color behind them.
// We should fix this before using them in production.
aDT->SetPermitSubpixelAA(false);
for (GlyphArray& g : mGlyphs) {
GlyphBuffer buffer = { g.glyphs().Elements(), (uint32_t)g.glyphs().Length() };
aDT->FillGlyphs(mFont, buffer, ColorPattern(g.color().value()));
}
}
protected:
BasicLayerManager* BasicManager()
{
return static_cast<BasicLayerManager*>(mManager);
}
};
already_AddRefed<TextLayer>
BasicLayerManager::CreateTextLayer()
{
NS_ASSERTION(InConstruction(), "Only allowed in construction phase");
RefPtr<TextLayer> layer = new BasicTextLayer(this);
return layer.forget();
}
} // namespace layers
} // namespace mozilla

View File

@ -0,0 +1,79 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "ClientLayerManager.h" // for ClientLayerManager, etc
#include "Layers.h" // for ColorLayer, etc
#include "mozilla/layers/LayersMessages.h" // for ColorLayerAttributes, etc
#include "mozilla/mozalloc.h" // for operator new
#include "nsCOMPtr.h" // for already_AddRefed
#include "nsDebug.h" // for NS_ASSERTION
#include "nsISupportsImpl.h" // for Layer::AddRef, etc
#include "nsRegion.h" // for nsIntRegion
namespace mozilla {
namespace layers {
using namespace mozilla::gfx;
class ClientBorderLayer : public BorderLayer,
public ClientLayer {
public:
explicit ClientBorderLayer(ClientLayerManager* aLayerManager) :
BorderLayer(aLayerManager, static_cast<ClientLayer*>(this))
{
MOZ_COUNT_CTOR(ClientBorderLayer);
}
protected:
virtual ~ClientBorderLayer()
{
MOZ_COUNT_DTOR(ClientBorderLayer);
}
public:
virtual void SetVisibleRegion(const LayerIntRegion& aRegion)
{
NS_ASSERTION(ClientManager()->InConstruction(),
"Can only set properties in construction phase");
BorderLayer::SetVisibleRegion(aRegion);
}
virtual void RenderLayer()
{
RenderMaskLayers(this);
}
virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
{
aAttrs = BorderLayerAttributes(mRect, mColors, mCorners, mWidths);
}
virtual Layer* AsLayer() { return this; }
virtual ShadowableLayer* AsShadowableLayer() { return this; }
virtual void Disconnect()
{
ClientLayer::Disconnect();
}
protected:
ClientLayerManager* ClientManager()
{
return static_cast<ClientLayerManager*>(mManager);
}
};
already_AddRefed<BorderLayer>
ClientLayerManager::CreateBorderLayer()
{
NS_ASSERTION(InConstruction(), "Only allowed in construction phase");
RefPtr<ClientBorderLayer> layer =
new ClientBorderLayer(this);
CREATE_SHADOW(Border);
return layer.forget();
}
} // namespace layers
} // namespace mozilla

View File

@ -19,6 +19,8 @@
#include "nsRect.h" // for mozilla::gfx::IntRect
#include "nsXULAppAPI.h" // for XRE_GetProcessType, etc
#include "gfxPrefs.h" // for WebGLForceLayersReadback
#include "gfxUtils.h"
#include "mozilla/layers/TextureClientSharedSurface.h"
using namespace mozilla::gfx;
using namespace mozilla::gl;

View File

@ -87,6 +87,8 @@ public:
virtual already_AddRefed<CanvasLayer> CreateCanvasLayer() override;
virtual already_AddRefed<ReadbackLayer> CreateReadbackLayer() override;
virtual already_AddRefed<ColorLayer> CreateColorLayer() override;
virtual already_AddRefed<TextLayer> CreateTextLayer() override;
virtual already_AddRefed<BorderLayer> CreateBorderLayer() override;
virtual already_AddRefed<RefLayer> CreateRefLayer() override;
void UpdateTextureFactoryIdentifier(const TextureFactoryIdentifier& aNewIdentifier);

View File

@ -0,0 +1,91 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "ClientLayerManager.h" // for ClientLayerManager, etc
#include "Layers.h" // for ColorLayer, etc
#include "mozilla/layers/LayersMessages.h" // for ColorLayerAttributes, etc
#include "mozilla/mozalloc.h" // for operator new
#include "nsCOMPtr.h" // for already_AddRefed
#include "nsDebug.h" // for NS_ASSERTION
#include "nsISupportsImpl.h" // for Layer::AddRef, etc
#include "nsRegion.h" // for nsIntRegion
namespace mozilla {
namespace layers {
using namespace mozilla::gfx;
class ClientTextLayer : public TextLayer,
public ClientLayer {
public:
explicit ClientTextLayer(ClientLayerManager* aLayerManager) :
TextLayer(aLayerManager, static_cast<ClientLayer*>(this)),
mSwapped(false)
{
MOZ_COUNT_CTOR(ClientTextLayer);
}
protected:
virtual ~ClientTextLayer()
{
MOZ_COUNT_DTOR(ClientTextLayer);
}
public:
virtual void SetVisibleRegion(const LayerIntRegion& aRegion)
{
NS_ASSERTION(ClientManager()->InConstruction(),
"Can only set properties in construction phase");
TextLayer::SetVisibleRegion(aRegion);
}
virtual void RenderLayer()
{
RenderMaskLayers(this);
}
virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
{
NS_ASSERTION(!mSwapped, "Trying to access glyph array after it's been swapped!");
aAttrs = TextLayerAttributes(GetBounds(), nsTArray<GlyphArray>(), uintptr_t(mFont.get()));
aAttrs.get_TextLayerAttributes().glyphs().SwapElements(mGlyphs);
mSwapped = true;
}
virtual void SetGlyphs(nsTArray<GlyphArray>&& aGlyphs)
{
TextLayer::SetGlyphs(Move(aGlyphs));
mSwapped = false;
}
virtual Layer* AsLayer() { return this; }
virtual ShadowableLayer* AsShadowableLayer() { return this; }
virtual void Disconnect()
{
ClientLayer::Disconnect();
}
protected:
ClientLayerManager* ClientManager()
{
return static_cast<ClientLayerManager*>(mManager);
}
bool mSwapped;
};
already_AddRefed<TextLayer>
ClientLayerManager::CreateTextLayer()
{
NS_ASSERTION(InConstruction(), "Only allowed in construction phase");
RefPtr<ClientTextLayer> layer =
new ClientTextLayer(this);
CREATE_SHADOW(Text);
return layer.forget();
}
} // namespace layers
} // namespace mozilla

View File

@ -69,7 +69,7 @@ ContentMightReflowOnOrientationChange(const IntRect& rect)
return rect.width != rect.height;
}
AsyncCompositionManager::AsyncCompositionManager(LayerManagerComposite* aManager)
AsyncCompositionManager::AsyncCompositionManager(HostLayerManager* aManager)
: mLayerManager(aManager)
, mIsFirstPaint(true)
, mLayersUpdated(false)
@ -205,7 +205,7 @@ GetBaseTransform(Layer* aLayer, Matrix4x4* aTransform)
{
// Start with the animated transform if there is one
*aTransform =
(aLayer->AsLayerComposite()->GetShadowTransformSetByAnimation()
(aLayer->AsHostLayer()->GetShadowTransformSetByAnimation()
? aLayer->GetLocalTransform()
: aLayer->GetTransform());
}
@ -216,10 +216,10 @@ TransformClipRect(Layer* aLayer,
const ParentLayerToParentLayerMatrix4x4& aTransform)
{
MOZ_ASSERT(aTransform.Is2D());
const Maybe<ParentLayerIntRect>& clipRect = aLayer->AsLayerComposite()->GetShadowClipRect();
const Maybe<ParentLayerIntRect>& clipRect = aLayer->AsHostLayer()->GetShadowClipRect();
if (clipRect) {
ParentLayerIntRect transformed = TransformBy(aTransform, *clipRect);
aLayer->AsLayerComposite()->SetShadowClipRect(Some(transformed));
aLayer->AsHostLayer()->SetShadowClipRect(Some(transformed));
}
}
@ -233,7 +233,7 @@ TransformFixedClip(Layer* aLayer,
MOZ_ASSERT(aTransform.Is2D());
if (aClipParts.mFixedClip) {
*aClipParts.mFixedClip = TransformBy(aTransform, *aClipParts.mFixedClip);
aLayer->AsLayerComposite()->SetShadowClipRect(aClipParts.Intersect());
aLayer->AsHostLayer()->SetShadowClipRect(aClipParts.Intersect());
}
}
@ -256,7 +256,7 @@ SetShadowTransform(Layer* aLayer, LayerToParentLayerMatrix4x4 aTransform)
aTransform.PostScale(1.0f / aLayer->GetPostXScale(),
1.0f / aLayer->GetPostYScale(),
1);
aLayer->AsLayerComposite()->SetShadowBaseTransform(aTransform.ToUnknownMatrix());
aLayer->AsHostLayer()->SetShadowBaseTransform(aTransform.ToUnknownMatrix());
}
static void
@ -277,7 +277,7 @@ TranslateShadowLayer(Layer* aLayer,
layerTransform.PostTranslate(aTranslation);
SetShadowTransform(aLayer, layerTransform);
aLayer->AsLayerComposite()->SetShadowTransformSetByAnimation(false);
aLayer->AsHostLayer()->SetShadowTransformSetByAnimation(false);
if (aAdjustClipRect) {
auto transform = ParentLayerToParentLayerMatrix4x4::Translation(aTranslation);
@ -720,12 +720,12 @@ SampleAnimations(Layer* aLayer, TimeStamp aPoint)
animData.mEndValues.LastElement(),
computedTiming.mCurrentIteration,
&interpolatedValue, layer);
LayerComposite* layerComposite = layer->AsLayerComposite();
HostLayer* layerCompositor = layer->AsHostLayer();
switch (animation.property()) {
case eCSSProperty_opacity:
{
layerComposite->SetShadowOpacity(interpolatedValue.get_float());
layerComposite->SetShadowOpacitySetByAnimation(true);
layerCompositor->SetShadowOpacity(interpolatedValue.get_float());
layerCompositor->SetShadowOpacitySetByAnimation(true);
break;
}
case eCSSProperty_transform:
@ -734,8 +734,8 @@ SampleAnimations(Layer* aLayer, TimeStamp aPoint)
if (ContainerLayer* c = layer->AsContainerLayer()) {
matrix.PostScale(c->GetInheritedXScale(), c->GetInheritedYScale(), 1);
}
layerComposite->SetShadowBaseTransform(matrix);
layerComposite->SetShadowTransformSetByAnimation(true);
layerCompositor->SetShadowBaseTransform(matrix);
layerCompositor->SetShadowTransformSetByAnimation(true);
break;
}
default:
@ -779,7 +779,7 @@ AsyncCompositionManager::RecordShadowTransforms(Layer* aLayer)
if (!apzc) {
continue;
}
gfx::Matrix4x4 shadowTransform = layer->AsLayerComposite()->GetShadowBaseTransform();
gfx::Matrix4x4 shadowTransform = layer->AsHostLayer()->GetShadowBaseTransform();
if (!shadowTransform.Is2D()) {
continue;
}
@ -805,7 +805,7 @@ AdjustForClip(const AsyncTransformComponentMatrix& asyncTransform, Layer* aLayer
// then applying it to container as-is will produce incorrect results. To
// avoid this, translate the layer so that the clip rect starts at the origin,
// apply the tree transform, and translate back.
if (const Maybe<ParentLayerIntRect>& shadowClipRect = aLayer->AsLayerComposite()->GetShadowClipRect()) {
if (const Maybe<ParentLayerIntRect>& shadowClipRect = aLayer->AsHostLayer()->GetShadowClipRect()) {
if (shadowClipRect->TopLeft() != ParentLayerIntPoint()) { // avoid a gratuitous change of basis
result.ChangeBasis(shadowClipRect->x, shadowClipRect->y, 0);
}
@ -822,7 +822,7 @@ ExpandRootClipRect(Layer* aLayer, const ScreenMargin& aFixedLayerMargins)
// LayerView visible to the user is larger than the viewport size that Gecko
// knows about (and therefore larger than the clip rect). We could also just
// clear the clip rect on aLayer entirely but this seems more precise.
Maybe<ParentLayerIntRect> rootClipRect = aLayer->AsLayerComposite()->GetShadowClipRect();
Maybe<ParentLayerIntRect> rootClipRect = aLayer->AsHostLayer()->GetShadowClipRect();
if (rootClipRect && aFixedLayerMargins != ScreenMargin()) {
#ifndef MOZ_WIDGET_ANDROID
// We should never enter here on anything other than Fennec, since
@ -832,7 +832,7 @@ ExpandRootClipRect(Layer* aLayer, const ScreenMargin& aFixedLayerMargins)
ParentLayerRect rect(rootClipRect.value());
rect.Deflate(ViewAs<ParentLayerPixel>(aFixedLayerMargins,
PixelCastJustification::ScreenIsParentLayerForRoot));
aLayer->AsLayerComposite()->SetShadowClipRect(Some(RoundedOut(rect)));
aLayer->AsHostLayer()->SetShadowClipRect(Some(RoundedOut(rect)));
}
}
@ -1103,7 +1103,7 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer,
// AlignFixedAndStickyLayers may overwrite this with a new clip it
// computes from the clip parts, but if that doesn't happen, this
// is the layer's final clip rect.
layer->AsLayerComposite()->SetShadowClipRect(clipParts.Intersect());
layer->AsHostLayer()->SetShadowClipRect(clipParts.Intersect());
}
if (hasAsyncTransform) {
@ -1439,7 +1439,7 @@ AsyncCompositionManager::TransformShadowTree(TimeStamp aCurrentFrame,
wantNextFrame |= SampleAPZAnimations(LayerMetricsWrapper(root), nextFrame);
}
LayerComposite* rootComposite = root->AsLayerComposite();
HostLayer* rootComposite = root->AsHostLayer();
gfx::Matrix4x4 trans = rootComposite->GetShadowBaseTransform();
trans *= gfx::Matrix4x4::From2D(mWorldTransform);

View File

@ -70,7 +70,7 @@ class AsyncCompositionManager final
public:
NS_INLINE_DECL_REFCOUNTING(AsyncCompositionManager)
explicit AsyncCompositionManager(LayerManagerComposite* aManager);
explicit AsyncCompositionManager(HostLayerManager* aManager);
/**
* This forces the is-first-paint flag to true. This is intended to
@ -218,7 +218,7 @@ private:
TargetConfig mTargetConfig;
CSSRect mContentRect;
RefPtr<LayerManagerComposite> mLayerManager;
RefPtr<HostLayerManager> mLayerManager;
// When this flag is set, the next composition will be the first for a
// particular document (i.e. the document displayed on the screen will change).
// This happens when loading a new page or switching tabs. We notify the

View File

@ -59,7 +59,7 @@ CanvasLayerComposite::GetLayer()
}
void
CanvasLayerComposite::SetLayerManager(LayerManagerComposite* aManager)
CanvasLayerComposite::SetLayerManager(HostLayerManager* aManager)
{
LayerComposite::SetLayerManager(aManager);
mManager = aManager;

View File

@ -48,7 +48,7 @@ public:
Destroy();
}
virtual void SetLayerManager(LayerManagerComposite* aManager) override;
virtual void SetLayerManager(HostLayerManager* aManager) override;
virtual Layer* GetLayer() override;
virtual void RenderLayer(const gfx::IntRect& aClipRect) override;
@ -59,9 +59,7 @@ public:
CompositableHost* GetCompositableHost() override;
virtual LayerComposite* AsLayerComposite() override { return this; }
void SetBounds(gfx::IntRect aBounds) { mBounds = aBounds; }
virtual HostLayer* AsHostLayer() override { return this; }
virtual const char* Name() const override { return "CanvasLayerComposite"; }

View File

@ -39,7 +39,7 @@ public:
// LayerComposite Implementation
virtual Layer* GetLayer() override { return this; }
virtual void SetLayerManager(LayerManagerComposite* aManager) override
virtual void SetLayerManager(HostLayerManager* aManager) override
{
LayerComposite::SetLayerManager(aManager);
mManager = aManager;
@ -54,7 +54,7 @@ public:
CompositableHost* GetCompositableHost() override { return nullptr; }
virtual LayerComposite* AsLayerComposite() override { return this; }
virtual HostLayer* AsHostLayer() override { return this; }
virtual const char* Name() const override { return "ColorLayerComposite"; }
};

View File

@ -97,7 +97,7 @@ static void PrintUniformityInfo(Layer* aLayer)
return;
}
Matrix4x4 transform = aLayer->AsLayerComposite()->GetShadowBaseTransform();
Matrix4x4 transform = aLayer->AsHostLayer()->GetShadowBaseTransform();
if (!transform.Is2D()) {
return;
}
@ -141,7 +141,7 @@ ContainerPrepare(ContainerT* aContainer,
aContainer->SortChildrenBy3DZOrder(children);
for (uint32_t i = 0; i < children.Length(); i++) {
LayerComposite* layerToRender = static_cast<LayerComposite*>(children.ElementAt(i)->ImplData());
LayerComposite* layerToRender = static_cast<LayerComposite*>(children.ElementAt(i)->AsHostLayer());
RenderTargetIntRect clipRect = layerToRender->GetLayer()->
CalculateScissorRect(aClipRect);
@ -606,7 +606,7 @@ ContainerLayerComposite::Destroy()
{
if (!mDestroyed) {
while (mFirstChild) {
static_cast<LayerComposite*>(GetFirstChild()->ImplData())->Destroy();
GetFirstChildComposite()->Destroy();
RemoveChild(mFirstChild);
}
mDestroyed = true;
@ -619,7 +619,7 @@ ContainerLayerComposite::GetFirstChildComposite()
if (!mFirstChild) {
return nullptr;
}
return static_cast<LayerComposite*>(mFirstChild->ImplData());
return static_cast<LayerComposite*>(mFirstChild->AsHostLayer());
}
void
@ -641,8 +641,7 @@ ContainerLayerComposite::CleanupResources()
mPrepared = nullptr;
for (Layer* l = GetFirstChild(); l; l = l->GetNextSibling()) {
LayerComposite* layerToCleanup = static_cast<LayerComposite*>(l->ImplData());
layerToCleanup->CleanupResources();
static_cast<LayerComposite*>(l->AsHostLayer())->CleanupResources();
}
}
@ -671,7 +670,7 @@ RefLayerComposite::GetFirstChildComposite()
if (!mFirstChild) {
return nullptr;
}
return static_cast<LayerComposite*>(mFirstChild->ImplData());
return static_cast<LayerComposite*>(mFirstChild->AsHostLayer());
}
void

View File

@ -63,14 +63,14 @@ public:
// LayerComposite Implementation
virtual Layer* GetLayer() override { return this; }
virtual void SetLayerManager(LayerManagerComposite* aManager) override
virtual void SetLayerManager(HostLayerManager* aManager) override
{
LayerComposite::SetLayerManager(aManager);
mManager = aManager;
mLastIntermediateSurface = nullptr;
for (Layer* l = GetFirstChild(); l; l = l->GetNextSibling()) {
LayerComposite* child = l->AsLayerComposite();
HostLayer* child = l->AsHostLayer();
child->SetLayerManager(aManager);
}
}
@ -89,7 +89,7 @@ public:
virtual void CleanupResources() override;
virtual LayerComposite* AsLayerComposite() override { return this; }
virtual HostLayer* AsHostLayer() override { return this; }
// container layers don't use a compositable
CompositableHost* GetCompositableHost() override { return nullptr; }
@ -173,7 +173,7 @@ public:
virtual void CleanupResources() override;
virtual LayerComposite* AsLayerComposite() override { return this; }
virtual HostLayer* AsHostLayer() override { return this; }
// ref layers don't use a compositable
CompositableHost* GetCompositableHost() override { return nullptr; }

View File

@ -349,7 +349,7 @@ ImageHost::Composite(LayerComposite* aLayer,
if (mLastFrameID != img->mFrameID || mLastProducerID != img->mProducerID) {
if (mImageContainer) {
aLayer->GetLayerManager()->
static_cast<LayerManagerComposite*>(aLayer->GetLayerManager())->
AppendImageCompositeNotification(ImageCompositeNotification(
mImageContainer, nullptr,
img->mTimeStamp, GetCompositor()->GetCompositionTime(),

View File

@ -80,7 +80,7 @@ ImageLayerComposite::GetLayer()
}
void
ImageLayerComposite::SetLayerManager(LayerManagerComposite* aManager)
ImageLayerComposite::SetLayerManager(HostLayerManager* aManager)
{
LayerComposite::SetLayerManager(aManager);
mManager = aManager;

View File

@ -43,7 +43,7 @@ public:
virtual Layer* GetLayer() override;
virtual void SetLayerManager(LayerManagerComposite* aManager) override;
virtual void SetLayerManager(HostLayerManager* aManager) override;
virtual void RenderLayer(const gfx::IntRect& aClipRect) override;
@ -55,7 +55,7 @@ public:
virtual void GenEffectChain(EffectChain& aEffect) override;
virtual LayerComposite* AsLayerComposite() override { return this; }
virtual HostLayer* AsHostLayer() override { return this; }
virtual const char* Name() const override { return "ImageLayerComposite"; }

View File

@ -110,21 +110,27 @@ LayerManagerComposite::ClearCachedResources(Layer* aSubtree)
// Do we need that?
}
HostLayerManager::HostLayerManager()
: mDebugOverlayWantsNextFrame(false)
, mWarningLevel(0.0f)
, mWindowOverlayChanged(false)
, mLastPaintTime(TimeDuration::Forever())
, mRenderStartTime(TimeStamp::Now())
{}
HostLayerManager::~HostLayerManager()
{}
/**
* LayerManagerComposite
*/
LayerManagerComposite::LayerManagerComposite(Compositor* aCompositor)
: mWarningLevel(0.0f)
, mUnusedApzTransformWarning(false)
: mUnusedApzTransformWarning(false)
, mDisabledApzWarning(false)
, mCompositor(aCompositor)
, mInTransaction(false)
, mIsCompositorReady(false)
, mDebugOverlayWantsNextFrame(false)
, mGeometryChanged(true)
, mWindowOverlayChanged(false)
, mLastPaintTime(TimeDuration::Forever())
, mRenderStartTime(TimeStamp::Now())
{
mTextRenderer = new TextRenderer(aCompositor);
MOZ_ASSERT(aCompositor);
@ -232,7 +238,7 @@ LayerManagerComposite::PostProcessLayers(Layer* aLayer,
// Direct children of the establisher may have a clip, becaue the
// item containing it; ex. of nsHTMLScrollFrame, may give it one.
Maybe<ParentLayerIntRect> layerClip =
aLayer->AsLayerComposite()->GetShadowClipRect();
aLayer->AsHostLayer()->GetShadowClipRect();
Maybe<ParentLayerIntRect> ancestorClipForChildren =
IntersectMaybeRects(layerClip, aClipFromAncestors);
MOZ_ASSERT(!layerClip || !aLayer->Combines3DTransformWithAncestors(),
@ -266,7 +272,7 @@ LayerManagerComposite::PostProcessLayers(Layer* aLayer,
// Compute a clip that's the combination of our layer clip with the clip
// from our ancestors.
LayerComposite* composite = aLayer->AsLayerComposite();
LayerComposite* composite = static_cast<LayerComposite*>(aLayer->AsHostLayer());
Maybe<ParentLayerIntRect> layerClip = composite->GetShadowClipRect();
MOZ_ASSERT(!layerClip || !aLayer->Combines3DTransformWithAncestors(),
"The layer with a clip should not participate "
@ -495,47 +501,6 @@ LayerManagerComposite::CreateOptimalMaskDrawTarget(const IntSize &aSize)
return nullptr;
}
already_AddRefed<PaintedLayer>
LayerManagerComposite::CreatePaintedLayer()
{
MOZ_ASSERT(gIsGtest, "Unless you're testing the compositor using GTest,"
"this should only be called on the drawing side");
RefPtr<PaintedLayer> layer = new PaintedLayerComposite(this);
return layer.forget();
}
already_AddRefed<ContainerLayer>
LayerManagerComposite::CreateContainerLayer()
{
MOZ_ASSERT(gIsGtest, "Unless you're testing the compositor using GTest,"
"this should only be called on the drawing side");
RefPtr<ContainerLayer> layer = new ContainerLayerComposite(this);
return layer.forget();
}
already_AddRefed<ImageLayer>
LayerManagerComposite::CreateImageLayer()
{
NS_RUNTIMEABORT("Should only be called on the drawing side");
return nullptr;
}
already_AddRefed<ColorLayer>
LayerManagerComposite::CreateColorLayer()
{
MOZ_ASSERT(gIsGtest, "Unless you're testing the compositor using GTest,"
"this should only be called on the drawing side");
RefPtr<ColorLayer> layer = new ColorLayerComposite(this);
return layer.forget();
}
already_AddRefed<CanvasLayer>
LayerManagerComposite::CreateCanvasLayer()
{
NS_RUNTIMEABORT("Should only be called on the drawing side");
return nullptr;
}
LayerComposite*
LayerManagerComposite::RootLayer() const
{
@ -833,8 +798,8 @@ ClearLayerFlags(Layer* aLayer) {
aLayer,
[] (Layer* layer)
{
if (layer->AsLayerComposite()) {
layer->AsLayerComposite()->SetLayerComposited(false);
if (layer->AsHostLayer()) {
static_cast<LayerComposite*>(layer->AsHostLayer())->SetLayerComposited(false);
}
});
}
@ -1156,64 +1121,170 @@ LayerManagerComposite::RenderToPresentationSurface()
}
#endif
already_AddRefed<PaintedLayerComposite>
LayerManagerComposite::CreatePaintedLayerComposite()
class TextLayerComposite : public TextLayer,
public LayerComposite
{
public:
explicit TextLayerComposite(LayerManagerComposite *aManager)
: TextLayer(aManager, nullptr)
, LayerComposite(aManager)
{
MOZ_COUNT_CTOR(TextLayerComposite);
mImplData = static_cast<LayerComposite*>(this);
}
protected:
~TextLayerComposite()
{
MOZ_COUNT_DTOR(TextLayerComposite);
Destroy();
}
public:
// LayerComposite Implementation
virtual Layer* GetLayer() override { return this; }
virtual void SetLayerManager(HostLayerManager* aManager) override
{
LayerComposite::SetLayerManager(aManager);
mManager = aManager;
}
virtual void Destroy() override { mDestroyed = true; }
virtual void RenderLayer(const gfx::IntRect& aClipRect) override {}
virtual void CleanupResources() override {};
virtual void GenEffectChain(EffectChain& aEffect) override {}
CompositableHost* GetCompositableHost() override { return nullptr; }
virtual HostLayer* AsHostLayer() override { return this; }
virtual const char* Name() const override { return "TextLayerComposite"; }
};
class BorderLayerComposite : public BorderLayer,
public LayerComposite
{
public:
explicit BorderLayerComposite(LayerManagerComposite *aManager)
: BorderLayer(aManager, nullptr)
, LayerComposite(aManager)
{
MOZ_COUNT_CTOR(BorderLayerComposite);
mImplData = static_cast<LayerComposite*>(this);
}
protected:
~BorderLayerComposite()
{
MOZ_COUNT_DTOR(BorderLayerComposite);
Destroy();
}
public:
// LayerComposite Implementation
virtual Layer* GetLayer() override { return this; }
virtual void SetLayerManager(HostLayerManager* aManager) override
{
LayerComposite::SetLayerManager(aManager);
mManager = aManager;
}
virtual void Destroy() override { mDestroyed = true; }
virtual void RenderLayer(const gfx::IntRect& aClipRect) override {}
virtual void CleanupResources() override {};
virtual void GenEffectChain(EffectChain& aEffect) override {}
CompositableHost* GetCompositableHost() override { return nullptr; }
virtual HostLayer* AsHostLayer() override { return this; }
virtual const char* Name() const override { return "BorderLayerComposite"; }
};
already_AddRefed<PaintedLayer>
LayerManagerComposite::CreatePaintedLayer()
{
if (mDestroyed) {
NS_WARNING("Call on destroyed layer manager");
return nullptr;
}
return RefPtr<PaintedLayerComposite>(new PaintedLayerComposite(this)).forget();
return RefPtr<PaintedLayer>(new PaintedLayerComposite(this)).forget();
}
already_AddRefed<ContainerLayerComposite>
LayerManagerComposite::CreateContainerLayerComposite()
already_AddRefed<ContainerLayer>
LayerManagerComposite::CreateContainerLayer()
{
if (mDestroyed) {
NS_WARNING("Call on destroyed layer manager");
return nullptr;
}
return RefPtr<ContainerLayerComposite>(new ContainerLayerComposite(this)).forget();
return RefPtr<ContainerLayer>(new ContainerLayerComposite(this)).forget();
}
already_AddRefed<ImageLayerComposite>
LayerManagerComposite::CreateImageLayerComposite()
already_AddRefed<ImageLayer>
LayerManagerComposite::CreateImageLayer()
{
if (mDestroyed) {
NS_WARNING("Call on destroyed layer manager");
return nullptr;
}
return RefPtr<ImageLayerComposite>(new ImageLayerComposite(this)).forget();
return RefPtr<ImageLayer>(new ImageLayerComposite(this)).forget();
}
already_AddRefed<ColorLayerComposite>
LayerManagerComposite::CreateColorLayerComposite()
already_AddRefed<ColorLayer>
LayerManagerComposite::CreateColorLayer()
{
if (LayerManagerComposite::mDestroyed) {
NS_WARNING("Call on destroyed layer manager");
return nullptr;
}
return RefPtr<ColorLayerComposite>(new ColorLayerComposite(this)).forget();
return RefPtr<ColorLayer>(new ColorLayerComposite(this)).forget();
}
already_AddRefed<CanvasLayerComposite>
LayerManagerComposite::CreateCanvasLayerComposite()
already_AddRefed<CanvasLayer>
LayerManagerComposite::CreateCanvasLayer()
{
if (LayerManagerComposite::mDestroyed) {
NS_WARNING("Call on destroyed layer manager");
return nullptr;
}
return RefPtr<CanvasLayerComposite>(new CanvasLayerComposite(this)).forget();
return RefPtr<CanvasLayer>(new CanvasLayerComposite(this)).forget();
}
already_AddRefed<RefLayerComposite>
LayerManagerComposite::CreateRefLayerComposite()
already_AddRefed<RefLayer>
LayerManagerComposite::CreateRefLayer()
{
if (LayerManagerComposite::mDestroyed) {
NS_WARNING("Call on destroyed layer manager");
return nullptr;
}
return RefPtr<RefLayerComposite>(new RefLayerComposite(this)).forget();
return RefPtr<RefLayer>(new RefLayerComposite(this)).forget();
}
already_AddRefed<TextLayer>
LayerManagerComposite::CreateTextLayer()
{
if (LayerManagerComposite::mDestroyed) {
NS_WARNING("Call on destroyed layer manager");
return nullptr;
}
return RefPtr<TextLayer>(new TextLayerComposite(this)).forget();
}
already_AddRefed<BorderLayer>
LayerManagerComposite::CreateBorderLayer()
{
if (LayerManagerComposite::mDestroyed) {
NS_WARNING("Call on destroyed layer manager");
return nullptr;
}
return RefPtr<BorderLayer>(new BorderLayerComposite(this)).forget();
}
LayerManagerComposite::AutoAddMaskEffect::AutoAddMaskEffect(Layer* aMaskLayer,
@ -1255,11 +1326,9 @@ LayerManagerComposite::ChangeCompositor(Compositor* aNewCompositor)
}
LayerComposite::LayerComposite(LayerManagerComposite *aManager)
: mCompositeManager(aManager)
: HostLayer(aManager)
, mCompositeManager(aManager)
, mCompositor(aManager->GetCompositor())
, mShadowOpacity(1.0)
, mShadowTransformSetByAnimation(false)
, mShadowOpacitySetByAnimation(false)
, mDestroyed(false)
, mLayerComposited(false)
{ }
@ -1305,10 +1374,11 @@ LayerManagerComposite::NotifyShadowTreeTransaction()
}
void
LayerComposite::SetLayerManager(LayerManagerComposite* aManager)
LayerComposite::SetLayerManager(HostLayerManager* aManager)
{
mCompositeManager = aManager;
mCompositor = aManager->GetCompositor();
HostLayer::SetLayerManager(aManager);
mCompositeManager = static_cast<LayerManagerComposite*>(aManager);
mCompositor = mCompositeManager->GetCompositor();
}
bool
@ -1336,7 +1406,7 @@ LayerComposite::GetFullyRenderedRegion() {
}
Matrix4x4
LayerComposite::GetShadowTransform() {
HostLayer::GetShadowTransform() {
Matrix4x4 transform = mShadowTransform;
Layer* layer = GetLayer();

View File

@ -65,7 +65,121 @@ class PaintCounter;
static const int kVisualWarningDuration = 150; // ms
class LayerManagerComposite final : public LayerManager
// An implementation of LayerManager that acts as a pair with ClientLayerManager
// and is mirrored across IPDL. This gets managed/updated by LayerTransactionParent.
class HostLayerManager : public LayerManager
{
public:
HostLayerManager();
~HostLayerManager();
virtual bool BeginTransactionWithTarget(gfxContext* aTarget) override
{
MOZ_CRASH("GFX: Use BeginTransactionWithDrawTarget");
}
virtual bool EndEmptyTransaction(EndTransactionFlags aFlags = END_DEFAULT) override
{
MOZ_CRASH("GFX: Use EndTransaction(aTimeStamp)");
return false;
}
virtual void EndTransaction(DrawPaintedLayerCallback aCallback,
void* aCallbackData,
EndTransactionFlags aFlags = END_DEFAULT) override
{
MOZ_CRASH("GFX: Use EndTransaction(aTimeStamp)");
}
virtual int32_t GetMaxTextureSize() const override
{
MOZ_CRASH("GFX: Call on compositor, not LayerManagerComposite");
}
virtual LayersBackend GetBackendType() override
{
MOZ_CRASH("GFX: Shouldn't be called for composited layer manager");
}
virtual void GetBackendName(nsAString& name) override
{
MOZ_CRASH("GFX: Shouldn't be called for composited layer manager");
}
virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() = 0;
virtual void ForcePresent() = 0;
virtual void AddInvalidRegion(const nsIntRegion& aRegion) = 0;
virtual void ClearApproximatelyVisibleRegions(uint64_t aLayersId,
const Maybe<uint32_t>& aPresShellId) = 0;
virtual void UpdateApproximatelyVisibleRegion(const ScrollableLayerGuid& aGuid,
const CSSIntRegion& aRegion) = 0;
virtual void NotifyShadowTreeTransaction() {}
virtual void BeginTransactionWithDrawTarget(gfx::DrawTarget* aTarget,
const gfx::IntRect& aRect) = 0;
virtual Compositor* GetCompositor() const = 0;
virtual void EndTransaction(const TimeStamp& aTimeStamp,
EndTransactionFlags aFlags = END_DEFAULT) = 0;
virtual void UpdateRenderBounds(const gfx::IntRect& aRect) {}
// Called by CompositorBridgeParent when a new compositor has been created due
// to a device reset. The layer manager must clear any cached resources
// attached to the old compositor, and make a best effort at ignoring
// layer or texture updates against the old compositor.
virtual void ChangeCompositor(Compositor* aNewCompositor) = 0;
void ExtractImageCompositeNotifications(nsTArray<ImageCompositeNotification>* aNotifications)
{
aNotifications->AppendElements(Move(mImageCompositeNotifications));
}
/**
* LayerManagerComposite provides sophisticated debug overlays
* that can request a next frame.
*/
bool DebugOverlayWantsNextFrame() { return mDebugOverlayWantsNextFrame; }
void SetDebugOverlayWantsNextFrame(bool aVal)
{ mDebugOverlayWantsNextFrame = aVal; }
/**
* Add an on frame warning.
* @param severity ranges from 0 to 1. It's used to compute the warning color.
*/
void VisualFrameWarning(float severity) {
mozilla::TimeStamp now = TimeStamp::Now();
if (mWarnTime.IsNull() ||
severity > mWarningLevel ||
mWarnTime + TimeDuration::FromMilliseconds(kVisualWarningDuration) < now) {
mWarnTime = now;
mWarningLevel = severity;
}
}
// Indicate that we need to composite even if nothing in our layers has
// changed, so that the widget can draw something different in its window
// overlay.
void SetWindowOverlayChanged() { mWindowOverlayChanged = true; }
void SetPaintTime(const TimeDuration& aPaintTime) { mLastPaintTime = aPaintTime; }
protected:
bool mDebugOverlayWantsNextFrame;
nsTArray<ImageCompositeNotification> mImageCompositeNotifications;
// Testing property. If hardware composer is supported, this will return
// true if the last frame was deemed 'too complicated' to be rendered.
float mWarningLevel;
mozilla::TimeStamp mWarnTime;
bool mWindowOverlayChanged;
RefPtr<PaintCounter> mPaintCounter;
TimeDuration mLastPaintTime;
TimeStamp mRenderStartTime;
};
// A layer manager implementation that uses the Compositor API
// to render layers.
class LayerManagerComposite final : public HostLayerManager
{
typedef mozilla::gfx::DrawTarget DrawTarget;
typedef mozilla::gfx::IntSize IntSize;
@ -99,30 +213,19 @@ public:
return this;
}
void UpdateRenderBounds(const gfx::IntRect& aRect);
void UpdateRenderBounds(const gfx::IntRect& aRect) override;
virtual bool BeginTransaction() override;
virtual bool BeginTransactionWithTarget(gfxContext* aTarget) override
{
MOZ_CRASH("GFX: Use BeginTransactionWithDrawTarget");
return false;
}
void BeginTransactionWithDrawTarget(gfx::DrawTarget* aTarget,
const gfx::IntRect& aRect);
virtual bool EndEmptyTransaction(EndTransactionFlags aFlags = END_DEFAULT) override
{
MOZ_CRASH("GFX: Use EndTransaction(aTimeStamp)");
return false;
}
const gfx::IntRect& aRect) override;
void EndTransaction(const TimeStamp& aTimeStamp,
EndTransactionFlags aFlags = END_DEFAULT) override;
virtual void EndTransaction(DrawPaintedLayerCallback aCallback,
void* aCallbackData,
EndTransactionFlags aFlags = END_DEFAULT) override
{
MOZ_CRASH("GFX: Use EndTransaction(aTimeStamp)");
}
void EndTransaction(const TimeStamp& aTimeStamp,
EndTransactionFlags aFlags = END_DEFAULT);
virtual void SetRoot(Layer* aLayer) override { mRoot = aLayer; }
@ -130,33 +233,16 @@ public:
// (bug 946926).
virtual bool CanUseCanvasLayerForSize(const gfx::IntSize &aSize) override;
virtual int32_t GetMaxTextureSize() const override
{
MOZ_CRASH("GFX: Call on compositor, not LayerManagerComposite");
}
virtual void ClearCachedResources(Layer* aSubtree = nullptr) override;
virtual already_AddRefed<PaintedLayer> CreatePaintedLayer() override;
virtual already_AddRefed<ContainerLayer> CreateContainerLayer() override;
virtual already_AddRefed<ImageLayer> CreateImageLayer() override;
virtual already_AddRefed<ColorLayer> CreateColorLayer() override;
virtual already_AddRefed<TextLayer> CreateTextLayer() override;
virtual already_AddRefed<BorderLayer> CreateBorderLayer() override;
virtual already_AddRefed<CanvasLayer> CreateCanvasLayer() override;
already_AddRefed<PaintedLayerComposite> CreatePaintedLayerComposite();
already_AddRefed<ContainerLayerComposite> CreateContainerLayerComposite();
already_AddRefed<ImageLayerComposite> CreateImageLayerComposite();
already_AddRefed<ColorLayerComposite> CreateColorLayerComposite();
already_AddRefed<CanvasLayerComposite> CreateCanvasLayerComposite();
already_AddRefed<RefLayerComposite> CreateRefLayerComposite();
virtual LayersBackend GetBackendType() override
{
MOZ_CRASH("GFX: Shouldn't be called for composited layer manager");
}
virtual void GetBackendName(nsAString& name) override
{
MOZ_CRASH("GFX: Shouldn't be called for composited layer manager");
}
virtual already_AddRefed<RefLayer> CreateRefLayer() override;
virtual bool AreComponentAlphaLayersEnabled() override;
@ -207,13 +293,13 @@ public:
static void PlatformSyncBeforeReplyUpdate();
void AddInvalidRegion(const nsIntRegion& aRegion)
void AddInvalidRegion(const nsIntRegion& aRegion) override
{
mInvalidRegion.Or(mInvalidRegion, aRegion);
}
void ClearApproximatelyVisibleRegions(uint64_t aLayersId,
const Maybe<uint32_t>& aPresShellId)
const Maybe<uint32_t>& aPresShellId) override
{
for (auto iter = mVisibleRegions.Iter(); !iter.Done(); iter.Next()) {
if (iter.Key().mLayersId == aLayersId &&
@ -224,7 +310,7 @@ public:
}
void UpdateApproximatelyVisibleRegion(const ScrollableLayerGuid& aGuid,
const CSSIntRegion& aRegion)
const CSSIntRegion& aRegion) override
{
CSSIntRegion* regionForScrollFrame = mVisibleRegions.LookupOrAdd(aGuid);
MOZ_ASSERT(regionForScrollFrame);
@ -237,7 +323,7 @@ public:
return mVisibleRegions.Get(aGuid);
}
Compositor* GetCompositor() const
Compositor* GetCompositor() const override
{
return mCompositor;
}
@ -246,34 +332,12 @@ public:
// to a device reset. The layer manager must clear any cached resources
// attached to the old compositor, and make a best effort at ignoring
// layer or texture updates against the old compositor.
void ChangeCompositor(Compositor* aNewCompositor);
void ChangeCompositor(Compositor* aNewCompositor) override;
/**
* LayerManagerComposite provides sophisticated debug overlays
* that can request a next frame.
*/
bool DebugOverlayWantsNextFrame() { return mDebugOverlayWantsNextFrame; }
void SetDebugOverlayWantsNextFrame(bool aVal)
{ mDebugOverlayWantsNextFrame = aVal; }
void NotifyShadowTreeTransaction();
void NotifyShadowTreeTransaction() override;
TextRenderer* GetTextRenderer() { return mTextRenderer; }
/**
* Add an on frame warning.
* @param severity ranges from 0 to 1. It's used to compute the warning color.
*/
void VisualFrameWarning(float severity) {
mozilla::TimeStamp now = TimeStamp::Now();
if (mWarnTime.IsNull() ||
severity > mWarningLevel ||
mWarnTime + TimeDuration::FromMilliseconds(kVisualWarningDuration) < now) {
mWarnTime = now;
mWarningLevel = severity;
}
}
void UnusedApzTransformWarning() {
mUnusedApzTransformWarning = true;
}
@ -294,19 +358,12 @@ public:
mImageCompositeNotifications.AppendElement(aNotification);
}
}
void ExtractImageCompositeNotifications(nsTArray<ImageCompositeNotification>* aNotifications)
virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() override
{
aNotifications->AppendElements(Move(mImageCompositeNotifications));
return mCompositor->GetTextureFactoryIdentifier();
}
// Indicate that we need to composite even if nothing in our layers has
// changed, so that the widget can draw something different in its window
// overlay.
void SetWindowOverlayChanged() { mWindowOverlayChanged = true; }
void ForcePresent() { mCompositor->ForcePresent(); }
void SetPaintTime(const TimeDuration& aPaintTime) { mLastPaintTime = aPaintTime; }
void ForcePresent() override { mCompositor->ForcePresent(); }
private:
/** Region we're clipping our current drawing to. */
@ -354,15 +411,11 @@ private:
void ChangeCompositorInternal(Compositor* aNewCompositor);
float mWarningLevel;
mozilla::TimeStamp mWarnTime;
bool mUnusedApzTransformWarning;
bool mDisabledApzWarning;
RefPtr<Compositor> mCompositor;
UniquePtr<LayerProperties> mClonedLayerTreeProperties;
nsTArray<ImageCompositeNotification> mImageCompositeNotifications;
/**
* Context target, nullptr when drawing directly to our swap chain.
*/
@ -379,70 +432,44 @@ private:
bool mInTransaction;
bool mIsCompositorReady;
bool mDebugOverlayWantsNextFrame;
RefPtr<CompositingRenderTarget> mTwoPassTmpTarget;
RefPtr<TextRenderer> mTextRenderer;
bool mGeometryChanged;
bool mWindowOverlayChanged;
RefPtr<PaintCounter> mPaintCounter;
TimeDuration mLastPaintTime;
TimeStamp mRenderStartTime;
};
/**
* Composite layers are for use with OMTC on the compositor thread only. There
* must be corresponding Basic layers on the content thread. For composite
* layers, the layer manager only maintains the layer tree, all rendering is
* done by a Compositor (see Compositor.h). As such, composite layers are
* platform-independent and can be used on any platform for which there is a
* Compositor implementation.
*
* The composite layer tree reflects exactly the basic layer tree. To
* composite to screen, the layer manager walks the layer tree calling render
* methods which in turn call into their CompositableHosts' Composite methods.
* These call Compositor::DrawQuad to do the rendering.
*
* Mostly, layers are updated during the layers transaction. This is done from
* CompositableClient to CompositableHost without interacting with the layer.
*
* A reference to the Compositor is stored in LayerManagerComposite.
* Compositor layers are for use with OMTC on the compositor thread only. There
* must be corresponding Client layers on the content thread. For composite
* layers, the layer manager only maintains the layer tree.
*/
class LayerComposite
class HostLayer
{
public:
explicit LayerComposite(LayerManagerComposite* aManager);
explicit HostLayer(HostLayerManager* aManager)
: mCompositorManager(aManager)
, mShadowOpacity(1.0)
, mShadowTransformSetByAnimation(false)
, mShadowOpacitySetByAnimation(false)
{
}
virtual ~LayerComposite();
virtual void SetLayerManager(HostLayerManager* aManager)
{
mCompositorManager = aManager;
}
HostLayerManager* GetLayerManager() const { return mCompositorManager; }
virtual ~HostLayer() {}
virtual LayerComposite* GetFirstChildComposite()
{
return nullptr;
}
/* Do NOT call this from the generic LayerComposite destructor. Only from the
* concrete class destructor
*/
virtual void Destroy();
virtual Layer* GetLayer() = 0;
virtual void SetLayerManager(LayerManagerComposite* aManager);
LayerManagerComposite* GetLayerManager() const { return mCompositeManager; }
/**
* Perform a first pass over the layer tree to render all of the intermediate
* surfaces that we can. This allows us to avoid framebuffer switches in the
* middle of our render which is inefficient especially on mobile GPUs. This
* must be called before RenderLayer.
*/
virtual void Prepare(const RenderTargetIntRect& aClipRect) {}
// TODO: This should also take RenderTargetIntRect like Prepare.
virtual void RenderLayer(const gfx::IntRect& aClipRect) = 0;
virtual bool SetCompositableHost(CompositableHost*)
{
// We must handle this gracefully, see bug 967824
@ -451,14 +478,6 @@ public:
}
virtual CompositableHost* GetCompositableHost() = 0;
virtual void CleanupResources() = 0;
virtual void DestroyFrontBuffer() { }
void AddBlendModeEffect(EffectChain& aEffectChain);
virtual void GenEffectChain(EffectChain& aEffect) { }
/**
* The following methods are
*
@ -494,6 +513,95 @@ public:
mShadowTransformSetByAnimation = aSetByAnimation;
}
// These getters can be used anytime.
float GetShadowOpacity() { return mShadowOpacity; }
const Maybe<ParentLayerIntRect>& GetShadowClipRect() { return mShadowClipRect; }
const LayerIntRegion& GetShadowVisibleRegion() { return mShadowVisibleRegion; }
const gfx::Matrix4x4& GetShadowBaseTransform() { return mShadowTransform; }
gfx::Matrix4x4 GetShadowTransform();
bool GetShadowTransformSetByAnimation() { return mShadowTransformSetByAnimation; }
bool GetShadowOpacitySetByAnimation() { return mShadowOpacitySetByAnimation; }
/**
* Return true if a checkerboarding background color needs to be drawn
* for this layer.
*/
virtual bool NeedToDrawCheckerboarding(gfx::Color* aOutCheckerboardingColor = nullptr) { return false; }
protected:
HostLayerManager* mCompositorManager;
gfx::Matrix4x4 mShadowTransform;
LayerIntRegion mShadowVisibleRegion;
Maybe<ParentLayerIntRect> mShadowClipRect;
float mShadowOpacity;
bool mShadowTransformSetByAnimation;
bool mShadowOpacitySetByAnimation;
};
/**
* Composite layers are for use with OMTC on the compositor thread only. There
* must be corresponding Client layers on the content thread. For composite
* layers, the layer manager only maintains the layer tree, all rendering is
* done by a Compositor (see Compositor.h). As such, composite layers are
* platform-independent and can be used on any platform for which there is a
* Compositor implementation.
*
* The composite layer tree reflects exactly the basic layer tree. To
* composite to screen, the layer manager walks the layer tree calling render
* methods which in turn call into their CompositableHosts' Composite methods.
* These call Compositor::DrawQuad to do the rendering.
*
* Mostly, layers are updated during the layers transaction. This is done from
* CompositableClient to CompositableHost without interacting with the layer.
*
* A reference to the Compositor is stored in LayerManagerComposite.
*/
class LayerComposite : public HostLayer
{
public:
explicit LayerComposite(LayerManagerComposite* aManager);
virtual ~LayerComposite();
virtual void SetLayerManager(HostLayerManager* aManager);
virtual LayerComposite* GetFirstChildComposite()
{
return nullptr;
}
/* Do NOT call this from the generic LayerComposite destructor. Only from the
* concrete class destructor
*/
virtual void Destroy();
/**
* Perform a first pass over the layer tree to render all of the intermediate
* surfaces that we can. This allows us to avoid framebuffer switches in the
* middle of our render which is inefficient especially on mobile GPUs. This
* must be called before RenderLayer.
*/
virtual void Prepare(const RenderTargetIntRect& aClipRect) {}
// TODO: This should also take RenderTargetIntRect like Prepare.
virtual void RenderLayer(const gfx::IntRect& aClipRect) = 0;
virtual bool SetCompositableHost(CompositableHost*)
{
// We must handle this gracefully, see bug 967824
NS_WARNING("called SetCompositableHost for a layer type not accepting a compositable");
return false;
}
virtual void CleanupResources() = 0;
virtual void DestroyFrontBuffer() { }
void AddBlendModeEffect(EffectChain& aEffectChain);
virtual void GenEffectChain(EffectChain& aEffect) { }
void SetLayerComposited(bool value)
{
mLayerComposited = value;
@ -504,14 +612,6 @@ public:
mClearRect = aRect;
}
// These getters can be used anytime.
float GetShadowOpacity() { return mShadowOpacity; }
const Maybe<ParentLayerIntRect>& GetShadowClipRect() { return mShadowClipRect; }
const LayerIntRegion& GetShadowVisibleRegion() { return mShadowVisibleRegion; }
const gfx::Matrix4x4& GetShadowBaseTransform() { return mShadowTransform; }
gfx::Matrix4x4 GetShadowTransform();
bool GetShadowTransformSetByAnimation() { return mShadowTransformSetByAnimation; }
bool GetShadowOpacitySetByAnimation() { return mShadowOpacitySetByAnimation; }
bool HasLayerBeenComposited() { return mLayerComposited; }
gfx::IntRect GetClearRect() { return mClearRect; }
@ -525,21 +625,12 @@ public:
*/
virtual nsIntRegion GetFullyRenderedRegion();
/**
* Return true if a checkerboarding background color needs to be drawn
* for this layer.
*/
bool NeedToDrawCheckerboarding(gfx::Color* aOutCheckerboardingColor = nullptr);
virtual bool NeedToDrawCheckerboarding(gfx::Color* aOutCheckerboardingColor = nullptr);
protected:
gfx::Matrix4x4 mShadowTransform;
LayerIntRegion mShadowVisibleRegion;
Maybe<ParentLayerIntRect> mShadowClipRect;
LayerManagerComposite* mCompositeManager;
RefPtr<Compositor> mCompositor;
float mShadowOpacity;
bool mShadowTransformSetByAnimation;
bool mShadowOpacitySetByAnimation;
bool mDestroyed;
bool mLayerComposited;
gfx::IntRect mClearRect;
@ -556,7 +647,7 @@ protected:
// aRenderCallback is called exactly once, inside this function, unless aLayer's
// visible region is completely clipped out (in that case, aRenderCallback won't
// be called at all).
// This function calls aLayer->AsLayerComposite()->AddBlendModeEffect for the
// This function calls aLayer->AsHostLayer()->AddBlendModeEffect for the
// final rendering pass.
//
// (This function should really live in LayerManagerComposite.cpp, but we
@ -589,7 +680,7 @@ RenderWithAllMasks(Layer* aLayer, Compositor* aCompositor,
EffectChain effectChain(aLayer);
LayerManagerComposite::AutoAddMaskEffect
autoMaskEffect(firstMask, effectChain);
aLayer->AsLayerComposite()->AddBlendModeEffect(effectChain);
static_cast<LayerComposite*>(aLayer->AsHostLayer())->AddBlendModeEffect(effectChain);
aRenderCallback(effectChain, aClipRect);
return;
}
@ -665,7 +756,7 @@ RenderWithAllMasks(Layer* aLayer, Compositor* aCompositor,
// The blend mode needs to be applied in this final step, because this is
// where we're blending with the actual background (which is in originalTarget).
aLayer->AsLayerComposite()->AddBlendModeEffect(finalEffectChain);
static_cast<LayerComposite*>(aLayer->AsHostLayer())->AddBlendModeEffect(finalEffectChain);
LayerManagerComposite::AutoAddMaskEffect autoMaskEffect(finalMask, finalEffectChain);
if (!autoMaskEffect.Failed()) {
aCompositor->DrawQuad(gfx::Rect(surfaceRect), aClipRect,

View File

@ -79,7 +79,7 @@ PaintedLayerComposite::GetLayer()
}
void
PaintedLayerComposite::SetLayerManager(LayerManagerComposite* aManager)
PaintedLayerComposite::SetLayerManager(HostLayerManager* aManager)
{
LayerComposite::SetLayerManager(aManager);
mManager = aManager;

View File

@ -49,7 +49,7 @@ public:
virtual Layer* GetLayer() override;
virtual void SetLayerManager(LayerManagerComposite* aManager) override;
virtual void SetLayerManager(HostLayerManager* aManager) override;
virtual void RenderLayer(const gfx::IntRect& aClipRect) override;
@ -59,20 +59,13 @@ public:
virtual bool SetCompositableHost(CompositableHost* aHost) override;
virtual LayerComposite* AsLayerComposite() override { return this; }
virtual HostLayer* AsHostLayer() override { return this; }
virtual void InvalidateRegion(const nsIntRegion& aRegion) override
{
NS_RUNTIMEABORT("PaintedLayerComposites can't fill invalidated regions");
}
void SetValidRegion(const nsIntRegion& aRegion)
{
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) ValidRegion", this));
mValidRegion = aRegion;
Mutated();
}
const virtual gfx::TiledIntRegion& GetInvalidRegion() override;
MOZ_LAYER_DECL_NAME("PaintedLayerComposite", TYPE_PAINTED)

View File

@ -855,14 +855,14 @@ CompositorBridgeParent::SetShadowProperties(Layer* aLayer)
}
// FIXME: Bug 717688 -- Do these updates in LayerTransactionParent::RecvUpdate.
LayerComposite* layerComposite = layer->AsLayerComposite();
HostLayer* layerCompositor = layer->AsHostLayer();
// Set the layerComposite's base transform to the layer's base transform.
layerComposite->SetShadowBaseTransform(layer->GetBaseTransform());
layerComposite->SetShadowTransformSetByAnimation(false);
layerComposite->SetShadowVisibleRegion(layer->GetVisibleRegion());
layerComposite->SetShadowClipRect(layer->GetClipRect());
layerComposite->SetShadowOpacity(layer->GetOpacity());
layerComposite->SetShadowOpacitySetByAnimation(false);
layerCompositor->SetShadowBaseTransform(layer->GetBaseTransform());
layerCompositor->SetShadowTransformSetByAnimation(false);
layerCompositor->SetShadowVisibleRegion(layer->GetVisibleRegion());
layerCompositor->SetShadowClipRect(layer->GetClipRect());
layerCompositor->SetShadowOpacity(layer->GetOpacity());
layerCompositor->SetShadowOpacitySetByAnimation(false);
}
);
}
@ -1159,7 +1159,9 @@ CompositorBridgeParent::ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
// race condition.
mLayerManager->UpdateRenderBounds(aTargetConfig.naturalBounds());
mLayerManager->SetRegionToClear(aTargetConfig.clearRegion());
mLayerManager->GetCompositor()->SetScreenRotation(aTargetConfig.rotation());
if (mLayerManager->GetCompositor()) {
mLayerManager->GetCompositor()->SetScreenRotation(aTargetConfig.rotation());
}
mCompositionManager->Updated(aIsFirstPaint, aTargetConfig, aPaintSyncId);
Layer* root = aLayerTree->GetRoot();
@ -1425,7 +1427,7 @@ CompositorBridgeParent::AllocPLayerTransactionParent(const nsTArray<LayersBacken
mCompositionManager = new AsyncCompositionManager(mLayerManager);
*aSuccess = true;
*aTextureFactoryIdentifier = mCompositor->GetTextureFactoryIdentifier();
*aTextureFactoryIdentifier = mLayerManager->GetTextureFactoryIdentifier();
LayerTransactionParent* p = new LayerTransactionParent(mLayerManager, this, 0);
p->AddIPDLReference();
return p;
@ -1527,7 +1529,7 @@ CompositorBridgeParent::RecvAdoptChild(const uint64_t& child)
sIndirectLayerTrees[child].mLayerTree->mLayerManager = mLayerManager;
}
if (sIndirectLayerTrees[child].mRoot) {
sIndirectLayerTrees[child].mRoot->AsLayerComposite()->SetLayerManager(mLayerManager);
sIndirectLayerTrees[child].mRoot->AsHostLayer()->SetLayerManager(static_cast<HostLayerManager*>(mLayerManager.get()));
}
parent = sIndirectLayerTrees[child].mApzcTreeManagerParent;
}

View File

@ -64,7 +64,7 @@ class AsyncCompositionManager;
class Compositor;
class CompositorBridgeParent;
class CompositorVsyncScheduler;
class LayerManagerComposite;
class HostLayerManager;
class LayerTransactionParent;
class PAPZParent;
class CrossProcessCompositorBridgeParent;
@ -359,7 +359,7 @@ public:
RefPtr<GeckoContentController> mController;
APZCTreeManagerParent* mApzcTreeManagerParent;
RefPtr<CompositorBridgeParent> mParent;
LayerManagerComposite* mLayerManager;
HostLayerManager* mLayerManager;
// Pointer to the CrossProcessCompositorBridgeParent. Used by APZCs to share
// their FrameMetrics with the corresponding child process that holds
// the PCompositorBridgeChild
@ -547,7 +547,7 @@ protected:
template <typename Lambda>
inline void ForEachIndirectLayerTree(const Lambda& aCallback);
RefPtr<LayerManagerComposite> mLayerManager;
RefPtr<HostLayerManager> mLayerManager;
RefPtr<Compositor> mCompositor;
RefPtr<AsyncCompositionManager> mCompositionManager;
widget::CompositorWidget* mWidget;

View File

@ -80,7 +80,7 @@ CrossProcessCompositorBridgeParent::AllocPLayerTransactionParent(
if (state && state->mLayerManager) {
state->mCrossProcessParent = this;
LayerManagerComposite* lm = state->mLayerManager;
HostLayerManager* lm = state->mLayerManager;
*aTextureFactoryIdentifier = lm->GetCompositor()->GetTextureFactoryIdentifier();
*aSuccess = true;
LayerTransactionParent* p = new LayerTransactionParent(lm, this, aId);

View File

@ -140,7 +140,7 @@ ShadowChild(const OpRaiseToTopChild& op)
//--------------------------------------------------
// LayerTransactionParent
LayerTransactionParent::LayerTransactionParent(LayerManagerComposite* aManager,
LayerTransactionParent::LayerTransactionParent(HostLayerManager* aManager,
CompositorBridgeParentBase* aBridge,
uint64_t aId)
: mLayerManager(aManager)
@ -286,15 +286,15 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
bool updateHitTestingTree = false;
for (EditArray::index_type i = 0; i < cset.Length(); ++i) {
const Edit& edit = cset[i];
Edit& edit = cset[i];
switch (edit.type()) {
// Create* ops
case Edit::TOpCreatePaintedLayer: {
MOZ_LAYERS_LOG(("[ParentSide] CreatePaintedLayer"));
RefPtr<PaintedLayerComposite> layer =
layer_manager()->CreatePaintedLayerComposite();
RefPtr<PaintedLayer> layer =
layer_manager()->CreatePaintedLayer();
AsLayerComposite(edit.get_OpCreatePaintedLayer())->Bind(layer);
updateHitTestingTree = true;
@ -303,7 +303,7 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
case Edit::TOpCreateContainerLayer: {
MOZ_LAYERS_LOG(("[ParentSide] CreateContainerLayer"));
RefPtr<ContainerLayer> layer = layer_manager()->CreateContainerLayerComposite();
RefPtr<ContainerLayer> layer = layer_manager()->CreateContainerLayer();
AsLayerComposite(edit.get_OpCreateContainerLayer())->Bind(layer);
updateHitTestingTree = true;
@ -312,8 +312,8 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
case Edit::TOpCreateImageLayer: {
MOZ_LAYERS_LOG(("[ParentSide] CreateImageLayer"));
RefPtr<ImageLayerComposite> layer =
layer_manager()->CreateImageLayerComposite();
RefPtr<ImageLayer> layer =
layer_manager()->CreateImageLayer();
AsLayerComposite(edit.get_OpCreateImageLayer())->Bind(layer);
updateHitTestingTree = true;
@ -322,17 +322,35 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
case Edit::TOpCreateColorLayer: {
MOZ_LAYERS_LOG(("[ParentSide] CreateColorLayer"));
RefPtr<ColorLayerComposite> layer = layer_manager()->CreateColorLayerComposite();
RefPtr<ColorLayer> layer = layer_manager()->CreateColorLayer();
AsLayerComposite(edit.get_OpCreateColorLayer())->Bind(layer);
updateHitTestingTree = true;
break;
}
case Edit::TOpCreateTextLayer: {
MOZ_LAYERS_LOG(("[ParentSide] CreateTextLayer"));
RefPtr<TextLayer> layer = layer_manager()->CreateTextLayer();
AsLayerComposite(edit.get_OpCreateTextLayer())->Bind(layer);
updateHitTestingTree = true;
break;
}
case Edit::TOpCreateBorderLayer: {
MOZ_LAYERS_LOG(("[ParentSide] CreateTextLayer"));
RefPtr<BorderLayer> layer = layer_manager()->CreateBorderLayer();
AsLayerComposite(edit.get_OpCreateBorderLayer())->Bind(layer);
updateHitTestingTree = true;
break;
}
case Edit::TOpCreateCanvasLayer: {
MOZ_LAYERS_LOG(("[ParentSide] CreateCanvasLayer"));
RefPtr<CanvasLayerComposite> layer =
layer_manager()->CreateCanvasLayerComposite();
RefPtr<CanvasLayer> layer =
layer_manager()->CreateCanvasLayer();
AsLayerComposite(edit.get_OpCreateCanvasLayer())->Bind(layer);
updateHitTestingTree = true;
@ -341,8 +359,8 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
case Edit::TOpCreateRefLayer: {
MOZ_LAYERS_LOG(("[ParentSide] CreateRefLayer"));
RefPtr<RefLayerComposite> layer =
layer_manager()->CreateRefLayerComposite();
RefPtr<RefLayer> layer =
layer_manager()->CreateRefLayer();
AsLayerComposite(edit.get_OpCreateRefLayer())->Bind(layer);
updateHitTestingTree = true;
@ -353,13 +371,13 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
case Edit::TOpSetLayerAttributes: {
MOZ_LAYERS_LOG(("[ParentSide] SetLayerAttributes"));
const OpSetLayerAttributes& osla = edit.get_OpSetLayerAttributes();
OpSetLayerAttributes& osla = edit.get_OpSetLayerAttributes();
ShadowLayerParent* layerParent = AsLayerComposite(osla);
Layer* layer = layerParent->AsLayer();
if (!layer) {
return IPC_FAIL_NO_REASON(this);
}
const LayerAttributes& attrs = osla.attrs();
LayerAttributes& attrs = osla.attrs();
const CommonLayerAttributes& common = attrs.common();
layer->SetLayerBounds(common.layerBounds());
@ -412,7 +430,7 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
layer->SetAncestorMaskLayers(maskLayers);
typedef SpecificLayerAttributes Specific;
const SpecificLayerAttributes& specific = attrs.specific();
SpecificLayerAttributes& specific = attrs.specific();
switch (specific.type()) {
case Specific::Tnull_t:
break;
@ -420,7 +438,7 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
case Specific::TPaintedLayerAttributes: {
MOZ_LAYERS_LOG(("[ParentSide] painted layer"));
PaintedLayerComposite* paintedLayer = layerParent->AsPaintedLayerComposite();
PaintedLayer* paintedLayer = layerParent->AsPaintedLayer();
if (!paintedLayer) {
return IPC_FAIL_NO_REASON(this);
}
@ -434,7 +452,7 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
case Specific::TContainerLayerAttributes: {
MOZ_LAYERS_LOG(("[ParentSide] container layer"));
ContainerLayerComposite* containerLayer = layerParent->AsContainerLayerComposite();
ContainerLayer* containerLayer = layerParent->AsContainerLayer();
if (!containerLayer) {
return IPC_FAIL_NO_REASON(this);
}
@ -451,7 +469,7 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
case Specific::TColorLayerAttributes: {
MOZ_LAYERS_LOG(("[ParentSide] color layer"));
ColorLayerComposite* colorLayer = layerParent->AsColorLayerComposite();
ColorLayer* colorLayer = layerParent->AsColorLayer();
if (!colorLayer) {
return IPC_FAIL_NO_REASON(this);
}
@ -459,10 +477,35 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
colorLayer->SetBounds(specific.get_ColorLayerAttributes().bounds());
break;
}
case Specific::TTextLayerAttributes: {
MOZ_LAYERS_LOG(("[ParentSide] text layer"));
TextLayer* textLayer = layerParent->AsTextLayer();
if (!textLayer) {
return IPC_FAIL_NO_REASON(this);
}
textLayer->SetBounds(specific.get_TextLayerAttributes().bounds());
textLayer->SetGlyphs(Move(specific.get_TextLayerAttributes().glyphs()));
textLayer->SetScaledFont(reinterpret_cast<gfx::ScaledFont*>(specific.get_TextLayerAttributes().scaledFont()));
break;
}
case Specific::TBorderLayerAttributes: {
MOZ_LAYERS_LOG(("[ParentSide] border layer"));
BorderLayer* borderLayer = layerParent->AsBorderLayer();
if (!borderLayer) {
return IPC_FAIL_NO_REASON(this);
}
borderLayer->SetRect(specific.get_BorderLayerAttributes().rect());
borderLayer->SetColors(specific.get_BorderLayerAttributes().colors());
borderLayer->SetCornerRadii(specific.get_BorderLayerAttributes().corners());
borderLayer->SetWidths(specific.get_BorderLayerAttributes().widths());
break;
}
case Specific::TCanvasLayerAttributes: {
MOZ_LAYERS_LOG(("[ParentSide] canvas layer"));
CanvasLayerComposite* canvasLayer = layerParent->AsCanvasLayerComposite();
CanvasLayer* canvasLayer = layerParent->AsCanvasLayer();
if (!canvasLayer) {
return IPC_FAIL_NO_REASON(this);
}
@ -473,7 +516,7 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
case Specific::TRefLayerAttributes: {
MOZ_LAYERS_LOG(("[ParentSide] ref layer"));
RefLayerComposite* refLayer = layerParent->AsRefLayerComposite();
RefLayer* refLayer = layerParent->AsRefLayer();
if (!refLayer) {
return IPC_FAIL_NO_REASON(this);
}
@ -484,7 +527,7 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
case Specific::TImageLayerAttributes: {
MOZ_LAYERS_LOG(("[ParentSide] image layer"));
ImageLayerComposite* imageLayer = layerParent->AsImageLayerComposite();
ImageLayer* imageLayer = layerParent->AsImageLayer();
if (!imageLayer) {
return IPC_FAIL_NO_REASON(this);
}
@ -534,7 +577,7 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
if (!child) {
return IPC_FAIL_NO_REASON(this);
}
ContainerLayerComposite* container = ShadowContainer(oia)->AsContainerLayerComposite();
ContainerLayer* container = ShadowContainer(oia)->AsContainerLayer();
if (!container ||
!container->InsertAfter(child, ShadowAfter(oia)->AsLayer()))
{
@ -552,7 +595,7 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
if (!child) {
return IPC_FAIL_NO_REASON(this);
}
ContainerLayerComposite* container = ShadowContainer(oac)->AsContainerLayerComposite();
ContainerLayer* container = ShadowContainer(oac)->AsContainerLayer();
if (!container ||
!container->InsertAfter(child, nullptr))
{
@ -570,7 +613,7 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
if (!childLayer) {
return IPC_FAIL_NO_REASON(this);
}
ContainerLayerComposite* container = ShadowContainer(orc)->AsContainerLayerComposite();
ContainerLayer* container = ShadowContainer(orc)->AsContainerLayer();
if (!container ||
!container->RemoveChild(childLayer))
{
@ -588,7 +631,7 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
if (!child) {
return IPC_FAIL_NO_REASON(this);
}
ContainerLayerComposite* container = ShadowContainer(orc)->AsContainerLayerComposite();
ContainerLayer* container = ShadowContainer(orc)->AsContainerLayer();
if (!container ||
!container->RepositionChild(child, ShadowAfter(orc)->AsLayer()))
{
@ -606,7 +649,7 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
if (!child) {
return IPC_FAIL_NO_REASON(this);
}
ContainerLayerComposite* container = ShadowContainer(rtc)->AsContainerLayerComposite();
ContainerLayer* container = ShadowContainer(rtc)->AsContainerLayer();
if (!container ||
!container->RepositionChild(child, nullptr))
{
@ -634,7 +677,9 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
if (!Attach(cast(op.layerParent()), host, false)) {
return IPC_FAIL_NO_REASON(this);
}
host->SetCompositorID(mLayerManager->GetCompositor()->GetCompositorID());
if (mLayerManager->GetCompositor()) {
host->SetCompositorID(mLayerManager->GetCompositor()->GetCompositorID());
}
break;
}
case Edit::TOpAttachAsyncCompositable: {
@ -653,7 +698,9 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
if (!Attach(cast(op.layerParent()), host, true)) {
return IPC_FAIL_NO_REASON(this);
}
host->SetCompositorID(mLayerManager->GetCompositor()->GetCompositorID());
if (mLayerManager->GetCompositor()) {
host->SetCompositorID(mLayerManager->GetCompositor()->GetCompositorID());
}
break;
}
default:
@ -766,7 +813,7 @@ LayerTransactionParent::RecvGetAnimationOpacity(PLayerParent* aParent,
mCompositorBridge->ApplyAsyncProperties(this);
if (!layer->AsLayerComposite()->GetShadowOpacitySetByAnimation()) {
if (!layer->AsHostLayer()->GetShadowOpacitySetByAnimation()) {
return IPC_OK();
}
@ -800,7 +847,7 @@ LayerTransactionParent::RecvGetAnimationTransform(PLayerParent* aParent,
// recover the untranslated transform from the shadow transform. For
// transforms that are not set by animation we don't have this information
// available.
if (!layer->AsLayerComposite()->GetShadowTransformSetByAnimation()) {
if (!layer->AsHostLayer()->GetShadowTransformSetByAnimation()) {
*aTransform = mozilla::void_t();
return IPC_OK();
}
@ -809,7 +856,7 @@ LayerTransactionParent::RecvGetAnimationTransform(PLayerParent* aParent,
// from the shadow transform by undoing the translations in
// AsyncCompositionManager::SampleValue.
Matrix4x4 transform = layer->AsLayerComposite()->GetShadowBaseTransform();
Matrix4x4 transform = layer->AsHostLayer()->GetShadowBaseTransform();
if (ContainerLayer* c = layer->AsContainerLayer()) {
// Undo the scale transform applied by AsyncCompositionManager::SampleValue
transform.PostScale(1.0f/c->GetInheritedXScale(),
@ -953,13 +1000,13 @@ LayerTransactionParent::Attach(ShadowLayerParent* aLayerParent,
if (!baselayer) {
return false;
}
LayerComposite* layer = baselayer->AsLayerComposite();
HostLayer* layer = baselayer->AsHostLayer();
if (!layer) {
return false;
}
Compositor* compositor
= static_cast<LayerManagerComposite*>(aLayerParent->AsLayer()->Manager())->GetCompositor();
= static_cast<HostLayerManager*>(aLayerParent->AsLayer()->Manager())->GetCompositor();
if (!layer->SetCompositableHost(aCompositable)) {
// not all layer types accept a compositable, see bug 967824

View File

@ -29,7 +29,7 @@ class RenderFrameParent;
namespace layers {
class Layer;
class LayerManagerComposite;
class HostLayerManager;
class ShadowLayerParent;
class CompositableParent;
class CompositorBridgeParentBase;
@ -45,7 +45,7 @@ class LayerTransactionParent final : public PLayerTransactionParent,
typedef InfallibleTArray<PluginWindowData> PluginsArray;
public:
LayerTransactionParent(LayerManagerComposite* aManager,
LayerTransactionParent(HostLayerManager* aManager,
CompositorBridgeParentBase* aBridge,
uint64_t aId);
@ -55,7 +55,7 @@ protected:
public:
void Destroy();
LayerManagerComposite* layer_manager() const { return mLayerManager; }
HostLayerManager* layer_manager() const { return mLayerManager; }
uint64_t GetId() const { return mId; }
Layer* GetRoot() const { return mRoot; }
@ -189,7 +189,7 @@ protected:
friend class layout::RenderFrameParent;
private:
RefPtr<LayerManagerComposite> mLayerManager;
RefPtr<HostLayerManager> mLayerManager;
CompositorBridgeParentBase* mCompositorBridge;
// Hold the root because it might be grafted under various
// containers in the "real" layer tree

View File

@ -33,6 +33,8 @@ using mozilla::dom::ScreenOrientationInternal from "mozilla/dom/ScreenOrientatio
using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h";
using mozilla::LayerMargin from "Units.h";
using mozilla::LayerPoint from "Units.h";
using mozilla::LayerCoord from "Units.h";
using mozilla::LayerSize from "Units.h";
using mozilla::LayerRect from "Units.h";
using mozilla::LayerIntRegion from "Units.h";
using mozilla::ParentLayerIntRect from "Units.h";
@ -45,6 +47,10 @@ using struct mozilla::layers::ScrollMetadata from "FrameMetrics.h";
using mozilla::layers::FrameMetrics::ViewID from "FrameMetrics.h";
using mozilla::layers::LayersBackend from "mozilla/layers/LayersTypes.h";
using mozilla::layers::MaybeLayerClip from "FrameMetrics.h";
using mozilla::gfx::Glyph from "Layers.h";
using mozilla::layers::BorderColors from "mozilla/layers/LayersTypes.h";
using mozilla::layers::BorderCorners from "mozilla/layers/LayersTypes.h";
using mozilla::layers::BorderWidths from "mozilla/layers/LayersTypes.h";
namespace mozilla {
namespace layers {
@ -61,6 +67,8 @@ struct OpCreatePaintedLayer { PLayer layer; };
struct OpCreateContainerLayer { PLayer layer; };
struct OpCreateImageLayer { PLayer layer; };
struct OpCreateColorLayer { PLayer layer; };
struct OpCreateTextLayer { PLayer layer; };
struct OpCreateBorderLayer { PLayer layer; };
struct OpCreateCanvasLayer { PLayer layer; };
struct OpCreateRefLayer { PLayer layer; };
@ -255,6 +263,16 @@ struct ContainerLayerAttributes {
bool scaleToResolution;
EventRegionsOverride eventRegionsOverride;
};
struct GlyphArray
{
LayerColor color;
Glyph[] glyphs;
};
// XXX - Bas - Hack warning! This is using a raw pointer to a ScaledFont*
// and won't work with e10s.
struct TextLayerAttributes { IntRect bounds; GlyphArray[] glyphs; uintptr_t scaledFont; };
struct ColorLayerAttributes { LayerColor color; IntRect bounds; };
struct CanvasLayerAttributes { SamplingFilter samplingFilter; IntRect bounds; };
struct RefLayerAttributes {
@ -264,6 +282,12 @@ struct RefLayerAttributes {
EventRegionsOverride eventRegionsOverride;
};
struct ImageLayerAttributes { SamplingFilter samplingFilter; IntSize scaleToSize; ScaleMode scaleMode; };
struct BorderLayerAttributes {
LayerRect rect;
BorderColors colors;
BorderCorners corners;
BorderWidths widths;
};
union SpecificLayerAttributes {
null_t;
@ -271,8 +295,10 @@ union SpecificLayerAttributes {
ContainerLayerAttributes;
ColorLayerAttributes;
CanvasLayerAttributes;
TextLayerAttributes;
RefLayerAttributes;
ImageLayerAttributes;
BorderLayerAttributes;
};
struct LayerAttributes {
@ -439,6 +465,8 @@ union Edit {
OpCreateContainerLayer;
OpCreateImageLayer;
OpCreateColorLayer;
OpCreateTextLayer;
OpCreateBorderLayer;
OpCreateCanvasLayer;
OpCreateRefLayer;

View File

@ -56,51 +56,67 @@ ShadowLayerParent::Destroy()
Disconnect();
}
ContainerLayerComposite*
ShadowLayerParent::AsContainerLayerComposite() const
ContainerLayer*
ShadowLayerParent::AsContainerLayer() const
{
return mLayer && mLayer->GetType() == Layer::TYPE_CONTAINER
? static_cast<ContainerLayerComposite*>(mLayer.get())
? static_cast<ContainerLayer*>(mLayer.get())
: nullptr;
}
CanvasLayerComposite*
ShadowLayerParent::AsCanvasLayerComposite() const
CanvasLayer*
ShadowLayerParent::AsCanvasLayer() const
{
return mLayer && mLayer->GetType() == Layer::TYPE_CANVAS
? static_cast<CanvasLayerComposite*>(mLayer.get())
? static_cast<CanvasLayer*>(mLayer.get())
: nullptr;
}
ColorLayerComposite*
ShadowLayerParent::AsColorLayerComposite() const
ColorLayer*
ShadowLayerParent::AsColorLayer() const
{
return mLayer && mLayer->GetType() == Layer::TYPE_COLOR
? static_cast<ColorLayerComposite*>(mLayer.get())
? static_cast<ColorLayer*>(mLayer.get())
: nullptr;
}
ImageLayerComposite*
ShadowLayerParent::AsImageLayerComposite() const
ImageLayer*
ShadowLayerParent::AsImageLayer() const
{
return mLayer && mLayer->GetType() == Layer::TYPE_IMAGE
? static_cast<ImageLayerComposite*>(mLayer.get())
? static_cast<ImageLayer*>(mLayer.get())
: nullptr;
}
RefLayerComposite*
ShadowLayerParent::AsRefLayerComposite() const
RefLayer*
ShadowLayerParent::AsRefLayer() const
{
return mLayer && mLayer->GetType() == Layer::TYPE_REF
? static_cast<RefLayerComposite*>(mLayer.get())
? static_cast<RefLayer*>(mLayer.get())
: nullptr;
}
PaintedLayerComposite*
ShadowLayerParent::AsPaintedLayerComposite() const
PaintedLayer*
ShadowLayerParent::AsPaintedLayer() const
{
return mLayer && mLayer->GetType() == Layer::TYPE_PAINTED
? static_cast<PaintedLayerComposite*>(mLayer.get())
? static_cast<PaintedLayer*>(mLayer.get())
: nullptr;
}
TextLayer*
ShadowLayerParent::AsTextLayer() const
{
return mLayer && mLayer->GetType() == Layer::TYPE_TEXT
? static_cast<TextLayer*>(mLayer.get())
: nullptr;
}
BorderLayer*
ShadowLayerParent::AsBorderLayer() const
{
return mLayer && mLayer->GetType() == Layer::TYPE_BORDER
? static_cast<BorderLayer*>(mLayer.get())
: nullptr;
}

View File

@ -18,12 +18,13 @@ namespace layers {
class ContainerLayer;
class Layer;
class CanvasLayerComposite;
class ColorLayerComposite;
class ContainerLayerComposite;
class ImageLayerComposite;
class RefLayerComposite;
class PaintedLayerComposite;
class CanvasLayer;
class ColorLayer;
class TextLayer;
class ContainerLayer;
class ImageLayer;
class RefLayer;
class PaintedLayer;
class ShadowLayerParent : public PLayerParent
{
@ -37,12 +38,14 @@ public:
Layer* AsLayer() const { return mLayer; }
ContainerLayerComposite* AsContainerLayerComposite() const;
CanvasLayerComposite* AsCanvasLayerComposite() const;
ColorLayerComposite* AsColorLayerComposite() const;
ImageLayerComposite* AsImageLayerComposite() const;
RefLayerComposite* AsRefLayerComposite() const;
PaintedLayerComposite* AsPaintedLayerComposite() const;
ContainerLayer* AsContainerLayer() const;
CanvasLayer* AsCanvasLayer() const;
ColorLayer* AsColorLayer() const;
TextLayer* AsTextLayer() const;
ImageLayer* AsImageLayer() const;
BorderLayer* AsBorderLayer() const;
RefLayer* AsRefLayer() const;
PaintedLayer* AsPaintedLayer() const;
private:
virtual void ActorDestroy(ActorDestroyReason why) override;

View File

@ -266,6 +266,16 @@ ShadowLayerForwarder::CreatedColorLayer(ShadowableLayer* aColor)
CreatedLayer<OpCreateColorLayer>(mTxn, aColor);
}
void
ShadowLayerForwarder::CreatedTextLayer(ShadowableLayer* aColor)
{
CreatedLayer<OpCreateTextLayer>(mTxn, aColor);
}
void
ShadowLayerForwarder::CreatedBorderLayer(ShadowableLayer* aBorder)
{
CreatedLayer<OpCreateBorderLayer>(mTxn, aBorder);
}
void
ShadowLayerForwarder::CreatedCanvasLayer(ShadowableLayer* aCanvas)
{
CreatedLayer<OpCreateCanvasLayer>(mTxn, aCanvas);

View File

@ -209,6 +209,8 @@ public:
void CreatedColorLayer(ShadowableLayer* aColor);
void CreatedCanvasLayer(ShadowableLayer* aCanvas);
void CreatedRefLayer(ShadowableLayer* aRef);
void CreatedTextLayer(ShadowableLayer* aRef);
void CreatedBorderLayer(ShadowableLayer* aRef);
/**
* At least one attribute of |aMutant| has changed, and |aMutant|

View File

@ -12,7 +12,6 @@ namespace layers {
using namespace mozilla::ipc;
using namespace mozilla::gfx;
using namespace mozilla::media;
static VideoBridgeParent* sVideoBridgeSingleton;

View File

@ -7,6 +7,7 @@
#define gfx_layers_ipc_VideoBridgeParent_h_
#include "mozilla/layers/PVideoBridgeParent.h"
#include "mozilla/layers/ISurfaceAllocator.h"
namespace mozilla {
namespace layers {

View File

@ -274,6 +274,7 @@ UNIFIED_SOURCES += [
'AsyncCanvasRenderer.cpp',
'AxisPhysicsModel.cpp',
'AxisPhysicsMSDModel.cpp',
'basic/BasicBorderLayer.cpp',
'basic/BasicCanvasLayer.cpp',
'basic/BasicColorLayer.cpp',
'basic/BasicCompositor.cpp',
@ -282,17 +283,20 @@ UNIFIED_SOURCES += [
'basic/BasicLayerManager.cpp',
'basic/BasicLayersImpl.cpp',
'basic/BasicPaintedLayer.cpp',
'basic/BasicTextLayer.cpp',
'basic/TextureHostBasic.cpp',
'BSPTree.cpp',
'BufferTexture.cpp',
'BufferUnrotate.cpp',
'client/CanvasClient.cpp',
'client/ClientBorderLayer.cpp',
'client/ClientCanvasLayer.cpp',
'client/ClientColorLayer.cpp',
'client/ClientContainerLayer.cpp',
'client/ClientImageLayer.cpp',
'client/ClientLayerManager.cpp',
'client/ClientPaintedLayer.cpp',
'client/ClientTextLayer.cpp',
'client/ClientTiledPaintedLayer.cpp',
'client/CompositableChild.cpp',
'client/CompositableClient.cpp',

View File

@ -72,8 +72,9 @@ enum LayersPacket_Layer_LayerType {
LayersPacket_Layer_LayerType_CanvasLayer = 4,
LayersPacket_Layer_LayerType_ImageLayer = 5,
LayersPacket_Layer_LayerType_ColorLayer = 6,
LayersPacket_Layer_LayerType_RefLayer = 7,
LayersPacket_Layer_LayerType_ReadbackLayer = 8
LayersPacket_Layer_LayerType_TextLayer = 7,
LayersPacket_Layer_LayerType_RefLayer = 8,
LayersPacket_Layer_LayerType_ReadbackLayer = 9
};
bool LayersPacket_Layer_LayerType_IsValid(int value);
const LayersPacket_Layer_LayerType LayersPacket_Layer_LayerType_LayerType_MIN = LayersPacket_Layer_LayerType_UnknownLayer;
@ -1673,6 +1674,7 @@ class LayersPacket_Layer : public ::google::protobuf::MessageLite {
static const LayerType CanvasLayer = LayersPacket_Layer_LayerType_CanvasLayer;
static const LayerType ImageLayer = LayersPacket_Layer_LayerType_ImageLayer;
static const LayerType ColorLayer = LayersPacket_Layer_LayerType_ColorLayer;
static const LayerType TextLayer = LayersPacket_Layer_LayerType_TextLayer;
static const LayerType RefLayer = LayersPacket_Layer_LayerType_RefLayer;
static const LayerType ReadbackLayer = LayersPacket_Layer_LayerType_ReadbackLayer;
static inline bool LayerType_IsValid(int value) {

Some files were not shown because too many files have changed in this diff Show More