summaryrefslogtreecommitdiffstats
path: root/dom
diff options
context:
space:
mode:
Diffstat (limited to 'dom')
-rw-r--r--dom/base/nsImageLoadingContent.cpp36
-rw-r--r--dom/base/nsImageLoadingContent.h10
-rw-r--r--dom/canvas/WebGLShaderValidator.cpp68
-rw-r--r--dom/canvas/WebGLShaderValidator.h6
-rw-r--r--dom/html/HTMLMediaElement.cpp2
-rw-r--r--dom/webidl/Event.webidl2
6 files changed, 73 insertions, 51 deletions
diff --git a/dom/base/nsImageLoadingContent.cpp b/dom/base/nsImageLoadingContent.cpp
index d25dd6319..0c6c37b44 100644
--- a/dom/base/nsImageLoadingContent.cpp
+++ b/dom/base/nsImageLoadingContent.cpp
@@ -94,8 +94,7 @@ nsImageLoadingContent::nsImageLoadingContent()
mNewRequestsWillNeedAnimationReset(false),
mStateChangerDepth(0),
mCurrentRequestRegistered(false),
- mPendingRequestRegistered(false),
- mFrameCreateCalled(false)
+ mPendingRequestRegistered(false)
{
if (!nsContentUtils::GetImgLoaderForChannel(nullptr, nullptr)) {
mLoadingEnabled = false;
@@ -489,10 +488,8 @@ nsImageLoadingContent::FrameCreated(nsIFrame* aFrame)
{
NS_ASSERTION(aFrame, "aFrame is null");
- mFrameCreateCalled = true;
-
- TrackImage(mCurrentRequest);
- TrackImage(mPendingRequest);
+ TrackImage(mCurrentRequest, aFrame);
+ TrackImage(mPendingRequest, aFrame);
// We need to make sure that our image request is registered, if it should
// be registered.
@@ -513,8 +510,6 @@ nsImageLoadingContent::FrameDestroyed(nsIFrame* aFrame)
{
NS_ASSERTION(aFrame, "aFrame is null");
- mFrameCreateCalled = false;
-
// We need to make sure that our image request is deregistered.
nsPresContext* presContext = GetFramePresContext();
if (mCurrentRequest) {
@@ -1486,7 +1481,8 @@ nsImageLoadingContent::OnVisibilityChange(Visibility aNewVisibility,
}
void
-nsImageLoadingContent::TrackImage(imgIRequest* aImage)
+nsImageLoadingContent::TrackImage(imgIRequest* aImage,
+ nsIFrame* aFrame /*= nullptr */)
{
if (!aImage)
return;
@@ -1499,13 +1495,21 @@ nsImageLoadingContent::TrackImage(imgIRequest* aImage)
return;
}
- // We only want to track this request if we're visible. Ordinarily we check
- // the visible count, but that requires a frame; in cases where
- // GetOurPrimaryFrame() cannot obtain a frame (e.g. <feImage>), we assume
- // we're visible if FrameCreated() was called.
- nsIFrame* frame = GetOurPrimaryFrame();
- if ((frame && frame->GetVisibility() == Visibility::APPROXIMATELY_NONVISIBLE) ||
- (!frame && !mFrameCreateCalled)) {
+ if (!aFrame) {
+ aFrame = GetOurPrimaryFrame();
+ }
+
+ /* This line is deceptively simple. It hides a lot of subtlety. Before we
+ * create an nsImageFrame we call nsImageFrame::ShouldCreateImageFrameFor
+ * to determine if we should create an nsImageFrame or create a frame based
+ * on the display of the element (ie inline, block, etc). Inline, block, etc
+ * frames don't register for visibility tracking so they will return UNTRACKED
+ * from GetVisibility(). So this line is choosing to mark such images as
+ * visible. Once the image loads we will get an nsImageFrame and the proper
+ * visibility. This is a pitfall of tracking the visibility on the frames
+ * instead of the content node.
+ */
+ if (!aFrame || aFrame->GetVisibility() == Visibility::APPROXIMATELY_NONVISIBLE) {
return;
}
diff --git a/dom/base/nsImageLoadingContent.h b/dom/base/nsImageLoadingContent.h
index 85db2bd2c..5f7daff72 100644
--- a/dom/base/nsImageLoadingContent.h
+++ b/dom/base/nsImageLoadingContent.h
@@ -364,6 +364,11 @@ protected:
*
* No-op if aImage is null.
*
+ * @param aFrame If called from FrameCreated the frame passed to FrameCreated.
+ * This is our frame, but at the time of the FrameCreated call
+ * our primary frame pointer hasn't been set yet, so this is
+ * only way to get our frame.
+ *
* @param aNonvisibleAction A requested action if the frame has become
* nonvisible. If Nothing(), no action is
* requested. If DISCARD_IMAGES is specified, the
@@ -371,7 +376,7 @@ protected:
* associated with to discard their surfaces if
* possible.
*/
- void TrackImage(imgIRequest* aImage);
+ void TrackImage(imgIRequest* aImage, nsIFrame* aFrame = nullptr);
void UntrackImage(imgIRequest* aImage,
const Maybe<OnNonvisible>& aNonvisibleAction = Nothing());
@@ -454,9 +459,6 @@ private:
// registered with the refresh driver.
bool mCurrentRequestRegistered;
bool mPendingRequestRegistered;
-
- // True when FrameCreate has been called but FrameDestroy has not.
- bool mFrameCreateCalled;
};
#endif // nsImageLoadingContent_h__
diff --git a/dom/canvas/WebGLShaderValidator.cpp b/dom/canvas/WebGLShaderValidator.cpp
index 80ba359a3..fda31e212 100644
--- a/dom/canvas/WebGLShaderValidator.cpp
+++ b/dom/canvas/WebGLShaderValidator.cpp
@@ -28,20 +28,39 @@ IdentifierHashFunc(const char* name, size_t len)
return hash[0];
}
-static ShCompileOptions
+static int
ChooseValidatorCompileOptions(const ShBuiltInResources& resources,
const mozilla::gl::GLContext* gl)
{
- ShCompileOptions options = SH_VARIABLES |
- SH_ENFORCE_PACKING_RESTRICTIONS |
- SH_OBJECT_CODE |
- SH_INIT_GL_POSITION;
-
+ int options = SH_VARIABLES |
+ SH_ENFORCE_PACKING_RESTRICTIONS |
+ SH_INIT_VARYINGS_WITHOUT_STATIC_USE |
+ SH_OBJECT_CODE |
+ SH_INIT_GL_POSITION;
+
+ if (resources.MaxExpressionComplexity > 0) {
+ options |= SH_LIMIT_EXPRESSION_COMPLEXITY;
+ }
// Sampler arrays indexed with non-constant expressions are forbidden in
// GLSL 1.30 and later.
// ESSL 3 requires constant-integral-expressions for this as well.
// Just do it universally.
options |= SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX;
+
+ // Needed for driver bug detection
+ options |= SH_EMULATE_BUILT_IN_FUNCTIONS;
+
+ if (gfxPrefs::WebGLAllANGLEOptions()) {
+ return options |
+ SH_VALIDATE_LOOP_INDEXING |
+ SH_UNROLL_FOR_LOOP_WITH_INTEGER_INDEX |
+ SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX |
+ SH_CLAMP_INDIRECT_ARRAY_BOUNDS |
+ SH_UNFOLD_SHORT_CIRCUIT |
+ SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS |
+ SH_INIT_OUTPUT_VARIABLES |
+ SH_REGENERATE_STRUCT_NAMES;
+ }
#ifndef XP_MACOSX
// We want to do this everywhere, but to do this on Mac, we need
@@ -55,30 +74,23 @@ ChooseValidatorCompileOptions(const ShBuiltInResources& resources,
// Work around https://bugs.webkit.org/show_bug.cgi?id=124684,
// https://chromium.googlesource.com/angle/angle/+/5e70cf9d0b1bb
options |= SH_UNFOLD_SHORT_CIRCUIT;
+
+ // OS X 10.7/10.8 specific:
+
+ // Work around bug 665578 and bug 769810
+ if (gl->Vendor() == gl::GLVendor::ATI) {
+ options |= SH_EMULATE_BUILT_IN_FUNCTIONS;
+ }
+ // Work around bug 735560
+ if (gl->Vendor() == gl::GLVendor::Intel) {
+ options |= SH_EMULATE_BUILT_IN_FUNCTIONS;
+ }
// Work around that Mac drivers handle struct scopes incorrectly.
options |= SH_REGENERATE_STRUCT_NAMES;
- options |= SH_INIT_OUTPUT_VARIABLES;
}
#endif
- if (gfxPrefs::WebGLAllANGLEOptions()) {
- options = -1;
-
- options ^= SH_INTERMEDIATE_TREE;
- options ^= SH_LINE_DIRECTIVES;
- options ^= SH_SOURCE_PATH;
-
- options ^= SH_LIMIT_EXPRESSION_COMPLEXITY;
- options ^= SH_LIMIT_CALL_STACK_DEPTH;
-
- options ^= SH_EXPAND_SELECT_HLSL_INTEGER_POW_EXPRESSIONS;
- options ^= SH_HLSL_GET_DIMENSIONS_IGNORES_BASE_LEVEL;
-
- options ^= SH_DONT_REMOVE_INVARIANT_FOR_FRAGMENT_INPUT;
- options ^= SH_REMOVE_INVARIANT_AND_CENTROID_FOR_ESSL3;
- }
-
if (resources.MaxExpressionComplexity > 0) {
options |= SH_LIMIT_EXPRESSION_COMPLEXITY;
}
@@ -173,7 +185,7 @@ WebGLContext::CreateShaderValidator(GLenum shaderType) const
#endif
}
- const auto compileOptions = webgl::ChooseValidatorCompileOptions(resources, gl);
+ int compileOptions = webgl::ChooseValidatorCompileOptions(resources, gl);
return webgl::ShaderValidator::Create(shaderType, spec, outputLanguage, resources,
compileOptions);
}
@@ -186,7 +198,7 @@ namespace webgl {
ShaderValidator::Create(GLenum shaderType, ShShaderSpec spec,
ShShaderOutput outputLanguage,
const ShBuiltInResources& resources,
- ShCompileOptions compileOptions)
+ int compileOptions)
{
ShHandle handle = ShConstructCompiler(shaderType, spec, outputLanguage, &resources);
if (!handle)
@@ -283,8 +295,8 @@ ShaderValidator::CanLinkTo(const ShaderValidator* prev, nsCString* const out_log
}
}
{
- const auto vertVars = sh::GetInterfaceBlocks(prev->mHandle);
- const auto fragVars = sh::GetInterfaceBlocks(mHandle);
+ const auto vertVars = ShGetInterfaceBlocks(prev->mHandle);
+ const auto fragVars = ShGetInterfaceBlocks(mHandle);
if (!vertVars || !fragVars) {
nsPrintfCString error("Could not create uniform block list.");
*out_log = error;
diff --git a/dom/canvas/WebGLShaderValidator.h b/dom/canvas/WebGLShaderValidator.h
index deb1c7c7f..ba50def28 100644
--- a/dom/canvas/WebGLShaderValidator.h
+++ b/dom/canvas/WebGLShaderValidator.h
@@ -17,7 +17,7 @@ namespace webgl {
class ShaderValidator final
{
const ShHandle mHandle;
- const ShCompileOptions mCompileOptions;
+ const int mCompileOptions;
const int mMaxVaryingVectors;
bool mHasRun;
@@ -25,10 +25,10 @@ public:
static ShaderValidator* Create(GLenum shaderType, ShShaderSpec spec,
ShShaderOutput outputLanguage,
const ShBuiltInResources& resources,
- ShCompileOptions compileOptions);
+ int compileOptions);
private:
- ShaderValidator(ShHandle handle, ShCompileOptions compileOptions,
+ ShaderValidator(ShHandle handle, int compileOptions,
int maxVaryingVectors)
: mHandle(handle)
, mCompileOptions(compileOptions)
diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp
index 0b9f606f1..3954e6208 100644
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -5514,7 +5514,9 @@ void HTMLMediaElement::SuspendOrResumeElement(bool aPauseElement, bool aSuspendE
}
mEventDeliveryPaused = aSuspendEvents;
} else {
+#ifdef MOZ_EME
MOZ_ASSERT(!mMediaKeys);
+#endif
if (mDecoder) {
mDecoder->Resume();
if (!mPaused && !mDecoder->IsEnded()) {
diff --git a/dom/webidl/Event.webidl b/dom/webidl/Event.webidl
index f87dc195c..70a0ef513 100644
--- a/dom/webidl/Event.webidl
+++ b/dom/webidl/Event.webidl
@@ -17,6 +17,8 @@ interface Event {
readonly attribute DOMString type;
[Pure]
readonly attribute EventTarget? target;
+ [Pure, BinaryName="target"]
+ readonly attribute EventTarget? srcElement;
[Pure]
readonly attribute EventTarget? currentTarget;