Merge mozilla-central to b2g-inbound

This commit is contained in:
Carsten "Tomcat" Book 2014-03-06 13:41:09 +01:00
commit 5e640e8a54
145 changed files with 8787 additions and 6850 deletions

View File

@ -7,11 +7,9 @@
#include "Accessible-inl.h"
#include "AccIterator.h"
#include "DocAccessible-inl.h"
#include "HTMLImageMapAccessible.h"
#include "nsAccessibilityService.h"
#include "nsAccUtils.h"
#include "nsEventShell.h"
#include "nsImageFrame.h"
#include "Role.h"
#include "nsEventStateManager.h"
@ -39,7 +37,7 @@ FocusManager::FocusedAccessible() const
if (focusedNode) {
DocAccessible* doc =
GetAccService()->GetDocAccessible(focusedNode->OwnerDoc());
return doc ? GetFocusableAccessibleFor(focusedNode, doc) : nullptr;
return doc ? doc->GetAccessibleEvenIfNotInMapOrContainer(focusedNode) : nullptr;
}
return nullptr;
@ -63,7 +61,7 @@ FocusManager::IsFocused(const Accessible* aAccessible) const
DocAccessible* doc =
GetAccService()->GetDocAccessible(focusedNode->OwnerDoc());
return aAccessible ==
(doc ? GetFocusableAccessibleFor(focusedNode, doc) : nullptr);
(doc ? doc->GetAccessibleEvenIfNotInMapOrContainer(focusedNode) : nullptr);
}
}
return false;
@ -243,7 +241,7 @@ FocusManager::ProcessDOMFocus(nsINode* aTarget)
DocAccessible* document =
GetAccService()->GetDocAccessible(aTarget->OwnerDoc());
Accessible* target = GetFocusableAccessibleFor(aTarget, document);
Accessible* target = document->GetAccessibleEvenIfNotInMapOrContainer(aTarget);
if (target && document) {
// Check if still focused. Otherwise we can end up with storing the active
// item for control that isn't focused anymore.
@ -251,7 +249,8 @@ FocusManager::ProcessDOMFocus(nsINode* aTarget)
if (!focusedNode)
return;
Accessible* DOMFocus = GetFocusableAccessibleFor(focusedNode, document);
Accessible* DOMFocus =
document->GetAccessibleEvenIfNotInMapOrContainer(focusedNode);
if (target != DOMFocus)
return;
@ -283,7 +282,8 @@ FocusManager::ProcessFocusEvent(AccEvent* aEvent)
if (!focusedNode)
return;
Accessible* DOMFocus = GetFocusableAccessibleFor(focusedNode, document);
Accessible* DOMFocus =
document->GetAccessibleEvenIfNotInMapOrContainer(focusedNode);
if (target != DOMFocus)
return;
@ -408,28 +408,3 @@ FocusManager::FocusedDOMDocument() const
nsINode* focusedNode = FocusedDOMNode();
return focusedNode ? focusedNode->OwnerDoc() : nullptr;
}
Accessible*
FocusManager::GetFocusableAccessibleFor(nsINode* aNode,
DocAccessible* aDoc) const
{
if (!aNode->IsContent() || !aNode->AsContent()->IsHTML(nsGkAtoms::area))
return aDoc->GetAccessibleOrContainer(aNode);
// XXX Bug 135040, incorrect when multiple images use the same map.
nsIFrame* frame = aNode->AsContent()->GetPrimaryFrame();
nsImageFrame* imageFrame = do_QueryFrame(frame);
if (imageFrame) {
Accessible* parent = aDoc->GetAccessible(imageFrame->GetContent());
if (parent) {
Accessible* area =
parent->AsImageMap()->GetChildAccessibleFor(aNode);
if (area)
return area;
return nullptr;
}
}
return aDoc->GetAccessibleOrContainer(aNode);
}

View File

@ -123,12 +123,6 @@ private:
*/
nsIDocument* FocusedDOMDocument() const;
/**
* Return accessible for a focusable node.
*/
Accessible* GetFocusableAccessibleFor(nsINode* aNode,
DocAccessible* aDoc) const;
private:
nsRefPtr<Accessible> mActiveItem;
nsRefPtr<Accessible> mActiveARIAMenubar;

View File

@ -116,6 +116,13 @@ DocAccessible::MaybeNotifyOfValueChange(Accessible* aAccessible)
FireDelayedEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE, aAccessible);
}
inline Accessible*
DocAccessible::GetAccessibleEvenIfNotInMapOrContainer(nsINode* aNode) const
{
Accessible* acc = GetAccessibleEvenIfNotInMap(aNode);
return acc ? acc : GetContainerAccessible(aNode);
}
} // namespace a11y
} // namespace mozilla

View File

@ -6,6 +6,7 @@
#include "Accessible-inl.h"
#include "AccIterator.h"
#include "DocAccessible-inl.h"
#include "HTMLImageMapAccessible.h"
#include "nsAccCache.h"
#include "nsAccessiblePivot.h"
#include "nsAccUtils.h"
@ -30,6 +31,7 @@
#include "nsEventStateManager.h"
#include "nsIFrame.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsImageFrame.h"
#include "nsIPersistentProperties2.h"
#include "nsIPresShell.h"
#include "nsIServiceManager.h"
@ -1435,6 +1437,30 @@ DocAccessible::ProcessInvalidationList()
mInvalidationList.Clear();
}
Accessible*
DocAccessible::GetAccessibleEvenIfNotInMap(nsINode* aNode) const
{
if (!aNode->IsContent() || !aNode->AsContent()->IsHTML(nsGkAtoms::area))
return GetAccessible(aNode);
// XXX Bug 135040, incorrect when multiple images use the same map.
nsIFrame* frame = aNode->AsContent()->GetPrimaryFrame();
nsImageFrame* imageFrame = do_QueryFrame(frame);
if (imageFrame) {
Accessible* parent = GetAccessible(imageFrame->GetContent());
if (parent) {
Accessible* area =
parent->AsImageMap()->GetChildAccessibleFor(aNode);
if (area)
return area;
return nullptr;
}
}
return GetAccessible(aNode);
}
////////////////////////////////////////////////////////////////////////////////
// Accessible protected

View File

@ -211,6 +211,15 @@ public:
*/
Accessible* GetAccessible(nsINode* aNode) const;
/**
* Return an accessible for the given node even if the node is not in
* document's node map cache (like HTML area element).
*
* XXX: it should be really merged with GetAccessible().
*/
Accessible* GetAccessibleEvenIfNotInMap(nsINode* aNode) const;
Accessible* GetAccessibleEvenIfNotInMapOrContainer(nsINode* aNode) const;
/**
* Return whether the given DOM node has an accessible or not.
*/

View File

@ -40,6 +40,7 @@ if CONFIG['MOZ_ENABLE_GTK']:
]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
LOCAL_INCLUDES += [
'../windows/ia2',
'../windows/msaa',
]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':

View File

@ -25,7 +25,7 @@ inline Accessible*
sdnAccessible::GetAccessible() const
{
DocAccessible* document = GetDocument();
return document ? document->GetAccessible(mNode) : nullptr;
return document ? document->GetAccessibleEvenIfNotInMap(mNode) : nullptr;
}
} // namespace a11y

View File

@ -250,8 +250,12 @@ pref("browser.uitour.enabled", true);
pref("browser.uitour.requireSecure", true);
pref("browser.uitour.themeOrigin", "https://addons.mozilla.org/%LOCALE%/firefox/themes/");
pref("browser.uitour.pinnedTabUrl", "https://support.mozilla.org/%LOCALE%/kb/pinned-tabs-keep-favorite-websites-open");
pref("browser.uitour.url", "https://www.mozilla.org/%LOCALE%/firefox/%VERSION%/tour/");
pref("browser.uitour.whitelist.add.260", "www.mozilla.org,support.mozilla.org");
pref("browser.customizemode.tip0.shown", false);
pref("browser.customizemode.tip0.learnMoreUrl", "https://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/customize");
pref("keyword.enabled", true);
pref("general.useragent.locale", "@AB_CD@");

View File

@ -52,6 +52,10 @@
#else
/>
#endif
<menuitem id="menu_openTour"
oncommand="openTourPage();"
label="&helpShowTour.label;"
accesskey="&helpShowTour.accesskey;"/>
<menuitem id="menu_keyboardShortcuts"
oncommand="openHelpLink('keyboard-shortcuts')"
onclick="checkForMiddleClick(this, event);"

View File

@ -104,7 +104,7 @@ tabbrowser {
.tabbrowser-tab:not([pinned]) {
-moz-box-flex: 100;
max-width: 180px;
max-width: 210px;
min-width: 100px;
width: 0;
transition: min-width 200ms ease-out,
@ -115,8 +115,6 @@ tabbrowser {
max-width: 0.1px;
min-width: 0.1px;
visibility: hidden;
transition: min-width 200ms ease-out,
max-width 230ms ease-out;
}
.tab-background {
@ -365,11 +363,6 @@ panel[noactions] > richlistbox > richlistitem[type~="action"] > .ac-url-box > .a
display: none;
}
#wrapper-urlbar-container > #urlbar-container > #urlbar-wrapper > #urlbar {
-moz-user-input: disabled;
cursor: grab;
}
#PopupAutoComplete {
-moz-binding: url("chrome://browser/content/urlbarBindings.xml#browser-autocomplete-result-popup");
}
@ -420,7 +413,7 @@ panel[noactions] > richlistbox > richlistitem[type~="action"] > .ac-url-box > .a
-moz-margin-end: 0.25em !important;
}
#wrapper-search-container > #search-container > #searchbar > .searchbar-textbox > .autocomplete-textbox-container > .textbox-input-box > html|*.textbox-input {
#main-window[customizing] :-moz-any(#urlbar, .searchbar-textbox) > .autocomplete-textbox-container > .textbox-input-box {
visibility: hidden;
}

View File

@ -948,7 +948,7 @@
tooltip="bhTooltip"
popupsinherittooltip="true">
<hbox flex="1">
<hbox id="PlacesToolbarDropIndicatorHolder" align="center">
<hbox id="PlacesToolbarDropIndicatorHolder" align="center" collapsed="true">
<image id="PlacesToolbarDropIndicator"
mousethrough="always"
collapsed="true"/>

View File

@ -568,6 +568,13 @@ function openFeedbackPage()
openUILinkIn(url, "tab");
}
function openTourPage()
{
let scope = {}
Components.utils.import("resource:///modules/UITour.jsm", scope);
openUILinkIn(scope.UITour.url, "tab");
}
function buildHelpMenu()
{
// Enable/disable the "Report Web Forgery" menu item.

View File

@ -231,3 +231,21 @@
overflowfortoolbar="nav-bar"/>
</vbox>
</panel>
<panel id="customization-tipPanel"
type="arrow"
flip="none"
side="left"
position="leftcenter topright"
noautohide="true">
<hbox class="customization-tipPanel-wrapper">
<vbox class="customization-tipPanel-infoBox"/>
<vbox class="customization-tipPanel-content" flex="1">
<description class="customization-tipPanel-contentMessage"/>
<image class="customization-tipPanel-contentImage"/>
</vbox>
<vbox pack="start" align="end" class="customization-tipPanel-closeBox">
<toolbarbutton oncommand="gCustomizeMode.hideTip()" class="close-icon"/>
</vbox>
</hbox>
</panel>

View File

@ -56,6 +56,7 @@ function CustomizeMode(aWindow) {
this.visiblePalette = this.document.getElementById(kPaletteId);
this.paletteEmptyNotice = this.document.getElementById("customization-empty");
this.paletteSpacer = this.document.getElementById("customization-spacer");
this.tipPanel = this.document.getElementById("customization-tipPanel");
#ifdef CAN_DRAW_IN_TITLEBAR
this._updateTitlebarButton();
Services.prefs.addObserver(kDrawInTitlebarPref, this, false);
@ -213,6 +214,8 @@ CustomizeMode.prototype = {
customizeButton.setAttribute("label", customizeButton.getAttribute("exitLabel"));
customizeButton.setAttribute("enterTooltiptext", customizeButton.getAttribute("tooltiptext"));
customizeButton.setAttribute("tooltiptext", customizeButton.getAttribute("exitTooltiptext"));
document.getElementById("PanelUI-help").setAttribute("disabled", true);
document.getElementById("PanelUI-quit").setAttribute("disabled", true);
this._transitioning = true;
@ -243,9 +246,6 @@ CustomizeMode.prototype = {
window.gNavToolbox.addEventListener("toolbarvisibilitychange", this);
document.getElementById("PanelUI-help").setAttribute("disabled", true);
document.getElementById("PanelUI-quit").setAttribute("disabled", true);
this._updateResetButton();
this._updateUndoResetButton();
@ -272,6 +272,8 @@ CustomizeMode.prototype = {
this.paletteSpacer.hidden = true;
this._updateEmptyPaletteNotice();
this.maybeShowTip(panelHolder);
this._handler.isEnteringCustomizeMode = false;
panelContents.removeAttribute("customize-transitioning");
@ -317,6 +319,8 @@ CustomizeMode.prototype = {
return;
}
this.hideTip();
this._handler.isExitingCustomizeMode = true;
if (this._enableOutlinesTimeout) {
@ -534,6 +538,45 @@ CustomizeMode.prototype = {
return deferred.promise;
},
maybeShowTip: function(aAnchor) {
let shown = false;
const kShownPref = "browser.customizemode.tip0.shown";
try {
shown = Services.prefs.getBoolPref(kShownPref);
} catch (ex) {}
if (shown)
return;
let anchorNode = aAnchor || this.document.getElementById("customization-panelHolder");
let messageNode = this.tipPanel.querySelector(".customization-tipPanel-contentMessage");
if (!messageNode.childElementCount) {
// Put the tip contents in the popup.
let bundle = this.document.getElementById("bundle_browser");
const kLabelClass = "customization-tipPanel-link";
messageNode.innerHTML = bundle.getFormattedString("customizeTips.tip0", [
"<label class=\"customization-tipPanel-em\" value=\"" +
bundle.getString("customizeTips.tip0.hint") + "\"/>",
this.document.getElementById("bundle_brand").getString("brandShortName"),
"<label class=\"" + kLabelClass + " text-link\" value=\"" +
bundle.getString("customizeTips.tip0.learnMore") + "\"/>"
]);
messageNode.querySelector("." + kLabelClass).addEventListener("click", () => {
let url = Services.urlFormatter.formatURLPref("browser.customizemode.tip0.learnMoreUrl");
let browser = this.browser;
browser.selectedTab = browser.addTab(url);
this.hideTip();
});
}
this.tipPanel.openPopup(anchorNode);
Services.prefs.setBoolPref(kShownPref, true);
},
hideTip: function() {
this.tipPanel.hidePopup();
},
_getCustomizableChildForNode: function(aNode) {
// NB: adjusted from _getCustomizableParent to keep that method fast
// (it's used during drags), and avoid multiple DOM loops

View File

@ -1575,6 +1575,7 @@ PlacesToolbar.prototype = {
// Dragging over a normal toolbarbutton,
// show indicator bar and move it to the appropriate drop point.
let ind = this._dropIndicator;
ind.parentNode.collapsed = false;
let halfInd = ind.clientWidth / 2;
let translateX;
if (this.isRTL) {

View File

@ -42,6 +42,7 @@ const SEENPAGEID_EXPIRY = 2 * 7 * 24 * 60 * 60 * 1000; // 2 weeks.
this.UITour = {
url: null,
seenPageIDs: null,
pageIDSourceTabs: new WeakMap(),
pageIDSourceWindows: new WeakMap(),
@ -127,6 +128,11 @@ this.UITour = {
configurable: true,
});
delete this.url;
XPCOMUtils.defineLazyGetter(this, "url", function () {
return Services.urlFormatter.formatURLPref("browser.uitour.url");
});
UITelemetry.addSimpleMeasureFunction("UITour",
this.getTelemetry.bind(this));

View File

@ -1641,7 +1641,8 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
}
/* Tabstrip close button */
.tabs-closebutton {
.tabs-closebutton,
.customization-tipPanel-closeBox > .close-icon {
list-style-image: url("moz-icon://stock/gtk-close?size=menu");
}
@ -2017,7 +2018,11 @@ chatbox {
%include ../shared/customizableui/customizeMode.inc.css
#main-window[customize-entered] #tab-view-deck {
#main-window[customizing] > #tab-view-deck {
background: linear-gradient(to bottom, #bcbcbc, #b5b5b5);
}
#main-window[customize-entered] > #tab-view-deck {
background-image: url("chrome://browser/skin/customizableui/customizeMode-gridTexture.png"),
url("chrome://browser/skin/customizableui/background-noise-toolbar.png"),
linear-gradient(to bottom, #bcbcbc, #b5b5b5);

View File

@ -72,11 +72,14 @@ browser.jar:
skin/classic/browser/webRTC-shareMicrophone-64.png
skin/classic/browser/webRTC-sharingMicrophone-16.png
skin/classic/browser/customizableui/background-noise-toolbar.png (customizableui/background-noise-toolbar.png)
skin/classic/browser/customizableui/customize-illustration.png (../shared/customizableui/customize-illustration.png)
skin/classic/browser/customizableui/customizeMode-gridTexture.png (customizableui/customizeMode-gridTexture.png)
skin/classic/browser/customizableui/customizeMode-separatorHorizontal.png (customizableui/customizeMode-separatorHorizontal.png)
skin/classic/browser/customizableui/customizeMode-separatorVertical.png (customizableui/customizeMode-separatorVertical.png)
skin/classic/browser/customizableui/customizeFavicon.ico (../shared/customizableui/customizeFavicon.ico)
skin/classic/browser/customizableui/info-icon-customizeTip.png (../shared/customizableui/info-icon-customizeTip.png)
skin/classic/browser/customizableui/menuPanel-customizeFinish.png (../shared/customizableui/menuPanel-customizeFinish.png)
skin/classic/browser/customizableui/panelarrow-customizeTip.png (../shared/customizableui/panelarrow-customizeTip.png)
* skin/classic/browser/customizableui/panelUIOverlay.css (customizableui/panelUIOverlay.css)
skin/classic/browser/customizableui/subView-arrow-back-inverted.png (../shared/customizableui/subView-arrow-back-inverted.png)
skin/classic/browser/downloads/allDownloadsViewOverlay.css (downloads/allDownloadsViewOverlay.css)

View File

@ -4162,7 +4162,11 @@ window > chatbox {
margin-bottom: 11px;
}
#main-window[customize-entered] #tab-view-deck {
#main-window[customizing] {
background-color: rgb(178,178,178);
}
#main-window[customize-entered] > #tab-view-deck {
background-image: url("chrome://browser/skin/customizableui/customizeMode-gridTexture.png"),
url("chrome://browser/skin/customizableui/background-noise-toolbar.png"),
linear-gradient(to bottom, rgb(233,233,233), rgb(178,178,178) 40px);
@ -4207,6 +4211,24 @@ window > chatbox {
#customization-titlebar-visibility-button > .button-box > .button-icon {
width: 24px;
}
.customization-tipPanel-closeBox > .close-icon > .toolbarbutton-icon {
width: 16px;
}
.customization-tipPanel-infoBox {
background-image: url(chrome://browser/skin/customizableui/info-icon-customizeTip@2x.png);
background-size: 25px 25px;
}
.customization-tipPanel-contentImage {
list-style-image: url(chrome://browser/skin/customizableui/customize-illustration@2x.png);
}
#customization-tipPanel > .panel-arrowcontainer > .panel-arrowbox > .panel-arrow[side="left"],
#customization-tipPanel > .panel-arrowcontainer > .panel-arrowbox > .panel-arrow[side="right"] {
list-style-image: url("chrome://browser/skin/customizableui/panelarrow-customizeTip@2x.png");
}
}
/* End customization mode */

View File

@ -122,12 +122,18 @@ browser.jar:
skin/classic/browser/customizableui/background-noise-toolbar.png (customizableui/background-noise-toolbar.png)
skin/classic/browser/customizableui/customize-titleBar-toggle.png (customizableui/customize-titleBar-toggle.png)
skin/classic/browser/customizableui/customize-titleBar-toggle@2x.png (customizableui/customize-titleBar-toggle@2x.png)
skin/classic/browser/customizableui/customize-illustration.png (../shared/customizableui/customize-illustration.png)
skin/classic/browser/customizableui/customize-illustration@2x.png (../shared/customizableui/customize-illustration@2x.png)
skin/classic/browser/customizableui/customizeFavicon.ico (../shared/customizableui/customizeFavicon.ico)
skin/classic/browser/customizableui/customizeMode-gridTexture.png (customizableui/customizeMode-gridTexture.png)
skin/classic/browser/customizableui/customizeMode-separatorHorizontal.png (customizableui/customizeMode-separatorHorizontal.png)
skin/classic/browser/customizableui/customizeMode-separatorVertical.png (customizableui/customizeMode-separatorVertical.png)
skin/classic/browser/customizableui/info-icon-customizeTip.png (../shared/customizableui/info-icon-customizeTip.png)
skin/classic/browser/customizableui/info-icon-customizeTip@2x.png (../shared/customizableui/info-icon-customizeTip@2x.png)
skin/classic/browser/customizableui/menuPanel-customizeFinish.png (../shared/customizableui/menuPanel-customizeFinish.png)
skin/classic/browser/customizableui/menuPanel-customizeFinish@2x.png (../shared/customizableui/menuPanel-customizeFinish@2x.png)
skin/classic/browser/customizableui/panelarrow-customizeTip.png (../shared/customizableui/panelarrow-customizeTip.png)
skin/classic/browser/customizableui/panelarrow-customizeTip@2x.png (../shared/customizableui/panelarrow-customizeTip@2x.png)
skin/classic/browser/customizableui/subView-arrow-back-inverted.png (../shared/customizableui/subView-arrow-back-inverted.png)
skin/classic/browser/customizableui/subView-arrow-back-inverted@2x.png (../shared/customizableui/subView-arrow-back-inverted@2x.png)
* skin/classic/browser/customizableui/panelUIOverlay.css (customizableui/panelUIOverlay.css)

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View File

@ -260,3 +260,5 @@ toolbarpaletteitem[place="toolbar"] {
margin-left: 0;
margin-right: 0;
}
%include customizeTip.inc.css

View File

@ -0,0 +1,72 @@
/* 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/. */
#customization-tipPanel > .panel-arrowcontainer > .panel-arrowcontent {
padding: 0;
margin: 0;
min-width: 400px;
max-width: 1000px;
min-height: 200px;
border-radius: 3px;
background-image: linear-gradient(90deg, #a0dfff 0%, #ceeeff 100%);
border: 0px solid rgba(0,148,221,.5);
box-shadow: 0 1px 5px 0 rgba(0,0,0,.5), inset 0 1px 1px 0 #fff;
}
#customization-tipPanel > .panel-arrowcontainer > .panel-arrowcontent:-moz-locale-dir(rtl) {
background-image: linear-gradient(90deg, #ceeeff 0%, #a0dfff 100%);
}
.customization-tipPanel-infoBox {
margin: 20px 25px 25px;
width: 25px;
background-image: url(chrome://browser/skin/customizableui/info-icon-customizeTip.png);
background-repeat: no-repeat;
}
.customization-tipPanel-content {
margin: 25px 0;
font-size: 12px;
line-height: 18px;
}
.customization-tipPanel-em {
margin: 0;
font-weight: bold;
}
.customization-tipPanel-contentImage {
margin-top: 25px;
list-style-image: url(chrome://browser/skin/customizableui/customize-illustration.png);
min-width: 300px;
max-width: 300px;
min-height: 190px;
max-height: 190px;
display: -moz-box;
}
.customization-tipPanel-link {
-moz-appearance: none;
background: transparent;
border: none;
box-shadow: none;
color: rgb(25,82,171);
margin: 0;
cursor: pointer;
}
.customization-tipPanel-link > .button-box > .button-text {
margin: 0 !important;
}
.customization-tipPanel-closeBox > .close-icon {
-moz-appearance: none;
border: 0;
-moz-margin-end: -25px;
}
#customization-tipPanel > .panel-arrowcontainer > .panel-arrowbox > .panel-arrow[side="left"],
#customization-tipPanel > .panel-arrowcontainer > .panel-arrowbox > .panel-arrow[side="right"] {
list-style-image: url("chrome://browser/skin/customizableui/panelarrow-customizeTip.png");
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 501 B

View File

@ -270,7 +270,7 @@ toolbaritem[cui-areatype="menu-panel"][sdkstylewidget="true"]:not(.panel-wide-it
border-radius: 0 0 2px 0;
}
.panel-combined-button[disabled] > .toolbarbutton-icon {
#main-window:not([customizing]) .panel-combined-button[disabled] > .toolbarbutton-icon {
opacity: .5;
}
@ -768,8 +768,8 @@ toolbarpaletteitem[place="palette"] > #search-container {
max-width: calc(@menuPanelButtonWidth@ - 2px);
}
#edit-controls@inAnyPanel@ > toolbarbutton[disabled] > .toolbarbutton-icon,
#zoom-controls@inAnyPanel@ > toolbarbutton[disabled] > .toolbarbutton-icon {
#main-window:not([customizing]) #edit-controls@inAnyPanel@ > toolbarbutton[disabled] > .toolbarbutton-icon,
#main-window:not([customizing]) #zoom-controls@inAnyPanel@ > toolbarbutton[disabled] > .toolbarbutton-icon {
opacity: .25;
}
@ -810,7 +810,13 @@ toolbarpaletteitem[place="palette"] > #search-container {
}
.toolbaritem-combined-buttons@inAnyPanel@ > separator {
margin: .5em 0;
/**
* The calculation below is a layout hack. Without it, when hovering over
* a .toolbaritem-combined-buttons element in the menu panel, the disappearance
* of the separator margins causes things in the menu panel to shift by a few
* pixels on Linux. See bug 978767.
*/
margin: calc(0.5em - 1px) 0;
width: 1px;
background: hsla(210,4%,10%,.15);
transition-property: margin;

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 B

View File

@ -2555,6 +2555,14 @@ chatbox {
background-clip: padding-box;
}
#customization-tipPanel > .panel-arrowcontainer > .panel-arrowbox > .panel-arrow[side="left"] {
margin-right: -2px;
}
#customization-tipPanel > .panel-arrowcontainer > .panel-arrowbox > .panel-arrow[side="right"] {
margin-left: -2px;
}
/* End customization mode */
#main-window[privatebrowsingmode=temporary] #private-browsing-indicator {

View File

@ -91,11 +91,14 @@ browser.jar:
skin/classic/browser/webRTC-sharingMicrophone-16.png
skin/classic/browser/customizableui/background-noise-toolbar.png (customizableui/background-noise-toolbar.png)
skin/classic/browser/customizableui/customizeFavicon.ico (../shared/customizableui/customizeFavicon.ico)
skin/classic/browser/customizableui/customize-illustration.png (../shared/customizableui/customize-illustration.png)
skin/classic/browser/customizableui/customize-titleBar-toggle.png (customizableui/customize-titleBar-toggle.png)
skin/classic/browser/customizableui/customizeMode-gridTexture.png (customizableui/customizeMode-gridTexture.png)
skin/classic/browser/customizableui/customizeMode-separatorHorizontal.png (customizableui/customizeMode-separatorHorizontal.png)
skin/classic/browser/customizableui/customizeMode-separatorVertical.png (customizableui/customizeMode-separatorVertical.png)
skin/classic/browser/customizableui/info-icon-customizeTip.png (../shared/customizableui/info-icon-customizeTip.png)
skin/classic/browser/customizableui/menuPanel-customizeFinish.png (../shared/customizableui/menuPanel-customizeFinish.png)
skin/classic/browser/customizableui/panelarrow-customizeTip.png (../shared/customizableui/panelarrow-customizeTip.png)
* skin/classic/browser/customizableui/panelUIOverlay.css (customizableui/panelUIOverlay.css)
skin/classic/browser/customizableui/subView-arrow-back-inverted.png (../shared/customizableui/subView-arrow-back-inverted.png)
* skin/classic/browser/downloads/allDownloadsViewOverlay.css (downloads/allDownloadsViewOverlay.css)
@ -412,12 +415,15 @@ browser.jar:
skin/classic/aero/browser/webRTC-shareMicrophone-64.png
skin/classic/aero/browser/webRTC-sharingMicrophone-16.png
skin/classic/aero/browser/customizableui/background-noise-toolbar.png (customizableui/background-noise-toolbar.png)
skin/classic/aero/browser/customizableui/customize-illustration.png (../shared/customizableui/customize-illustration.png)
skin/classic/aero/browser/customizableui/customize-titleBar-toggle.png (customizableui/customize-titleBar-toggle.png)
skin/classic/aero/browser/customizableui/customizeFavicon.ico (../shared/customizableui/customizeFavicon.ico)
skin/classic/aero/browser/customizableui/customizeMode-gridTexture.png (customizableui/customizeMode-gridTexture.png)
skin/classic/aero/browser/customizableui/customizeMode-separatorHorizontal.png (customizableui/customizeMode-separatorHorizontal.png)
skin/classic/aero/browser/customizableui/customizeMode-separatorVertical.png (customizableui/customizeMode-separatorVertical.png)
skin/classic/aero/browser/customizableui/info-icon-customizeTip.png (../shared/customizableui/info-icon-customizeTip.png)
skin/classic/aero/browser/customizableui/menuPanel-customizeFinish.png (../shared/customizableui/menuPanel-customizeFinish.png)
skin/classic/aero/browser/customizableui/panelarrow-customizeTip.png (../shared/customizableui/panelarrow-customizeTip.png)
* skin/classic/aero/browser/customizableui/panelUIOverlay.css (customizableui/panelUIOverlay-aero.css)
skin/classic/aero/browser/customizableui/subView-arrow-back-inverted.png (../shared/customizableui/subView-arrow-back-inverted.png)
* skin/classic/aero/browser/downloads/allDownloadsViewOverlay.css (downloads/allDownloadsViewOverlay-aero.css)

54
build/docs/cppeclipse.rst Normal file
View File

@ -0,0 +1,54 @@
.. _build_cppeclipse:
=====================
Cpp Eclipse Projects
=====================
For additional information on using Eclipse CDT see
`the MDN page
<https://developer.mozilla.org/en-US/docs/Eclipse_CDT>`_.
The build system contains alpha support for generating C++ Eclipse
project files to aid with development.
Please report bugs to bugzilla and make them depend on bug 973770.
To generate a C++ Eclipse project files, you'll need to have a fully
built tree::
mach build
Then, simply generate the Android Eclipse build backend::
mach build-backend -b CppEclipse
If all goes well, the path to the generated workspace should be
printed (currently, ``$OBJDIR/android_eclipse``).
To use the generated Android Eclipse project files, you'll need to
have a Eclipse CDT 8.3 (We plan to follow the latest Eclipse release)
`Eclipse CDT plugin
<https://www.eclipse.org/cdt/>`_
installed. You can then import all the projects into Eclipse using
*File > Import ... > General > Existing Projects into Workspace*
-only- if you have not ran the background indexer.
Updating Project Files
======================
As you pull and update the source tree, your C++ Eclipse files may
fall out of sync with the build configuration. The tree should still
build fine from within Eclipse, but source files may be missing and in
rare circumstances Eclipse's index may not have the proper build
configuration.
To account for this, you'll want to periodically regenerate the
Android Eclipse project files. You can do this by running ``mach build
&& mach build-backend -b CppEclipse`` from the
command line.
Currently, regeneration rewrites the original project files. **If
you've made any customizations to the projects, they will likely get
overwritten.** We would like to improve this user experience in the
future.

View File

@ -22,8 +22,15 @@ Important Concepts
mozinfo
preprocessor
jar-manifests
visualstudio
integrated development environment (IDE)
========================================
.. toctree::
:maxdepth: 1
androideclipse
cppeclipse
visualstudio
mozbuild
========

View File

@ -94,14 +94,14 @@
#include "GLContext.h"
#include "GLContextProvider.h"
#ifdef USE_SKIA_GPU
#undef free // apparently defined by some windows header, clashing with a free()
// method in SkTypes.h
#include "GLContextSkia.h"
#include "SkiaGLGlue.h"
#include "SurfaceStream.h"
#include "SurfaceTypes.h"
#include "nsIGfxInfo.h"
#endif
using mozilla::gl::GLContext;
using mozilla::gl::SkiaGLGlue;
using mozilla::gl::GLContextProvider;
#ifdef XP_WIN
@ -430,28 +430,18 @@ public:
}
}
#ifdef USE_SKIA_GPU
static void PreTransactionCallback(void* aData)
{
CanvasRenderingContext2DUserData* self =
static_cast<CanvasRenderingContext2DUserData*>(aData);
CanvasRenderingContext2D* context = self->mContext;
if (!context)
if (!context || !context->mStream || !context->mTarget)
return;
GLContext* glContext = static_cast<GLContext*>(context->mTarget->GetGLContext());
if (!glContext)
return;
if (context->mTarget) {
// Since SkiaGL default to store drawing command until flush
// We will have to flush it before present.
context->mTarget->Flush();
}
glContext->MakeCurrent();
glContext->PublishFrame();
// Since SkiaGL default to store drawing command until flush
// We will have to flush it before present.
context->mTarget->Flush();
}
#endif
static void DidTransactionCallback(void* aData)
{
@ -542,18 +532,15 @@ DrawTarget* CanvasRenderingContext2D::sErrorTarget = nullptr;
CanvasRenderingContext2D::CanvasRenderingContext2D()
: mZero(false), mOpaque(false), mResetLayer(true)
: mForceSoftware(false), mZero(false), mOpaque(false), mResetLayer(true)
, mIPC(false)
, mStream(nullptr)
, mIsEntireFrameInvalid(false)
, mPredictManyRedrawCalls(false), mPathTransformWillUpdate(false)
, mInvalidateCount(0)
{
sNumLivingContexts++;
SetIsDOMBinding();
#ifdef USE_SKIA_GPU
mForceSoftware = false;
#endif
}
CanvasRenderingContext2D::~CanvasRenderingContext2D()
@ -568,9 +555,7 @@ CanvasRenderingContext2D::~CanvasRenderingContext2D()
NS_IF_RELEASE(sErrorTarget);
}
#ifdef USE_SKIA_GPU
RemoveDemotableContext(this);
#endif
}
JSObject*
@ -638,6 +623,7 @@ CanvasRenderingContext2D::Reset()
}
mTarget = nullptr;
mStream = nullptr;
// reset hit regions
#ifdef ACCESSIBILITY
@ -765,8 +751,7 @@ CanvasRenderingContext2D::RedrawUser(const gfxRect& r)
void CanvasRenderingContext2D::Demote()
{
#ifdef USE_SKIA_GPU
if (!IsTargetValid() || mForceSoftware || !mTarget->GetGLContext())
if (!IsTargetValid() || mForceSoftware || !mStream)
return;
RemoveDemotableContext(this);
@ -774,6 +759,7 @@ void CanvasRenderingContext2D::Demote()
RefPtr<SourceSurface> snapshot = mTarget->Snapshot();
RefPtr<DrawTarget> oldTarget = mTarget;
mTarget = nullptr;
mStream = nullptr;
mResetLayer = true;
mForceSoftware = true;
@ -792,11 +778,8 @@ void CanvasRenderingContext2D::Demote()
}
mTarget->SetTransform(oldTarget->GetTransform());
#endif
}
#ifdef USE_SKIA_GPU
std::vector<CanvasRenderingContext2D*>&
CanvasRenderingContext2D::DemotableContexts()
{
@ -807,11 +790,7 @@ CanvasRenderingContext2D::DemotableContexts()
void
CanvasRenderingContext2D::DemoteOldestContextIfNecessary()
{
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
const size_t kMaxContexts = 2;
#else
const size_t kMaxContexts = 16;
#endif
const size_t kMaxContexts = 64;
std::vector<CanvasRenderingContext2D*>& contexts = DemotableContexts();
if (contexts.size() < kMaxContexts)
@ -845,8 +824,6 @@ CheckSizeForSkiaGL(IntSize size) {
return size.width >= minsize && size.height >= minsize;
}
#endif
void
CanvasRenderingContext2D::EnsureTarget()
{
@ -872,42 +849,29 @@ CanvasRenderingContext2D::EnsureTarget()
}
if (layerManager) {
#ifdef USE_SKIA_GPU
if (gfxPlatform::GetPlatform()->UseAcceleratedSkiaCanvas()) {
SurfaceCaps caps = SurfaceCaps::ForRGBA();
caps.preserve = true;
#ifdef MOZ_WIDGET_GONK
layers::ShadowLayerForwarder *forwarder = layerManager->AsShadowForwarder();
if (forwarder) {
caps.surfaceAllocator = static_cast<layers::ISurfaceAllocator*>(forwarder);
}
#endif
if (gfxPlatform::GetPlatform()->UseAcceleratedSkiaCanvas() &&
!mForceSoftware &&
CheckSizeForSkiaGL(size)) {
DemoteOldestContextIfNecessary();
nsRefPtr<GLContext> glContext;
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
nsString vendor;
SkiaGLGlue* glue = gfxPlatform::GetPlatform()->GetSkiaGLGlue();
if (!mForceSoftware && CheckSizeForSkiaGL(size))
{
glContext = GLContextProvider::CreateOffscreen(gfxIntSize(size.width, size.height),
caps);
if (glue) {
mTarget = Factory::CreateDrawTargetSkiaWithGrContext(glue->GetGrContext(), size, format);
if (mTarget) {
mStream = gfx::SurfaceStream::CreateForType(SurfaceStreamType::TripleBuffer, glue->GetGLContext());
AddDemotableContext(this);
} else {
printf_stderr("Failed to create a SkiaGL DrawTarget, falling back to software\n");
}
}
if (glContext) {
SkAutoTUnref<GrGLInterface> i(CreateGrGLInterfaceFromGLContext(glContext));
mTarget = Factory::CreateDrawTargetSkiaWithGLContextAndGrGLInterface(glContext, i, size, format);
AddDemotableContext(this);
} else {
if (!mTarget) {
mTarget = layerManager->CreateDrawTarget(size, format);
}
} else
#endif
mTarget = layerManager->CreateDrawTarget(size, format);
mTarget = layerManager->CreateDrawTarget(size, format);
} else {
mTarget = gfxPlatform::GetPlatform()->CreateOffscreenCanvasDrawTarget(size, format);
mTarget = gfxPlatform::GetPlatform()->CreateOffscreenCanvasDrawTarget(size, format);
}
}
@ -1092,12 +1056,10 @@ CanvasRenderingContext2D::SetContextOptions(JSContext* aCx, JS::Handle<JS::Value
ContextAttributes2D attributes;
NS_ENSURE_TRUE(attributes.Init(aCx, aOptions), NS_ERROR_UNEXPECTED);
#ifdef USE_SKIA_GPU
if (Preferences::GetBool("gfx.canvas.willReadFrequently.enable", false)) {
// Use software when there is going to be a lot of readback
mForceSoftware = attributes.mWillReadFrequently;
}
#endif
return NS_OK;
}
@ -3340,7 +3302,6 @@ CanvasRenderingContext2D::DrawDirectlyToCanvas(
NS_ENSURE_SUCCESS_VOID(rv);
}
#ifdef USE_SKIA_GPU
static bool
IsStandardCompositeOp(CompositionOp op)
{
@ -3356,7 +3317,6 @@ IsStandardCompositeOp(CompositionOp op)
op == CompositionOp::OP_ADD ||
op == CompositionOp::OP_XOR);
}
#endif
void
CanvasRenderingContext2D::SetGlobalCompositeOperation(const nsAString& op,
@ -3397,11 +3357,9 @@ CanvasRenderingContext2D::SetGlobalCompositeOperation(const nsAString& op,
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
else return;
#ifdef USE_SKIA_GPU
if (!IsStandardCompositeOp(comp_op)) {
Demote();
}
#endif
#undef CANVAS_OP_TO_GFX_OP
CurrentState().op = comp_op;
@ -3447,11 +3405,9 @@ CanvasRenderingContext2D::GetGlobalCompositeOperation(nsAString& op,
error.Throw(NS_ERROR_FAILURE);
}
#ifdef USE_SKIA_GPU
if (!IsStandardCompositeOp(comp_op)) {
Demote();
}
#endif
#undef CANVAS_OP_TO_GFX_OP
}
@ -4151,7 +4107,17 @@ CanvasRenderingContext2D::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
aOldLayer->GetUserData(&g2DContextLayerUserData));
CanvasLayer::Data data;
data.mGLContext = static_cast<GLContext*>(mTarget->GetGLContext());
if (mStream) {
SkiaGLGlue* glue = gfxPlatform::GetPlatform()->GetSkiaGLGlue();
if (glue) {
data.mGLContext = glue->GetGLContext();
data.mStream = mStream.get();
}
} else {
data.mDrawTarget = mTarget;
}
if (userData && userData->IsForContext(this) && aOldLayer->IsDataValid(data)) {
nsRefPtr<CanvasLayer> ret = aOldLayer;
return ret.forget();
@ -4184,15 +4150,17 @@ CanvasRenderingContext2D::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
canvasLayer->SetUserData(&g2DContextLayerUserData, userData);
CanvasLayer::Data data;
#ifdef USE_SKIA_GPU
GLContext* glContext = static_cast<GLContext*>(mTarget->GetGLContext());
if (glContext) {
canvasLayer->SetPreTransactionCallback(
CanvasRenderingContext2DUserData::PreTransactionCallback, userData);
data.mGLContext = glContext;
} else
#endif
{
if (mStream) {
SkiaGLGlue* glue = gfxPlatform::GetPlatform()->GetSkiaGLGlue();
if (glue) {
canvasLayer->SetPreTransactionCallback(
CanvasRenderingContext2DUserData::PreTransactionCallback, userData);
data.mGLContext = glue->GetGLContext();
data.mStream = mStream.get();
data.mTexID = (uint32_t)((uintptr_t)mTarget->GetNativeSurface(NativeSurfaceType::OPENGL_TEXTURE));
}
} else {
data.mDrawTarget = mTarget;
}

View File

@ -31,6 +31,7 @@ class nsXULElement;
namespace mozilla {
namespace gfx {
class SourceSurface;
class SurfaceStream;
}
namespace dom {
@ -596,7 +597,6 @@ protected:
return CurrentState().font;
}
#if USE_SKIA_GPU
static std::vector<CanvasRenderingContext2D*>& DemotableContexts();
static void DemoteOldestContextIfNecessary();
@ -605,7 +605,6 @@ protected:
// Do not use GL
bool mForceSoftware;
#endif
// Member vars
int32_t mWidth, mHeight;
@ -632,6 +631,8 @@ protected:
// sErrorTarget.
mozilla::RefPtr<mozilla::gfx::DrawTarget> mTarget;
RefPtr<gfx::SurfaceStream> mStream;
/**
* Flag to avoid duplicate calls to InvalidateFrame. Set to true whenever
* Redraw is called, reset to false when Render is called.

View File

@ -1343,6 +1343,11 @@ WebGLContext::GetFramebufferAttachmentParameter(JSContext* cx,
return JS::NullValue();
}
if (!mBoundFramebuffer) {
ErrorInvalidOperation("getFramebufferAttachmentParameter: cannot query framebuffer 0");
return JS::NullValue();
}
if (attachment != LOCAL_GL_DEPTH_ATTACHMENT &&
attachment != LOCAL_GL_STENCIL_ATTACHMENT &&
attachment != LOCAL_GL_DEPTH_STENCIL_ATTACHMENT)
@ -1365,11 +1370,6 @@ WebGLContext::GetFramebufferAttachmentParameter(JSContext* cx,
}
}
if (!mBoundFramebuffer) {
ErrorInvalidOperation("getFramebufferAttachmentParameter: cannot query framebuffer 0");
return JS::NullValue();
}
MakeContextCurrent();
const WebGLFramebuffer::Attachment& fba = mBoundFramebuffer->GetAttachment(attachment);

View File

@ -4,6 +4,8 @@ support-files =
webgl-util.js
[test_depth_readpixels.html]
[test_fb_param.html]
[test_fb_param_crash.html]
[test_highp_fs.html]
[test_no_arr_points.html]
[test_privileged_exts.html]

View File

@ -0,0 +1,55 @@
<!DOCTYPE HTML>
<title>WebGL test: bug 958491</title>
<script src="/MochiKit/MochiKit.js"></script>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
<script src="driver-info.js"></script>
<script src="webgl-util.js"></script>
<body>
<canvas id="c"></canvas>
<script>
// Give ourselves a scope to return early from:
(function() {
var gl = WebGLUtil.getWebGL('c');
if (!gl) {
todo(false, 'WebGL is unavailable.');
return;
}
// Catch actual WebGLUtil errors, not GL errors.
function errorFunc(str) {
ok(false, 'Error: ' + str);
}
WebGLUtil.setErrorFunc(errorFunc);
function checkGLError(func, info, reference) {
var error = gl.getError();
var prefix = info ? ('[' + info + '] ') : '';
var text = 'gl.getError should be 0x' + reference.toString(16) +
', was 0x' + error.toString(16) + '.';
func(error == reference, prefix + text);
}
// Begin test:
var rb = gl.createRenderbuffer();
gl.bindRenderbuffer(gl.RENDERBUFFER, rb);
gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 4, 4);
var fb = gl.createFramebuffer();
gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0,
gl.RENDERBUFFER, rb);
checkGLError(ok, 'before bad param query', 0);
var GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 0x8210;
var result = gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER,
gl.COLOR_ATTACHMENT0,
GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING);
checkGLError(ok, 'after bad param query', gl.INVALID_ENUM);
})();
</script>

View File

@ -0,0 +1,49 @@
<!DOCTYPE HTML>
<title>WebGL test: bug 958723</title>
<script src="/MochiKit/MochiKit.js"></script>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
<script src="driver-info.js"></script>
<script src="webgl-util.js"></script>
<body>
<canvas id="c"></canvas>
<script>
// Give ourselves a scope to return early from:
(function() {
var gl = WebGLUtil.getWebGL('c');
if (!gl) {
todo(false, 'WebGL is unavailable.');
return;
}
// Catch actual WebGLUtil errors, not GL errors.
function errorFunc(str) {
ok(false, 'Error: ' + str);
}
WebGLUtil.setErrorFunc(errorFunc);
function checkGLError(func, info, reference) {
var error = gl.getError();
var prefix = info ? ('[' + info + '] ') : '';
var text = 'gl.getError should be 0x' + reference.toString(16) +
', was 0x' + error.toString(16) + '.';
func(error == reference, prefix + text);
}
// Begin test:
if (!gl.getExtension('WEBGL_draw_buffers')) {
todo(false, 'Not having this extension is fine.');
return;
}
checkGLError(ok, 'before bad param query', 0);
var result = gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER,
gl.COLOR_ATTACHMENT0,
gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);
checkGLError(ok, 'after bad param query', gl.INVALID_OPERATION);
})();
</script>

View File

@ -6117,7 +6117,7 @@ HTMLInputElement::GetValueMode() const
bool
HTMLInputElement::IsMutable() const
{
return !IsDisabled() && GetCurrentDoc() &&
return !IsDisabled() &&
!(DoesReadOnlyApply() &&
HasAttr(kNameSpaceID_None, nsGkAtoms::readonly));
}

View File

@ -73,3 +73,4 @@ skip-if = os == "android" || appname == "b2g"
[test_valueAsDate_pref.html]
[test_valueasdate_attribute.html]
[test_valueasnumber_attribute.html]
[test_validation_not_in_doc.html]

View File

@ -185,8 +185,10 @@ function checkInputRequiredValidity(type)
element.required = true;
SpecialPowers.wrap(element).value = ''; // To make :-moz-ui-valid apply.
checkSufferingFromBeingMissing(element, true);
document.forms[0].removeChild(element);
checkNotSufferingFromBeingMissing(element);
// Removing the child changes nothing about whether it's valid
checkSufferingFromBeingMissing(element, true);
}
function checkInputRequiredValidityForCheckbox()
@ -221,7 +223,7 @@ function checkInputRequiredValidityForCheckbox()
element.required = true;
element.checked = false;
document.forms[0].removeChild(element);
checkNotSufferingFromBeingMissing(element);
checkSufferingFromBeingMissing(element, true);
}
function checkInputRequiredValidityForRadio()
@ -297,7 +299,7 @@ function checkInputRequiredValidityForRadio()
element2.required = true;
element2.checked = false;
document.forms[0].removeChild(element2);
checkNotSufferingFromBeingMissing(element2);
checkSufferingFromBeingMissing(element2, true);
}
function checkInputRequiredValidityForFile()
@ -350,7 +352,7 @@ function checkInputRequiredValidityForFile()
SpecialPowers.wrap(element).value = '';
file.remove(false);
document.forms[0].removeChild(element);
checkNotSufferingFromBeingMissing(element);
checkSufferingFromBeingMissing(element, true);
}
checkTextareaRequiredValidity();

View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Test for constraint validation of form controls not in documents</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
test(function() {
var input = document.createElement('input');
input.required = true;
assert_false(input.checkValidity());
}, "Should validate input not in document");
test(function() {
var textarea = document.createElement('textarea');
textarea.required = true;
assert_false(textarea.checkValidity());
}, "Should validate textarea not in document");
</script>

View File

@ -129,7 +129,7 @@ function checkRadios(r1, r2, r3, form)
var p = r2.parentNode;
p.removeChild(r2);
checkPseudoClasses(r1, true, true, false);
checkPseudoClasses(r2, true, true, false);
checkPseudoClasses(r2, false, false, true);
p.appendChild(r2);
checkPseudoClasses(r1, false, false, true);

View File

@ -63,7 +63,6 @@ support-files =
[test_bug875221.html]
[test_bug875402.html]
[test_bug894150.html]
[test_bug938022.html]
[test_bug956489.html]
[test_bug964376.html]
[test_bug972678.html]
@ -108,6 +107,7 @@ support-files =
[test_pannerNode.html]
[test_pannerNodeAbove.html]
[test_pannerNodeChannelCount.html]
[test_pannerNodeHRTFSymmetry.html]
[test_pannerNodeTail.html]
[test_pannerNode_equalPower.html]
[test_periodicWave.html]

View File

@ -1,28 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test audio element currentTime is correct when used as media source</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
addLoadEvent(function() {
var context = new AudioContext();
var audio = new Audio("small-shot.ogg");
audio.load();
audio.addEventListener("loadeddata", function (e) {
is(this.currentTime, 0, "currentTime must be 0");
SimpleTest.finish();
});
audio.play();
var source = context.createMediaElementSource(audio);
source.connect(context.destination);
});
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,104 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test left/right symmetry and block-offset invariance of HRTF panner</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="webaudio.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
const blockSize = 128;
const bufferSize = 4096; // > HRTF panner latency
var ctx = new AudioContext();
function isChannelSilent(channel) {
for (var i = 0; i < channel.length; ++i) {
if (channel[i] != 0.0) {
return false;
}
}
return true;
}
function startTest() {
var leftPanner = ctx.createPanner();
var rightPanner = ctx.createPanner();
leftPanner.setPosition(-1,0,0);
rightPanner.setPosition(1,0,0);
// Test that PannerNode processes the signal consistently irrespective of
// the offset in the processing block. This is done by inserting a delay of
// less than a block size before one panner.
const delayTime = 0.7 * blockSize / ctx.sampleRate;
var leftDelay = ctx.createDelay(delayTime);
leftDelay.delayTime.value = delayTime;
leftDelay.connect(leftPanner);
// and compensating for the delay after the other.
var rightDelay = ctx.createDelay(delayTime);
rightDelay.delayTime.value = delayTime;
rightPanner.connect(rightDelay);
// Feed the panners with a signal having some harmonics to fill the spectrum.
var oscillator = ctx.createOscillator();
oscillator.frequency.value = 110;
oscillator.type = "sawtooth";
oscillator.connect(leftDelay);
oscillator.connect(rightPanner);
oscillator.start(0);
// Switch the channels on one panner output, and it should match the other.
var splitter = ctx.createChannelSplitter();
leftPanner.connect(splitter);
var merger = ctx.createChannelMerger();
splitter.connect(merger, 0, 1);
splitter.connect(merger, 1, 0);
// Invert one signal so that mixing with the other will find the difference.
var gain = ctx.createGain();
gain.gain.value = -1.0;
merger.connect(gain);
var processor = ctx.createScriptProcessor(bufferSize, 2, 0);
gain.connect(processor);
rightDelay.connect(processor);
processor.onaudioprocess =
function(e) {
compareBuffers(e.inputBuffer,
ctx.createBuffer(2, bufferSize, ctx.sampleRate));
e.target.onaudioprocess = null;
SimpleTest.finish();
}
}
function prepareTest() {
// A PannerNode will produce no output until it has loaded its HRIR
// database. Wait for this to load before starting the test.
var processor = ctx.createScriptProcessor(bufferSize, 2, 0);
var panner = ctx.createPanner();
panner.connect(processor);
var oscillator = ctx.createOscillator();
oscillator.connect(panner);
oscillator.start(0);
processor.onaudioprocess =
function(e) {
if (isChannelSilent(e.inputBuffer.getChannelData(0)))
return;
oscillator.stop(0);
panner.disconnect();
e.target.onaudioprocess = null;
startTest();
};
}
prepareTest();
</script>
</pre>
</body>
</html>

View File

@ -9,6 +9,7 @@
#include "prtime.h"
#include "prinrval.h"
#include "prsystem.h"
#include "prprf.h"
#include "nsString.h"
#include "nsThreadUtils.h"
@ -214,9 +215,9 @@ nsresult LoadInfo::UpdateSystemLoad()
uint64_t nice;
uint64_t system;
uint64_t idle;
if (sscanf(buffer.get(), "cpu %Lu %Lu %Lu %Lu",
&user, &nice,
&system, &idle) != 4) {
if (PR_sscanf(buffer.get(), "cpu %llu %llu %llu %llu",
&user, &nice,
&system, &idle) != 4) {
LOG(("Error parsing /proc/stat"));
return NS_ERROR_FAILURE;
}

View File

@ -270,16 +270,25 @@ class CGDOMProxyJSClass(CGThing):
def declare(self):
return ""
def define(self):
flags = ["JSCLASS_IS_DOMJSCLASS"]
# We don't use an IDL annotation for JSCLASS_EMULATES_UNDEFINED because
# we don't want people ever adding that to any interface other than
# HTMLAllCollection. So just hardcode it here.
if self.descriptor.interface.identifier.name == "HTMLAllCollection":
flags.append("JSCLASS_EMULATES_UNDEFINED")
callHook = LEGACYCALLER_HOOK_NAME if self.descriptor.operations["LegacyCaller"] else 'nullptr'
return """
static const DOMJSClass Class = {
PROXY_CLASS_DEF("%s",
0, /* extra slots */
JSCLASS_IS_DOMJSCLASS,
nullptr, /* call */
%s,
%s, /* call */
nullptr /* construct */),
%s
};
""" % (self.descriptor.interface.identifier.name,
" | ".join(flags),
callHook,
CGIndenter(CGGeneric(DOMClass(self.descriptor))).define())
def PrototypeIDAndDepth(descriptor):

View File

@ -353,10 +353,6 @@ class Descriptor(DescriptorProvider):
raise SyntaxError("%s supports named properties but does "
"not have a named getter.\n%s" %
(self.interface, self.interface.location))
if operations['LegacyCaller']:
raise SyntaxError("%s has a legacy caller but is a proxy; "
"we don't support that yet.\n%s" %
(self.interface, self.interface.location))
iface = self.interface
while iface:
iface.setUserData('hasProxyDescendant', True)

View File

@ -967,6 +967,7 @@ public:
uint32_t Item(uint32_t&);
uint32_t Item(uint32_t, bool&) MOZ_DELETE;
uint32_t Length();
void LegacyCall(JS::Handle<JS::Value>);
};
class TestNamedGetterInterface : public nsISupports,

View File

@ -876,6 +876,7 @@ dictionary DictForConstructor {
interface TestIndexedGetterInterface {
getter long item(unsigned long idx);
readonly attribute unsigned long length;
legacycaller void();
};
interface TestNamedGetterInterface {

View File

@ -1,3 +1,5 @@
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* 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/. */
@ -225,23 +227,22 @@ class DeviceSuccessCallbackRunnable: public nsRunnable
public:
DeviceSuccessCallbackRunnable(
uint64_t aWindowID,
already_AddRefed<nsIGetUserMediaDevicesSuccessCallback> aSuccess,
already_AddRefed<nsIDOMGetUserMediaErrorCallback> aError,
nsCOMPtr<nsIGetUserMediaDevicesSuccessCallback>& aSuccess,
nsCOMPtr<nsIDOMGetUserMediaErrorCallback>& aError,
nsTArray<nsCOMPtr<nsIMediaDevice> >* aDevices)
: mSuccess(aSuccess)
, mError(aError)
, mDevices(aDevices)
: mDevices(aDevices)
, mWindowID(aWindowID)
, mManager(MediaManager::GetInstance()) {}
, mManager(MediaManager::GetInstance())
{
mSuccess.swap(aSuccess);
mError.swap(aError);
}
NS_IMETHOD
Run()
{
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
nsCOMPtr<nsIGetUserMediaDevicesSuccessCallback> success(mSuccess);
nsCOMPtr<nsIDOMGetUserMediaErrorCallback> error(mError);
// Only run if window is still on our active list.
if (!mManager->IsWindowStillActive(mWindowID)) {
return NS_OK;
@ -256,7 +257,7 @@ public:
// We should in the future return an empty array, and dynamically add
// devices to the dropdowns if things are hotplugged while the
// requester is up.
error->OnError(NS_LITERAL_STRING("NO_DEVICES_FOUND"));
mError->OnError(NS_LITERAL_STRING("NO_DEVICES_FOUND"));
return NS_OK;
}
@ -272,13 +273,13 @@ public:
static_cast<const void*>(tmp.Elements())
));
success->OnSuccess(devices);
mSuccess->OnSuccess(devices);
return NS_OK;
}
private:
already_AddRefed<nsIGetUserMediaDevicesSuccessCallback> mSuccess;
already_AddRefed<nsIDOMGetUserMediaErrorCallback> mError;
nsCOMPtr<nsIGetUserMediaDevicesSuccessCallback> mSuccess;
nsCOMPtr<nsIDOMGetUserMediaErrorCallback> mError;
nsAutoPtr<nsTArray<nsCOMPtr<nsIMediaDevice> > > mDevices;
uint64_t mWindowID;
nsRefPtr<MediaManager> mManager;
@ -1099,13 +1100,15 @@ public:
NS_DispatchToMainThread(new DeviceSuccessCallbackRunnable(mWindowId,
mSuccess, mError,
final.forget()));
// DeviceSuccessCallbackRunnable should have taken these.
MOZ_ASSERT(!mSuccess && !mError);
return NS_OK;
}
private:
MediaStreamConstraintsInternal mConstraints;
already_AddRefed<nsIGetUserMediaDevicesSuccessCallback> mSuccess;
already_AddRefed<nsIDOMGetUserMediaErrorCallback> mError;
nsCOMPtr<nsIGetUserMediaDevicesSuccessCallback> mSuccess;
nsCOMPtr<nsIDOMGetUserMediaErrorCallback> mError;
nsRefPtr<MediaManager> mManager;
uint64_t mWindowId;
const nsString mCallId;

View File

@ -2142,7 +2142,15 @@ WorkerPrivateParent<Derived>::WrapObject(JSContext* aCx,
AssertIsOnParentThread();
return WorkerBinding::Wrap(aCx, aScope, ParentAsWorkerPrivate());
// XXXkhuey this should not need to be rooted, the analysis is dumb.
// See bug 980181.
JS::Rooted<JSObject*> wrapper(aCx,
WorkerBinding::Wrap(aCx, aScope, ParentAsWorkerPrivate()));
if (wrapper) {
MOZ_ALWAYS_TRUE(TryPreserveWrapper(wrapper));
}
return wrapper;
}
template <class Derived>

View File

@ -971,15 +971,10 @@ public:
return mPermitSubpixelAA;
}
virtual GenericRefCountedBase* GetGLContext() const {
return nullptr;
}
#ifdef USE_SKIA_GPU
virtual void InitWithGLContextAndGrGLInterface(GenericRefCountedBase* aGLContext,
GrGLInterface* aGrGLInterface,
const IntSize &aSize,
SurfaceFormat aFormat)
virtual void InitWithGrContext(GrContext* aGrContext,
const IntSize &aSize,
SurfaceFormat aFormat)
{
MOZ_CRASH();
}
@ -1085,13 +1080,9 @@ public:
#ifdef USE_SKIA_GPU
static TemporaryRef<DrawTarget>
CreateDrawTargetSkiaWithGLContextAndGrGLInterface(GenericRefCountedBase* aGLContext,
GrGLInterface* aGrGLInterface,
const IntSize &aSize,
SurfaceFormat aFormat);
static void
SetGlobalSkiaCacheLimits(int aCount, int aSizeInBytes);
CreateDrawTargetSkiaWithGrContext(GrContext* aGrContext,
const IntSize &aSize,
SurfaceFormat aFormat);
#endif
static void PurgeAllCaches();

View File

@ -79,80 +79,6 @@ public:
ExtendMode mExtendMode;
};
#ifdef USE_SKIA_GPU
int DrawTargetSkia::sTextureCacheCount = 256;
int DrawTargetSkia::sTextureCacheSizeInBytes = 96*1024*1024;
static std::vector<DrawTargetSkia*>&
GLDrawTargets()
{
static std::vector<DrawTargetSkia*> targets;
return targets;
}
void
DrawTargetSkia::RebalanceCacheLimits()
{
// Divide the global cache limits equally between all currently active GL-backed
// Skia DrawTargets.
std::vector<DrawTargetSkia*>& targets = GLDrawTargets();
uint32_t targetCount = targets.size();
if (targetCount == 0)
return;
int individualCacheSize = sTextureCacheSizeInBytes / targetCount;
for (uint32_t i = 0; i < targetCount; i++) {
targets[i]->SetCacheLimits(sTextureCacheCount, individualCacheSize);
}
}
static void
AddGLDrawTarget(DrawTargetSkia* target)
{
GLDrawTargets().push_back(target);
DrawTargetSkia::RebalanceCacheLimits();
}
static void
RemoveGLDrawTarget(DrawTargetSkia* target)
{
std::vector<DrawTargetSkia*>& targets = GLDrawTargets();
std::vector<DrawTargetSkia*>::iterator it = std::find(targets.begin(), targets.end(), target);
if (it != targets.end()) {
targets.erase(it);
DrawTargetSkia::RebalanceCacheLimits();
}
}
void
DrawTargetSkia::SetGlobalCacheLimits(int aCount, int aSizeInBytes)
{
sTextureCacheCount = aCount;
sTextureCacheSizeInBytes = aSizeInBytes;
DrawTargetSkia::RebalanceCacheLimits();
}
void
DrawTargetSkia::PurgeCaches()
{
if (mGrContext) {
mGrContext->freeGpuResources();
}
}
/* static */ void
DrawTargetSkia::PurgeAllCaches()
{
std::vector<DrawTargetSkia*>& targets = GLDrawTargets();
uint32_t targetCount = targets.size();
for (uint32_t i = 0; i < targetCount; i++) {
targets[i]->PurgeCaches();
}
}
#endif
/**
* When constructing a temporary SkBitmap via GetBitmapForSurface, we may also
* have to construct a temporary DataSourceSurface, which must live as long as
@ -189,15 +115,12 @@ GetBitmapForSurface(SourceSurface* aSurface)
}
DrawTargetSkia::DrawTargetSkia()
: mSnapshot(nullptr)
: mTexture(0), mSnapshot(nullptr)
{
}
DrawTargetSkia::~DrawTargetSkia()
{
#ifdef USE_SKIA_GPU
RemoveGLDrawTarget(this);
#endif
}
TemporaryRef<SourceSurface>
@ -770,45 +693,33 @@ DrawTargetSkia::Init(const IntSize &aSize, SurfaceFormat aFormat)
#ifdef USE_SKIA_GPU
void
DrawTargetSkia::InitWithGLContextAndGrGLInterface(GenericRefCountedBase* aGLContext,
GrGLInterface* aGrGLInterface,
const IntSize &aSize,
SurfaceFormat aFormat)
DrawTargetSkia::InitWithGrContext(GrContext* aGrContext,
const IntSize &aSize,
SurfaceFormat aFormat)
{
mGLContext = aGLContext;
mGrContext = aGrContext;
mSize = aSize;
mFormat = aFormat;
mGrGLInterface = aGrGLInterface;
mGrGLInterface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(this);
GrBackendContext backendContext = reinterpret_cast<GrBackendContext>(aGrGLInterface);
SkAutoTUnref<GrContext> gr(GrContext::Create(kOpenGL_GrBackend, backendContext));
mGrContext = gr.get();
GrBackendRenderTargetDesc targetDescriptor;
GrTextureDesc targetDescriptor;
targetDescriptor.fFlags = kRenderTarget_GrTextureFlagBit;
targetDescriptor.fWidth = mSize.width;
targetDescriptor.fHeight = mSize.height;
targetDescriptor.fConfig = GfxFormatToGrConfig(mFormat);
targetDescriptor.fOrigin = kBottomLeft_GrSurfaceOrigin;
targetDescriptor.fSampleCnt = 0;
targetDescriptor.fRenderTargetHandle = 0; // GLContext always exposes the right framebuffer as id 0
SkAutoTUnref<GrRenderTarget> target(mGrContext->wrapBackendRenderTarget(targetDescriptor));
SkAutoTUnref<SkBaseDevice> device(new SkGpuDevice(mGrContext.get(), target.get()));
SkAutoTUnref<GrTexture> skiaTexture(mGrContext->createUncachedTexture(targetDescriptor, NULL, 0));
mTexture = (uint32_t)skiaTexture->getTextureHandle();
SkAutoTUnref<SkBaseDevice> device(new SkGpuDevice(mGrContext.get(), skiaTexture->asRenderTarget()));
SkAutoTUnref<SkCanvas> canvas(new SkCanvas(device.get()));
mCanvas = canvas.get();
AddGLDrawTarget(this);
}
void
DrawTargetSkia::SetCacheLimits(int aCount, int aSizeInBytes)
{
MOZ_ASSERT(mGrContext, "No GrContext!");
mGrContext->setTextureCacheLimits(aCount, aSizeInBytes);
}
#endif
void
@ -840,6 +751,17 @@ DrawTargetSkia::SetTransform(const Matrix& aTransform)
mTransform = aTransform;
}
void*
DrawTargetSkia::GetNativeSurface(NativeSurfaceType aType)
{
if (aType == NativeSurfaceType::OPENGL_TEXTURE) {
return (void*)((uintptr_t)mTexture);
}
return nullptr;
}
TemporaryRef<PathBuilder>
DrawTargetSkia::CreatePathBuilder(FillRule aFillRule) const
{

View File

@ -100,23 +100,15 @@ public:
virtual TemporaryRef<GradientStops> CreateGradientStops(GradientStop *aStops, uint32_t aNumStops, ExtendMode aExtendMode = ExtendMode::CLAMP) const;
virtual TemporaryRef<FilterNode> CreateFilter(FilterType aType);
virtual void SetTransform(const Matrix &aTransform);
virtual void *GetNativeSurface(NativeSurfaceType aType);
bool Init(const IntSize &aSize, SurfaceFormat aFormat);
void Init(unsigned char* aData, const IntSize &aSize, int32_t aStride, SurfaceFormat aFormat);
#ifdef USE_SKIA_GPU
virtual GenericRefCountedBase* GetGLContext() const MOZ_OVERRIDE { return mGLContext; }
void InitWithGLContextAndGrGLInterface(GenericRefCountedBase* aGLContext,
GrGLInterface* aGrGLInterface,
const IntSize &aSize,
SurfaceFormat aFormat) MOZ_OVERRIDE;
void SetCacheLimits(int aCount, int aSizeInBytes);
void PurgeCaches();
static void SetGlobalCacheLimits(int aCount, int aSizeInBytes);
static void RebalanceCacheLimits();
static void PurgeAllCaches();
void InitWithGrContext(GrContext* aGrContext,
const IntSize &aSize,
SurfaceFormat aFormat) MOZ_OVERRIDE;
#endif
operator std::string() const {
@ -134,18 +126,8 @@ private:
SkRect SkRectCoveringWholeSurface() const;
#ifdef USE_SKIA_GPU
/*
* These members have inter-dependencies, but do not keep each other alive, so
* destruction order is very important here: mGrContext uses mGrGLInterface, and
* through it, uses mGLContext, so it is important that they be declared in the
* present order.
*/
RefPtr<GenericRefCountedBase> mGLContext;
SkRefPtr<GrGLInterface> mGrGLInterface;
SkRefPtr<GrContext> mGrContext;
static int sTextureCacheCount;
static int sTextureCacheSizeInBytes;
uint32_t mTexture;
#endif
IntSize mSize;

View File

@ -586,30 +586,21 @@ Factory::D2DCleanup()
#ifdef USE_SKIA_GPU
TemporaryRef<DrawTarget>
Factory::CreateDrawTargetSkiaWithGLContextAndGrGLInterface(GenericRefCountedBase* aGLContext,
GrGLInterface* aGrGLInterface,
const IntSize &aSize,
SurfaceFormat aFormat)
Factory::CreateDrawTargetSkiaWithGrContext(GrContext* aGrContext,
const IntSize &aSize,
SurfaceFormat aFormat)
{
DrawTargetSkia* newDrawTargetSkia = new DrawTargetSkia();
newDrawTargetSkia->InitWithGLContextAndGrGLInterface(aGLContext, aGrGLInterface, aSize, aFormat);
newDrawTargetSkia->InitWithGrContext(aGrContext, aSize, aFormat);
RefPtr<DrawTarget> newTarget = newDrawTargetSkia;
return newTarget;
}
void
Factory::SetGlobalSkiaCacheLimits(int aCount, int aSizeInBytes)
{
DrawTargetSkia::SetGlobalCacheLimits(aCount, aSizeInBytes);
}
#endif // USE_SKIA_GPU
void
Factory::PurgeAllCaches()
{
#ifdef USE_SKIA_GPU
DrawTargetSkia::PurgeAllCaches();
#endif
}
#ifdef USE_SKIA_FREETYPE

View File

@ -96,7 +96,8 @@ MOZ_BEGIN_ENUM_CLASS(NativeSurfaceType, int8_t)
CAIRO_SURFACE,
CAIRO_CONTEXT,
CGCONTEXT,
CGCONTEXT_ACCELERATED
CGCONTEXT_ACCELERATED,
OPENGL_TEXTURE
MOZ_END_ENUM_CLASS(NativeSurfaceType)
MOZ_BEGIN_ENUM_CLASS(NativeFontType, int8_t)

View File

@ -628,6 +628,12 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
MarkUnsupported(GLFeature::standard_derivatives);
}
if (Vendor() == GLVendor::Imagination &&
Renderer() == GLRenderer::SGX540) {
// Bug 980048
MarkExtensionUnsupported(OES_EGL_sync);
}
#ifdef XP_MACOSX
// The Mac Nvidia driver, for versions up to and including 10.8, don't seem
// to properly support this. See 814839

View File

@ -1938,39 +1938,39 @@ public:
private:
GLuint GLAPIENTRY raw_fCreateProgram() {
GLuint raw_fCreateProgram() {
BEFORE_GL_CALL;
GLuint ret = mSymbols.fCreateProgram();
AFTER_GL_CALL;
return ret;
}
GLuint GLAPIENTRY raw_fCreateShader(GLenum t) {
GLuint raw_fCreateShader(GLenum t) {
BEFORE_GL_CALL;
GLuint ret = mSymbols.fCreateShader(t);
AFTER_GL_CALL;
return ret;
}
void GLAPIENTRY raw_fGenBuffers(GLsizei n, GLuint* names) {
void raw_fGenBuffers(GLsizei n, GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fGenBuffers(n, names);
AFTER_GL_CALL;
}
void GLAPIENTRY raw_fGenFramebuffers(GLsizei n, GLuint* names) {
void raw_fGenFramebuffers(GLsizei n, GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fGenFramebuffers(n, names);
AFTER_GL_CALL;
}
void GLAPIENTRY raw_fGenRenderbuffers(GLsizei n, GLuint* names) {
void raw_fGenRenderbuffers(GLsizei n, GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fGenRenderbuffers(n, names);
AFTER_GL_CALL;
}
void GLAPIENTRY raw_fGenTextures(GLsizei n, GLuint* names) {
void raw_fGenTextures(GLsizei n, GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fGenTextures(n, names);
AFTER_GL_CALL;
@ -2010,37 +2010,37 @@ public:
}
private:
void GLAPIENTRY raw_fDeleteProgram(GLuint program) {
void raw_fDeleteProgram(GLuint program) {
BEFORE_GL_CALL;
mSymbols.fDeleteProgram(program);
AFTER_GL_CALL;
}
void GLAPIENTRY raw_fDeleteShader(GLuint shader) {
void raw_fDeleteShader(GLuint shader) {
BEFORE_GL_CALL;
mSymbols.fDeleteShader(shader);
AFTER_GL_CALL;
}
void GLAPIENTRY raw_fDeleteBuffers(GLsizei n, const GLuint* names) {
void raw_fDeleteBuffers(GLsizei n, const GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fDeleteBuffers(n, names);
AFTER_GL_CALL;
}
void GLAPIENTRY raw_fDeleteFramebuffers(GLsizei n, const GLuint* names) {
void raw_fDeleteFramebuffers(GLsizei n, const GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fDeleteFramebuffers(n, names);
AFTER_GL_CALL;
}
void GLAPIENTRY raw_fDeleteRenderbuffers(GLsizei n, const GLuint* names) {
void raw_fDeleteRenderbuffers(GLsizei n, const GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fDeleteRenderbuffers(n, names);
AFTER_GL_CALL;
}
void GLAPIENTRY raw_fDeleteTextures(GLsizei n, const GLuint* names) {
void raw_fDeleteTextures(GLsizei n, const GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fDeleteTextures(n, names);
AFTER_GL_CALL;
@ -2090,7 +2090,7 @@ public:
TRACKING_CONTEXT(DeletedTextures(this, n, names));
}
GLenum GLAPIENTRY fGetGraphicsResetStatus() {
GLenum fGetGraphicsResetStatus() {
MOZ_ASSERT(mHasRobustness);
BEFORE_GL_CALL;
@ -2104,7 +2104,7 @@ public:
// -----------------------------------------------------------------------------
// Extension ARB_sync (GL)
public:
GLsync GLAPIENTRY fFenceSync(GLenum condition, GLbitfield flags) {
GLsync fFenceSync(GLenum condition, GLbitfield flags) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fFenceSync);
GLsync ret = mSymbols.fFenceSync(condition, flags);
@ -2112,7 +2112,7 @@ public:
return ret;
}
realGLboolean GLAPIENTRY fIsSync(GLsync sync) {
realGLboolean fIsSync(GLsync sync) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fIsSync);
realGLboolean ret = mSymbols.fIsSync(sync);
@ -2120,14 +2120,14 @@ public:
return ret;
}
void GLAPIENTRY fDeleteSync(GLsync sync) {
void fDeleteSync(GLsync sync) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fDeleteSync);
mSymbols.fDeleteSync(sync);
AFTER_GL_CALL;
}
GLenum GLAPIENTRY fClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) {
GLenum fClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fClientWaitSync);
GLenum ret = mSymbols.fClientWaitSync(sync, flags, timeout);
@ -2135,21 +2135,21 @@ public:
return ret;
}
void GLAPIENTRY fWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) {
void fWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fWaitSync);
mSymbols.fWaitSync(sync, flags, timeout);
AFTER_GL_CALL;
}
void GLAPIENTRY fGetInteger64v(GLenum pname, GLint64 *params) {
void fGetInteger64v(GLenum pname, GLint64 *params) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fGetInteger64v);
mSymbols.fGetInteger64v(pname, params);
AFTER_GL_CALL;
}
void GLAPIENTRY fGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values) {
void fGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fGetSynciv);
mSymbols.fGetSynciv(sync, pname, bufSize, length, values);
@ -2404,7 +2404,7 @@ public:
// -----------------------------------------------------------------------------
// Package XXX_vertex_array_object
public:
void GLAPIENTRY fBindVertexArray(GLuint array)
void fBindVertexArray(GLuint array)
{
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fBindVertexArray);
@ -2412,7 +2412,7 @@ public:
AFTER_GL_CALL;
}
void GLAPIENTRY fDeleteVertexArrays(GLsizei n, const GLuint *arrays)
void fDeleteVertexArrays(GLsizei n, const GLuint *arrays)
{
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fDeleteVertexArrays);
@ -2420,7 +2420,7 @@ public:
AFTER_GL_CALL;
}
void GLAPIENTRY fGenVertexArrays(GLsizei n, GLuint *arrays)
void fGenVertexArrays(GLsizei n, GLuint *arrays)
{
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fGenVertexArrays);
@ -2428,7 +2428,7 @@ public:
AFTER_GL_CALL;
}
realGLboolean GLAPIENTRY fIsVertexArray(GLuint array)
realGLboolean fIsVertexArray(GLuint array)
{
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fIsVertexArray);

View File

@ -1,8 +0,0 @@
/* -*- Mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40; -*- */
/* 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 "skia/GrGLInterface.h"
GrGLInterface* CreateGrGLInterfaceFromGLContext(mozilla::gl::GLContext* context);

View File

@ -43,6 +43,7 @@ GLScreenBuffer::Create(GLContext* gl,
#ifdef MOZ_WIDGET_GONK
/* On B2G, we want a Gralloc factory, and we want one right at the start */
if (!factory &&
caps.surfaceAllocator &&
XRE_GetProcessType() != GeckoProcessType_Default)
{
factory = new SurfaceFactory_Gralloc(gl, caps);
@ -70,7 +71,6 @@ GLScreenBuffer::Create(GLContext* gl,
GLScreenBuffer::~GLScreenBuffer()
{
delete mStream;
delete mDraw;
delete mRead;
@ -378,7 +378,6 @@ GLScreenBuffer::Morph(SurfaceFactory_GL* newFactory, SurfaceStreamType streamTyp
SurfaceStream* newStream = SurfaceStream::CreateForType(streamType, mGL, mStream);
MOZ_ASSERT(newStream);
delete mStream;
mStream = newStream;
}

View File

@ -16,6 +16,7 @@
#define SCREEN_BUFFER_H_
#include "SurfaceTypes.h"
#include "SurfaceStream.h"
#include "GLContextTypes.h"
#include "GLDefs.h"
#include "mozilla/gfx/2D.h"
@ -156,7 +157,7 @@ protected:
GLContext* const mGL; // Owns us.
SurfaceCaps mCaps;
SurfaceFactory_GL* mFactory; // Owned by us.
SurfaceStream* mStream; // Owned by us.
RefPtr<SurfaceStream> mStream;
DrawBuffer* mDraw; // Owned by us.
ReadBuffer* mRead; // Owned by us.

View File

@ -124,6 +124,7 @@ ScopedBindTexture::Init(GLenum aTarget)
GLenum bindingTarget = (aTarget == LOCAL_GL_TEXTURE_2D) ? LOCAL_GL_TEXTURE_BINDING_2D
: (aTarget == LOCAL_GL_TEXTURE_RECTANGLE_ARB) ? LOCAL_GL_TEXTURE_BINDING_RECTANGLE_ARB
: (aTarget == LOCAL_GL_TEXTURE_CUBE_MAP) ? LOCAL_GL_TEXTURE_BINDING_CUBE_MAP
: (aTarget == LOCAL_GL_TEXTURE_EXTERNAL) ? LOCAL_GL_TEXTURE_EXTERNAL
: LOCAL_GL_NONE;
MOZ_ASSERT(bindingTarget != LOCAL_GL_NONE);
mGL->GetUIntegerv(bindingTarget, &mOldTex);

View File

@ -27,18 +27,30 @@ SharedSurface_EGLImage::Create(GLContext* prodGL,
{
GLLibraryEGL* egl = &sEGLLibrary;
MOZ_ASSERT(egl);
MOZ_ASSERT(context);
if (!HasExtensions(egl, prodGL))
if (!HasExtensions(egl, prodGL)) {
return nullptr;
}
MOZ_ALWAYS_TRUE(prodGL->MakeCurrent());
GLuint prodTex = CreateTextureForOffscreen(prodGL, formats, size);
if (!prodTex)
if (!prodTex) {
return nullptr;
}
EGLClientBuffer buffer = reinterpret_cast<EGLClientBuffer>(prodTex);
EGLImage image = egl->fCreateImage(egl->Display(), context,
LOCAL_EGL_GL_TEXTURE_2D, buffer,
nullptr);
if (!image) {
prodGL->fDeleteTextures(1, &prodTex);
return nullptr;
}
return new SharedSurface_EGLImage(prodGL, egl,
size, hasAlpha,
formats, prodTex);
formats, prodTex, image);
}
@ -47,7 +59,7 @@ SharedSurface_EGLImage::HasExtensions(GLLibraryEGL* egl, GLContext* gl)
{
return egl->HasKHRImageBase() &&
egl->IsExtensionSupported(GLLibraryEGL::KHR_gl_texture_2D_image) &&
gl->IsExtensionSupported(GLContext::OES_EGL_image);
gl->IsExtensionSupported(GLContext::OES_EGL_image_external);
}
SharedSurface_EGLImage::SharedSurface_EGLImage(GLContext* gl,
@ -55,7 +67,8 @@ SharedSurface_EGLImage::SharedSurface_EGLImage(GLContext* gl,
const gfx::IntSize& size,
bool hasAlpha,
const GLFormats& formats,
GLuint prodTex)
GLuint prodTex,
EGLImage image)
: SharedSurface_GL(SharedSurfaceType::EGLImageShare,
AttachmentType::GLTexture,
gl,
@ -65,14 +78,10 @@ SharedSurface_EGLImage::SharedSurface_EGLImage(GLContext* gl,
, mEGL(egl)
, mFormats(formats)
, mProdTex(prodTex)
, mProdTexForPipe(0)
, mImage(0)
, mImage(image)
, mCurConsGL(nullptr)
, mConsTex(0)
, mSync(0)
, mPipeFailed(false)
, mPipeComplete(false)
, mPipeActive(false)
{}
SharedSurface_EGLImage::~SharedSurface_EGLImage()
@ -84,11 +93,6 @@ SharedSurface_EGLImage::~SharedSurface_EGLImage()
mGL->fDeleteTextures(1, &mProdTex);
mProdTex = 0;
if (mProdTexForPipe) {
mGL->fDeleteTextures(1, &mProdTexForPipe);
mProdTexForPipe = 0;
}
if (mConsTex) {
MOZ_ASSERT(mGarbageBin);
mGarbageBin->Trash(mConsTex);
@ -103,94 +107,12 @@ SharedSurface_EGLImage::~SharedSurface_EGLImage()
}
}
void
SharedSurface_EGLImage::LockProdImpl()
{
MutexAutoLock lock(mMutex);
if (!mPipeComplete)
return;
if (mPipeActive)
return;
mGL->BlitHelper()->BlitTextureToTexture(mProdTex, mProdTexForPipe, Size(), Size());
mGL->fDeleteTextures(1, &mProdTex);
mProdTex = mProdTexForPipe;
mProdTexForPipe = 0;
mPipeActive = true;
}
static bool
CreateTexturePipe(GLLibraryEGL* const egl, GLContext* const gl,
const GLFormats& formats, const gfx::IntSize& size,
GLuint* const out_tex, EGLImage* const out_image)
{
MOZ_ASSERT(out_tex && out_image);
*out_tex = 0;
*out_image = 0;
GLuint tex = CreateTextureForOffscreen(gl, formats, size);
if (!tex)
return false;
EGLContext context = GLContextEGL::Cast(gl)->GetEGLContext();
MOZ_ASSERT(context);
EGLClientBuffer buffer = reinterpret_cast<EGLClientBuffer>(tex);
EGLImage image = egl->fCreateImage(egl->Display(), context,
LOCAL_EGL_GL_TEXTURE_2D, buffer,
nullptr);
if (!image) {
gl->fDeleteTextures(1, &tex);
return false;
}
// Success.
*out_tex = tex;
*out_image = image;
return true;
}
void
SharedSurface_EGLImage::Fence()
{
MutexAutoLock lock(mMutex);
mGL->MakeCurrent();
if (!mPipeActive) {
MOZ_ASSERT(!mSync);
MOZ_ASSERT(!mPipeComplete);
if (!mPipeFailed) {
if (!CreateTexturePipe(mEGL, mGL, mFormats, Size(),
&mProdTexForPipe, &mImage))
{
mPipeFailed = true;
}
}
if (!mPixels) {
SurfaceFormat format =
HasAlpha() ? SurfaceFormat::B8G8R8A8
: SurfaceFormat::B8G8R8X8;
mPixels = Factory::CreateDataSourceSurface(Size(), format);
}
DataSourceSurface::MappedSurface map;
mPixels->Map(DataSourceSurface::MapType::WRITE, &map);
nsRefPtr<gfxImageSurface> wrappedData =
new gfxImageSurface(map.mData,
ThebesIntSize(mPixels->GetSize()),
map.mStride,
SurfaceFormatToImageFormat(mPixels->GetFormat()));
ReadScreenIntoImageSurface(mGL, wrappedData);
mPixels->Unmap();
return;
}
MOZ_ASSERT(mPipeActive);
MOZ_ASSERT(mCurConsGL);
if (mEGL->IsExtensionSupported(GLLibraryEGL::KHR_fence_sync) &&
mGL->IsExtensionSupported(GLContext::OES_EGL_sync))
{
@ -249,42 +171,28 @@ SharedSurface_EGLImage::Display() const
return mEGL->Display();
}
GLuint
SharedSurface_EGLImage::AcquireConsumerTexture(GLContext* consGL)
void
SharedSurface_EGLImage::AcquireConsumerTexture(GLContext* consGL, GLuint* out_texture, GLuint* out_target)
{
MutexAutoLock lock(mMutex);
MOZ_ASSERT(!mCurConsGL || consGL == mCurConsGL);
if (mPipeFailed)
return 0;
if (mPipeActive) {
MOZ_ASSERT(mConsTex);
return mConsTex;
}
if (!mConsTex) {
consGL->fGenTextures(1, &mConsTex);
ScopedBindTexture autoTex(consGL, mConsTex);
consGL->fEGLImageTargetTexture2D(LOCAL_GL_TEXTURE_2D, mImage);
MOZ_ASSERT(mConsTex);
ScopedBindTexture autoTex(consGL, mConsTex, LOCAL_GL_TEXTURE_EXTERNAL);
consGL->fEGLImageTargetTexture2D(LOCAL_GL_TEXTURE_EXTERNAL, mImage);
mPipeComplete = true;
mCurConsGL = consGL;
mGarbageBin = consGL->TexGarbageBin();
}
MOZ_ASSERT(consGL == mCurConsGL);
return 0;
*out_texture = mConsTex;
*out_target = LOCAL_GL_TEXTURE_EXTERNAL;
}
DataSourceSurface*
SharedSurface_EGLImage::GetPixels() const
{
MutexAutoLock lock(mMutex);
return mPixels;
}
SurfaceFactory_EGLImage*
SurfaceFactory_EGLImage::Create(GLContext* prodGL,
@ -292,6 +200,11 @@ SurfaceFactory_EGLImage::Create(GLContext* prodGL,
{
EGLContext context = GLContextEGL::Cast(prodGL)->GetEGLContext();
GLLibraryEGL* egl = &sEGLLibrary;
if (!SharedSurface_EGLImage::HasExtensions(egl, prodGL)) {
return nullptr;
}
return new SurfaceFactory_EGLImage(prodGL, context, caps);
}

View File

@ -35,37 +35,34 @@ public:
return (SharedSurface_EGLImage*)surf;
}
static bool HasExtensions(GLLibraryEGL* egl, GLContext* gl);
protected:
mutable Mutex mMutex;
GLLibraryEGL* const mEGL;
const GLFormats mFormats;
GLuint mProdTex;
RefPtr<gfx::DataSourceSurface> mPixels;
GLuint mProdTexForPipe; // Moves to mProdTex when mPipeActive becomes true.
EGLImage mImage;
GLContext* mCurConsGL;
GLuint mConsTex;
nsRefPtr<TextureGarbageBin> mGarbageBin;
EGLSync mSync;
bool mPipeFailed; // Pipe creation failed, and has been abandoned.
bool mPipeComplete; // Pipe connects (mPipeActive ? mProdTex : mProdTexForPipe) to mConsTex.
bool mPipeActive; // Pipe is complete and in use for production.
SharedSurface_EGLImage(GLContext* gl,
GLLibraryEGL* egl,
const gfx::IntSize& size,
bool hasAlpha,
const GLFormats& formats,
GLuint prodTex);
GLuint prodTex,
EGLImage image);
EGLDisplay Display() const;
static bool HasExtensions(GLLibraryEGL* egl, GLContext* gl);
public:
virtual ~SharedSurface_EGLImage();
virtual void LockProdImpl();
virtual void LockProdImpl() {}
virtual void UnlockProdImpl() {}
@ -78,11 +75,8 @@ public:
}
// Implementation-specific functions below:
// Returns 0 if the pipe isn't ready. If 0, use GetPixels below.
GLuint AcquireConsumerTexture(GLContext* consGL);
// Will be void if AcquireConsumerTexture returns non-zero.
gfx::DataSourceSurface* GetPixels() const;
// Returns texture and target
void AcquireConsumerTexture(GLContext* consGL, GLuint* out_texture, GLuint* out_target);
};
@ -91,7 +85,7 @@ class SurfaceFactory_EGLImage
: public SurfaceFactory_GL
{
public:
// Infallible:
// Fallible:
static SurfaceFactory_EGLImage* Create(GLContext* prodGL,
const SurfaceCaps& caps);

View File

@ -283,8 +283,24 @@ SharedSurface_Basic::SharedSurface_Basic(GLContext* gl,
gl,
size,
hasAlpha)
, mTex(tex)
, mTex(tex), mFB(0)
{
mGL->MakeCurrent();
mGL->fGenFramebuffers(1, &mFB);
ScopedBindFramebuffer autoFB(mGL, mFB);
mGL->fFramebufferTexture2D(LOCAL_GL_FRAMEBUFFER,
LOCAL_GL_COLOR_ATTACHMENT0,
LOCAL_GL_TEXTURE_2D,
mTex,
0);
GLenum status = mGL->fCheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER);
if (status != LOCAL_GL_FRAMEBUFFER_COMPLETE) {
mGL->fDeleteFramebuffers(1, &mFB);
mFB = 0;
}
mData = Factory::CreateDataSourceSurfaceWithStride(size, format,
GetAlignedStride<4>(size.width * BytesPerPixel(format)));
}
@ -294,16 +310,19 @@ SharedSurface_Basic::~SharedSurface_Basic()
if (!mGL->MakeCurrent())
return;
if (mFB)
mGL->fDeleteFramebuffers(1, &mFB);
mGL->fDeleteTextures(1, &mTex);
}
void
SharedSurface_Basic::Fence()
{
MOZ_ASSERT(mData->GetSize() == mGL->OffscreenSize());
mGL->MakeCurrent();
ScopedBindFramebuffer autoFB(mGL, mFB);
DataSourceSurface::MappedSurface map;
mData->Map(DataSourceSurface::MapType::WRITE, &map);
nsRefPtr<gfxImageSurface> wrappedData =
@ -311,7 +330,7 @@ SharedSurface_Basic::Fence()
ThebesIntSize(mData->GetSize()),
map.mStride,
SurfaceFormatToImageFormat(mData->GetFormat()));
ReadScreenIntoImageSurface(mGL, wrappedData);
ReadPixelsIntoImageSurface(mGL, wrappedData);
mData->Unmap();
}
@ -322,15 +341,24 @@ SharedSurface_GLTexture::Create(GLContext* prodGL,
GLContext* consGL,
const GLFormats& formats,
const gfx::IntSize& size,
bool hasAlpha)
bool hasAlpha,
GLuint texture)
{
MOZ_ASSERT(prodGL);
MOZ_ASSERT(!consGL || prodGL->SharesWith(consGL));
prodGL->MakeCurrent();
GLuint tex = CreateTextureForOffscreen(prodGL, formats, size);
return new SharedSurface_GLTexture(prodGL, consGL, size, hasAlpha, tex);
GLuint tex = texture;
bool ownsTex = false;
if (!tex) {
tex = CreateTextureForOffscreen(prodGL, formats, size);
ownsTex = true;
}
return new SharedSurface_GLTexture(prodGL, consGL, size, hasAlpha, tex, ownsTex);
}
SharedSurface_GLTexture::~SharedSurface_GLTexture()
@ -338,7 +366,9 @@ SharedSurface_GLTexture::~SharedSurface_GLTexture()
if (!mGL->MakeCurrent())
return;
mGL->fDeleteTextures(1, &mTex);
if (mOwnsTex) {
mGL->fDeleteTextures(1, &mTex);
}
if (mSync) {
mGL->fDeleteSync(mSync);

View File

@ -6,6 +6,7 @@
#ifndef SHARED_SURFACE_GL_H_
#define SHARED_SURFACE_GL_H_
#include "ScopedGLHelpers.h"
#include "SharedSurface.h"
#include "SurfaceFactory.h"
#include "SurfaceTypes.h"
@ -135,6 +136,8 @@ public:
protected:
const GLuint mTex;
GLuint mFB;
RefPtr<gfx::DataSourceSurface> mData;
SharedSurface_Basic(GLContext* gl,
@ -192,7 +195,8 @@ public:
GLContext* consGL,
const GLFormats& formats,
const gfx::IntSize& size,
bool hasAlpha);
bool hasAlpha,
GLuint texture = 0);
static SharedSurface_GLTexture* Cast(SharedSurface* surf) {
MOZ_ASSERT(surf->Type() == SharedSurfaceType::GLTextureShare);
@ -203,6 +207,7 @@ public:
protected:
GLContext* mConsGL;
const GLuint mTex;
const bool mOwnsTex;
GLsync mSync;
mutable Mutex mMutex;
@ -210,7 +215,8 @@ protected:
GLContext* consGL,
const gfx::IntSize& size,
bool hasAlpha,
GLuint tex)
GLuint tex,
bool ownsTex)
: SharedSurface_GL(SharedSurfaceType::GLTextureShare,
AttachmentType::GLTexture,
prodGL,
@ -218,6 +224,7 @@ protected:
hasAlpha)
, mConsGL(consGL)
, mTex(tex)
, mOwnsTex(ownsTex)
, mSync(0)
, mMutex("SharedSurface_GLTexture mutex")
{

View File

@ -3,6 +3,7 @@
* 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 "skia/GrContext.h"
#include "skia/GrGLInterface.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/ThreadLocal.h"
@ -16,9 +17,11 @@
#endif
#include "GLContext.h"
#include "SkiaGLGlue.h"
using mozilla::gl::GLContext;
using mozilla::gl::GLFeature;
using mozilla::gl::SkiaGLGlue;
using mozilla::gfx::DrawTarget;
static mozilla::ThreadLocal<GLContext*> sGLContext;
@ -27,8 +30,8 @@ extern "C" {
void EnsureGLContext(const GrGLInterface* i)
{
const DrawTarget* drawTarget = reinterpret_cast<const DrawTarget*>(i->fCallbackData);
GLContext* gl = static_cast<GLContext*>(drawTarget->GetGLContext());
const SkiaGLGlue* contextSkia = reinterpret_cast<const SkiaGLGlue*>(i->fCallbackData);
GLContext* gl = contextSkia->GetGLContext();
gl->MakeCurrent();
if (!sGLContext.initialized()) {
@ -775,7 +778,7 @@ GrGLvoid glVertexPointer_mozilla(GrGLint size, GrGLenum type, GrGLsizei stride,
} // extern "C"
GrGLInterface* CreateGrGLInterfaceFromGLContext(GLContext* context)
static GrGLInterface* CreateGrGLInterfaceFromGLContext(GLContext* context)
{
GrGLInterface* i = new GrGLInterface();
i->fCallback = EnsureGLContext;
@ -934,3 +937,14 @@ GrGLInterface* CreateGrGLInterfaceFromGLContext(GLContext* context)
return i;
}
SkiaGLGlue::SkiaGLGlue(GLContext* context)
: mGLContext(context)
{
SkAutoTUnref<GrGLInterface> i(CreateGrGLInterfaceFromGLContext(mGLContext));
i->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(this);
mGrGLInterface = i;
SkAutoTUnref<GrContext> gr(GrContext::Create(kOpenGL_GrBackend, (GrBackendContext)mGrGLInterface.get()));
mGrContext = gr;
}

64
gfx/gl/SkiaGLGlue.h Executable file
View File

@ -0,0 +1,64 @@
/* -*- Mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40; -*- */
/* 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 "mozilla/RefPtr.h"
#ifdef USE_SKIA_GPU
#include "GLContext.h"
#include "skia/GrGLInterface.h"
#include "skia/GrContext.h"
namespace mozilla {
namespace gl {
class SkiaGLGlue : public GenericAtomicRefCounted
{
public:
SkiaGLGlue(GLContext* context);
GLContext* GetGLContext() const { return mGLContext.get(); }
GrContext* GetGrContext() const { return mGrContext.get(); }
protected:
virtual ~SkiaGLGlue() {
/*
* These members have inter-dependencies, but do not keep each other alive, so
* destruction order is very important here: mGrContext uses mGrGLInterface, and
* through it, uses mGLContext
*/
mGrContext = nullptr;
mGrGLInterface = nullptr;
mGLContext = nullptr;
}
private:
RefPtr<GLContext> mGLContext;
SkRefPtr<GrGLInterface> mGrGLInterface;
SkRefPtr<GrContext> mGrContext;
};
}
}
#else
class GrContext;
namespace mozilla {
namespace gl {
class GLContext;
class SkiaGLGlue : public GenericAtomicRefCounted
{
public:
SkiaGLGlue(GLContext* context);
GLContext* GetGLContext() const { return nullptr; }
GrContext* GetGrContext() const { return nullptr; }
};
}
}
#endif

View File

@ -7,6 +7,7 @@
#include "gfxPoint.h"
#include "SharedSurface.h"
#include "SharedSurfaceGL.h"
#include "SurfaceFactory.h"
#include "GeckoProfiler.h"
@ -53,6 +54,22 @@ SurfaceStream::CreateForType(SurfaceStreamType type, mozilla::gl::GLContext* glC
return result;
}
bool
SurfaceStream_TripleBuffer::CopySurfaceToProducer(SharedSurface* src, SurfaceFactory* factory)
{
if (!mProducer) {
New(factory, src->Size(), mProducer);
if (!mProducer) {
return false;
}
}
MOZ_ASSERT(src->Size() == mProducer->Size(), "Size mismatch");
SharedSurface::Copy(src, mProducer, factory);
return true;
}
void
SurfaceStream::New(SurfaceFactory* factory, const gfx::IntSize& size,
SharedSurface*& surf)

View File

@ -11,6 +11,7 @@
#include "mozilla/Monitor.h"
#include "mozilla/Attributes.h"
#include "mozilla/gfx/Point.h"
#include "mozilla/GenericRefCounted.h"
#include "SurfaceTypes.h"
namespace mozilla {
@ -24,7 +25,7 @@ class SharedSurface;
class SurfaceFactory;
// Owned by: ScreenBuffer
class SurfaceStream
class SurfaceStream : public GenericAtomicRefCounted
{
public:
typedef enum {
@ -50,6 +51,8 @@ public:
const SurfaceStreamType mType;
mozilla::gl::GLContext* GLContext() const { return mGLContext; }
protected:
// |mProd| is owned by us, but can be ripped away when
// creating a new GLStream from this one.
@ -121,6 +124,8 @@ public:
virtual SharedSurface* Resize(SurfaceFactory* factory, const gfx::IntSize& size);
virtual bool CopySurfaceToProducer(SharedSurface* src, SurfaceFactory* factory) { MOZ_ASSERT(0); return false; }
protected:
// SwapCons will return the same surface more than once,
// if nothing new has been published.
@ -189,6 +194,7 @@ protected:
public:
SurfaceStream_TripleBuffer(SurfaceStream* prevStream);
virtual ~SurfaceStream_TripleBuffer();
virtual bool CopySurfaceToProducer(SharedSurface* src, SurfaceFactory* factory);
private:
// Common constructor code.

View File

@ -75,9 +75,9 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
'SharedSurfaceANGLE.cpp',
]
if CONFIG['MOZ_ENABLE_SKIA_GPU']:
EXPORTS += ['GLContextSkia.h']
EXPORTS += ['SkiaGLGlue.h']
UNIFIED_SOURCES += [
'GLContextSkia.cpp',
'SkiaGLGlue.cpp',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':

View File

@ -32,6 +32,7 @@ namespace layers {
CopyableCanvasLayer::CopyableCanvasLayer(LayerManager* aLayerManager, void *aImplData) :
CanvasLayer(aLayerManager, aImplData)
, mStream(nullptr)
{
MOZ_COUNT_CTOR(CopyableCanvasLayer);
}
@ -48,6 +49,7 @@ CopyableCanvasLayer::Initialize(const Data& aData)
if (aData.mGLContext) {
mGLContext = aData.mGLContext;
mStream = aData.mStream;
mIsGLAlphaPremult = aData.mIsGLAlphaPremult;
mNeedsYFlip = true;
MOZ_ASSERT(mGLContext->IsOffscreen(), "canvas gl context isn't offscreen");
@ -70,7 +72,7 @@ CopyableCanvasLayer::Initialize(const Data& aData)
bool
CopyableCanvasLayer::IsDataValid(const Data& aData)
{
return mGLContext == aData.mGLContext;
return mGLContext == aData.mGLContext && mStream == aData.mStream;
}
void

View File

@ -22,6 +22,13 @@
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
namespace mozilla {
namespace gfx {
class SurfaceStream;
class SharedSurface;
class SurfaceFactory;
}
namespace layers {
class CanvasClientWebGL;
@ -54,6 +61,8 @@ protected:
nsRefPtr<mozilla::gl::GLContext> mGLContext;
mozilla::RefPtr<mozilla::gfx::DrawTarget> mDrawTarget;
RefPtr<gfx::SurfaceStream> mStream;
uint32_t mCanvasFramebuffer;
bool mIsGLAlphaPremult;

View File

@ -63,6 +63,7 @@ class GLContext;
namespace gfx {
class DrawTarget;
class SurfaceStream;
}
namespace css {
@ -595,12 +596,19 @@ public:
bool IsInTransaction() const { return mInTransaction; }
virtual void AddRegionToClear(const nsIntRegion& aRegion)
{
mRegionToClear.Or(mRegionToClear, aRegion);
}
protected:
nsRefPtr<Layer> mRoot;
gfx::UserData mUserData;
bool mDestroyed;
bool mSnapEffectiveTransforms;
nsIntRegion mRegionToClear;
// Print interesting information about this into aTo. Internally
// used to implement Dump*() and Log*().
virtual nsACString& PrintInfo(nsACString& aTo, const char* aPrefix);
@ -1334,6 +1342,7 @@ public:
virtual LayerRenderState GetRenderState() { return LayerRenderState(); }
void Mutated()
{
mManager->Mutated(this);
@ -1796,6 +1805,8 @@ public:
Data()
: mDrawTarget(nullptr)
, mGLContext(nullptr)
, mStream(nullptr)
, mTexID(0)
, mSize(0,0)
, mIsGLAlphaPremult(false)
{ }
@ -1804,6 +1815,12 @@ public:
mozilla::gfx::DrawTarget *mDrawTarget; // a DrawTarget for the canvas contents
mozilla::gl::GLContext* mGLContext; // or this, for GL.
// Canvas/SkiaGL uses this
mozilla::gfx::SurfaceStream* mStream;
// ID of the texture backing the canvas layer (defaults to 0)
uint32_t mTexID;
// The size of the canvas content
nsIntSize mSize;

View File

@ -625,6 +625,16 @@ BasicLayerManager::EndTransactionInternal(DrawThebesLayerCallback aCallback,
}
PaintLayer(mTarget, mRoot, aCallback, aCallbackData, nullptr);
if (!mRegionToClear.IsEmpty()) {
AutoSetOperator op(mTarget, gfxContext::OPERATOR_CLEAR);
nsIntRegionRectIterator iter(mRegionToClear);
const nsIntRect *r;
while ((r = iter.Next())) {
mTarget->NewPath();
mTarget->Rectangle(gfxRect(r->x, r->y, r->width, r->height));
mTarget->Fill();
}
}
if (mWidget) {
FlashWidgetUpdateArea(mTarget);
}

View File

@ -116,7 +116,18 @@ void
CanvasClientSurfaceStream::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
{
GLScreenBuffer* screen = aLayer->mGLContext->Screen();
SurfaceStream* stream = screen->Stream();
SurfaceStream* stream = nullptr;
if (aLayer->mStream) {
stream = aLayer->mStream;
// Copy our current surface to the current producer surface in our stream, then
// call SwapProducer to make a new buffer ready.
stream->CopySurfaceToProducer(aLayer->mTextureSurface, aLayer->mFactory);
stream->SwapProducer(aLayer->mFactory, gfx::IntSize(aSize.width, aSize.height));
} else {
stream = screen->Stream();
}
bool isCrossProcess = !(XRE_GetProcessType() == GeckoProcessType_Default);
bool bufferCreated = false;
@ -255,7 +266,15 @@ DeprecatedCanvasClientSurfaceStream::Update(gfx::IntSize aSize, ClientCanvasLaye
mDeprecatedTextureClient->EnsureAllocated(aSize, gfxContentType::COLOR);
GLScreenBuffer* screen = aLayer->mGLContext->Screen();
SurfaceStream* stream = screen->Stream();
SurfaceStream* stream = nullptr;
if (aLayer->mStream) {
stream = aLayer->mStream;
stream->CopySurfaceToProducer(aLayer->mTextureSurface, aLayer->mFactory);
stream->SwapProducer(aLayer->mFactory, gfx::IntSize(aSize.width, aSize.height));
} else {
stream = screen->Stream();
}
bool isCrossProcess = !(XRE_GetProcessType() == GeckoProcessType_Default);
if (isCrossProcess) {

View File

@ -33,15 +33,34 @@ using namespace mozilla::gl;
namespace mozilla {
namespace layers {
ClientCanvasLayer::~ClientCanvasLayer()
{
MOZ_COUNT_DTOR(ClientCanvasLayer);
if (mCanvasClient) {
mCanvasClient->OnDetach();
mCanvasClient = nullptr;
}
if (mTextureSurface) {
delete mTextureSurface;
}
}
void
ClientCanvasLayer::Initialize(const Data& aData)
{
CopyableCanvasLayer::Initialize(aData);
mCanvasClient = nullptr;
if (mGLContext) {
GLScreenBuffer* screen = mGLContext->Screen();
SurfaceCaps caps = screen->Caps();
if (mStream) {
// The screen caps are irrelevant if we're using a separate stream
caps = GetContentFlags() & CONTENT_OPAQUE ? SurfaceCaps::ForRGB() : SurfaceCaps::ForRGBA();
}
SurfaceStreamType streamType =
SurfaceStream::ChooseGLStreamType(SurfaceStream::OffMainThread,
screen->PreserveBuffer());
@ -53,11 +72,11 @@ ClientCanvasLayer::Initialize(const Data& aData)
if (!isCrossProcess) {
// [Basic/OGL Layers, OMTC] WebGL layer init.
factory = SurfaceFactory_EGLImage::Create(mGLContext, screen->Caps());
factory = SurfaceFactory_EGLImage::Create(mGLContext, caps);
} else {
// [Basic/OGL Layers, OOPC] WebGL layer init. (Out Of Process Compositing)
#ifdef MOZ_WIDGET_GONK
factory = new SurfaceFactory_Gralloc(mGLContext, screen->Caps(), ClientManager()->AsShadowForwarder());
factory = new SurfaceFactory_Gralloc(mGLContext, caps, ClientManager()->AsShadowForwarder());
#else
// we could do readback here maybe
NS_NOTREACHED("isCrossProcess but not on native B2G!");
@ -67,15 +86,35 @@ ClientCanvasLayer::Initialize(const Data& aData)
// [Basic Layers, OMTC] WebGL layer init.
// Well, this *should* work...
#ifdef XP_MACOSX
factory = new SurfaceFactory_IOSurface(mGLContext, screen->Caps());
factory = new SurfaceFactory_IOSurface(mGLContext, caps);
#else
factory = new SurfaceFactory_GLTexture(mGLContext, nullptr, screen->Caps());
factory = new SurfaceFactory_GLTexture(mGLContext, nullptr, caps);
#endif
}
}
}
if (factory) {
if (mStream) {
// We're using a stream other than the one in the default screen
mFactory = factory;
if (!mFactory) {
// Absolutely must have a factory here, so create a basic one
mFactory = new SurfaceFactory_Basic(mGLContext, caps);
}
gfx::IntSize size = gfx::IntSize(aData.mSize.width, aData.mSize.height);
mTextureSurface = SharedSurface_GLTexture::Create(mGLContext, mGLContext,
mGLContext->GetGLFormats(),
size, caps.alpha, aData.mTexID);
SharedSurface* producer = mStream->SwapProducer(mFactory, size);
if (!producer) {
// Fallback to basic factory
delete mFactory;
mFactory = new SurfaceFactory_Basic(mGLContext, caps);
producer = mStream->SwapProducer(mFactory, size);
MOZ_ASSERT(producer, "Failed to create initial canvas surface with basic factory");
}
} else if (factory) {
screen->Morph(factory, streamType);
}
}

View File

@ -33,17 +33,12 @@ public:
ClientCanvasLayer(ClientLayerManager* aLayerManager) :
CopyableCanvasLayer(aLayerManager,
static_cast<ClientLayer*>(MOZ_THIS_IN_INITIALIZER_LIST()))
, mTextureSurface(nullptr)
, mFactory(nullptr)
{
MOZ_COUNT_CTOR(ClientCanvasLayer);
}
virtual ~ClientCanvasLayer()
{
MOZ_COUNT_DTOR(ClientCanvasLayer);
if (mCanvasClient) {
mCanvasClient->OnDetach();
mCanvasClient = nullptr;
}
}
virtual ~ClientCanvasLayer();
virtual void SetVisibleRegion(const nsIntRegion& aRegion)
{
@ -97,6 +92,9 @@ protected:
RefPtr<CanvasClient> mCanvasClient;
gfx::SharedSurface* mTextureSurface;
gfx::SurfaceFactory* mFactory;
friend class DeprecatedCanvasClient2D;
friend class CanvasClient2D;
friend class DeprecatedCanvasClientSurfaceStream;

View File

@ -709,6 +709,30 @@ LayerManagerD3D10::Render(EndTransactionFlags aFlags)
static_cast<LayerD3D10*>(mRoot->ImplData())->RenderLayer();
if (!mRegionToClear.IsEmpty()) {
float color[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
gfx::Matrix4x4 transform;
effect()->GetVariableByName("mLayerTransform")->SetRawValue(&transform, 0, 64);
effect()->GetVariableByName("fLayerColor")->AsVector()->SetFloatVector(color);
ID3D10EffectTechnique *technique = effect()->GetTechniqueByName("RenderClearLayer");
nsIntRegionRectIterator iter(mRegionToClear);
const nsIntRect *r;
while ((r = iter.Next())) {
effect()->GetVariableByName("vLayerQuad")->AsVector()->SetFloatVector(
ShaderConstantRectD3D10(
(float)r->x,
(float)r->y,
(float)r->width,
(float)r->height)
);
technique->GetPassByIndex(0)->Apply(0);
device()->Draw(4, 0);
}
}
// See bug 630197 - we have some reasons to believe if an earlier call
// returned an error, the upcoming present call may raise an exception.
// This will check if any of the calls done recently has returned an error

View File

@ -448,6 +448,18 @@ technique10 RenderSolidColorLayer
}
}
technique10 RenderClearLayer
{
pass P0
{
SetRasterizerState( LayerRast );
SetBlendState( NoBlendDual, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF );
SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) );
SetGeometryShader( NULL );
SetPixelShader( CompileShader( ps_4_0_level_9_3, SolidColorShader() ) );
}
}
technique10 PrepareAlphaExtractionTextures
{
pass P0

File diff suppressed because it is too large Load Diff

View File

@ -261,6 +261,25 @@ LayerManagerD3D9::Render()
static_cast<LayerD3D9*>(mRoot->ImplData())->RenderLayer();
if (!mRegionToClear.IsEmpty()) {
D3DRECT* rects = new D3DRECT[mRegionToClear.GetNumRects()];
nsIntRegionRectIterator iter(mRegionToClear);
const nsIntRect *r;
size_t i = 0;
while ((r = iter.Next())) {
rects[i].x1 = r->x;
rects[i].y1 = r->y;
rects[i].x2 = r->x + r->width;
rects[i].y2 = r->y + r->height;
i++;
}
device()->Clear(i, rects, D3DCLEAR_TARGET,
0x00000000, 0, 0);
delete [] rects;
}
device()->EndScene();
if (!mTarget) {

View File

@ -86,7 +86,6 @@ SharedTextureClientOGL::IsAllocated() const
StreamTextureClientOGL::StreamTextureClientOGL(TextureFlags aFlags)
: TextureClient(aFlags)
, mStream(0)
, mIsLocked(false)
{
}
@ -131,6 +130,7 @@ StreamTextureClientOGL::InitWith(gfx::SurfaceStream* aStream)
{
MOZ_ASSERT(!IsAllocated());
mStream = aStream;
mGL = mStream->GLContext();
}
bool

View File

@ -97,8 +97,9 @@ public:
virtual gfx::IntSize GetSize() const { return gfx::IntSize(); }
protected:
gfx::SurfaceStream* mStream;
bool mIsLocked;
RefPtr<gfx::SurfaceStream> mStream;
RefPtr<gl::GLContext> mGL;
};
} // namespace

View File

@ -515,15 +515,10 @@ StreamTextureSourceOGL::RetrieveTextureFromStream()
SharedSurface_EGLImage* eglImageSurf =
SharedSurface_EGLImage::Cast(sharedSurf);
mTextureHandle = eglImageSurf->AcquireConsumerTexture(gl());
mTextureTarget = eglImageSurf->TextureTarget();
if (!mTextureHandle) {
toUpload = eglImageSurf->GetPixels();
MOZ_ASSERT(toUpload);
} else {
mFormat = sharedSurf->HasAlpha() ? SurfaceFormat::R8G8B8A8
: SurfaceFormat::R8G8B8X8;
}
eglImageSurf->AcquireConsumerTexture(gl(), &mTextureHandle, &mTextureTarget);
MOZ_ASSERT(mTextureHandle);
mFormat = sharedSurf->HasAlpha() ? SurfaceFormat::R8G8B8A8
: SurfaceFormat::R8G8B8X8;
break;
}
#ifdef XP_MACOSX

View File

@ -1,54 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
ifeq (86,$(findstring 86,$(OS_TEST)))
CSRCS += transform-sse2.c
ifdef _MSC_VER
ifneq ($(OS_ARCH)_$(OS_TEST),WINNT_x86_64)
CSRCS += transform-sse1.c
endif
else
CSRCS += transform-sse1.c
ifdef GNU_CC
SSE1_FLAGS=-msse
SSE2_FLAGS=-msse2
else
ifeq ($(SOLARIS_SUNPRO_CC),1)
ifneq (64,$(findstring 64,$(OS_TEST)))
SSE1_FLAGS=-xarch=sse
SSE2_FLAGS=-xarch=sse2
else
# Sun Studio doesn't work correctly for x86 intristics
# with -m64 and without optimization.
SSE1_FLAGS= -xO4
SSE2_FLAGS= -xO4
endif
else
SSE1_FLAGS=
SSE2_FLAGS=
endif
endif
endif
else
ifeq (ppc,$(findstring ppc,$(CPU_ARCH)))
ifdef GNU_CC
CSRCS += transform-altivec.c
ALTIVEC_FLAGS=-maltivec
endif
endif
endif
include $(topsrcdir)/config/rules.mk
# Disable spammy "missing initializer" GCC warning
ifdef GNU_CC
CFLAGS += -Wno-missing-field-initializers
endif # GNU_CC
# special rules for transform-sse*.c to get the right cflags. (taken from pixman/src/Makefile.in)
transform-sse1.$(OBJ_SUFFIX): COMPILE_CFLAGS += $(SSE1_FLAGS)
transform-sse2.$(OBJ_SUFFIX): COMPILE_CFLAGS += $(SSE2_FLAGS)
transform-altivec.$(OBJ_SUFFIX): COMPILE_CFLAGS += $(ALTIVEC_FLAGS)

View File

@ -20,3 +20,48 @@ SOURCES += [
MSVC_ENABLE_PGO = True
FINAL_LIBRARY = 'gkmedias'
if CONFIG['GNU_CC']:
CFLAGS += ['-Wno-missing-field-initializers']
use_sse1 = False
use_sse2 = False
use_altivec = False
if '86' in CONFIG['OS_TEST']:
use_sse2 = True
if CONFIG['_MSC_VER']:
if CONFIG['OS_ARCH'] != 'WINNT' or CONFIG['OS_TEST'] != 'x86_64':
use_sse1 = True
else:
use_sse1 = True
elif 'ppc' in CONFIG['CPU_ARCH']:
if CONFIG['GNU_CC']:
use_altivec = True
if use_sse1:
SOURCES += ['transform-sse1.c']
if CONFIG['GNU_CC']:
SOURCES['transform-sse1.c'].flags += ['-msse']
elif CONFIG['SOLARIS_SUNPRO_CC']:
if '64' in CONFIG['OS_TEST']:
# Sun Studio doesn't work correctly for x86 intristics
# with -m64 and without optimization.
SOURCES['transform-sse1.c'].flags += ['-xO4']
else:
SOURCES['transform-sse1.c'].flags += ['-xarch=sse']
if use_sse2:
SOURCES += ['transform-sse2.c']
if CONFIG['GNU_CC']:
SOURCES['transform-sse2.c'].flags += ['-msse2']
elif CONFIG['SOLARIS_SUNPRO_CC']:
if '64' in CONFIG['OS_TEST']:
# Sun Studio doesn't work correctly for x86 intristics
# with -m64 and without optimization.
SOURCES['transform-sse2.c'].flags += ['-xO4']
else:
SOURCES['transform-sse2.c'].flags += ['-xarch=sse2']
if use_altivec:
SOURCES += ['transform-altivec.c']
SOURCES['transform-altivec.c'].flags += ['-maltivec']

View File

@ -17,19 +17,6 @@ endif
include $(topsrcdir)/config/rules.mk
ifneq (,$(INTEL_ARCHITECTURE))
ifdef GNU_CC
SkBitmapFilter_opts_SSE2.$(OBJ_SUFFIX): CXXFLAGS+=-msse2
SkBitmapProcState_opts_SSE2.$(OBJ_SUFFIX): CXXFLAGS+=-msse2
SkBitmapProcState_opts_SSSE3.$(OBJ_SUFFIX): CXXFLAGS+=-mssse3
SkBlitRect_opts_SSE2.$(OBJ_SUFFIX): CXXFLAGS+=-msse2
SkBlitRow_opts_SSE2.$(OBJ_SUFFIX): CXXFLAGS+=-msse2
SkBlurImage_opts_SSE2.$(OBJ_SUFFIX): CXXFLAGS+=-msse2
SkMorphology_opts_SSE2.$(OBJ_SUFFIX): CXXFLAGS+=-msse2
SkUtils_opts_SSE2.$(OBJ_SUFFIX): CXXFLAGS+=-msse2
endif
endif
ifeq ($(CPU_ARCH)_$(GNU_CC),arm_1)
# The assembly uses the frame pointer register (r7 in Thumb/r11 in
# ARM), the compiler doesn't like that.

View File

@ -67,6 +67,16 @@ if (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android') or \
CONFIG['MOZ_WIDGET_GTK']:
DEFINES['SK_FONTHOST_DOES_NOT_USE_FONTMGR'] = 1
if CONFIG['INTEL_ARCHITECTURE'] and CONFIG['GNU_CC']:
SOURCES['trunk/src/opts/SkBitmapFilter_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkBitmapProcState_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkBitmapProcState_opts_SSSE3.cpp'].flags += ['-mssse3']
SOURCES['trunk/src/opts/SkBlitRect_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkBlitRow_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkBlurImage_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkMorphology_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkUtils_opts_SSE2.cpp'].flags += ['-msse2']
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
DEFINES['SKIA_DLL'] = 1
DEFINES['GR_DLL'] = 1

View File

@ -847,9 +847,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gtk2', 'gtk3', 'qt', 'gonk', 'co
if CONFIG['INTEL_ARCHITECTURE'] and CONFIG['HAVE_TOOLCHAIN_SUPPORT_MSSSE3']:
DEFINES['SK_BUILD_SSSE3'] = 1
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
DEFINES['SKIA_DLL'] = 1
if (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android') or (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk') or (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa') or CONFIG['MOZ_WIDGET_GTK'] or CONFIG['MOZ_WIDGET_QT']:
DEFINES['SK_FONTHOST_DOES_NOT_USE_FONTMGR'] = 1
@ -857,5 +854,15 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
DEFINES['SKIA_DLL'] = 1
DEFINES['GR_DLL'] = 1
if CONFIG['INTEL_ARCHITECTURE'] and CONFIG['GNU_CC']:
SOURCES['trunk/src/opts/SkBitmapFilter_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkBitmapProcState_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkBitmapProcState_opts_SSSE3.cpp'].flags += ['-mssse3']
SOURCES['trunk/src/opts/SkBlitRect_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkBlitRow_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkBlurImage_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkMorphology_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkUtils_opts_SSE2.cpp'].flags += ['-msse2']
DEFINES['SKIA_IMPLEMENTATION'] = 1
DEFINES['GR_IMPLEMENTATION'] = 1

View File

@ -16,6 +16,7 @@
struct nsRect;
struct nsIntRect;
struct nsIntSize;
class nsIntRegion;
struct nsFont;
struct nsIntMargin;
class nsPresContext;
@ -29,8 +30,8 @@ class nsIWidget;
// IID for the nsITheme interface
// {b0f3efe9-0bd4-4f6b-8daa-0ec7f6006822}
#define NS_ITHEME_IID \
{ 0x3ca584e6, 0xdcd6, 0x485b, \
{ 0x88, 0x8c, 0xe3, 0x47, 0x3d, 0xe4, 0xd9, 0x58 } }
{ 0x2e49c679, 0x2130, 0x432c, \
{ 0x92, 0xcb, 0xd4, 0x8e, 0x9a, 0xe2, 0x34, 0x75 } }
// {D930E29B-6909-44e5-AB4B-AF10D6923705}
#define NS_THEMERENDERER_CID \
{ 0x9020805b, 0x14a3, 0x4125, \
@ -62,7 +63,8 @@ public:
nsIFrame* aFrame,
uint8_t aWidgetType,
const nsRect& aRect,
const nsRect& aDirtyRect) = 0;
const nsRect& aDirtyRect,
nsIntRegion* aRegionToClear = nullptr) = 0;
/**
* Get the computed CSS border for the widget, in pixels.

View File

@ -22,6 +22,10 @@
#include "gfxPrefs.h"
#include "cairo.h"
#ifdef MOZ_WIDGET_ANDROID
#include "AndroidBridge.h"
#endif
#include "ft2build.h"
#include FT_FREETYPE_H
#include FT_MODULE_H
@ -418,3 +422,16 @@ gfxAndroidPlatform::GetScreenDepth() const
{
return mScreenDepth;
}
bool
gfxAndroidPlatform::UseAcceleratedSkiaCanvas()
{
#ifdef MOZ_WIDGET_ANDROID
if (AndroidBridge::Bridge()->GetAPIVersion() < 11) {
// It's slower than software due to not having a compositing fast path
return false;
}
#endif
return gfxPlatform::UseAcceleratedSkiaCanvas();
}

View File

@ -81,6 +81,8 @@ public:
virtual int GetScreenDepth() const;
virtual bool UseAcceleratedSkiaCanvas() MOZ_OVERRIDE;
private:
int mScreenDepth;
gfxImageFormat mOffscreenFormat;

View File

@ -76,6 +76,9 @@
#ifdef USE_SKIA
#include "mozilla/Hal.h"
#include "skia/SkGraphics.h"
#include "SkiaGLGlue.h"
#endif
#include "mozilla/Preferences.h"
@ -104,7 +107,10 @@ static qcms_transform *gCMSRGBATransform = nullptr;
static bool gCMSInitialized = false;
static eCMSMode gCMSMode = eCMSMode_Off;
static int gCMSIntent = -2;
static bool gCMSIntentInitialized = false;
static int gCMSIntent = QCMS_INTENT_DEFAULT;
static void ShutdownCMS();
@ -138,12 +144,7 @@ NS_IMPL_ISUPPORTS2(SRGBOverrideObserver, nsIObserver, nsISupportsWeakReference)
#define BIDI_NUMERAL_PREF "bidi.numeral"
#define GFX_PREF_CMS_RENDERING_INTENT "gfx.color_management.rendering_intent"
#define GFX_PREF_CMS_DISPLAY_PROFILE "gfx.color_management.display_profile"
#define GFX_PREF_CMS_ENABLED_OBSOLETE "gfx.color_management.enabled"
#define GFX_PREF_CMS_FORCE_SRGB "gfx.color_management.force_srgb"
#define GFX_PREF_CMS_ENABLEV4 "gfx.color_management.enablev4"
#define GFX_PREF_CMS_MODE "gfx.color_management.mode"
NS_IMETHODIMP
SRGBOverrideObserver::Observe(nsISupports *aSubject,
@ -204,6 +205,8 @@ MemoryPressureObserver::Observe(nsISupports *aSubject,
{
NS_ASSERTION(strcmp(aTopic, "memory-pressure") == 0, "unexpected event topic");
Factory::PurgeAllCaches();
gfxPlatform::GetPlatform()->PurgeSkiaCache();
return NS_OK;
}
@ -268,6 +271,8 @@ gfxPlatform::gfxPlatform()
mLayersUseDeprecated = false;
#endif
mSkiaGlue = nullptr;
uint32_t canvasMask = BackendTypeBit(BackendType::CAIRO) | BackendTypeBit(BackendType::SKIA);
uint32_t contentMask = BackendTypeBit(BackendType::CAIRO);
InitBackendPrefs(canvasMask, BackendType::CAIRO,
@ -424,10 +429,6 @@ gfxPlatform::Init()
CreateCMSOutputProfile();
#ifdef USE_SKIA
gPlatform->InitializeSkiaCaches();
#endif
// Listen to memory pressure event so we can purge DrawTarget caches
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) {
@ -827,9 +828,8 @@ gfxPlatform::UseAcceleratedSkiaCanvas()
}
void
gfxPlatform::InitializeSkiaCaches()
gfxPlatform::InitializeSkiaCacheLimits()
{
#ifdef USE_SKIA_GPU
if (UseAcceleratedSkiaCanvas()) {
bool usingDynamicCache = gfxPrefs::CanvasSkiaGLDynamicCache();
int cacheItemLimit = gfxPrefs::CanvasSkiaGLCacheItems();
@ -849,12 +849,47 @@ gfxPlatform::InitializeSkiaCaches()
}
}
#ifdef DEBUG
#ifdef DEBUG
printf_stderr("Determined SkiaGL cache limits: Size %i, Items: %i\n", cacheSizeLimit, cacheItemLimit);
#endif
mSkiaGlue->GetGrContext()->setTextureCacheLimits(cacheItemLimit, cacheSizeLimit);
}
}
mozilla::gl::SkiaGLGlue*
gfxPlatform::GetSkiaGLGlue()
{
#ifdef USE_SKIA_GPU
if (!mSkiaGlue) {
/* Dummy context. We always draw into a FBO.
*
* FIXME: This should be stored in TLS or something, since there needs to be one for each thread using it. As it
* stands, this only works on the main thread.
*/
mozilla::gfx::SurfaceCaps caps = mozilla::gfx::SurfaceCaps::ForRGBA();
nsRefPtr<mozilla::gl::GLContext> glContext = mozilla::gl::GLContextProvider::CreateOffscreen(gfxIntSize(16, 16), caps);
if (!glContext) {
printf_stderr("Failed to create GLContext for SkiaGL!\n");
return nullptr;
}
mSkiaGlue = new mozilla::gl::SkiaGLGlue(glContext);
MOZ_ASSERT(mSkiaGlue->GetGrContext(), "No GrContext");
InitializeSkiaCacheLimits();
}
#endif
Factory::SetGlobalSkiaCacheLimits(cacheItemLimit, cacheSizeLimit);
}
return mSkiaGlue;
}
void
gfxPlatform::PurgeSkiaCache()
{
#ifdef USE_SKIA_GPU
if (!mSkiaGlue)
return;
mSkiaGlue->GetGrContext()->freeGpuResources();
#endif
}
@ -1500,17 +1535,14 @@ gfxPlatform::GetCMSMode()
{
if (gCMSInitialized == false) {
gCMSInitialized = true;
nsresult rv;
int32_t mode;
rv = Preferences::GetInt(GFX_PREF_CMS_MODE, &mode);
if (NS_SUCCEEDED(rv) && (mode >= 0) && (mode < eCMSMode_AllCount)) {
int32_t mode = gfxPrefs::CMSMode();
if (mode >= 0 && mode < eCMSMode_AllCount) {
gCMSMode = static_cast<eCMSMode>(mode);
}
bool enableV4;
rv = Preferences::GetBool(GFX_PREF_CMS_ENABLEV4, &enableV4);
if (NS_SUCCEEDED(rv) && enableV4) {
bool enableV4 = gfxPrefs::CMSEnableV4();
if (enableV4) {
qcms_enable_iccv4();
}
}
@ -1520,23 +1552,22 @@ gfxPlatform::GetCMSMode()
int
gfxPlatform::GetRenderingIntent()
{
if (gCMSIntent == -2) {
if (!gCMSIntentInitialized) {
gCMSIntentInitialized = true;
// gfxPrefs.h is using 0 as the default for the rendering
// intent preference, based on that being the value for
// QCMS_INTENT_DEFAULT. Assert here to catch if that ever
// changes and we can then figure out what to do about it.
MOZ_ASSERT(QCMS_INTENT_DEFAULT == 0);
/* Try to query the pref system for a rendering intent. */
int32_t pIntent;
if (NS_SUCCEEDED(Preferences::GetInt(GFX_PREF_CMS_RENDERING_INTENT, &pIntent))) {
/* If the pref is within range, use it as an override. */
if ((pIntent >= QCMS_INTENT_MIN) && (pIntent <= QCMS_INTENT_MAX)) {
gCMSIntent = pIntent;
}
int32_t pIntent = gfxPrefs::CMSRenderingIntent();
if ((pIntent >= QCMS_INTENT_MIN) && (pIntent <= QCMS_INTENT_MAX)) {
gCMSIntent = pIntent;
} else {
/* If the pref is out of range, use embedded profile. */
else {
gCMSIntent = -1;
}
}
/* If we didn't get a valid intent from prefs, use the default. */
else {
gCMSIntent = QCMS_INTENT_DEFAULT;
gCMSIntent = -1;
}
}
return gCMSIntent;

View File

@ -40,6 +40,7 @@ struct gfxRGBA;
namespace mozilla {
namespace gl {
class GLContext;
class SkiaGLGlue;
}
namespace gfx {
class DrawTarget;
@ -283,8 +284,7 @@ public:
}
virtual bool UseAcceleratedSkiaCanvas();
virtual void InitializeSkiaCaches();
virtual void InitializeSkiaCacheLimits();
void GetAzureBackendInfo(mozilla::widget::InfoObject &aObj) {
aObj.DefineProperty("AzureCanvasBackend", GetBackendName(mPreferredCanvasBackend));
@ -598,6 +598,9 @@ public:
bool PreferMemoryOverShmem() const;
bool UseDeprecatedTextures() const { return mLayersUseDeprecated; }
mozilla::gl::SkiaGLGlue* GetSkiaGLGlue();
void PurgeSkiaCache();
protected:
gfxPlatform();
virtual ~gfxPlatform();
@ -711,6 +714,7 @@ private:
mozilla::RefPtr<mozilla::gfx::DrawEventRecorder> mRecorder;
bool mLayersPreferMemoryOverShmem;
bool mLayersUseDeprecated;
mozilla::RefPtr<mozilla::gl::SkiaGLGlue> mSkiaGlue;
};
#endif /* GFX_PLATFORM_H */

View File

@ -118,6 +118,11 @@ private:
DECL_GFX_PREF(Once, "gfx.canvas.skiagl.cache-size", CanvasSkiaGLCacheSize, int32_t, 96);
DECL_GFX_PREF(Once, "gfx.canvas.skiagl.cache-items", CanvasSkiaGLCacheItems, int32_t, 256);
DECL_GFX_PREF(Live, "gfx.color_management.enablev4", CMSEnableV4, bool, false);
DECL_GFX_PREF(Live, "gfx.color_management.mode", CMSMode, int32_t,-1);
// The zero default here should match QCMS_INTENT_DEFAULT from qcms.h
DECL_GFX_PREF(Live, "gfx.color_management.rendering_intent", CMSRenderingIntent, int32_t, 0);
DECL_GFX_PREF(Once, "gfx.direct2d.disabled", Direct2DDisabled, bool, false);
DECL_GFX_PREF(Once, "gfx.direct2d.force-enabled", Direct2DForceEnabled, bool, false);
DECL_GFX_PREF(Live, "gfx.gralloc.fence-with-readpixels", GrallocFenceWithReadPixels, bool, false);

View File

@ -23,6 +23,7 @@
#include "nsIScriptSecurityManager.h"
#include "ImageFactory.h"
#include "gfxPrefs.h"
namespace mozilla {
namespace image {
@ -38,6 +39,8 @@ ImageFactory::Initialize()
{
MOZ_ASSERT(NS_IsMainThread());
if (!gInitializedPrefCaches) {
// Initialize the graphics preferences
gfxPrefs::GetSingleton();
Preferences::AddBoolVarCache(&gDiscardable, "image.mem.discardable");
Preferences::AddBoolVarCache(&gDecodeOnDraw, "image.mem.decodeondraw");
Preferences::AddBoolVarCache(&gEnableMozSampleSize, "image.mozsamplesize.enabled");

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