mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1252882 - Content-Signature Service - some tests r=keeler,r=fkiefer (7fc1f726a4)
- Bug 1265085 - Replace verification source with a SAN in the content signature verifier interface. r=Cykesiopka,r=fkiefer (0881ba797d)
- Bug 1264706: Move nsILocalCertService, and implementation, to security/manager/ssl in order to alloow use w use elsewhere in gecko. r=dkeeler (6f2200f2a6)
- Bug 1219088 - Clear the session cache when a weak crypto override is revoked. r=keeler (456e2ce3e6)
- Bug 550185 - Ensure nsCertTree::GetCellText returns an initialized value. r=kaie (ee356452a5)
- Bug 1252384 - Remove nsICertTree.isHostPortOverride(). r=dkeele It is unused since the changes in Bug 825583 landed. (61400adad7)
- reorder as Bug 1411458 (600fc338a9)
- bug 1264761 - improve handling of x509 versions in certificate manager r=Cykesiopka (a89237c66d)
- Bug 1263857 - (followup) Disable windows crash reporter on automated tests. r=sfink (bb9581fec9)
- bug 1263221 - improve how PSM handles the visibility of __CERT_AddTempCertToPerm r=chmanchester,mgoodwin (d9fd09d9a6)
- bug 1182742 - allow users to override small key size errors r=rbarnes (b09074987b)
- Bug 1252722 - Fully implement nsNSSShutDownObject everywhere. r=keeler (8c1a8df597)
- Bug 1252722 - Use smart pointers for NSS resources. r=keeler (b2ef34f9d2)
- Bug 1252722 - Ensure arguments of all public methods are checked. r=keeler (7064697e25)
- bug 1242032 - change some pipnss logging output from Debug to Verbose r=Cykesiopka (516c52da9f)
- Bug 1252722 - Improve handling of PK11_* function error codes. r=keeler (b47d13bd7e)
- Bug 1251801 - Ensure arguments of all public methods are checked. r=keeler (ffe77174e7)
- Bug 1127158 - Remove brittle debug only flag math in nsSecureBrowserUIImpl.cpp. r=dkeeler (410d25dc3e)
- Bug 1257246: Update security/manager for eslint 2. r=cykesiopka (bbdcf78264)
- bug 1218515 - flip pinning-test.badssl.com into production mode r=jcj DONTBUILD NPOTB (0d93e78cab)
- Bug 1199624 - Don't use memset and memcmp in files that don't include cstring explicitly. r=briansmith (5a938e056c)
- Bug 1154399 - Part 1: De-templatize and un-inline IntegralValue. r=keeler (bcaa11a646)
- Bug 1154399 - Part 2: Simplify and un-inline OptionalVersion. r=keeler (a5a9bb5e46)
- Bug 1154399 - Part 3: Simplify OptionalExtensions. r=keeler (0d3f613cde)
- Bug 1154399 - Part 4: Simplify certificate parsing in OCSP responses. r=keeler (94aa90a96d)
- Bug 1189020 - Replace |// unnamed namespace| with |// namespace| in mozilla::pkix. r=Cykesiopka (bb016e13ac)
- bug 1255153 - (re)move redundant xpcshell name constraint tests to gtests r=Cykesiopka,jcj (d8597a3bb1)
- bug 1248099 - add extended key usage tests for mozilla::pkix r=Cykesiopka,jcj (f9c11a8ecc)
- Bug 1266298 - Add sys_fchmod to seccomp whitelist r=jld (e16608d738)
- Bug 1268579 - Add inotify_rm_watch to the seccomp-bpf whitelist. r=jld (c20823e237)
- Bug 1176099 - Add hooks for sigprocmask/pthread_sigmask. r=jld r=glandium (55d16a8e41)
- Bug 1176099 - Fix missing NULL check r=luke (2f6e6e3836)
- Bug 1245789 - Use ifdef MOZ_WIDEVINE_EME to prevent compilation when not enabled. r=gerald (40d13ca2d9)
- Bug 1267453 - Amazon Widevine rejects HDCP on MacBook Pro with or without an external display. r=gcp (5366006c54)
- Bug 1268379 - Delay WMF checks in GMPParent - r=jesup (0f6642fdcc)
- bit of Bug 1245789 - Push detection of WMF decoding (e60b0634de)
- missing bit of 1267453 (573b867a62)
- Bug 1243594 (part 3) - leave the utf-8 encoding of the payload to rest.js instead of directly in loop. r=Standard8 (7781df1275)
- Bug 1243594 (part 2) - have rest.js automatically encode the request body as utf-8. r=gfritzsche (fd98dddf43)
- Bug 1246938 - Allow extra headers to be passed via hawk requests. r=markh (3692244524)
- Bug 1239354: Replace old-style generator function with star functions. r=asuth (a7793a89aa)
- Bug 1217982 - Remove for-each from storage/. r=mak (bbff0f0b7b)
- Bug 1223510, part 1 - Always finishTest() in test_nonUnicode.html. r=baku (ba3fb681ad)
- Bug 1223510, part 2 - Make ArchiveReader tests use pushPrefEnv. r=baku (5a4a5f9a7a)
- Bug 1223510, part 3 - Change where generator is created. r=baku Mostly this lets us take advantage of things created during the initial setup. (ee337d83de)
- Bug 1220304 - Part 1 - Make test_XHRSendData.html use SpecialPowers.createFiles(). r=baku (91fc25f3b7)
- Bug 1220304 - Part 2 - Make ArchiveReader tests use SpecialPowers.createFiles(). r=baku (5a0bfc4200)
- Bug 1267966 - Remove the deprecation warning from Attr.ownerElement; r=baku (cfd8910f2f)
- Bug 1269646 - Console API should be NOP after window-inner-destroyed, r=smaug (c4e5959d1f)
- Bug 1263392 - ConsoleCallData::mStatus should be set also when ConsoleCallData is not used in workers, r=smaug (10358e33a1)
- Bug 1268361 - Strip leading '?' in new URLSearchParams(query), r=smaug (a1a5075185)
- Bug 1052139 - Make more objects on the global prototype chain have immutable [[Prototype]], when we enable enforcement of this requirement. r=bz (8e48cfc3d6)
- Bug 1267932 - Update EventSource.webidl, r=ehsan (41532a54d5)
- Bug 1269383 - Remove dom.server-events.enabled pref, r=smaug (21e65b8436)
- Bug 1237077 - Part 3: use createCodebasePrincipal. r=tanvi (7da7268d47)
- Bug 1268721, part 1 - Use early continue in TransferableToIPCTransferable. r=jimm (317ab04f38)
- Bug 1268721, part 2 - Null check first argument to nsContentUtils::GetSurfaceData(). r=jimm (544d181021)
- Bug 1272203 (part 3) - Use NotNull in nsContentUtils::GetSurfaceData(). r=froydnj. (65e488c4f8)
- Bug 1272203 (part 1) - Add mozilla::NotNull to MFBT. r=froydnj. (4653d120fc)
- Bug 964092: don't let DOM DataChannels get GC'd if they have an active callback r=smaug,jib (c9c291f44a)
- Bug 1224186: Implement DOMTokenlist.replace r=baku,Ms2ger (329f4f942e)
- Bug 1265715 - Part 1. Pull Mode out of nsDisplayListBuilder; r=jfkthame (2c7cae0f3a)
- Bug 1265715 - Part 2. Add nsDisplayListBuilderMode parameter into nsLayoutUtils::PaintFrame; r=jfkthame (5ecabbda5d)
- Bug 1264949 - Ensure that the display list does not contain any background-image/background-color display item; r=jfkthame (018a7aec15)
- Bug 1265715 - Part 3. Use nsLayoutUtils::PaintFrame in ClipBackgroundByText; r=jfkthame (182a700fa6)
- Bug 1265715 - Part 4. Fix transform problem; r=jfkthame (37f77bf24b)
- Bug 1265715 - Part 5. bg-clip:text transform reftest; r=jfkthame (44778bcfd7)
- Bug 1267209 - Convert nsLayoutUtils::PaintFrame flags to be an enum class. r=jfkthame (4f304b84f1)
- Bug 1265280 - Temporary debugging code to crash with a useful abort message. r=khuey (43d532166f)
- Bug 1232939 - Ensure the opaque region of a fixed background layer is correctly clipped. r=mstange (cc2118e0a0)
- Bug 735857 - Treat background-attachment:fixed as background-attachment:scroll if it's on a non-root element affected by a transform. r=mstange (273d62aabf)
- Bug 735857 - Factor out a helper function nsLayoutUtils::IsTransformed(). r=mstange (61528fafef)
- Bug 1263286 - Move base-uri CSP check into SetBaseURIUsingFirstBaseWithHref. r=bz (03114b2fcb)
- Bug 1227327 - Allow specifying a background rect for background dislay items. r=mattwoodrow (410ef269eb)
- Bug 1227327 - Make fieldset frames build nsDisplayBackgroundImage items. r=mattwoodrow (9a3a8953b4)
- Fix temporary debugging patch for bug 1265280 so we'll hit the condition. r=khuey (fd30f8f0b4)
- Bug 1265715 - followup - Correct dirty region; r=me (38fc76e698)
- Bug 550426 - Use background-position-x/y in ActiveLayerTracker. r=dbaron (4f154a39dd)
- Bug 1266131 part 1 - [css-grid] 'order' doesn't apply to grid-aligned abs.pos. descendants (anymore). r=dholbert (ba8aa18fea)
- Bug 1266131 part 2 - [css-grid] Remove unused nsDisplayList::SortByCSSOrder() function. r=dholbert (b676c48a26)
- Bug 550426 - Add support for {background,mask}-position-{x,y}, most of the style system changes. r=dbaron (3739a8ec58)
- Bug 550426 - Add support for {background,mask}-position-{x,y}, StyleAnimation changes. r=dbaron (0fd2f97a60)
- Bug 852754 - Part 4: Reduce max downscaling allowed to <3. r=mstange (399b851221)
- Bug 1266868, part 1 - Fix nsCSSValue::Array leaks in the StyleAnimationValue code. r=dholbert (c6fc4f7d9c)
- Bug 1266868, part 2 - Fix leaks of the values passed to nsCSSValue::.SetPairValue in the StyleAnimationValue code. r=dholbert (e5a1ff8603)
- Bug 1266868, part 3 - Avoid Maybe::ref() where not necessary. r=dholbert (8dd435fd5e)
- Back out bug 1164227, because bug 1236043 fixes the original problem in a better way. (6b734f0718)
- Bug 1267524 Part 1 - Use member initializer list for nsStyleOutline. r=heycam (d7cabb2ea8)
- Bug 1267524 Part 2 - Use member initializer list for nsStyleXUL. r=heycam (82107506a6)
- Bug 1267524 Part 3 - Use member initializer list for nsStyleColumn. r=heycam (80318b0056)
- Bug 1267524 Part 4.1 - Add Reset() and rewrite methods for nsStyleSVGPaint. r=heycam (02ba8762cb)
- Bug 1267524 Part 4.2 - Use member initializer list for nsStyleSVG. r=heycam (5531ed4a93)
- Bug 1267524 Part 5 - Use member initializer list for nsStyleSVGReset. r=heycam (4a72005b1b)
- Bug 1267524 Part 6 - Use member initializer list for nsStylePosition. r=heycam (cfd6a8b640)
- Bug 1267524 Part 7 - Use member initializer list for nsStyleTable. r=heycam (510678ed8b)
- Bug 1267524 Part 8 - Use member initializer list for nsStyleTableBorder. r=heycam (c1617af193)
- Bug 1267524 Part 9 - Use member initializer list for nsStyleColor. r=heycam (753afba9f8)
- Bug 1267524 Part 10 - Use member initializer list for nsStyleDisplay. r=heycam (a6cc7ce52b)
- Bug 1267524 Part 11 - Use member initializer list for nsStyleVisibility. r=heycam (c93d75480e)
- Bug 1267524 Part 12 - Use member initializer list for nsStyleContent. r=heycam (ccc17aa74a)
- Bug 1267524 Part 13 - Use member initializer list for nsStyleTextReset. r=heycam (fc8b6ae837)
- Bug 1267524 Part 14 - Use member initializer list for nsStyleText. r=heycam (d73abb7d32)
- Bug 1267524 Part 15 - Use member initializer list for nsStyleUserInterface. r=heycam (3964558f27)
- Bug 1267524 Part 16 - Use member initializer list for nsStyleUIReset. r=heycam (3154cbc7d2)
- Bug 1267524 Part 17 - Use member initializer list for nsStyleVariables. r=heycam (3d286d2299)
- Bug 1267524 Part 18 - Remove "void" from zero argument functions. r=heycam (57b1a87c19)
- Bug 1267524 Part 19 - Move nsStyleCoord members to initializer list. r=heycam (385231a406)
- Bug 1227327 - Invalidate table parts and MathML frames when background-position changes on them. r=dbaron (088fad2be7)
- Bug 1268290: stylo: Pass SheetParsingMode to Servo, r=bholley (f05d51b7b1)
- Bug 1267833 - Pass the RawServoStyleSet to Servo_GetComputedValuesForAnonymousBox. r=heycam (c4870e2005)
- Bug 1268392 - Make Servo_GetComputedValues take a node rather than an element. r=bholley (61230bdc1f)
- Bug 1268390 - Part 1: Factor out most of nsStyleSet::AddDocStyleSheet for re-use. r=bholley (5bd89657a1)
- Bug 1268390 - Part 2: Add bindings for Servo_InsertStyleSheetBefore. r=bholley (f83ea77d37)
- Bug 1268404 - Part 1: Split out ResolveStyleForText from ResolveStyleForNonElement and pass in the text node. r=bholley (dc40bbc9dc)
- Bug 1268404 - Part 2: Implement ServoStyleSet::ResolveStyleForText. r=bholley (0c6bffbd4b)
- Bug 1268748 - Implement {Resolve,Probe}PseudoElementStyle. r=heycam (cd674703d6)
- Bug 1267560 - Get style structs from ServoComputedValues rather than the rule node, when using the Servo-backed style system. r=bholley (62784ed0ee)
- Bug 1268290 followup: remove stray semicolon on a CLOSED TREE. (609540fab1)
- Bug 1268390 - Part 3: Add support for doc style sheets in ServoStyleSet. r=bholley (787cee0d54)
- Bug 1267564 - Implement a couple of Servo-backed style object methods. r=bholley (b27b0f78a0)
- Bug 1250820 - Part 1: Define scoped enum for CSSPseudoClass::Type. r=heycam (c2992f4c01)
- Bug 1250820 - Part 2: Replace nsCSSPseudoClasses::Type with CSSPseudoClassType. r=heycam (8102ab491b)
- Bug 1250820 - Part 3: Replace notPseudo with negation. r=heycam (94f4b95650)
- Bug 1250820 - Part 4: Add MAX to CSSPseudoClassType. r=heycam (85acf2bc45)
- Bug 1206961 - Use channel->AsyncOpen2() for imageLoader; Remove security checks from callsites (r=bz) (0d5b91ca12)
- Bug 1134163 - Part1.Modify animationstart event timing in order to fire event after end of pending task. r=birtles (e2c333fb8d)
- Bug 1134163 - Part2 - Modify animation tests which rely on animationstart timing. r=birtles (fb780f4298)
- Bug 1067769 - Part 1: Avoid doing RequestRestyle and mutation batch for null target. r=birtles (c3a0c1a1ef)
- Bug 1067769 - Part 2: Support nullable target in KeyframeEffect(ReadOnly) constructor. r=birtles (e8ac02ebf0)
- Bug 1067769 - Part 3: Test for KeyframeEffectReadOnly with null target. r=birtles (9ee7fc48c3)
- Bug 1067769 - Part 4: Add some simple tests for document.getAnimation() in wpt. r=birtles (77c18ad32a)
- Bug 1067769 - Part 5: Support setting KeyframeEffect.target webidl interface. r=smaug (cb450cd6f7)
- Bug 1067769 - Part 6: Rename NonOwningAnimationTarget.h to AnimationTarget.h. r=birtles (45083b4141)
- Bug 1067769 - Part 7: Define OwningAnimationTarget and use it. r=birtles (0a716665aa)
- Bug 1067769 - Part 8: Add ConvertTarget function. r=birtles (2663246043)
- Bug 1067769 - Part 9: Wrap RequestRestyle and UnregisterTarget. r=birtles (1deb75c7e0)
- Bug 1067769 - Part 10: Implement SetTarget(). r=birtles (0823f6da17)
- Bug 1067769 - Part 11: Implement animation mutation observer while setting the target. r=birtles (8224724c49)
- Bug 1067769 - Part 12: Use Maybe<OwningAnimationTarget> in KeyframeEffect(ReadOnly) constructors. r=birtles (e057c15804)
- Bug 1067769 - Part 13: Test for setting the target in basic cases. r=birtles (b6a638a268)
- Bug 1067769 - Part 14: Test for our animation mutation observer. r=birtles (5381522d25)
- Bug 1264067 - [css-grid] 'fr' min-sizing is now invalid. r=dholbert (abc7d63364)
- Bug 550426 - Add support for {background,mask}-position-{x,y}, computed style additions. r=dbaron (0dea650527)
- Bug 1266948 - text-decoration-color: currentcolor should not use value from -webkit-text-fill-color; r=jfkthame (9b36b2f493)
- Bug 1271590 - Rename timespecadd to moz_timespecadd. r=jandem (4b417dabae)
- Bug 550426 - Use background-position-x/y when detecting scroll-linked effects. r=dbaron (478331b348)
- Bug 1227327 - Use regular background drawing for XUL groupbox frames. r=mattwoodrow (db42359656)
- Bug 1260329 - Properly escape the frameTable when running |dmd.py --clamp-contents|. r=mccr8. (b40a5a0f49)
- Bug 1148544 - Update tests to work with new way of handling user agent overrides. r=jchen (2cede65d5b)
- Bug 1262326 - Make test_user_agent_overrides.html work in e10s r=nwgh (81c4d7ba00)
- Bug 1180107: Factor out logic for determining whether a flex item's main size could influence cross size. r=mats (94b89305ea)
- Bug 1267471 - Check the snap info when comparing scroll metadata for equality. rs=botond (e5a40f0387)
- Bug 1257288 - Improve the APZ gtest infrastructure to make writing multi-FrameMetrics tests easier. r=kats (b4b898abc2)
- Bug 1256344 - Add a gtest to catch scenarios where the long-press block is interrupted by a non-touch block. r=botond (84982b1ba7)
- Bug 1265510 - Add a gtest for interrupting a scroll snap. r=botond (5f33cdadea)
- Bug 1246290 - Add a simple gtest to exercise the force-disabled-APZ codepaths. r=botond (be91113c70)
- Bug 1267470 - Move more fields from FrameMetrics to ScrollMetadata. r=kats (259f44ab15)
- Bug 1030952 part 4: For flex items with an aspect ratio, stomp on reflow state's main size *and cross size* in final reflow. r=mats (3f02ed9761)
- Bug 550426 - In PropertySupportsVariant, add {background,mask}-position-{x,y} to the list of properties that are parsed by functions. r=dbaron (b350dd9ec4)
- Bug 1258609: Initialize nsICanvasRenderingContextInternal with a DrawTarget instead of a gfxASurface. r=jrmuizel (236656c82d)
- Merge remote-tracking branch 'upstream/dev' into winbuild (c0659b547d)
- [mfbt] NotNull: VC2013 fix (86139057b8)
- layout: put back array initializations back to function body, fix VC2013 build. (3ac23f6474)
This commit is contained in:
@@ -702,7 +702,7 @@ TextAttrsMgr::TextDecorValue::
|
||||
bool isForegroundColor = false;
|
||||
textReset->GetDecorationColor(mColor, isForegroundColor);
|
||||
if (isForegroundColor)
|
||||
mColor = aFrame->StyleContext()->GetTextFillColor();
|
||||
mColor = aFrame->StyleColor()->mColor;
|
||||
|
||||
mLine = textReset->mTextDecorationLine &
|
||||
(NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE |
|
||||
|
||||
@@ -178,7 +178,6 @@
|
||||
@BINPATH@/components/content_html.xpt
|
||||
@BINPATH@/components/content_xslt.xpt
|
||||
@BINPATH@/components/cookie.xpt
|
||||
@BINPATH@/components/devtools_security.xpt
|
||||
@BINPATH@/components/directory.xpt
|
||||
@BINPATH@/components/diskspacewatcher.xpt
|
||||
@BINPATH@/components/docshell.xpt
|
||||
|
||||
@@ -921,16 +921,6 @@ pref("dom.ipc.plugins.enabled.x86_64", true);
|
||||
pref("dom.ipc.plugins.enabled", true);
|
||||
#endif
|
||||
|
||||
// Decode using Gecko Media Plugins in <video>, if a system decoder is not
|
||||
// availble and the preferred GMP is available.
|
||||
pref("media.gmp.decoder.enabled", true);
|
||||
|
||||
// If decoding-via-GMP is turned on for <video>, use Adobe's GMP for decoding,
|
||||
// if it's available. Note: We won't fallback to another GMP if Adobe's is not
|
||||
// installed.
|
||||
pref("media.gmp.decoder.aac", 2);
|
||||
pref("media.gmp.decoder.h264", 2);
|
||||
|
||||
pref("browser.tabs.remote", false);
|
||||
|
||||
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
|
||||
@@ -1294,6 +1284,18 @@ pref("general.useragent.override.addons.mozilla.org","Mozilla/5.0 (Linux; X11; r
|
||||
pref("general.useragent.override.addons.mozilla.org","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0");
|
||||
#endif
|
||||
|
||||
|
||||
// Decode using Gecko Media Plugins in <video>, if a system decoder is not
|
||||
// availble and the preferred GMP is available.
|
||||
pref("media.gmp.decoder.enabled", true);
|
||||
|
||||
// If decoding-via-GMP is turned on for <video>, use Adobe's GMP for decoding,
|
||||
// if it's available. Note: We won't fallback to another GMP if Adobe's is not
|
||||
// installed.
|
||||
pref("media.gmp.decoder.aac", 2);
|
||||
pref("media.gmp.decoder.h264", 2);
|
||||
|
||||
|
||||
// ****************** s4e prefs ******************
|
||||
pref("status4evar.addonbar.borderStyle", false);
|
||||
pref("status4evar.addonbar.closeButton", false);
|
||||
|
||||
@@ -191,7 +191,6 @@
|
||||
#endif
|
||||
@RESPATH@/components/content_xslt.xpt
|
||||
@RESPATH@/components/cookie.xpt
|
||||
@RESPATH@/components/devtools_security.xpt
|
||||
@RESPATH@/components/directory.xpt
|
||||
@RESPATH@/components/docshell.xpt
|
||||
@RESPATH@/components/dom.xpt
|
||||
|
||||
Vendored
+1
@@ -261,6 +261,7 @@ NSS_Init
|
||||
NSS_Initialize
|
||||
NSS_InitWithMerge
|
||||
NSS_IsInitialized
|
||||
NSS_OptionSet
|
||||
NSS_NoDB_Init
|
||||
NSS_SecureMemcmp
|
||||
NSS_SecureMemcmpZero
|
||||
|
||||
@@ -13273,7 +13273,7 @@ nsDocShell::SetBaseUrlForWyciwyg(nsIContentViewer* aContentViewer)
|
||||
if (baseURI) {
|
||||
nsIDocument* document = aContentViewer->GetDocument();
|
||||
if (document) {
|
||||
rv = document->SetBaseURI(baseURI);
|
||||
document->SetBaseURI(baseURI);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
#include "AnimationUtils.h"
|
||||
#include "mozilla/dom/AnimationBinding.h"
|
||||
#include "mozilla/dom/AnimationPlaybackEvent.h"
|
||||
#include "mozilla/AnimationTarget.h"
|
||||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/AsyncEventDispatcher.h" // For AsyncEventDispatcher
|
||||
#include "mozilla/Maybe.h" // For Maybe
|
||||
#include "mozilla/NonOwningAnimationTarget.h"
|
||||
#include "nsAnimationManager.h" // For CSSAnimation
|
||||
#include "nsDOMMutationObserver.h" // For nsAutoAnimationMutationBatch
|
||||
#include "nsIDocument.h" // For nsIDocument
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=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/. */
|
||||
|
||||
#ifndef mozilla_AnimationTarget_h
|
||||
#define mozilla_AnimationTarget_h
|
||||
|
||||
#include "mozilla/Attributes.h" // For MOZ_NON_OWNING_REF
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "nsCSSPseudoElements.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace dom {
|
||||
class Element;
|
||||
} // namespace dom
|
||||
|
||||
struct OwningAnimationTarget
|
||||
{
|
||||
OwningAnimationTarget(dom::Element* aElement, CSSPseudoElementType aType)
|
||||
: mElement(aElement), mPseudoType(aType) { }
|
||||
|
||||
explicit OwningAnimationTarget(dom::Element* aElement)
|
||||
: mElement(aElement) { }
|
||||
|
||||
bool operator==(const OwningAnimationTarget& aOther) const
|
||||
{
|
||||
return mElement == aOther.mElement &&
|
||||
mPseudoType == aOther.mPseudoType;
|
||||
}
|
||||
|
||||
// mElement represents the parent element of a pseudo-element, not the
|
||||
// generated content element.
|
||||
RefPtr<dom::Element> mElement;
|
||||
CSSPseudoElementType mPseudoType = CSSPseudoElementType::NotPseudo;
|
||||
};
|
||||
|
||||
struct NonOwningAnimationTarget
|
||||
{
|
||||
NonOwningAnimationTarget(dom::Element* aElement, CSSPseudoElementType aType)
|
||||
: mElement(aElement), mPseudoType(aType) { }
|
||||
|
||||
explicit NonOwningAnimationTarget(const OwningAnimationTarget& aOther)
|
||||
: mElement(aOther.mElement), mPseudoType(aOther.mPseudoType) { }
|
||||
|
||||
// mElement represents the parent element of a pseudo-element, not the
|
||||
// generated content element.
|
||||
dom::Element* MOZ_NON_OWNING_REF mElement = nullptr;
|
||||
CSSPseudoElementType mPseudoType = CSSPseudoElementType::NotPseudo;
|
||||
};
|
||||
|
||||
|
||||
// Helper functions for cycle-collecting Maybe<OwningAnimationTarget>
|
||||
inline void
|
||||
ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback,
|
||||
Maybe<OwningAnimationTarget>& aTarget,
|
||||
const char* aName,
|
||||
uint32_t aFlags = 0)
|
||||
{
|
||||
if (aTarget) {
|
||||
ImplCycleCollectionTraverse(aCallback, aTarget->mElement, aName, aFlags);
|
||||
}
|
||||
}
|
||||
|
||||
inline void
|
||||
ImplCycleCollectionUnlink(Maybe<OwningAnimationTarget>& aTarget)
|
||||
{
|
||||
if (aTarget) {
|
||||
ImplCycleCollectionUnlink(aTarget->mElement);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_AnimationTarget_h
|
||||
@@ -9,8 +9,9 @@
|
||||
#include "mozilla/dom/Animation.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/KeyframeEffect.h" // For KeyframeEffectReadOnly
|
||||
#include "mozilla/AnimationUtils.h"
|
||||
#include "mozilla/AnimationPerformanceWarning.h"
|
||||
#include "mozilla/AnimationTarget.h"
|
||||
#include "mozilla/AnimationUtils.h"
|
||||
#include "mozilla/EffectSet.h"
|
||||
#include "mozilla/InitializerList.h"
|
||||
#include "mozilla/LayerAnimationInfo.h"
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include "mozilla/EnumeratedArray.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/OwningNonNull.h"
|
||||
#include "mozilla/NonOwningAnimationTarget.h"
|
||||
#include "mozilla/PseudoElementHashEntry.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "nsCSSProperty.h"
|
||||
@@ -30,6 +29,7 @@ namespace mozilla {
|
||||
class EffectSet;
|
||||
class RestyleTracker;
|
||||
struct AnimationPerformanceWarning;
|
||||
struct NonOwningAnimationTarget;
|
||||
|
||||
namespace dom {
|
||||
class Animation;
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "mozilla/dom/AnimatableBinding.h"
|
||||
#include "mozilla/dom/KeyframeEffectBinding.h"
|
||||
#include "mozilla/AnimationUtils.h"
|
||||
#include "mozilla/EffectCompositor.h"
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozilla/LookAndFeel.h" // For LookAndFeel::GetInt
|
||||
#include "mozilla/KeyframeUtils.h"
|
||||
@@ -76,10 +75,9 @@ NS_IMPL_RELEASE_INHERITED(KeyframeEffectReadOnly, AnimationEffectReadOnly)
|
||||
|
||||
KeyframeEffectReadOnly::KeyframeEffectReadOnly(
|
||||
nsIDocument* aDocument,
|
||||
Element* aTarget,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
const Maybe<OwningAnimationTarget>& aTarget,
|
||||
const TimingParams& aTiming)
|
||||
: KeyframeEffectReadOnly(aDocument, aTarget, aPseudoType,
|
||||
: KeyframeEffectReadOnly(aDocument, aTarget,
|
||||
new AnimationEffectTimingReadOnly(aDocument,
|
||||
aTiming))
|
||||
{
|
||||
@@ -87,17 +85,14 @@ KeyframeEffectReadOnly::KeyframeEffectReadOnly(
|
||||
|
||||
KeyframeEffectReadOnly::KeyframeEffectReadOnly(
|
||||
nsIDocument* aDocument,
|
||||
Element* aTarget,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
const Maybe<OwningAnimationTarget>& aTarget,
|
||||
AnimationEffectTimingReadOnly* aTiming)
|
||||
: AnimationEffectReadOnly(aDocument)
|
||||
, mTarget(aTarget)
|
||||
, mTiming(aTiming)
|
||||
, mPseudoType(aPseudoType)
|
||||
, mInEffectOnLastAnimationTimingUpdate(false)
|
||||
{
|
||||
MOZ_ASSERT(aTiming);
|
||||
MOZ_ASSERT(aTarget, "null animation target is not yet supported");
|
||||
}
|
||||
|
||||
JSObject*
|
||||
@@ -162,7 +157,8 @@ KeyframeEffectReadOnly::NotifyAnimationTimingUpdated()
|
||||
bool inEffect = IsInEffect();
|
||||
if (inEffect != mInEffectOnLastAnimationTimingUpdate) {
|
||||
if (mTarget) {
|
||||
EffectSet* effectSet = EffectSet::GetEffectSet(mTarget, mPseudoType);
|
||||
EffectSet* effectSet = EffectSet::GetEffectSet(mTarget->mElement,
|
||||
mTarget->mPseudoType);
|
||||
if (effectSet) {
|
||||
effectSet->MarkCascadeNeedsUpdate();
|
||||
}
|
||||
@@ -188,12 +184,7 @@ KeyframeEffectReadOnly::NotifyAnimationTimingUpdated()
|
||||
CanThrottle() ?
|
||||
EffectCompositor::RestyleType::Throttled :
|
||||
EffectCompositor::RestyleType::Standard;
|
||||
nsPresContext* presContext = GetPresContext();
|
||||
if (presContext) {
|
||||
presContext->EffectCompositor()->
|
||||
RequestRestyle(mTarget, mPseudoType, restyleType,
|
||||
mAnimation->CascadeLevel());
|
||||
}
|
||||
RequestRestyle(restyleType);
|
||||
|
||||
// If we're not relevant, we will have been removed from the EffectSet.
|
||||
// As a result, when the restyle we requested above is fulfilled, our
|
||||
@@ -460,10 +451,11 @@ KeyframeEffectReadOnly::SetFrames(JSContext* aContext,
|
||||
nsIPresShell* shell = doc->GetShell();
|
||||
if (shell && mTarget) {
|
||||
nsIAtom* pseudo =
|
||||
mPseudoType < CSSPseudoElementType::Count ?
|
||||
nsCSSPseudoElements::GetPseudoAtom(mPseudoType) : nullptr;
|
||||
mTarget->mPseudoType < CSSPseudoElementType::Count ?
|
||||
nsCSSPseudoElements::GetPseudoAtom(mTarget->mPseudoType) : nullptr;
|
||||
styleContext =
|
||||
nsComputedDOMStyle::GetStyleContextForElement(mTarget, pseudo, shell);
|
||||
nsComputedDOMStyle::GetStyleContextForElement(mTarget->mElement,
|
||||
pseudo, shell);
|
||||
}
|
||||
|
||||
SetFrames(Move(keyframes), styleContext);
|
||||
@@ -527,8 +519,8 @@ KeyframeEffectReadOnly::UpdateProperties(nsStyleContext* aStyleContext)
|
||||
if (mTarget) {
|
||||
properties =
|
||||
KeyframeUtils::GetAnimationPropertiesFromKeyframes(aStyleContext,
|
||||
mTarget,
|
||||
mPseudoType,
|
||||
mTarget->mElement,
|
||||
mTarget->mPseudoType,
|
||||
mFrames);
|
||||
}
|
||||
|
||||
@@ -559,20 +551,13 @@ KeyframeEffectReadOnly::UpdateProperties(nsStyleContext* aStyleContext)
|
||||
}
|
||||
|
||||
if (mTarget) {
|
||||
EffectSet* effectSet = EffectSet::GetEffectSet(mTarget, mPseudoType);
|
||||
EffectSet* effectSet = EffectSet::GetEffectSet(mTarget->mElement,
|
||||
mTarget->mPseudoType);
|
||||
if (effectSet) {
|
||||
effectSet->MarkCascadeNeedsUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
if (mAnimation) {
|
||||
nsPresContext* presContext = GetPresContext();
|
||||
if (presContext) {
|
||||
presContext->EffectCompositor()->
|
||||
RequestRestyle(mTarget, mPseudoType,
|
||||
EffectCompositor::RestyleType::Layer,
|
||||
mAnimation->CascadeLevel());
|
||||
}
|
||||
RequestRestyle(EffectCompositor::RestyleType::Layer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -716,6 +701,29 @@ KeyframeEffectReadOnly::~KeyframeEffectReadOnly()
|
||||
{
|
||||
}
|
||||
|
||||
static Maybe<OwningAnimationTarget>
|
||||
ConvertTarget(const Nullable<ElementOrCSSPseudoElement>& aTarget)
|
||||
{
|
||||
// Return value optimization.
|
||||
Maybe<OwningAnimationTarget> result;
|
||||
|
||||
if (aTarget.IsNull()) {
|
||||
return result;
|
||||
}
|
||||
|
||||
const ElementOrCSSPseudoElement& target = aTarget.Value();
|
||||
MOZ_ASSERT(target.IsElement() || target.IsCSSPseudoElement(),
|
||||
"Uninitialized target");
|
||||
|
||||
if (target.IsElement()) {
|
||||
result.emplace(&target.GetAsElement());
|
||||
} else {
|
||||
RefPtr<Element> elem = target.GetAsCSSPseudoElement().ParentElement();
|
||||
result.emplace(elem, target.GetAsCSSPseudoElement().GetType());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class KeyframeEffectType, class OptionsType>
|
||||
/* static */ already_AddRefed<KeyframeEffectType>
|
||||
KeyframeEffectReadOnly::ConstructKeyframeEffect(
|
||||
@@ -737,28 +745,10 @@ KeyframeEffectReadOnly::ConstructKeyframeEffect(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (aTarget.IsNull()) {
|
||||
// We don't support null targets yet.
|
||||
aRv.Throw(NS_ERROR_DOM_ANIM_NO_TARGET_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const ElementOrCSSPseudoElement& target = aTarget.Value();
|
||||
MOZ_ASSERT(target.IsElement() || target.IsCSSPseudoElement(),
|
||||
"Uninitialized target");
|
||||
|
||||
RefPtr<Element> targetElement;
|
||||
CSSPseudoElementType pseudoType = CSSPseudoElementType::NotPseudo;
|
||||
if (target.IsElement()) {
|
||||
targetElement = &target.GetAsElement();
|
||||
} else {
|
||||
targetElement = target.GetAsCSSPseudoElement().ParentElement();
|
||||
pseudoType = target.GetAsCSSPseudoElement().GetType();
|
||||
}
|
||||
|
||||
Maybe<OwningAnimationTarget> target = ConvertTarget(aTarget);
|
||||
RefPtr<KeyframeEffectType> effect =
|
||||
new KeyframeEffectType(targetElement->OwnerDoc(), targetElement,
|
||||
pseudoType, timingParams);
|
||||
new KeyframeEffectType(doc, target, timingParams);
|
||||
|
||||
effect->SetFrames(aGlobal.Context(), aFrames, aRv);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
@@ -775,6 +765,14 @@ KeyframeEffectReadOnly::ResetIsRunningOnCompositor()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
KeyframeEffectReadOnly::ResetWinsInCascade()
|
||||
{
|
||||
for (AnimationProperty& property : mProperties) {
|
||||
property.mWinsInCascade = false;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
KeyframeEffectReadOnly::UpdateTargetRegistration()
|
||||
{
|
||||
@@ -792,20 +790,39 @@ KeyframeEffectReadOnly::UpdateTargetRegistration()
|
||||
"Out of date Animation::IsRelevant value");
|
||||
|
||||
if (isRelevant) {
|
||||
EffectSet* effectSet = EffectSet::GetOrCreateEffectSet(mTarget,
|
||||
mPseudoType);
|
||||
EffectSet* effectSet =
|
||||
EffectSet::GetOrCreateEffectSet(mTarget->mElement, mTarget->mPseudoType);
|
||||
effectSet->AddEffect(*this);
|
||||
} else {
|
||||
EffectSet* effectSet = EffectSet::GetEffectSet(mTarget, mPseudoType);
|
||||
if (effectSet) {
|
||||
effectSet->RemoveEffect(*this);
|
||||
if (effectSet->IsEmpty()) {
|
||||
EffectSet::DestroyEffectSet(mTarget, mPseudoType);
|
||||
}
|
||||
UnregisterTarget();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
KeyframeEffectReadOnly::UnregisterTarget()
|
||||
{
|
||||
EffectSet* effectSet =
|
||||
EffectSet::GetEffectSet(mTarget->mElement, mTarget->mPseudoType);
|
||||
if (effectSet) {
|
||||
effectSet->RemoveEffect(*this);
|
||||
if (effectSet->IsEmpty()) {
|
||||
EffectSet::DestroyEffectSet(mTarget->mElement, mTarget->mPseudoType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
KeyframeEffectReadOnly::RequestRestyle(
|
||||
EffectCompositor::RestyleType aRestyleType)
|
||||
{
|
||||
nsPresContext* presContext = GetPresContext();
|
||||
if (presContext && mTarget && mAnimation) {
|
||||
presContext->EffectCompositor()->
|
||||
RequestRestyle(mTarget->mElement, mTarget->mPseudoType,
|
||||
aRestyleType, mAnimation->CascadeLevel());
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
DumpAnimationProperties(nsTArray<AnimationProperty>& aAnimationProperties)
|
||||
@@ -859,15 +876,16 @@ KeyframeEffectReadOnly::GetTarget(
|
||||
return;
|
||||
}
|
||||
|
||||
switch (mPseudoType) {
|
||||
switch (mTarget->mPseudoType) {
|
||||
case CSSPseudoElementType::before:
|
||||
case CSSPseudoElementType::after:
|
||||
aRv.SetValue().SetAsCSSPseudoElement() =
|
||||
CSSPseudoElement::GetCSSPseudoElement(mTarget, mPseudoType);
|
||||
CSSPseudoElement::GetCSSPseudoElement(mTarget->mElement,
|
||||
mTarget->mPseudoType);
|
||||
break;
|
||||
|
||||
case CSSPseudoElementType::NotPseudo:
|
||||
aRv.SetValue().SetAsElement() = mTarget;
|
||||
aRv.SetValue().SetAsElement() = mTarget->mElement;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1073,7 +1091,8 @@ KeyframeEffectReadOnly::CanThrottle() const
|
||||
continue;
|
||||
}
|
||||
|
||||
EffectSet* effectSet = EffectSet::GetEffectSet(mTarget, mPseudoType);
|
||||
EffectSet* effectSet = EffectSet::GetEffectSet(mTarget->mElement,
|
||||
mTarget->mPseudoType);
|
||||
MOZ_ASSERT(effectSet, "CanThrottle should be called on an effect "
|
||||
"associated with a target element");
|
||||
layers::Layer* layer =
|
||||
@@ -1121,7 +1140,8 @@ KeyframeEffectReadOnly::CanThrottleTransformChanges(nsIFrame& aFrame) const
|
||||
TimeStamp now =
|
||||
presContext->RefreshDriver()->MostRecentRefresh();
|
||||
|
||||
EffectSet* effectSet = EffectSet::GetEffectSet(mTarget, mPseudoType);
|
||||
EffectSet* effectSet = EffectSet::GetEffectSet(mTarget->mElement,
|
||||
mTarget->mPseudoType);
|
||||
MOZ_ASSERT(effectSet, "CanThrottleTransformChanges is expected to be called"
|
||||
" on an effect in an effect set");
|
||||
MOZ_ASSERT(mAnimation, "CanThrottleTransformChanges is expected to be called"
|
||||
@@ -1159,18 +1179,18 @@ KeyframeEffectReadOnly::GetAnimationFrame() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsIFrame* frame = mTarget->GetPrimaryFrame();
|
||||
nsIFrame* frame = mTarget->mElement->GetPrimaryFrame();
|
||||
if (!frame) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (mPseudoType == CSSPseudoElementType::before) {
|
||||
if (mTarget->mPseudoType == CSSPseudoElementType::before) {
|
||||
frame = nsLayoutUtils::GetBeforeFrame(frame);
|
||||
} else if (mPseudoType == CSSPseudoElementType::after) {
|
||||
} else if (mTarget->mPseudoType == CSSPseudoElementType::after) {
|
||||
frame = nsLayoutUtils::GetAfterFrame(frame);
|
||||
} else {
|
||||
MOZ_ASSERT(mPseudoType == CSSPseudoElementType::NotPseudo,
|
||||
"unknown mPseudoType");
|
||||
MOZ_ASSERT(mTarget->mPseudoType == CSSPseudoElementType::NotPseudo,
|
||||
"unknown mTarget->mPseudoType");
|
||||
}
|
||||
if (!frame) {
|
||||
return nullptr;
|
||||
@@ -1185,7 +1205,7 @@ KeyframeEffectReadOnly::GetRenderedDocument() const
|
||||
if (!mTarget) {
|
||||
return nullptr;
|
||||
}
|
||||
return mTarget->GetComposedDoc();
|
||||
return mTarget->mElement->GetComposedDoc();
|
||||
}
|
||||
|
||||
nsPresContext*
|
||||
@@ -1303,7 +1323,7 @@ KeyframeEffectReadOnly::SetPerformanceWarning(
|
||||
if (nsLayoutUtils::IsAnimationLoggingEnabled() &&
|
||||
property.mPerformanceWarning->ToLocalizedString(localizedString)) {
|
||||
nsAutoCString logMessage = NS_ConvertUTF16toUTF8(localizedString);
|
||||
AnimationUtils::LogAsyncAnimationFailure(logMessage, mTarget);
|
||||
AnimationUtils::LogAsyncAnimationFailure(logMessage, mTarget->mElement);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1317,10 +1337,9 @@ KeyframeEffectReadOnly::SetPerformanceWarning(
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
KeyframeEffect::KeyframeEffect(nsIDocument* aDocument,
|
||||
Element* aTarget,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
const Maybe<OwningAnimationTarget>& aTarget,
|
||||
const TimingParams& aTiming)
|
||||
: KeyframeEffectReadOnly(aDocument, aTarget, aPseudoType,
|
||||
: KeyframeEffectReadOnly(aDocument, aTarget,
|
||||
new AnimationEffectTiming(aDocument, aTiming, this))
|
||||
{
|
||||
}
|
||||
@@ -1356,10 +1375,13 @@ KeyframeEffect::Constructor(
|
||||
aOptions, aRv);
|
||||
}
|
||||
|
||||
void KeyframeEffect::NotifySpecifiedTimingUpdated()
|
||||
void
|
||||
KeyframeEffect::NotifySpecifiedTimingUpdated()
|
||||
{
|
||||
// Use the same document for a pseudo element and its parent element.
|
||||
nsAutoAnimationMutationBatch mb(mTarget->OwnerDoc());
|
||||
// Use nullptr if we don't have mTarget, so disable the mutation batch.
|
||||
nsAutoAnimationMutationBatch mb(mTarget ? mTarget->mElement->OwnerDoc()
|
||||
: nullptr);
|
||||
|
||||
if (mAnimation) {
|
||||
mAnimation->NotifyEffectTimingUpdated();
|
||||
@@ -1368,12 +1390,43 @@ void KeyframeEffect::NotifySpecifiedTimingUpdated()
|
||||
nsNodeUtils::AnimationChanged(mAnimation);
|
||||
}
|
||||
|
||||
nsPresContext* presContext = GetPresContext();
|
||||
if (presContext) {
|
||||
presContext->EffectCompositor()->
|
||||
RequestRestyle(mTarget, mPseudoType,
|
||||
EffectCompositor::RestyleType::Layer,
|
||||
mAnimation->CascadeLevel());
|
||||
RequestRestyle(EffectCompositor::RestyleType::Layer);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
KeyframeEffect::SetTarget(const Nullable<ElementOrCSSPseudoElement>& aTarget)
|
||||
{
|
||||
Maybe<OwningAnimationTarget> newTarget = ConvertTarget(aTarget);
|
||||
if (mTarget == newTarget) {
|
||||
// Assign the same target, skip it.
|
||||
return;
|
||||
}
|
||||
|
||||
if (mTarget) {
|
||||
UnregisterTarget();
|
||||
ResetIsRunningOnCompositor();
|
||||
ResetWinsInCascade();
|
||||
|
||||
RequestRestyle(EffectCompositor::RestyleType::Layer);
|
||||
|
||||
nsAutoAnimationMutationBatch mb(mTarget->mElement->OwnerDoc());
|
||||
if (mAnimation) {
|
||||
nsNodeUtils::AnimationRemoved(mAnimation);
|
||||
}
|
||||
}
|
||||
|
||||
mTarget = newTarget;
|
||||
|
||||
if (mTarget) {
|
||||
UpdateTargetRegistration();
|
||||
MaybeUpdateProperties();
|
||||
|
||||
RequestRestyle(EffectCompositor::RestyleType::Layer);
|
||||
|
||||
nsAutoAnimationMutationBatch mb(mTarget->mElement->OwnerDoc());
|
||||
if (mAnimation) {
|
||||
nsNodeUtils::AnimationAdded(mAnimation);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1387,5 +1440,30 @@ KeyframeEffect::~KeyframeEffect()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
KeyframeEffect::MaybeUpdateProperties()
|
||||
{
|
||||
if (!mTarget) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsIDocument* doc = mTarget->mElement->OwnerDoc();
|
||||
if (!doc) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsIAtom* pseudo = mTarget->mPseudoType < CSSPseudoElementType::Count ?
|
||||
nsCSSPseudoElements::GetPseudoAtom(mTarget->mPseudoType) :
|
||||
nullptr;
|
||||
RefPtr<nsStyleContext> styleContext =
|
||||
nsComputedDOMStyle::GetStyleContextForElement(mTarget->mElement, pseudo,
|
||||
doc->GetShell());
|
||||
if (!styleContext) {
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateProperties(styleContext);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
@@ -15,12 +15,13 @@
|
||||
#include "nsTArray.h"
|
||||
#include "nsWrapperCache.h"
|
||||
#include "mozilla/AnimationPerformanceWarning.h"
|
||||
#include "mozilla/AnimationTarget.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ComputedTiming.h"
|
||||
#include "mozilla/ComputedTimingFunction.h"
|
||||
#include "mozilla/EffectCompositor.h"
|
||||
#include "mozilla/LayerAnimationInfo.h" // LayerAnimations::kRecords
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/NonOwningAnimationTarget.h"
|
||||
#include "mozilla/OwningNonNull.h" // OwningNonNull<...>
|
||||
#include "mozilla/StickyTimeDuration.h"
|
||||
#include "mozilla/StyleAnimationValue.h"
|
||||
@@ -191,8 +192,7 @@ class KeyframeEffectReadOnly : public AnimationEffectReadOnly
|
||||
{
|
||||
public:
|
||||
KeyframeEffectReadOnly(nsIDocument* aDocument,
|
||||
Element* aTarget,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
const Maybe<OwningAnimationTarget>& aTarget,
|
||||
const TimingParams& aTiming);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
@@ -221,7 +221,7 @@ public:
|
||||
{
|
||||
Maybe<NonOwningAnimationTarget> result;
|
||||
if (mTarget) {
|
||||
result.emplace(mTarget, mPseudoType);
|
||||
result.emplace(*mTarget);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -338,8 +338,7 @@ public:
|
||||
|
||||
protected:
|
||||
KeyframeEffectReadOnly(nsIDocument* aDocument,
|
||||
Element* aTarget,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
const Maybe<OwningAnimationTarget>& aTarget,
|
||||
AnimationEffectTimingReadOnly* aTiming);
|
||||
|
||||
virtual ~KeyframeEffectReadOnly();
|
||||
@@ -353,6 +352,7 @@ protected:
|
||||
ErrorResult& aRv);
|
||||
|
||||
void ResetIsRunningOnCompositor();
|
||||
void ResetWinsInCascade();
|
||||
|
||||
// This effect is registered with its target element so long as:
|
||||
//
|
||||
@@ -365,11 +365,15 @@ protected:
|
||||
// owning Animation's timing.
|
||||
void UpdateTargetRegistration();
|
||||
|
||||
nsCOMPtr<Element> mTarget;
|
||||
// Remove the current effect target from its EffectSet.
|
||||
void UnregisterTarget();
|
||||
|
||||
void RequestRestyle(EffectCompositor::RestyleType aRestyleType);
|
||||
|
||||
Maybe<OwningAnimationTarget> mTarget;
|
||||
RefPtr<Animation> mAnimation;
|
||||
|
||||
RefPtr<AnimationEffectTimingReadOnly> mTiming;
|
||||
CSSPseudoElementType mPseudoType;
|
||||
|
||||
// The specified keyframes.
|
||||
nsTArray<Keyframe> mFrames;
|
||||
@@ -407,8 +411,7 @@ class KeyframeEffect : public KeyframeEffectReadOnly
|
||||
{
|
||||
public:
|
||||
KeyframeEffect(nsIDocument* aDocument,
|
||||
Element* aTarget,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
const Maybe<OwningAnimationTarget>& aTarget,
|
||||
const TimingParams& aTiming);
|
||||
|
||||
JSObject* WrapObject(JSContext* aCx,
|
||||
@@ -433,8 +436,21 @@ public:
|
||||
|
||||
void NotifySpecifiedTimingUpdated();
|
||||
|
||||
// This method calls MaybeUpdateProperties which is not safe to use when
|
||||
// we are in the middle of updating style. If we need to use this when
|
||||
// updating style, we should pass the nsStyleContext into this method and use
|
||||
// that to update the properties rather than calling
|
||||
// GetStyleContextForElement.
|
||||
void SetTarget(const Nullable<ElementOrCSSPseudoElement>& aTarget);
|
||||
|
||||
protected:
|
||||
~KeyframeEffect() override;
|
||||
|
||||
// We need to be careful to *not* call this when we are updating the style
|
||||
// context. That's because calling GetStyleContextForElement when we are in
|
||||
// the process of building a style context may trigger various forms of
|
||||
// infinite recursion.
|
||||
void MaybeUpdateProperties();
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=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/. */
|
||||
|
||||
#ifndef mozilla_NonOwningAnimationTarget_h
|
||||
#define mozilla_NonOwningAnimationTarget_h
|
||||
|
||||
#include "mozilla/Attributes.h" // For MOZ_NON_OWNING_REF
|
||||
#include "nsCSSPseudoElements.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace dom {
|
||||
class Element;
|
||||
} // namespace dom
|
||||
|
||||
struct NonOwningAnimationTarget
|
||||
{
|
||||
NonOwningAnimationTarget(dom::Element* aElement, CSSPseudoElementType aType)
|
||||
: mElement(aElement), mPseudoType(aType) { }
|
||||
|
||||
// mElement represents the parent element of a pseudo-element, not the
|
||||
// generated content element.
|
||||
dom::Element* MOZ_NON_OWNING_REF mElement = nullptr;
|
||||
CSSPseudoElementType mPseudoType = CSSPseudoElementType::NotPseudo;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_NonOwningAnimationTarget_h
|
||||
@@ -8,8 +8,8 @@
|
||||
#define mozilla_PseudoElementHashEntry_h
|
||||
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/AnimationTarget.h"
|
||||
#include "mozilla/HashFunctions.h"
|
||||
#include "mozilla/NonOwningAnimationTarget.h"
|
||||
#include "PLDHashTable.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@@ -21,6 +21,7 @@ EXPORTS.mozilla.dom += [
|
||||
EXPORTS.mozilla += [
|
||||
'AnimationComparator.h',
|
||||
'AnimationPerformanceWarning.h',
|
||||
'AnimationTarget.h',
|
||||
'AnimationUtils.h',
|
||||
'AnimValuesStyleRule.h',
|
||||
'ComputedTiming.h',
|
||||
@@ -28,7 +29,6 @@ EXPORTS.mozilla += [
|
||||
'EffectCompositor.h',
|
||||
'EffectSet.h',
|
||||
'KeyframeUtils.h',
|
||||
'NonOwningAnimationTarget.h',
|
||||
'PendingAnimationTracker.h',
|
||||
'PseudoElementHashEntry.h',
|
||||
'TimingParams.h',
|
||||
|
||||
@@ -2105,6 +2105,81 @@ addAsyncAnimTest("exclude_animations_targeting_pseudo_elements",
|
||||
"records after animation is finished");
|
||||
});
|
||||
|
||||
addAsyncAnimTest("create_animation_without_target",
|
||||
{ observe: document, subtree: true }, function*() {
|
||||
var effect = new KeyframeEffectReadOnly(null,
|
||||
{ opacity: [ 0, 1 ] },
|
||||
{ duration: 10000 });
|
||||
var anim = new Animation(effect, document.timeline);
|
||||
anim.play();
|
||||
yield await_frame();
|
||||
assert_records([], "no records after animation is added");
|
||||
|
||||
anim.cancel();
|
||||
yield await_frame();
|
||||
assert_records([], "no records after animation is removed");
|
||||
});
|
||||
|
||||
addAsyncAnimTest("set_animation_target",
|
||||
{ observe: document, subtree: true }, function*() {
|
||||
var anim = div.animate({ opacity: [ 0, 1 ] },
|
||||
{ duration: 100 * MS_PER_SEC });
|
||||
|
||||
yield await_frame();
|
||||
assert_records([{ added: [anim], changed: [], removed: [] }],
|
||||
"records after animation is added");
|
||||
|
||||
anim.effect.target = null;
|
||||
yield await_frame();
|
||||
assert_records([{ added: [], changed: [], removed: [anim] }],
|
||||
"records after setting null");
|
||||
|
||||
anim.effect.target = div;
|
||||
yield await_frame();
|
||||
assert_records([{ added: [anim], changed: [], removed: [] }],
|
||||
"records after setting a target");
|
||||
|
||||
var newTarget = document.createElement("div");
|
||||
document.body.appendChild(newTarget);
|
||||
anim.effect.target = newTarget;
|
||||
yield await_frame();
|
||||
assert_records([{ added: [], changed: [], removed: [anim] },
|
||||
{ added: [anim], changed: [], removed: [] }],
|
||||
"records after setting a different target");
|
||||
|
||||
anim.cancel();
|
||||
yield await_frame();
|
||||
assert_records([{ added: [], changed: [], removed: [anim] }],
|
||||
"records after animation ends");
|
||||
|
||||
newTarget.remove();
|
||||
});
|
||||
|
||||
addAsyncAnimTest("set_redundant_animation_target",
|
||||
{ observe: div, subtree: true }, function*() {
|
||||
var anim = div.animate({ opacity: [ 0, 1 ] },
|
||||
{ duration: 100 * MS_PER_SEC });
|
||||
yield await_frame();
|
||||
assert_records([{ added: [anim], changed: [], removed: [] }],
|
||||
"records after animation is added");
|
||||
|
||||
anim.effect.target = div;
|
||||
yield await_frame();
|
||||
assert_records([], "no records after setting the same target");
|
||||
|
||||
anim.effect.target = null;
|
||||
yield await_frame();
|
||||
assert_records([{ added: [], changed: [], removed: [anim] }],
|
||||
"records after setting null");
|
||||
|
||||
anim.effect.target = null;
|
||||
yield await_frame();
|
||||
assert_records([], "records after setting redundant null");
|
||||
|
||||
anim.cancel();
|
||||
yield await_frame();
|
||||
});
|
||||
|
||||
// Run the tests.
|
||||
SimpleTest.requestLongerTimeout(2);
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
@@ -3,35 +3,29 @@
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
var archiveReaderEnabled = false;
|
||||
|
||||
var testGenerator = testSteps();
|
||||
var testGenerator;
|
||||
|
||||
function runTest()
|
||||
{
|
||||
enableArchiveReader();
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
testGenerator.next();
|
||||
|
||||
SpecialPowers.pushPrefEnv({'set': [ ["dom.archivereader.enabled", true] ]}, function() {
|
||||
SpecialPowers.createFiles(filesToCreate(),
|
||||
function (files) {
|
||||
testGenerator = testSteps(files);
|
||||
return testGenerator.next();
|
||||
},
|
||||
function (msg) {
|
||||
ok(false, "File creation error: " + msg);
|
||||
finishTest();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function finishTest()
|
||||
{
|
||||
resetArchiveReader();
|
||||
|
||||
SimpleTest.executeSoon(function() {
|
||||
SpecialPowers.popPrefEnv(function() {
|
||||
testGenerator.close();
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
|
||||
function enableArchiveReader()
|
||||
{
|
||||
archiveReaderEnabled = SpecialPowers.getBoolPref("dom.archivereader.enabled");
|
||||
SpecialPowers.setBoolPref("dom.archivereader.enabled", true);
|
||||
}
|
||||
|
||||
function resetArchiveReader()
|
||||
{
|
||||
SpecialPowers.setBoolPref("dom.archivereader.enabled", archiveReaderEnabled);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
[DEFAULT]
|
||||
skip-if = e10s
|
||||
support-files =
|
||||
helpers.js
|
||||
|
||||
|
||||
@@ -10,57 +10,7 @@
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
|
||||
<script type="text/javascript;version=1.7">
|
||||
function createZipFileWithData(fileData) {
|
||||
var Cc = SpecialPowers.Cc;
|
||||
var Ci = SpecialPowers.Ci;
|
||||
|
||||
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
|
||||
var testFile = dirSvc.get("ProfD", Ci.nsIFile);
|
||||
testFile.append("fileArchiveReader.zip");
|
||||
var outStream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(Ci.nsIFileOutputStream);
|
||||
outStream.init(testFile, 0x02 | 0x08 | 0x20, // write, create, truncate
|
||||
0666, 0);
|
||||
outStream.write(fileData, fileData.length);
|
||||
outStream.close();
|
||||
|
||||
var fileList = document.getElementById('fileList');
|
||||
SpecialPowers.wrap(fileList).value = testFile.path;
|
||||
|
||||
return fileList.files[0];
|
||||
}
|
||||
|
||||
function createTextFileWithData(fileData) {
|
||||
var Cc = SpecialPowers.Cc;
|
||||
var Ci = SpecialPowers.Ci;
|
||||
|
||||
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
|
||||
var testFile = dirSvc.get("ProfD", Ci.nsIFile);
|
||||
testFile.append("fileArchiveReader.txt");
|
||||
var outStream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(Ci.nsIFileOutputStream);
|
||||
outStream.init(testFile, 0x02 | 0x08 | 0x20, // write, create, truncate
|
||||
0666, 0);
|
||||
outStream.write(fileData, fileData.length);
|
||||
outStream.close();
|
||||
|
||||
var fileList = document.getElementById('fileList');
|
||||
SpecialPowers.wrap(fileList).value = testFile.path;
|
||||
|
||||
return fileList.files[0];
|
||||
}
|
||||
|
||||
handleFinished = 0;
|
||||
function markTestDone() {
|
||||
++handleFinished;
|
||||
if (isFinished()) {
|
||||
finishTest();
|
||||
}
|
||||
}
|
||||
function isFinished() {
|
||||
return handleFinished == 6;
|
||||
}
|
||||
|
||||
function testSteps()
|
||||
{
|
||||
function filesToCreate() {
|
||||
var binaryString = '504B03040A00000000002E6BF14000000000000000000000000005001C00746573742F555409000337CA055039CA055075780B' +
|
||||
'000104E803000004E8030000504B03041400000008002D6BF1401780E15015000000580200000A001C00746573742F612E7478' +
|
||||
'74555409000336CA05503ACA055075780B000104E803000004E8030000CB48CDC9C95728CF2FCA49E1CA18658FB2A9C4060050' +
|
||||
@@ -78,8 +28,25 @@
|
||||
binaryData += String.fromCharCode(parseInt(hex,16));
|
||||
}
|
||||
|
||||
var binaryFile = createZipFileWithData(binaryData);
|
||||
var textFile = createTextFileWithData("Hello World");
|
||||
return [ {name: "fileArchiveReader.zip", data: binaryData},
|
||||
{name: "fileArchiveReader.txt", data: "Hello World"}];
|
||||
}
|
||||
|
||||
handleFinished = 0;
|
||||
function markTestDone() {
|
||||
++handleFinished;
|
||||
if (isFinished()) {
|
||||
finishTest();
|
||||
}
|
||||
}
|
||||
function isFinished() {
|
||||
return handleFinished == 6;
|
||||
}
|
||||
|
||||
function testSteps(files)
|
||||
{
|
||||
var binaryFile = files[0];
|
||||
var textFile = files[1];
|
||||
|
||||
var status;
|
||||
|
||||
@@ -254,7 +221,6 @@
|
||||
|
||||
<body onload="runTest();">
|
||||
<p id="display">
|
||||
<input id="fileList" type="file"></input>
|
||||
</p>
|
||||
</body>
|
||||
|
||||
|
||||
@@ -10,35 +10,17 @@
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
|
||||
<script type="text/javascript;version=1.7">
|
||||
function createNonUnicodeData() {
|
||||
const Cc = SpecialPowers.Cc;
|
||||
const Ci = SpecialPowers.Ci;
|
||||
|
||||
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
|
||||
var testFile = dirSvc.get("ProfD", Ci.nsIFile);
|
||||
testFile.append("fileArchiveReader_nonUnicode.zip");
|
||||
var outStream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(Ci.nsIFileOutputStream);
|
||||
outStream.init(testFile, 0x02 | 0x08 | 0x20, // write, create, truncate
|
||||
0666, 0);
|
||||
|
||||
function filesToCreate() {
|
||||
var binaryData = "";
|
||||
for (var i = 0, len = binaryString.length / 2; i < len; ++i) {
|
||||
var hex = binaryString[i * 2] + binaryString[i * 2 + 1];
|
||||
binaryData += String.fromCharCode(parseInt(hex,16));
|
||||
}
|
||||
outStream.write(binaryData, binaryData.length);
|
||||
outStream.close();
|
||||
|
||||
var fileList = document.getElementById('fileList');
|
||||
SpecialPowers.wrap(fileList).value = testFile.path;
|
||||
|
||||
return fileList.files[0];
|
||||
return [ {name: "fileArchiveReader_nonUnicode.zip", data: binaryData} ];
|
||||
}
|
||||
|
||||
function test1()
|
||||
function test1(binaryFile)
|
||||
{
|
||||
var binaryFile = createNonUnicodeData();
|
||||
|
||||
var r = new ArchiveReader(binaryFile, { encoding: "ISO-8859-1" });
|
||||
isnot(r, null, "ArchiveReader cannot be null");
|
||||
|
||||
@@ -51,26 +33,24 @@
|
||||
is(this.result.length, 1, "ArchiveReader.getFilenames(): the array contains 1 item");
|
||||
ok(this.reader, r, "ArchiveRequest.reader should be == ArchiveReader");
|
||||
dump('Content: ' + this.result[0] + '\n');
|
||||
test2();
|
||||
test2(binaryFile);
|
||||
}
|
||||
}
|
||||
|
||||
function test2()
|
||||
function test2(binaryFile)
|
||||
{
|
||||
var binaryFile = createNonUnicodeData();
|
||||
|
||||
try {
|
||||
new ArchiveReader(binaryFile, { encoding: "random stuff" });
|
||||
ok(false, "Should have thrown for bogus encoding label.");
|
||||
} catch (e) {
|
||||
ok(e instanceof RangeError, "Expected a RangeError");
|
||||
finishTest();
|
||||
}
|
||||
finishTest();
|
||||
}
|
||||
|
||||
function testSteps()
|
||||
function testSteps(files)
|
||||
{
|
||||
test1();
|
||||
test1(files[0]);
|
||||
yield undefined;
|
||||
}
|
||||
|
||||
@@ -82,7 +62,6 @@
|
||||
|
||||
<body onload="runTest();">
|
||||
<p id="display">
|
||||
<input id="fileList" type="file"></input>
|
||||
</p>
|
||||
<script type="text/javascript;version=1.7">
|
||||
var binaryString = '' +
|
||||
|
||||
@@ -10,34 +10,18 @@
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
|
||||
<script type="text/javascript;version=1.7">
|
||||
function createZipInZipData() {
|
||||
var Cc = SpecialPowers.Cc;
|
||||
var Ci = SpecialPowers.Ci;
|
||||
|
||||
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
|
||||
var testFile = dirSvc.get("ProfD", Ci.nsIFile);
|
||||
testFile.append("fileArchiveReader_42.zip");
|
||||
var outStream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(Ci.nsIFileOutputStream);
|
||||
outStream.init(testFile, 0x02 | 0x08 | 0x20, // write, create, truncate
|
||||
0666, 0);
|
||||
|
||||
function filesToCreate() {
|
||||
var binaryData = "";
|
||||
for (var i = 0, len = binaryString.length / 2; i < len; ++i) {
|
||||
var hex = binaryString[i * 2] + binaryString[i * 2 + 1];
|
||||
binaryData += String.fromCharCode(parseInt(hex,16));
|
||||
}
|
||||
outStream.write(binaryData, binaryData.length);
|
||||
outStream.close();
|
||||
|
||||
var fileList = document.getElementById('fileList');
|
||||
SpecialPowers.wrap(fileList).value = testFile.path;
|
||||
|
||||
return fileList.files[0];
|
||||
return [ {name: "fileArchiveReader_42.zip", data: binaryData} ];
|
||||
}
|
||||
|
||||
function testSteps()
|
||||
function testSteps(files)
|
||||
{
|
||||
var binaryFile = createZipInZipData();
|
||||
var binaryFile = files[0];
|
||||
|
||||
// The input is 4 nested zip archives:
|
||||
doLoop(binaryFile, 4);
|
||||
@@ -96,7 +80,6 @@
|
||||
|
||||
<body onload="runTest();">
|
||||
<p id="display">
|
||||
<input id="fileList" type="file"></input>
|
||||
</p>
|
||||
<script type="text/javascript;version=1.7">
|
||||
var binaryString = '' +
|
||||
|
||||
@@ -218,7 +218,6 @@ Attr::GetSpecified(bool* aSpecified)
|
||||
Element*
|
||||
Attr::GetOwnerElement(ErrorResult& aRv)
|
||||
{
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eOwnerElement);
|
||||
return GetElement();
|
||||
}
|
||||
|
||||
@@ -226,7 +225,6 @@ NS_IMETHODIMP
|
||||
Attr::GetOwnerElement(nsIDOMElement** aOwnerElement)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aOwnerElement);
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eOwnerElement);
|
||||
|
||||
Element* element = GetElement();
|
||||
if (element) {
|
||||
|
||||
+14
-12
@@ -96,6 +96,7 @@ public:
|
||||
, mIDType(eUnknown)
|
||||
, mOuterIDNumber(0)
|
||||
, mInnerIDNumber(0)
|
||||
, mStatus(eUnused)
|
||||
#ifdef DEBUG
|
||||
, mOwningThread(PR_GetCurrentThread())
|
||||
#endif
|
||||
@@ -1048,7 +1049,6 @@ void
|
||||
Console::Trace(JSContext* aCx)
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(mStatus == eInitialized);
|
||||
|
||||
const Sequence<JS::Value> data;
|
||||
Method(aCx, MethodTrace, NS_LITERAL_STRING("trace"), data);
|
||||
@@ -1066,7 +1066,6 @@ void
|
||||
Console::Time(JSContext* aCx, const JS::Handle<JS::Value> aTime)
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(mStatus == eInitialized);
|
||||
|
||||
Sequence<JS::Value> data;
|
||||
SequenceRooter<JS::Value> rooter(aCx, &data);
|
||||
@@ -1082,7 +1081,6 @@ void
|
||||
Console::TimeEnd(JSContext* aCx, const JS::Handle<JS::Value> aTime)
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(mStatus == eInitialized);
|
||||
|
||||
Sequence<JS::Value> data;
|
||||
SequenceRooter<JS::Value> rooter(aCx, &data);
|
||||
@@ -1098,7 +1096,6 @@ void
|
||||
Console::TimeStamp(JSContext* aCx, const JS::Handle<JS::Value> aData)
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(mStatus == eInitialized);
|
||||
|
||||
Sequence<JS::Value> data;
|
||||
SequenceRooter<JS::Value> rooter(aCx, &data);
|
||||
@@ -1114,8 +1111,6 @@ void
|
||||
Console::Profile(JSContext* aCx, const Sequence<JS::Value>& aData)
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(mStatus == eInitialized);
|
||||
|
||||
ProfileMethod(aCx, NS_LITERAL_STRING("profile"), aData);
|
||||
}
|
||||
|
||||
@@ -1123,8 +1118,6 @@ void
|
||||
Console::ProfileEnd(JSContext* aCx, const Sequence<JS::Value>& aData)
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(mStatus == eInitialized);
|
||||
|
||||
ProfileMethod(aCx, NS_LITERAL_STRING("profileEnd"), aData);
|
||||
}
|
||||
|
||||
@@ -1132,7 +1125,9 @@ void
|
||||
Console::ProfileMethod(JSContext* aCx, const nsAString& aAction,
|
||||
const Sequence<JS::Value>& aData)
|
||||
{
|
||||
MOZ_ASSERT(mStatus == eInitialized);
|
||||
if (IsShuttingDown()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!NS_IsMainThread()) {
|
||||
// Here we are in a worker thread.
|
||||
@@ -1190,7 +1185,6 @@ Console::Assert(JSContext* aCx, bool aCondition,
|
||||
const Sequence<JS::Value>& aData)
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(mStatus == eInitialized);
|
||||
|
||||
if (!aCondition) {
|
||||
Method(aCx, MethodAssert, NS_LITERAL_STRING("assert"), aData);
|
||||
@@ -1203,7 +1197,6 @@ void
|
||||
Console::NoopMethod()
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(mStatus == eInitialized);
|
||||
|
||||
// Nothing to do.
|
||||
}
|
||||
@@ -1277,7 +1270,9 @@ Console::Method(JSContext* aCx, MethodName aMethodName,
|
||||
const Sequence<JS::Value>& aData)
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(mStatus == eInitialized);
|
||||
if (IsShuttingDown()) {
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<ConsoleCallData> callData(new ConsoleCallData());
|
||||
|
||||
@@ -2410,5 +2405,12 @@ Console::AssertIsOnOwningThread() const
|
||||
MOZ_ASSERT(PR_GetCurrentThread() == mOwningThread);
|
||||
}
|
||||
|
||||
bool
|
||||
Console::IsShuttingDown() const
|
||||
{
|
||||
MOZ_ASSERT(mStatus != eUnknown);
|
||||
return mStatus == eShuttingDown;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
+4
-2
@@ -36,8 +36,6 @@ class Console final : public nsIObserver
|
||||
, public nsWrapperCache
|
||||
, public nsSupportsWeakReference
|
||||
{
|
||||
~Console();
|
||||
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(Console, nsIObserver)
|
||||
@@ -133,6 +131,7 @@ public:
|
||||
|
||||
private:
|
||||
explicit Console(nsPIDOMWindow* aWindow);
|
||||
~Console();
|
||||
|
||||
void
|
||||
Initialize(ErrorResult& aRv);
|
||||
@@ -343,6 +342,9 @@ private:
|
||||
void
|
||||
AssertIsOnOwningThread() const;
|
||||
|
||||
bool
|
||||
IsShuttingDown() const;
|
||||
|
||||
// All these nsCOMPtr are touched on main thread only.
|
||||
nsCOMPtr<nsPIDOMWindow> mWindow;
|
||||
nsCOMPtr<nsIConsoleAPIStorage> mStorage;
|
||||
|
||||
@@ -184,7 +184,7 @@ EventSource::Init(nsISupports* aOwner,
|
||||
const nsAString& aURL,
|
||||
bool aWithCredentials)
|
||||
{
|
||||
if (mReadyState != CONNECTING || !PrefEnabled()) {
|
||||
if (mReadyState != CONNECTING) {
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
@@ -571,13 +571,6 @@ EventSource::GetInterface(const nsIID & aIID,
|
||||
return QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
// static
|
||||
bool
|
||||
EventSource::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
|
||||
{
|
||||
return Preferences::GetBool("dom.server-events.enabled", false);
|
||||
}
|
||||
|
||||
nsresult
|
||||
EventSource::GetBaseURI(nsIURI **aBaseURI)
|
||||
{
|
||||
|
||||
@@ -93,9 +93,6 @@ public:
|
||||
IMPL_EVENT_HANDLER(error)
|
||||
void Close();
|
||||
|
||||
// Determine if preferences allow EventSource
|
||||
static bool PrefEnabled(JSContext* aCx = nullptr, JSObject* aGlobal = nullptr);
|
||||
|
||||
virtual void DisconnectFromOwner() override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -337,7 +337,14 @@ URLSearchParams::Constructor(const GlobalObject& aGlobal,
|
||||
{
|
||||
RefPtr<URLSearchParams> sp =
|
||||
new URLSearchParams(aGlobal.GetAsSupports(), nullptr);
|
||||
sp->ParseInput(NS_ConvertUTF16toUTF8(aInit));
|
||||
|
||||
NS_ConvertUTF16toUTF8 input(aInit);
|
||||
|
||||
if (StringBeginsWith(input, NS_LITERAL_CSTRING("?"))) {
|
||||
sp->ParseInput(Substring(input, 1, input.Length() - 1));
|
||||
} else {
|
||||
sp->ParseInput(input);
|
||||
}
|
||||
|
||||
return sp.forget();
|
||||
}
|
||||
|
||||
@@ -296,13 +296,27 @@ WindowNamedPropertiesHandler::Create(JSContext* aCx,
|
||||
// Note: since the scope polluter proxy lives on the window's prototype
|
||||
// chain, it needs a singleton type to avoid polluting type information
|
||||
// for properties on the window.
|
||||
JS::Rooted<JSObject*> gsp(aCx);
|
||||
js::ProxyOptions options;
|
||||
options.setSingleton(true);
|
||||
options.setClass(&WindowNamedPropertiesClass.mBase);
|
||||
return js::NewProxyObject(aCx, WindowNamedPropertiesHandler::getInstance(),
|
||||
JS::NullHandleValue, aProto,
|
||||
options);
|
||||
|
||||
JS::Rooted<JSObject*> gsp(aCx);
|
||||
gsp = js::NewProxyObject(aCx, WindowNamedPropertiesHandler::getInstance(),
|
||||
JS::NullHandleValue, aProto,
|
||||
options);
|
||||
if (!gsp) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool succeeded;
|
||||
if (!JS_SetImmutablePrototype(aCx, gsp, &succeeded)) {
|
||||
return nullptr;
|
||||
}
|
||||
MOZ_ASSERT(succeeded,
|
||||
"errors making the [[Prototype]] of the named properties object "
|
||||
"immutable should have been JSAPI failures, not !succeeded");
|
||||
|
||||
return gsp;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
|
||||
@@ -83,7 +83,7 @@ ContentAreaDropListener.prototype =
|
||||
|
||||
// Use file:/// as the default uri so that drops of file URIs are always allowed
|
||||
let principal = sourceNode ? sourceNode.nodePrincipal
|
||||
: secMan.getSimpleCodebasePrincipal(ioService.newURI("file:///", null, null));
|
||||
: secMan.createCodebasePrincipal(ioService.newURI("file:///", null, null), {});
|
||||
|
||||
secMan.checkLoadURIStrWithPrincipal(principal, uriString, flags);
|
||||
|
||||
|
||||
@@ -118,7 +118,6 @@ DOM4_MSG_DEF(BtAuthRejectedError, "Authentication rejected", NS_ERROR_DOM_BLUET
|
||||
/* Web Animations errors */
|
||||
|
||||
DOM4_MSG_DEF(NotSupportedError, "Animation to or from an underlying value is not yet supported.", NS_ERROR_DOM_ANIM_MISSING_PROPS_ERR)
|
||||
DOM4_MSG_DEF(NotSupportedError, "Animation with no target is not yet supported.", NS_ERROR_DOM_ANIM_NO_TARGET_ERR)
|
||||
DOM4_MSG_DEF(NotSupportedError, "Animation with no timeline is not yet supported.", NS_ERROR_DOM_ANIM_NO_TIMELINE_ERR)
|
||||
DOM4_MSG_DEF(NotSupportedError, "Animation with no effect is not yet supported.", NS_ERROR_DOM_ANIM_NO_EFFECT_ERR)
|
||||
|
||||
|
||||
@@ -381,12 +381,12 @@ nsAttrAndChildArray::AttrAt(uint32_t aPos) const
|
||||
NS_ASSERTION(aPos < AttrCount(),
|
||||
"out-of-bounds access in nsAttrAndChildArray");
|
||||
|
||||
uint32_t mapped = MappedAttrCount();
|
||||
if (aPos < mapped) {
|
||||
return mImpl->mMappedAttrs->AttrAt(aPos);
|
||||
uint32_t nonmapped = NonMappedAttrCount();
|
||||
if (aPos < nonmapped) {
|
||||
return &ATTRS(mImpl)[aPos].mValue;
|
||||
}
|
||||
|
||||
return &ATTRS(mImpl)[aPos - mapped].mValue;
|
||||
return mImpl->mMappedAttrs->AttrAt(aPos - nonmapped);
|
||||
}
|
||||
|
||||
nsresult
|
||||
@@ -454,36 +454,35 @@ nsAttrAndChildArray::RemoveAttrAt(uint32_t aPos, nsAttrValue& aValue)
|
||||
{
|
||||
NS_ASSERTION(aPos < AttrCount(), "out-of-bounds");
|
||||
|
||||
uint32_t mapped = MappedAttrCount();
|
||||
if (aPos < mapped) {
|
||||
if (mapped == 1) {
|
||||
// We're removing the last mapped attribute. Can't swap in this
|
||||
// case; have to copy.
|
||||
aValue.SetTo(*mImpl->mMappedAttrs->AttrAt(0));
|
||||
NS_RELEASE(mImpl->mMappedAttrs);
|
||||
uint32_t nonmapped = NonMappedAttrCount();
|
||||
if (aPos < nonmapped) {
|
||||
ATTRS(mImpl)[aPos].mValue.SwapValueWith(aValue);
|
||||
ATTRS(mImpl)[aPos].~InternalAttr();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
uint32_t slotCount = AttrSlotCount();
|
||||
memmove(&ATTRS(mImpl)[aPos],
|
||||
&ATTRS(mImpl)[aPos + 1],
|
||||
(slotCount - aPos - 1) * sizeof(InternalAttr));
|
||||
memset(&ATTRS(mImpl)[slotCount - 1], 0, sizeof(InternalAttr));
|
||||
|
||||
RefPtr<nsMappedAttributes> mapped =
|
||||
GetModifiableMapped(nullptr, nullptr, false);
|
||||
|
||||
mapped->RemoveAttrAt(aPos, aValue);
|
||||
|
||||
return MakeMappedUnique(mapped);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
aPos -= mapped;
|
||||
ATTRS(mImpl)[aPos].mValue.SwapValueWith(aValue);
|
||||
ATTRS(mImpl)[aPos].~InternalAttr();
|
||||
if (MappedAttrCount() == 1) {
|
||||
// We're removing the last mapped attribute. Can't swap in this
|
||||
// case; have to copy.
|
||||
aValue.SetTo(*mImpl->mMappedAttrs->AttrAt(0));
|
||||
NS_RELEASE(mImpl->mMappedAttrs);
|
||||
|
||||
uint32_t slotCount = AttrSlotCount();
|
||||
memmove(&ATTRS(mImpl)[aPos],
|
||||
&ATTRS(mImpl)[aPos + 1],
|
||||
(slotCount - aPos - 1) * sizeof(InternalAttr));
|
||||
memset(&ATTRS(mImpl)[slotCount - 1], 0, sizeof(InternalAttr));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
RefPtr<nsMappedAttributes> mapped =
|
||||
GetModifiableMapped(nullptr, nullptr, false);
|
||||
|
||||
mapped->RemoveAttrAt(aPos - nonmapped, aValue);
|
||||
|
||||
return MakeMappedUnique(mapped);
|
||||
}
|
||||
|
||||
const nsAttrName*
|
||||
@@ -492,33 +491,32 @@ nsAttrAndChildArray::AttrNameAt(uint32_t aPos) const
|
||||
NS_ASSERTION(aPos < AttrCount(),
|
||||
"out-of-bounds access in nsAttrAndChildArray");
|
||||
|
||||
uint32_t mapped = MappedAttrCount();
|
||||
if (aPos < mapped) {
|
||||
return mImpl->mMappedAttrs->NameAt(aPos);
|
||||
uint32_t nonmapped = NonMappedAttrCount();
|
||||
if (aPos < nonmapped) {
|
||||
return &ATTRS(mImpl)[aPos].mName;
|
||||
}
|
||||
|
||||
return &ATTRS(mImpl)[aPos - mapped].mName;
|
||||
return mImpl->mMappedAttrs->NameAt(aPos - nonmapped);
|
||||
}
|
||||
|
||||
const nsAttrName*
|
||||
nsAttrAndChildArray::GetSafeAttrNameAt(uint32_t aPos) const
|
||||
{
|
||||
uint32_t mapped = MappedAttrCount();
|
||||
if (aPos < mapped) {
|
||||
return mImpl->mMappedAttrs->NameAt(aPos);
|
||||
uint32_t nonmapped = NonMappedAttrCount();
|
||||
if (aPos < nonmapped) {
|
||||
void** pos = mImpl->mBuffer + aPos * ATTRSIZE;
|
||||
if (!*pos) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return &reinterpret_cast<InternalAttr*>(pos)->mName;
|
||||
}
|
||||
|
||||
aPos -= mapped;
|
||||
if (aPos >= AttrSlotCount()) {
|
||||
if (aPos >= AttrCount()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void** pos = mImpl->mBuffer + aPos * ATTRSIZE;
|
||||
if (!*pos) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return &reinterpret_cast<InternalAttr*>(pos)->mName;
|
||||
return mImpl->mMappedAttrs->NameAt(aPos - nonmapped);
|
||||
}
|
||||
|
||||
const nsAttrName*
|
||||
@@ -545,25 +543,24 @@ nsAttrAndChildArray::IndexOfAttr(nsIAtom* aLocalName, int32_t aNamespaceID) cons
|
||||
if (mImpl && mImpl->mMappedAttrs && aNamespaceID == kNameSpaceID_None) {
|
||||
idx = mImpl->mMappedAttrs->IndexOfAttr(aLocalName);
|
||||
if (idx >= 0) {
|
||||
return idx;
|
||||
return NonMappedAttrCount() + idx;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t i;
|
||||
uint32_t mapped = MappedAttrCount();
|
||||
uint32_t slotCount = AttrSlotCount();
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
// This should be the common case so lets make an optimized loop
|
||||
for (i = 0; i < slotCount && AttrSlotIsTaken(i); ++i) {
|
||||
if (ATTRS(mImpl)[i].mName.Equals(aLocalName)) {
|
||||
return i + mapped;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (i = 0; i < slotCount && AttrSlotIsTaken(i); ++i) {
|
||||
if (ATTRS(mImpl)[i].mName.Equals(aLocalName, aNamespaceID)) {
|
||||
return i + mapped;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+29
-24
@@ -7399,27 +7399,32 @@ nsContentUtils::TransferableToIPCTransferable(nsITransferable* aTransferable,
|
||||
RefPtr<mozilla::gfx::SourceSurface> surface =
|
||||
image->GetFrame(imgIContainer::FRAME_CURRENT,
|
||||
imgIContainer::FLAG_SYNC_DECODE);
|
||||
if (surface) {
|
||||
RefPtr<mozilla::gfx::DataSourceSurface> dataSurface =
|
||||
surface->GetDataSurface();
|
||||
size_t length;
|
||||
int32_t stride;
|
||||
mozilla::UniquePtr<char[]> surfaceData =
|
||||
nsContentUtils::GetSurfaceData(dataSurface, &length, &stride);
|
||||
|
||||
IPCDataTransferItem* item = aIPCDataTransfer->items().AppendElement();
|
||||
item->flavor() = flavorStr;
|
||||
// Turn item->data() into an nsCString prior to accessing it.
|
||||
item->data() = EmptyCString();
|
||||
item->data().get_nsCString().Adopt(surfaceData.release(), length);
|
||||
|
||||
IPCDataTransferImage& imageDetails = item->imageDetails();
|
||||
mozilla::gfx::IntSize size = dataSurface->GetSize();
|
||||
imageDetails.width() = size.width;
|
||||
imageDetails.height() = size.height;
|
||||
imageDetails.stride() = stride;
|
||||
imageDetails.format() = static_cast<uint8_t>(dataSurface->GetFormat());
|
||||
if (!surface) {
|
||||
continue;
|
||||
}
|
||||
RefPtr<mozilla::gfx::DataSourceSurface> dataSurface =
|
||||
surface->GetDataSurface();
|
||||
if (!dataSurface) {
|
||||
continue;
|
||||
}
|
||||
size_t length;
|
||||
int32_t stride;
|
||||
mozilla::UniquePtr<char[]> surfaceData =
|
||||
nsContentUtils::GetSurfaceData(WrapNotNull(dataSurface), &length,
|
||||
&stride);
|
||||
|
||||
IPCDataTransferItem* item = aIPCDataTransfer->items().AppendElement();
|
||||
item->flavor() = flavorStr;
|
||||
// Turn item->data() into an nsCString prior to accessing it.
|
||||
item->data() = EmptyCString();
|
||||
item->data().get_nsCString().Adopt(surfaceData.release(), length);
|
||||
|
||||
IPCDataTransferImage& imageDetails = item->imageDetails();
|
||||
mozilla::gfx::IntSize size = dataSurface->GetSize();
|
||||
imageDetails.width() = size.width;
|
||||
imageDetails.height() = size.height;
|
||||
imageDetails.stride() = stride;
|
||||
imageDetails.format() = static_cast<uint8_t>(dataSurface->GetFormat());
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -7510,8 +7515,9 @@ nsContentUtils::TransferableToIPCTransferable(nsITransferable* aTransferable,
|
||||
}
|
||||
|
||||
mozilla::UniquePtr<char[]>
|
||||
nsContentUtils::GetSurfaceData(mozilla::gfx::DataSourceSurface* aSurface,
|
||||
size_t* aLength, int32_t* aStride)
|
||||
nsContentUtils::GetSurfaceData(
|
||||
NotNull<mozilla::gfx::DataSourceSurface*> aSurface,
|
||||
size_t* aLength, int32_t* aStride)
|
||||
{
|
||||
mozilla::gfx::DataSourceSurface::MappedSurface map;
|
||||
if (NS_WARN_IF(!aSurface->Map(mozilla::gfx::DataSourceSurface::MapType::READ, &map))) {
|
||||
@@ -8581,8 +8587,7 @@ StartElement(Element* aContent, StringBuilder& aBuilder)
|
||||
}
|
||||
|
||||
int32_t count = aContent->GetAttrCount();
|
||||
for (int32_t i = count; i > 0;) {
|
||||
--i;
|
||||
for (int32_t i = 0; i < count; i++) {
|
||||
const nsAttrName* name = aContent->GetAttrNameAt(i);
|
||||
int32_t attNs = name->NamespaceID();
|
||||
nsIAtom* attName = name->LocalName();
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozilla/net/ReferrerPolicy.h"
|
||||
#include "mozilla/Logging.h"
|
||||
#include "mozilla/NotNull.h"
|
||||
#include "nsIContentPolicy.h"
|
||||
|
||||
#if defined(XP_WIN)
|
||||
@@ -2436,8 +2437,9 @@ public:
|
||||
* Get the pixel data from the given source surface and return it as a buffer.
|
||||
* The length and stride will be assigned from the surface.
|
||||
*/
|
||||
static mozilla::UniquePtr<char[]> GetSurfaceData(mozilla::gfx::DataSourceSurface* aSurface,
|
||||
size_t* aLength, int32_t* aStride);
|
||||
static mozilla::UniquePtr<char[]> GetSurfaceData(
|
||||
mozilla::NotNull<mozilla::gfx::DataSourceSurface*> aSurface,
|
||||
size_t* aLength, int32_t* aStride);
|
||||
|
||||
// Helpers shared by the implementations of nsContentUtils methods and
|
||||
// nsIDOMWindowUtils methods.
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsIScriptObjectPrincipal.h"
|
||||
#include "nsProxyRelease.h"
|
||||
|
||||
#include "DataChannel.h"
|
||||
#include "DataChannelLog.h"
|
||||
@@ -43,7 +44,7 @@ nsDOMDataChannel::~nsDOMDataChannel()
|
||||
// Don't call us anymore! Likely isn't an issue (or maybe just less of
|
||||
// one) once we block GC until all the (appropriate) onXxxx handlers
|
||||
// are dropped. (See WebRTC spec)
|
||||
LOG(("Close()ing %p", mDataChannel.get()));
|
||||
LOG(("%p: Close()ing %p", this, mDataChannel.get()));
|
||||
mDataChannel->SetListener(nullptr, nullptr);
|
||||
mDataChannel->Close();
|
||||
}
|
||||
@@ -77,6 +78,8 @@ nsDOMDataChannel::nsDOMDataChannel(already_AddRefed<mozilla::DataChannel>& aData
|
||||
aWindow->GetCurrentInnerWindow() : aWindow)
|
||||
, mDataChannel(aDataChannel)
|
||||
, mBinaryType(DC_BINARY_TYPE_BLOB)
|
||||
, mCheckMustKeepAlive(true)
|
||||
, mSentClose(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -263,6 +266,7 @@ NS_IMETHODIMP
|
||||
nsDOMDataChannel::Close()
|
||||
{
|
||||
mDataChannel->Close();
|
||||
UpdateMustKeepAlive();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -472,9 +476,20 @@ nsDOMDataChannel::OnChannelConnected(nsISupports* aContext)
|
||||
nsresult
|
||||
nsDOMDataChannel::OnChannelClosed(nsISupports* aContext)
|
||||
{
|
||||
LOG(("%p(%p): %s - Dispatching\n",this,(void*)mDataChannel,__FUNCTION__));
|
||||
nsresult rv;
|
||||
// so we don't have to worry if we're notified from different paths in
|
||||
// the underlying code
|
||||
if (!mSentClose) {
|
||||
LOG(("%p(%p): %s - Dispatching\n",this,(void*)mDataChannel,__FUNCTION__));
|
||||
|
||||
return OnSimpleEvent(aContext, NS_LITERAL_STRING("close"));
|
||||
rv = OnSimpleEvent(aContext, NS_LITERAL_STRING("close"));
|
||||
// no more events can happen
|
||||
mSentClose = true;
|
||||
} else {
|
||||
rv = NS_OK;
|
||||
}
|
||||
DontKeepAliveAnyMore();
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
@@ -485,12 +500,111 @@ nsDOMDataChannel::OnBufferLow(nsISupports* aContext)
|
||||
return OnSimpleEvent(aContext, NS_LITERAL_STRING("bufferedamountlow"));
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMDataChannel::NotBuffered(nsISupports* aContext)
|
||||
{
|
||||
// In the rare case that we held off GC to let the buffer drain
|
||||
UpdateMustKeepAlive();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsDOMDataChannel::AppReady()
|
||||
{
|
||||
mDataChannel->AppReady();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Methods that keep alive the DataChannel object when:
|
||||
// 1. the object has registered event listeners that can be triggered
|
||||
// ("strong event listeners");
|
||||
// 2. there are outgoing not sent messages.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void
|
||||
nsDOMDataChannel::UpdateMustKeepAlive()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (!mCheckMustKeepAlive) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool shouldKeepAlive = false;
|
||||
uint16_t readyState = mDataChannel->GetReadyState();
|
||||
|
||||
switch (readyState)
|
||||
{
|
||||
case DataChannel::CONNECTING:
|
||||
case DataChannel::WAITING_TO_OPEN:
|
||||
{
|
||||
if (mListenerManager &&
|
||||
(mListenerManager->HasListenersFor(nsGkAtoms::onopen) ||
|
||||
mListenerManager->HasListenersFor(nsGkAtoms::onmessage) ||
|
||||
mListenerManager->HasListenersFor(nsGkAtoms::onerror) ||
|
||||
mListenerManager->HasListenersFor(nsGkAtoms::onbufferedamountlow) ||
|
||||
mListenerManager->HasListenersFor(nsGkAtoms::onclose))) {
|
||||
shouldKeepAlive = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case DataChannel::OPEN:
|
||||
case DataChannel::CLOSING:
|
||||
{
|
||||
if (mDataChannel->GetBufferedAmount() != 0 ||
|
||||
(mListenerManager &&
|
||||
(mListenerManager->HasListenersFor(nsGkAtoms::onmessage) ||
|
||||
mListenerManager->HasListenersFor(nsGkAtoms::onerror) ||
|
||||
mListenerManager->HasListenersFor(nsGkAtoms::onbufferedamountlow) ||
|
||||
mListenerManager->HasListenersFor(nsGkAtoms::onclose)))) {
|
||||
shouldKeepAlive = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case DataChannel::CLOSED:
|
||||
{
|
||||
shouldKeepAlive = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (mSelfRef && !shouldKeepAlive) {
|
||||
// release our self-reference (safely) by putting it in an event (always)
|
||||
NS_ReleaseOnMainThread(mSelfRef.forget(), true);
|
||||
} else if (!mSelfRef && shouldKeepAlive) {
|
||||
mSelfRef = this;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsDOMDataChannel::DontKeepAliveAnyMore()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (mSelfRef) {
|
||||
// Since we're on MainThread, force an eventloop trip to avoid deleting ourselves.
|
||||
NS_ReleaseOnMainThread(mSelfRef.forget(), true);
|
||||
}
|
||||
|
||||
mCheckMustKeepAlive = false;
|
||||
}
|
||||
|
||||
void
|
||||
nsDOMDataChannel::EventListenerAdded(nsIAtom* aType)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
UpdateMustKeepAlive();
|
||||
}
|
||||
|
||||
void
|
||||
nsDOMDataChannel::EventListenerRemoved(nsIAtom* aType)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
UpdateMustKeepAlive();
|
||||
}
|
||||
|
||||
|
||||
/* static */
|
||||
nsresult
|
||||
NS_NewDOMDataChannel(already_AddRefed<mozilla::DataChannel>&& aDataChannel,
|
||||
|
||||
@@ -42,6 +42,10 @@ public:
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMDataChannel,
|
||||
mozilla::DOMEventTargetHelper)
|
||||
|
||||
// EventTarget
|
||||
virtual void EventListenerAdded(nsIAtom* aType) override;
|
||||
virtual void EventListenerRemoved(nsIAtom* aType) override;
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
override;
|
||||
nsPIDOMWindow* GetParentObject() const
|
||||
@@ -103,9 +107,20 @@ public:
|
||||
virtual nsresult
|
||||
OnBufferLow(nsISupports* aContext) override;
|
||||
|
||||
virtual nsresult
|
||||
NotBuffered(nsISupports* aContext) override;
|
||||
|
||||
virtual void
|
||||
AppReady();
|
||||
|
||||
// if there are "strong event listeners" or outgoing not sent messages
|
||||
// then this method keeps the object alive when js doesn't have strong
|
||||
// references to it.
|
||||
void UpdateMustKeepAlive();
|
||||
// ATTENTION, when calling this method the object can be released
|
||||
// (and possibly collected).
|
||||
void DontKeepAliveAnyMore();
|
||||
|
||||
protected:
|
||||
~nsDOMDataChannel();
|
||||
|
||||
@@ -113,6 +128,8 @@ private:
|
||||
void Send(nsIInputStream* aMsgStream, const nsACString& aMsgString,
|
||||
uint32_t aMsgLength, bool aIsBinary, mozilla::ErrorResult& aRv);
|
||||
|
||||
// to keep us alive while we have listeners
|
||||
RefPtr<nsDOMDataChannel> mSelfRef;
|
||||
// Owning reference
|
||||
RefPtr<mozilla::DataChannel> mDataChannel;
|
||||
nsString mOrigin;
|
||||
@@ -121,6 +138,8 @@ private:
|
||||
DC_BINARY_TYPE_BLOB,
|
||||
};
|
||||
DataChannelBinaryType mBinaryType;
|
||||
bool mCheckMustKeepAlive;
|
||||
bool mSentClose;
|
||||
};
|
||||
|
||||
#endif // nsDOMDataChannel_h
|
||||
|
||||
@@ -74,7 +74,7 @@ nsDOMTokenList::IndexedGetter(uint32_t aIndex, bool& aFound, nsAString& aResult)
|
||||
}
|
||||
|
||||
void
|
||||
nsDOMTokenList::SetValue(const nsAString& aValue, mozilla::ErrorResult& rv)
|
||||
nsDOMTokenList::SetValue(const nsAString& aValue, ErrorResult& rv)
|
||||
{
|
||||
if (!mElement) {
|
||||
return;
|
||||
@@ -182,7 +182,7 @@ nsDOMTokenList::Add(const nsTArray<nsString>& aTokens, ErrorResult& aError)
|
||||
}
|
||||
|
||||
void
|
||||
nsDOMTokenList::Add(const nsAString& aToken, mozilla::ErrorResult& aError)
|
||||
nsDOMTokenList::Add(const nsAString& aToken, ErrorResult& aError)
|
||||
{
|
||||
AutoTArray<nsString, 1> tokens;
|
||||
tokens.AppendElement(aToken);
|
||||
@@ -268,7 +268,7 @@ nsDOMTokenList::Remove(const nsTArray<nsString>& aTokens, ErrorResult& aError)
|
||||
}
|
||||
|
||||
void
|
||||
nsDOMTokenList::Remove(const nsAString& aToken, mozilla::ErrorResult& aError)
|
||||
nsDOMTokenList::Remove(const nsAString& aToken, ErrorResult& aError)
|
||||
{
|
||||
AutoTArray<nsString, 1> tokens;
|
||||
tokens.AppendElement(aToken);
|
||||
@@ -308,6 +308,43 @@ nsDOMTokenList::Toggle(const nsAString& aToken,
|
||||
return isPresent;
|
||||
}
|
||||
|
||||
void
|
||||
nsDOMTokenList::Replace(const nsAString& aToken,
|
||||
const nsAString& aNewToken,
|
||||
ErrorResult& aError)
|
||||
{
|
||||
// Doing this here instead of using `CheckToken` because if aToken had invalid
|
||||
// characters, and aNewToken is empty, the returned error should be a
|
||||
// SyntaxError, not an InvalidCharacterError.
|
||||
if (aNewToken.IsEmpty()) {
|
||||
aError.Throw(NS_ERROR_DOM_SYNTAX_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
aError = CheckToken(aToken);
|
||||
if (aError.Failed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
aError = CheckToken(aNewToken);
|
||||
if (aError.Failed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const nsAttrValue* attr = GetParsedAttr();
|
||||
if (!attr || !attr->Contains(aToken)) {
|
||||
return;
|
||||
}
|
||||
|
||||
AutoTArray<nsString, 1> tokens;
|
||||
|
||||
tokens.AppendElement(aToken);
|
||||
RemoveInternal(attr, tokens);
|
||||
|
||||
tokens[0] = aNewToken;
|
||||
AddInternal(attr, tokens);
|
||||
}
|
||||
|
||||
void
|
||||
nsDOMTokenList::Stringify(nsAString& aResult)
|
||||
{
|
||||
|
||||
@@ -63,10 +63,13 @@ public:
|
||||
void Remove(const nsAString& aToken, mozilla::ErrorResult& aError);
|
||||
void Remove(const nsTArray<nsString>& aTokens,
|
||||
mozilla::ErrorResult& aError);
|
||||
void Replace(const nsAString& aToken,
|
||||
const nsAString& aNewToken,
|
||||
mozilla::ErrorResult& aError);
|
||||
bool Toggle(const nsAString& aToken,
|
||||
const mozilla::dom::Optional<bool>& force,
|
||||
mozilla::ErrorResult& aError);
|
||||
|
||||
|
||||
void GetValue(nsAString& aResult) { Stringify(aResult); }
|
||||
void SetValue(const nsAString& aValue, mozilla::ErrorResult& rv);
|
||||
void Stringify(nsAString& aResult);
|
||||
|
||||
@@ -392,9 +392,12 @@ nsDOMWindowUtils::SetDisplayPortForElement(float aXPx, float aYPx,
|
||||
LayerManager* manager = widget->GetLayerManager(&isRetainingManager);
|
||||
if (isRetainingManager) {
|
||||
manager->BeginTransaction();
|
||||
nsLayoutUtils::PaintFrame(nullptr, rootFrame, nsRegion(), NS_RGB(255, 255, 255),
|
||||
nsLayoutUtils::PAINT_WIDGET_LAYERS |
|
||||
nsLayoutUtils::PAINT_EXISTING_TRANSACTION);
|
||||
using PaintFrameFlags = nsLayoutUtils::PaintFrameFlags;
|
||||
nsLayoutUtils::PaintFrame(nullptr, rootFrame, nsRegion(),
|
||||
NS_RGB(255, 255, 255),
|
||||
nsDisplayListBuilderMode::PAINTING,
|
||||
PaintFrameFlags::PAINT_WIDGET_LAYERS |
|
||||
PaintFrameFlags::PAINT_EXISTING_TRANSACTION);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ DEPRECATED_OPERATION(SetAttributeNodeNS)
|
||||
DEPRECATED_OPERATION(RemoveAttributeNode)
|
||||
DEPRECATED_OPERATION(CreateAttribute)
|
||||
DEPRECATED_OPERATION(CreateAttributeNS)
|
||||
DEPRECATED_OPERATION(OwnerElement)
|
||||
DEPRECATED_OPERATION(NodeValue)
|
||||
DEPRECATED_OPERATION(TextContent)
|
||||
DEPRECATED_OPERATION(EnablePrivilege)
|
||||
|
||||
+3
-23
@@ -3576,11 +3576,11 @@ nsIDocument::GetBaseURI(bool aTryUseXHRDocBaseURI) const
|
||||
return uri.forget();
|
||||
}
|
||||
|
||||
nsresult
|
||||
void
|
||||
nsDocument::SetBaseURI(nsIURI* aURI)
|
||||
{
|
||||
if (!aURI && !mDocumentBaseURI) {
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't do anything if the URI wasn't actually changed.
|
||||
@@ -3588,25 +3588,7 @@ nsDocument::SetBaseURI(nsIURI* aURI)
|
||||
bool equalBases = false;
|
||||
mDocumentBaseURI->Equals(aURI, &equalBases);
|
||||
if (equalBases) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if CSP allows this base-uri
|
||||
nsCOMPtr<nsIContentSecurityPolicy> csp;
|
||||
nsresult rv = NodePrincipal()->GetCsp(getter_AddRefs(csp));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (csp && aURI) {
|
||||
bool permitsBaseURI = false;
|
||||
|
||||
// base-uri is only enforced if explicitly defined in the
|
||||
// policy - do *not* consult default-src, see:
|
||||
// http://www.w3.org/TR/CSP2/#directive-default-src
|
||||
rv = csp->Permits(aURI, nsIContentSecurityPolicy::BASE_URI_DIRECTIVE,
|
||||
true, &permitsBaseURI);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (!permitsBaseURI) {
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3616,8 +3598,6 @@ nsDocument::SetBaseURI(nsIURI* aURI)
|
||||
mDocumentBaseURI = nullptr;
|
||||
}
|
||||
RefreshLinkHrefs();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -707,7 +707,7 @@ public:
|
||||
*/
|
||||
virtual void SetContentType(const nsAString& aContentType) override;
|
||||
|
||||
virtual nsresult SetBaseURI(nsIURI* aURI) override;
|
||||
virtual void SetBaseURI(nsIURI* aURI) override;
|
||||
|
||||
/**
|
||||
* Get/Set the base target of a link in a document.
|
||||
|
||||
@@ -82,8 +82,7 @@ nsHTMLContentSerializer::SerializeHTMLAttributes(nsIContent* aContent,
|
||||
nsAutoString valueStr;
|
||||
NS_NAMED_LITERAL_STRING(_mozStr, "_moz");
|
||||
|
||||
for (int32_t index = count; index > 0;) {
|
||||
--index;
|
||||
for (int32_t index = 0; index < count; index++) {
|
||||
const nsAttrName* name = aContent->GetAttrNameAt(index);
|
||||
int32_t namespaceID = name->NamespaceID();
|
||||
nsIAtom* attrName = name->LocalName();
|
||||
|
||||
+12
-1
@@ -398,7 +398,7 @@ public:
|
||||
}
|
||||
virtual already_AddRefed<nsIURI> GetBaseURI(bool aTryUseXHRDocBaseURI = false) const override;
|
||||
|
||||
virtual nsresult SetBaseURI(nsIURI* aURI) = 0;
|
||||
virtual void SetBaseURI(nsIURI* aURI) = 0;
|
||||
|
||||
/**
|
||||
* Get/Set the base target of a link in a document.
|
||||
@@ -1058,6 +1058,17 @@ public:
|
||||
nsIURI* sheetURI) = 0;
|
||||
virtual mozilla::StyleSheetHandle GetFirstAdditionalAuthorSheet() = 0;
|
||||
|
||||
/**
|
||||
* Assuming that aDocSheets is an array of document-level style
|
||||
* sheets for this document, returns the index that aSheet should
|
||||
* be inserted at to maintain document ordering.
|
||||
*
|
||||
* Defined in nsIDocumentInlines.h.
|
||||
*/
|
||||
template<typename T>
|
||||
size_t FindDocStyleSheetInsertionPoint(const nsTArray<RefPtr<T>>& aDocSheets,
|
||||
T* aSheet);
|
||||
|
||||
/**
|
||||
* Get this document's CSSLoader. This is guaranteed to not return null.
|
||||
*/
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "nsIDocument.h"
|
||||
#include "mozilla/dom/HTMLBodyElement.h"
|
||||
#include "nsStyleSheetService.h"
|
||||
|
||||
inline mozilla::dom::HTMLBodyElement*
|
||||
nsIDocument::GetBodyElement()
|
||||
@@ -15,4 +16,45 @@ nsIDocument::GetBodyElement()
|
||||
return static_cast<mozilla::dom::HTMLBodyElement*>(GetHtmlChildElement(nsGkAtoms::body));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
size_t
|
||||
nsIDocument::FindDocStyleSheetInsertionPoint(
|
||||
const nsTArray<RefPtr<T>>& aDocSheets,
|
||||
T* aSheet)
|
||||
{
|
||||
nsStyleSheetService* sheetService = nsStyleSheetService::GetInstance();
|
||||
|
||||
// lowest index first
|
||||
int32_t newDocIndex = GetIndexOfStyleSheet(aSheet);
|
||||
|
||||
int32_t count = aDocSheets.Length();
|
||||
int32_t index;
|
||||
for (index = 0; index < count; index++) {
|
||||
T* sheet = aDocSheets[index];
|
||||
int32_t sheetDocIndex = GetIndexOfStyleSheet(sheet);
|
||||
if (sheetDocIndex > newDocIndex)
|
||||
break;
|
||||
|
||||
mozilla::StyleSheetHandle sheetHandle = sheet;
|
||||
|
||||
// If the sheet is not owned by the document it can be an author
|
||||
// sheet registered at nsStyleSheetService or an additional author
|
||||
// sheet on the document, which means the new
|
||||
// doc sheet should end up before it.
|
||||
if (sheetDocIndex < 0) {
|
||||
if (sheetService) {
|
||||
auto& authorSheets = *sheetService->AuthorStyleSheets();
|
||||
if (authorSheets.IndexOf(sheetHandle) != authorSheets.NoIndex) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (sheetHandle == GetFirstAdditionalAuthorSheet()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return size_t(index);
|
||||
}
|
||||
|
||||
#endif // nsIDocumentInlines_h
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#endif
|
||||
#include "nsBindingManager.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "mozilla/AnimationTarget.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/dom/Animation.h"
|
||||
#include "mozilla/dom/HTMLImageElement.h"
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#define nsNodeUtils_h___
|
||||
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/NonOwningAnimationTarget.h"
|
||||
#include "nsIContent.h" // for use in inline function (ParentChainChanged)
|
||||
#include "nsIMutationObserver.h" // for use in inline function (ParentChainChanged)
|
||||
#include "js/TypeDecls.h"
|
||||
@@ -18,6 +17,7 @@ struct CharacterDataChangeInfo;
|
||||
template<class E> class nsCOMArray;
|
||||
class nsCycleCollectionTraversalCallback;
|
||||
namespace mozilla {
|
||||
struct NonOwningAnimationTarget;
|
||||
namespace dom {
|
||||
class Animation;
|
||||
} // namespace dom
|
||||
|
||||
@@ -378,7 +378,6 @@ skip-if = toolkit != 'gonk'
|
||||
[test_XHRDocURI.html]
|
||||
[test_XHRResponseURL.html]
|
||||
[test_XHRSendData.html]
|
||||
skip-if = buildapp == 'b2g' || e10s # b2g(seems to stall) b2g-debug(seems to stall) b2g-desktop(seems to stall)
|
||||
[test_XHR_anon.html]
|
||||
[test_XHR_header.html]
|
||||
[test_XHR_onuploadprogress.html]
|
||||
|
||||
@@ -21,9 +21,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=716841
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
function doTest(test_id) {
|
||||
oldPrefVal = SpecialPowers.getBoolPref("dom.server-events.enabled");
|
||||
ok(true, "here we go");
|
||||
|
||||
source = new EventSource("eventsource_redirect.resource");
|
||||
ok(source.url == "http://mochi.test:8888/tests/dom/base/test/eventsource_redirect.resource", "Test failed.");
|
||||
ok(source.readyState == 0 || source.readyState == 1, "Test failed.");
|
||||
@@ -47,9 +44,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=716841
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(function() {
|
||||
SpecialPowers.pushPrefEnv({"set": [['dom.server-events.enabled', true]]}, doTest);
|
||||
});
|
||||
addLoadEvent(doTest);
|
||||
</script>
|
||||
</pre>
|
||||
|
||||
|
||||
@@ -5,27 +5,48 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=464848
|
||||
-->
|
||||
<head>
|
||||
<title>XMLHttpRequest send data and headers</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body onload="gen.next();">
|
||||
<body onload="createFiles();">
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=464848">Mozilla Bug 464848</a>
|
||||
<p id="display">
|
||||
<input id="fileList" type="file"></input>
|
||||
</p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="application/javascript;version=1.8">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testData = "blahblahblahblahblahblahblaaaaaaaah. blah.";
|
||||
var extensions = [".txt",".png",".jpg",".gif",".xml", "noext"];
|
||||
var fileTypes = ["text/plain", "image/png", "image/jpeg", "image/gif", "text/xml", null];
|
||||
var gen = runTests();
|
||||
var testDOMFiles;
|
||||
|
||||
function createFiles() {
|
||||
var filesToCreate = new Array();
|
||||
extensions.forEach(function (extension) {
|
||||
filesToCreate.push({name: "testfile" + extension, data: testData});
|
||||
});
|
||||
SpecialPowers.createFiles(filesToCreate,
|
||||
function (files) {
|
||||
testDOMFiles = files;
|
||||
gen.next();
|
||||
},
|
||||
function (msg) {
|
||||
testDOMFiles = new Array;
|
||||
ok(false, "File creation error: " + msg);
|
||||
gen.next();
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
function continueTest() { gen.next(); }
|
||||
|
||||
function runTests() {
|
||||
|
||||
xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "file_XHRSendData_doc.xml", false);
|
||||
xhr.send();
|
||||
@@ -38,12 +59,6 @@ testDoc2.appendChild(testDoc2.createElement("res"));
|
||||
testDoc2.documentElement.appendChild(testDoc2.createTextNode("text"));
|
||||
is(testDoc2.inputEncoding, "UTF-8", "wrong encoding");
|
||||
|
||||
var testData = "blahblahblahblahblahblahblaaaaaaaah. blah.";
|
||||
var extensions = [".txt",".png",".jpg",".gif",".xml", "noext"];
|
||||
var fileTypes = ["text/plain", "image/png", "image/jpeg", "image/gif", "text/xml", null];
|
||||
var testFiles = new Array;
|
||||
var testDOMFiles = new Array;
|
||||
|
||||
// arraybuffer test objects
|
||||
var shortArray = new ArrayBuffer(1);
|
||||
var shortInt8View = new Uint8Array(shortArray);
|
||||
@@ -64,28 +79,6 @@ var longInt16View2 = new Uint16Array(longArray, 256, 64)
|
||||
var longInt8View1 = new Int8Array(longArraySlice)
|
||||
var longInt8View2 = new Int8Array(longArray, 256, 128)
|
||||
|
||||
extensions.forEach(
|
||||
function (extension) {
|
||||
var testFile = createFileWithDataExt(testData, extension);
|
||||
testFiles.push(testFile);
|
||||
|
||||
var fileList = document.getElementById('fileList');
|
||||
SpecialPowers.wrap(fileList).value = testFile.path;
|
||||
testDOMFiles.push(fileList.files[0]);
|
||||
}
|
||||
);
|
||||
|
||||
function createFileWithDataExt(fileData, extension) {
|
||||
var testFile = SpecialPowers.Services.dirsvc.get("ProfD", SpecialPowers.Ci.nsIFile);
|
||||
testFile.append("testfile" + extension);
|
||||
var outStream = SpecialPowers.Cc["@mozilla.org/network/file-output-stream;1"].createInstance(SpecialPowers.Ci.nsIFileOutputStream);
|
||||
outStream.init(testFile, 0x02 | 0x08 | 0x20, 0666, 0);
|
||||
outStream.write(fileData, fileData.length);
|
||||
outStream.close();
|
||||
|
||||
return testFile;
|
||||
}
|
||||
|
||||
tests = [{ body: null,
|
||||
resBody: "",
|
||||
},
|
||||
@@ -253,19 +246,7 @@ try {
|
||||
"Wrong page for redirect");
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
cleanUpData();
|
||||
}
|
||||
|
||||
function cleanUpData() {
|
||||
testFiles.forEach(
|
||||
function (testFile) {
|
||||
try {
|
||||
testFile.remove(false);
|
||||
} catch (e) {}
|
||||
}
|
||||
);
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
function is_identical_arraybuffer(ab1, ab2) {
|
||||
|
||||
@@ -621,7 +621,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
|
||||
function doTest()
|
||||
{
|
||||
// Allow all cookies, then run the actual test
|
||||
SpecialPowers.pushPrefEnv({"set": [["network.cookie.cookieBehavior", 0], ["dom.server-events.enabled", true]]}, function() { SpecialPowers.pushPermissions([{'type': 'systemXHR', 'allow': true, 'context': document}], doTestCallback);});
|
||||
SpecialPowers.pushPrefEnv({"set": [["network.cookie.cookieBehavior", 0]]},
|
||||
function() {
|
||||
SpecialPowers.pushPermissions([{'type': 'systemXHR', 'allow': true, 'context': document}],
|
||||
doTestCallback);
|
||||
});
|
||||
}
|
||||
|
||||
function doTestCallback()
|
||||
|
||||
@@ -224,7 +224,7 @@ function testHtmlSerializer_1 () {
|
||||
encoder.init(document, "application/xhtml+xml",de.OutputSelectionOnly | de.OutputRaw);
|
||||
encoder.setNode(node);
|
||||
out = encoder.encodeToString();
|
||||
expected = '<hr xmlns="http://www.w3.org/1999/xhtml" noshade="noshade" id="shortattr6" />';
|
||||
expected = '<hr xmlns="http://www.w3.org/1999/xhtml" id="shortattr6" noshade="noshade" />';
|
||||
is(out, expected, "test short attr #6");
|
||||
|
||||
node = document.getElementById('shortattr7');
|
||||
@@ -239,7 +239,7 @@ function testHtmlSerializer_1 () {
|
||||
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly | de.OutputRaw);
|
||||
encoder.setNode(node);
|
||||
out = encoder.encodeToString();
|
||||
expected = '<div __moz_b="b" id="mozattr"> lorem ipsum</div>';
|
||||
expected = '<div id="mozattr" __moz_b="b"> lorem ipsum</div>';
|
||||
is(out, expected, "test -moz/_moz attr");
|
||||
|
||||
node.setAttribute('_moz_c','barc');
|
||||
@@ -249,7 +249,7 @@ function testHtmlSerializer_1 () {
|
||||
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly | de.OutputRaw);
|
||||
encoder.setNode(node);
|
||||
out = encoder.encodeToString();
|
||||
expected = '<div __moz_e="bare" _-moz_d="bard" __moz_b="b" id="mozattr"> lorem ipsum</div>';
|
||||
expected = '<div id="mozattr" __moz_b="b" _-moz_d="bard" __moz_e="bare"> lorem ipsum</div>';
|
||||
is(out, expected, "test -moz/_moz attr #2");
|
||||
|
||||
SimpleTest.finish();
|
||||
@@ -284,7 +284,7 @@ addLoadEvent(testHtmlSerializer_1);
|
||||
<object id="shortattr3" declare="" />
|
||||
<script id="shortattr4" defer="" />
|
||||
<select id="shortattr5" multiple=""><option selected="">aaa</option></select>
|
||||
<hr noshade="" id="shortattr6"/>
|
||||
<hr id="shortattr6" noshade=""/>
|
||||
<div id="shortattr7"><foo:bar checked="" value="" disabled="" ismap="" readonly="" /></div>
|
||||
<div id="mozattr" _moz_a="a" __moz_b="b"> lorem ipsum</div>
|
||||
</div>
|
||||
|
||||
@@ -174,7 +174,7 @@ function testHtmlSerializer_1 () {
|
||||
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
|
||||
encoder.setSelection(select);
|
||||
out = encoder.encodeToString();
|
||||
expected = '<ol start="5" id="aList"><li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
|
||||
expected = '<ol id="aList" start="5"><li>sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
|
||||
is(out, expected, "test list selection with range: selection start at the third child of the ol, and end after the element ol + ol start at the value 5");
|
||||
|
||||
|
||||
@@ -272,7 +272,7 @@ function testHtmlSerializer_1 () {
|
||||
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly | de.OutputRaw);
|
||||
encoder.setNode(node);
|
||||
out = encoder.encodeToString();
|
||||
expected = '<div __moz_e="bare" _-moz_d="bard" id="mozattr" __moz_b="b"> lorem ipsum</div>';
|
||||
expected = '<div id="mozattr" __moz_b="b" _-moz_d="bard" __moz_e="bare"> lorem ipsum</div>';
|
||||
is(out, expected, "test -moz/_moz attr #2");
|
||||
|
||||
SimpleTest.finish();
|
||||
@@ -317,4 +317,4 @@ addLoadEvent(testHtmlSerializer_1);
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@@ -54,19 +54,19 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=744830
|
||||
is(t.innerHTML, '<example xml:lang="us-en"><foo></example>');
|
||||
|
||||
t.firstChild.setAttributeNS("http://www.w3.org/1999/xlink", "href", "foo");
|
||||
is(t.innerHTML, '<example xlink:href="foo" xml:lang="us-en"><foo></example>');
|
||||
is(t.innerHTML, '<example xml:lang="us-en" xlink:href="foo"><foo></example>');
|
||||
|
||||
t.firstChild.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns", "http://foo");
|
||||
is(t.innerHTML, '<example xmlns="http://foo" xlink:href="foo" xml:lang="us-en"><foo></example>');
|
||||
is(t.innerHTML, '<example xml:lang="us-en" xlink:href="foo" xmlns="http://foo"><foo></example>');
|
||||
|
||||
t.firstChild.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:bar", "http://bar");
|
||||
is(t.innerHTML, '<example xmlns:bar="http://bar" xmlns="http://foo" xlink:href="foo" xml:lang="us-en"><foo></example>');
|
||||
is(t.innerHTML, '<example xml:lang="us-en" xlink:href="foo" xmlns="http://foo" xmlns:bar="http://bar"><foo></example>');
|
||||
|
||||
t.firstChild.setAttributeNS("http://www.helloworldns.org", "hello:world", "!");
|
||||
is(t.innerHTML, '<example hello:world="!" xmlns:bar="http://bar" xmlns="http://foo" xlink:href="foo" xml:lang="us-en"><foo></example>');
|
||||
is(t.innerHTML, '<example xml:lang="us-en" xlink:href="foo" xmlns="http://foo" xmlns:bar="http://bar" hello:world="!"><foo></example>');
|
||||
|
||||
t.firstChild.setAttribute("foo", '-"&\xA0-');
|
||||
is(t.innerHTML, '<example foo="-"& -" hello:world="!" xmlns:bar="http://bar" xmlns="http://foo" xlink:href="foo" xml:lang="us-en"><foo></example>');
|
||||
is(t.innerHTML, '<example xml:lang="us-en" xlink:href="foo" xmlns="http://foo" xmlns:bar="http://bar" hello:world="!" foo="-"& -"><foo></example>');
|
||||
|
||||
t.innerHTML = null;
|
||||
t.appendChild(document.createElement("div"));
|
||||
|
||||
@@ -118,7 +118,7 @@ function testHtmlCopyEncoder () {
|
||||
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
|
||||
encoder.setSelection(select);
|
||||
out = encoder.encodeToString();
|
||||
expected = '<ol start=\"5\" id=\"aList\"><li value=\"6\">sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
|
||||
expected = '<ol id=\"aList\" start=\"5\"><li value=\"6\">sit amet, <strong>consectetuer</strong> </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
|
||||
is(out, expected, "test list selection with range: selection start at the third child of the ol, and end after the element ol + ol start at the value 5");
|
||||
|
||||
// selection contains only some child of the ol
|
||||
|
||||
@@ -38,11 +38,7 @@ function testHtmlCopyEncoder () {
|
||||
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
|
||||
encoder.setNode(node);
|
||||
out = encoder.encodeToString();
|
||||
// the attributes are in the reverse order because the XHTML parser parse in the
|
||||
// right order but the html serializer serializes in the reverse order
|
||||
// (because the html parser stores the attribute in the reverse order,
|
||||
// see bug 213347 for reason).
|
||||
expected = "<div ondragstart=\"doDragStartSelection(event)\" id=\"draggable\">This is a <em>draggable</em> <br>bit of text.</div>";
|
||||
expected = "<div id=\"draggable\" ondragstart=\"doDragStartSelection(event)\">This is a <em>draggable</em> <br>bit of text.</div>";
|
||||
is(out, expected, "test node");
|
||||
|
||||
var select = window.getSelection();
|
||||
|
||||
@@ -89,6 +89,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=887836
|
||||
{ input: '%a_=a', data: { '%a_' : ['a'] } },
|
||||
{ input: '%61=a', data: { 'a' : ['a'] } },
|
||||
{ input: '%61+%4d%4D=', data: { 'a MM' : [''] } },
|
||||
{ input: '?a=1', data: { 'a' : ['1'] } },
|
||||
{ input: '?', data: {} },
|
||||
{ input: '?=b', data: { '' : ['b'] } },
|
||||
];
|
||||
|
||||
for (var i = 0; i < checks.length; ++i) {
|
||||
|
||||
@@ -1586,18 +1586,16 @@ CanvasRenderingContext2D::ReturnTarget()
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CanvasRenderingContext2D::InitializeWithSurface(nsIDocShell* aShell,
|
||||
gfxASurface* aSurface,
|
||||
int32_t aWidth,
|
||||
int32_t aHeight)
|
||||
CanvasRenderingContext2D::InitializeWithDrawTarget(nsIDocShell* aShell,
|
||||
gfx::DrawTarget* aTarget)
|
||||
{
|
||||
RemovePostRefreshObserver();
|
||||
mDocShell = aShell;
|
||||
AddPostRefreshObserverIfNecessary();
|
||||
|
||||
SetDimensions(aWidth, aHeight);
|
||||
mTarget = gfxPlatform::GetPlatform()->
|
||||
CreateDrawTargetForSurface(aSurface, IntSize(aWidth, aHeight));
|
||||
IntSize size = aTarget->GetSize();
|
||||
SetDimensions(size.width, size.height);
|
||||
mTarget = aTarget;
|
||||
|
||||
if (!mTarget) {
|
||||
EnsureErrorTarget();
|
||||
|
||||
@@ -442,7 +442,8 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
NS_IMETHOD SetDimensions(int32_t aWidth, int32_t aHeight) override;
|
||||
NS_IMETHOD InitializeWithSurface(nsIDocShell* aShell, gfxASurface* aSurface, int32_t aWidth, int32_t aHeight) override;
|
||||
NS_IMETHOD InitializeWithDrawTarget(nsIDocShell* aShell,
|
||||
gfx::DrawTarget* aTarget) override;
|
||||
|
||||
NS_IMETHOD GetInputStream(const char* aMimeType,
|
||||
const char16_t* aEncoderOptions,
|
||||
|
||||
@@ -82,10 +82,8 @@ ImageBitmapRenderingContext::SetDimensions(int32_t aWidth, int32_t aHeight)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ImageBitmapRenderingContext::InitializeWithSurface(nsIDocShell* aDocShell,
|
||||
gfxASurface* aSurface,
|
||||
int32_t aWidth,
|
||||
int32_t aHeight)
|
||||
ImageBitmapRenderingContext::InitializeWithDrawTarget(nsIDocShell* aDocShell,
|
||||
gfx::DrawTarget* aTarget)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace mozilla {
|
||||
|
||||
namespace gfx {
|
||||
class DataSourceSurface;
|
||||
class DrawTarget;
|
||||
class SourceSurface;
|
||||
}
|
||||
|
||||
@@ -53,10 +54,8 @@ public:
|
||||
|
||||
NS_IMETHOD SetDimensions(int32_t aWidth, int32_t aHeight) override;
|
||||
|
||||
NS_IMETHOD InitializeWithSurface(nsIDocShell* aDocShell,
|
||||
gfxASurface* aSurface,
|
||||
int32_t aWidth,
|
||||
int32_t aHeight) override;
|
||||
NS_IMETHOD InitializeWithDrawTarget(nsIDocShell* aDocShell,
|
||||
gfx::DrawTarget* aTarget) override;
|
||||
|
||||
virtual mozilla::UniquePtr<uint8_t[]> GetImageBuffer(int32_t* aFormat) override;
|
||||
NS_IMETHOD GetInputStream(const char* aMimeType,
|
||||
|
||||
@@ -239,8 +239,7 @@ public:
|
||||
virtual int32_t GetHeight() const override;
|
||||
|
||||
NS_IMETHOD SetDimensions(int32_t width, int32_t height) override;
|
||||
NS_IMETHOD InitializeWithSurface(nsIDocShell*, gfxASurface*, int32_t,
|
||||
int32_t) override
|
||||
NS_IMETHOD InitializeWithDrawTarget(nsIDocShell*, gfx::DrawTarget*) override
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
@@ -96,7 +96,10 @@ public:
|
||||
// whenever the size of the element changes.
|
||||
NS_IMETHOD SetDimensions(int32_t width, int32_t height) = 0;
|
||||
|
||||
NS_IMETHOD InitializeWithSurface(nsIDocShell *docShell, gfxASurface *surface, int32_t width, int32_t height) = 0;
|
||||
// Initializes with an nsIDocShell and DrawTarget. The size is taken from the
|
||||
// DrawTarget.
|
||||
NS_IMETHOD InitializeWithDrawTarget(nsIDocShell *aDocShell,
|
||||
mozilla::gfx::DrawTarget* aTarget) = 0;
|
||||
|
||||
// Creates an image buffer. Returns null on failure.
|
||||
virtual mozilla::UniquePtr<uint8_t[]> GetImageBuffer(int32_t* format) = 0;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "nsRuleData.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIContentSecurityPolicy.h"
|
||||
#include "nsIURI.h"
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(Shared)
|
||||
@@ -174,12 +175,28 @@ SetBaseURIUsingFirstBaseWithHref(nsIDocument* aDocument, nsIContent* aMustMatch)
|
||||
getter_AddRefs(newBaseURI), href, aDocument,
|
||||
aDocument->GetFallbackBaseURI());
|
||||
|
||||
// Try to set our base URI. If that fails, try to set base URI to null
|
||||
nsresult rv = aDocument->SetBaseURI(newBaseURI);
|
||||
aDocument->SetChromeXHRDocBaseURI(nullptr);
|
||||
// Check if CSP allows this base-uri
|
||||
nsCOMPtr<nsIContentSecurityPolicy> csp;
|
||||
nsresult rv = aDocument->NodePrincipal()->GetCsp(getter_AddRefs(csp));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Getting CSP Failed");
|
||||
// For all the different error cases we assign a nullptr to
|
||||
// newBaseURI, so we basically call aDocument->SetBaseURI(nullptr);
|
||||
if (NS_FAILED(rv)) {
|
||||
aDocument->SetBaseURI(nullptr);
|
||||
newBaseURI = nullptr;
|
||||
}
|
||||
if (csp && newBaseURI) {
|
||||
// base-uri is only enforced if explicitly defined in the
|
||||
// policy - do *not* consult default-src, see:
|
||||
// http://www.w3.org/TR/CSP2/#directive-default-src
|
||||
bool cspPermitsBaseURI = true;
|
||||
rv = csp->Permits(newBaseURI, nsIContentSecurityPolicy::BASE_URI_DIRECTIVE,
|
||||
true, &cspPermitsBaseURI);
|
||||
if (NS_FAILED(rv) || !cspPermitsBaseURI) {
|
||||
newBaseURI = nullptr;
|
||||
}
|
||||
}
|
||||
aDocument->SetBaseURI(newBaseURI);
|
||||
aDocument->SetChromeXHRDocBaseURI(nullptr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,6 @@ SetAttributeNodeNSWarning=Use of setAttributeNodeNS() is deprecated. Use setAttr
|
||||
RemoveAttributeNodeWarning=Use of removeAttributeNode() is deprecated. Use removeAttribute() instead.
|
||||
CreateAttributeWarning=Use of document.createAttribute() is deprecated. Use element.setAttribute() instead.
|
||||
CreateAttributeNSWarning=Use of document.createAttributeNS() is deprecated. Use element.setAttributeNS() instead.
|
||||
OwnerElementWarning=Use of attributes' ownerElement attribute is deprecated.
|
||||
NodeValueWarning=Use of attributes' nodeValue attribute is deprecated. Use value instead.
|
||||
TextContentWarning=Use of attributes' textContent attribute is deprecated. Use value instead.
|
||||
EnablePrivilegeWarning=Use of enablePrivilege is deprecated. Please use code that runs with the system principal (e.g. an extension) instead.
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
#include <fstream>
|
||||
#include "GMPUtils.h"
|
||||
#include "prio.h"
|
||||
#ifdef MOZ_WIDEVINE_EME
|
||||
#include "widevine-adapter/WidevineAdapter.h"
|
||||
#endif
|
||||
|
||||
using namespace mozilla::ipc;
|
||||
using mozilla::dom::CrashReporterChild;
|
||||
@@ -216,7 +219,7 @@ GetAppPaths(nsCString &aAppPath, nsCString &aAppBinaryPath)
|
||||
}
|
||||
|
||||
bool
|
||||
GMPChild::SetMacSandboxInfo()
|
||||
GMPChild::SetMacSandboxInfo(MacSandboxPluginType aPluginType)
|
||||
{
|
||||
if (!mGMPLoader) {
|
||||
return false;
|
||||
@@ -232,7 +235,7 @@ GMPChild::SetMacSandboxInfo()
|
||||
|
||||
MacSandboxInfo info;
|
||||
info.type = MacSandboxType_Plugin;
|
||||
info.pluginInfo.type = MacSandboxPluginType_GMPlugin_Default;
|
||||
info.pluginInfo.type = aPluginType;
|
||||
info.pluginInfo.pluginPath.assign(pluginDirectoryPath.get());
|
||||
info.pluginInfo.pluginBinaryPath.assign(pluginFilePath.get());
|
||||
info.appPath.assign(appPath.get());
|
||||
@@ -376,8 +379,18 @@ GMPChild::AnswerStartPlugin(const nsString& aAdapter)
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDEVINE_EME
|
||||
bool isWidevine = aAdapter.EqualsLiteral("widevine");
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_GMP_SANDBOX) && defined(XP_MACOSX)
|
||||
if (!SetMacSandboxInfo()) {
|
||||
MacSandboxPluginType pluginType = MacSandboxPluginType_GMPlugin_Default;
|
||||
#ifdef MOZ_WIDEVINE_EME
|
||||
if (isWidevine) {
|
||||
pluginType = MacSandboxPluginType_GMPlugin_EME_Widevine;
|
||||
}
|
||||
#endif
|
||||
if (!SetMacSandboxInfo(pluginType)) {
|
||||
NS_WARNING("Failed to set Mac GMP sandbox info");
|
||||
delete platformAPI;
|
||||
return false;
|
||||
@@ -385,6 +398,11 @@ GMPChild::AnswerStartPlugin(const nsString& aAdapter)
|
||||
#endif
|
||||
|
||||
GMPAdapter* adapter = nullptr;
|
||||
#ifdef MOZ_WIDEVINE_EME
|
||||
if (isWidevine) {
|
||||
adapter = new WidevineAdapter();
|
||||
}
|
||||
#endif
|
||||
if (!mGMPLoader->Load(libPath.get(),
|
||||
libPath.Length(),
|
||||
mNodeId.BeginWriting(),
|
||||
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
void ShutdownComplete() override;
|
||||
|
||||
#if defined(XP_MACOSX) && defined(MOZ_GMP_SANDBOX)
|
||||
bool SetMacSandboxInfo();
|
||||
bool SetMacSandboxInfo(MacSandboxPluginType aPluginType);
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
+92
-19
@@ -39,6 +39,15 @@ using CrashReporter::GetIDFromMinidump;
|
||||
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
#include "WMFDecoderModule.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDEVINE_EME
|
||||
#include "mozilla/dom/WidevineCDMManifestBinding.h"
|
||||
#include "widevine-adapter/WidevineAdapter.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
#undef LOG
|
||||
@@ -570,6 +579,23 @@ GMPParent::SupportsAPI(const nsCString& aAPI, const nsCString& aTag)
|
||||
nsTArray<nsCString>& tags = mCapabilities[i].mAPITags;
|
||||
for (uint32_t j = 0; j < tags.Length(); j++) {
|
||||
if (tags[j].Equals(aTag)) {
|
||||
#ifdef XP_WIN
|
||||
// Clearkey on Windows advertises that it can decode in its GMP info
|
||||
// file, but uses Windows Media Foundation to decode. That's not present
|
||||
// on Windows XP, and on some Vista, Windows N, and KN variants without
|
||||
// certain services packs.
|
||||
if (tags[j].EqualsLiteral("org.w3.clearkey")) {
|
||||
if (mCapabilities[i].mAPIName.EqualsLiteral(GMP_API_VIDEO_DECODER)) {
|
||||
if (!WMFDecoderModule::HasH264()) {
|
||||
continue;
|
||||
}
|
||||
} else if (mCapabilities[i].mAPIName.EqualsLiteral(GMP_API_AUDIO_DECODER)) {
|
||||
if (!WMFDecoderModule::HasAAC()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -787,7 +813,18 @@ GMPParent::ReadGMPMetaData()
|
||||
return ReadGMPInfoFile(infoFile);
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDEVINE_EME
|
||||
// Maybe this is the Widevine adapted plugin?
|
||||
nsCOMPtr<nsIFile> manifestFile;
|
||||
rv = mDirectory->Clone(getter_AddRefs(manifestFile));
|
||||
if (NS_FAILED(rv)) {
|
||||
return GenericPromise::CreateAndReject(rv, __func__);
|
||||
}
|
||||
manifestFile->AppendRelativePath(NS_LITERAL_STRING("manifest.json"));
|
||||
return ReadChromiumManifestFile(manifestFile);
|
||||
#else
|
||||
return GenericPromise::CreateAndReject(rv, __func__);
|
||||
#endif
|
||||
}
|
||||
|
||||
RefPtr<GenericPromise>
|
||||
@@ -872,25 +909,6 @@ GMPParent::ReadGMPInfoFile(nsIFile* aFile)
|
||||
#endif // XP_WIN
|
||||
}
|
||||
|
||||
#ifdef XP_WIN
|
||||
// Clearkey on Windows advertises that it can decode in its GMP info
|
||||
// file, but uses Windows Media Foundation to decode. That's not present
|
||||
// on Windows XP, and on some Vista, Windows N, and KN variants without
|
||||
// certain services packs. So don't add the decoding capability to
|
||||
// gmp-clearkey's GMPParent if it's not going to be able to use WMF to
|
||||
// decode.
|
||||
if (cap.mAPIName.EqualsLiteral(GMP_API_VIDEO_DECODER) &&
|
||||
cap.mAPITags.Contains(NS_LITERAL_CSTRING("org.w3.clearkey")) &&
|
||||
!WMFDecoderModule::HasH264()) {
|
||||
continue;
|
||||
}
|
||||
if (cap.mAPIName.EqualsLiteral(GMP_API_AUDIO_DECODER) &&
|
||||
cap.mAPITags.Contains(NS_LITERAL_CSTRING("org.w3.clearkey")) &&
|
||||
!WMFDecoderModule::HasAAC()) {
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
mCapabilities.AppendElement(Move(cap));
|
||||
}
|
||||
|
||||
@@ -901,6 +919,61 @@ GMPParent::ReadGMPInfoFile(nsIFile* aFile)
|
||||
return GenericPromise::CreateAndResolve(true, __func__);
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDEVINE_EME
|
||||
RefPtr<GenericPromise>
|
||||
GMPParent::ReadChromiumManifestFile(nsIFile* aFile)
|
||||
{
|
||||
nsAutoCString json;
|
||||
if (!ReadIntoString(aFile, json, 5 * 1024)) {
|
||||
return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
|
||||
}
|
||||
|
||||
// DOM JSON parsing needs to run on the main thread.
|
||||
return InvokeAsync(AbstractThread::MainThread(), this, __func__,
|
||||
&GMPParent::ParseChromiumManifest, NS_ConvertUTF8toUTF16(json));
|
||||
}
|
||||
|
||||
RefPtr<GenericPromise>
|
||||
GMPParent::ParseChromiumManifest(nsString aJSON)
|
||||
{
|
||||
LOGD("%s: for '%s'", __FUNCTION__, NS_LossyConvertUTF16toASCII(aJSON).get());
|
||||
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mozilla::dom::WidevineCDMManifest m;
|
||||
if (!m.Init(aJSON)) {
|
||||
return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
|
||||
}
|
||||
|
||||
nsresult ignored; // Note: ToInteger returns 0 on failure.
|
||||
if (!WidevineAdapter::Supports(m.mX_cdm_module_versions.ToInteger(&ignored),
|
||||
m.mX_cdm_interface_versions.ToInteger(&ignored),
|
||||
m.mX_cdm_host_versions.ToInteger(&ignored))) {
|
||||
return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
|
||||
}
|
||||
|
||||
mDisplayName = NS_ConvertUTF16toUTF8(m.mName);
|
||||
mDescription = NS_ConvertUTF16toUTF8(m.mDescription);
|
||||
mVersion = NS_ConvertUTF16toUTF8(m.mVersion);
|
||||
|
||||
GMPCapability video(NS_LITERAL_CSTRING(GMP_API_VIDEO_DECODER));
|
||||
video.mAPITags.AppendElement(NS_LITERAL_CSTRING("h264"));
|
||||
video.mAPITags.AppendElement(NS_LITERAL_CSTRING("com.widevine.alpha"));
|
||||
mCapabilities.AppendElement(Move(video));
|
||||
|
||||
GMPCapability decrypt(NS_LITERAL_CSTRING(GMP_API_DECRYPTOR));
|
||||
decrypt.mAPITags.AppendElement(NS_LITERAL_CSTRING("com.widevine.alpha"));
|
||||
mCapabilities.AppendElement(Move(decrypt));
|
||||
|
||||
MOZ_ASSERT(mName.EqualsLiteral("widevinecdm"));
|
||||
mAdapter = NS_LITERAL_STRING("widevine");
|
||||
#ifdef XP_WIN
|
||||
mLibs = NS_LITERAL_CSTRING("dxva2.dll");
|
||||
#endif
|
||||
|
||||
return GenericPromise::CreateAndResolve(true, __func__);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
GMPParent::CanBeSharedCrossNodeIds() const
|
||||
{
|
||||
|
||||
@@ -167,6 +167,10 @@ private:
|
||||
bool EnsureProcessLoaded();
|
||||
RefPtr<GenericPromise> ReadGMPMetaData();
|
||||
RefPtr<GenericPromise> ReadGMPInfoFile(nsIFile* aFile);
|
||||
#ifdef MOZ_WIDEVINE_EME
|
||||
RefPtr<GenericPromise> ParseChromiumManifest(nsString aJSON); // Main thread.
|
||||
RefPtr<GenericPromise> ReadChromiumManifestFile(nsIFile* aFile); // GMP thread.
|
||||
#endif
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
void WriteExtraDataForMinidump(CrashReporter::AnnotationTable& notes);
|
||||
void GetCrashID(nsString& aResult);
|
||||
|
||||
@@ -39,6 +39,44 @@ static bool SchemeIs(nsIURI* aURI, const char* aScheme)
|
||||
return NS_SUCCEEDED(baseURI->SchemeIs(aScheme, &isScheme)) && isScheme;
|
||||
}
|
||||
|
||||
|
||||
static bool IsImageLoadInEditorAppType(nsILoadInfo* aLoadInfo)
|
||||
{
|
||||
// Editor apps get special treatment here, editors can load images
|
||||
// from anywhere. This allows editor to insert images from file://
|
||||
// into documents that are being edited.
|
||||
nsContentPolicyType type = aLoadInfo->InternalContentPolicyType();
|
||||
if (type != nsIContentPolicy::TYPE_INTERNAL_IMAGE &&
|
||||
type != nsIContentPolicy::TYPE_INTERNAL_IMAGE_PRELOAD &&
|
||||
type != nsIContentPolicy::TYPE_IMAGESET) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t appType = nsIDocShell::APP_TYPE_UNKNOWN;
|
||||
nsINode* node = aLoadInfo->LoadingNode();
|
||||
if (!node) {
|
||||
return false;
|
||||
}
|
||||
nsIDocument* doc = node->OwnerDoc();
|
||||
if (!doc) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem = doc->GetDocShell();
|
||||
if (!docShellTreeItem) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> root;
|
||||
docShellTreeItem->GetRootTreeItem(getter_AddRefs(root));
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(root));
|
||||
if (!docShell || NS_FAILED(docShell->GetAppType(&appType))) {
|
||||
appType = nsIDocShell::APP_TYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
return appType == nsIDocShell::APP_TYPE_EDITOR;
|
||||
}
|
||||
|
||||
static nsresult
|
||||
DoCheckLoadURIChecks(nsIURI* aURI, nsILoadInfo* aLoadInfo)
|
||||
{
|
||||
@@ -55,8 +93,11 @@ DoCheckLoadURIChecks(nsIURI* aURI, nsILoadInfo* aLoadInfo)
|
||||
flags |= nsIScriptSecurityManager::ALLOW_CHROME;
|
||||
}
|
||||
|
||||
bool isImageInEditorType = IsImageLoadInEditorAppType(aLoadInfo);
|
||||
|
||||
// We don't have a loadingPrincipal for TYPE_DOCUMENT
|
||||
if (aLoadInfo->GetExternalContentPolicyType() != nsIContentPolicy::TYPE_DOCUMENT) {
|
||||
if (aLoadInfo->GetExternalContentPolicyType() != nsIContentPolicy::TYPE_DOCUMENT &&
|
||||
!isImageInEditorType) {
|
||||
rv = nsContentUtils::GetSecurityManager()->
|
||||
CheckLoadURIWithPrincipal(loadingPrincipal,
|
||||
aURI,
|
||||
@@ -67,7 +108,7 @@ DoCheckLoadURIChecks(nsIURI* aURI, nsILoadInfo* aLoadInfo)
|
||||
// If the loadingPrincipal and the triggeringPrincipal are different, then make
|
||||
// sure the triggeringPrincipal is allowed to access that URI.
|
||||
nsCOMPtr<nsIPrincipal> triggeringPrincipal = aLoadInfo->TriggeringPrincipal();
|
||||
if (loadingPrincipal != triggeringPrincipal) {
|
||||
if (loadingPrincipal != triggeringPrincipal && !isImageInEditorType) {
|
||||
rv = nsContentUtils::GetSecurityManager()->
|
||||
CheckLoadURIWithPrincipal(triggeringPrincipal,
|
||||
aURI,
|
||||
@@ -155,7 +196,8 @@ DoContentSecurityChecks(nsIURI* aURI, nsILoadInfo* aLoadInfo)
|
||||
}
|
||||
|
||||
case nsIContentPolicy::TYPE_IMAGE: {
|
||||
MOZ_ASSERT(false, "contentPolicyType not supported yet");
|
||||
mimeTypeGuess = EmptyCString();
|
||||
requestingContext = aLoadInfo->LoadingNode();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -295,7 +337,8 @@ DoContentSecurityChecks(nsIURI* aURI, nsILoadInfo* aLoadInfo)
|
||||
}
|
||||
|
||||
case nsIContentPolicy::TYPE_IMAGESET: {
|
||||
MOZ_ASSERT(false, "contentPolicyType not supported yet");
|
||||
mimeTypeGuess = EmptyCString();
|
||||
requestingContext = aLoadInfo->LoadingNode();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@ interface DOMTokenList {
|
||||
[Throws]
|
||||
void remove(DOMString... tokens);
|
||||
[Throws]
|
||||
void replace(DOMString token, DOMString newToken);
|
||||
[Throws]
|
||||
boolean toggle(DOMString token, optional boolean force);
|
||||
[SetterThrows]
|
||||
attribute DOMString value;
|
||||
|
||||
@@ -4,15 +4,14 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* http://www.whatwg.org/specs/web-apps/current-work/
|
||||
* https://html.spec.whatwg.org/multipage/comms.html#the-eventsource-interface
|
||||
*
|
||||
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
|
||||
* Opera Software ASA. You are granted a license to use, reproduce
|
||||
* and create derivative works of this document.
|
||||
*/
|
||||
|
||||
[Constructor(DOMString url, optional EventSourceInit eventSourceInitDict),
|
||||
Func="mozilla::dom::EventSource::PrefEnabled"]
|
||||
[Constructor(USVString url, optional EventSourceInit eventSourceInitDict)]
|
||||
interface EventSource : EventTarget {
|
||||
[Constant]
|
||||
readonly attribute DOMString url;
|
||||
|
||||
@@ -69,8 +69,7 @@ partial interface KeyframeEffectReadOnly {
|
||||
object? frames,
|
||||
optional (unrestricted double or KeyframeEffectOptions) options)]
|
||||
interface KeyframeEffect : KeyframeEffectReadOnly {
|
||||
// Bug 1067769 - Allow setting KeyframeEffect.target
|
||||
// inherit attribute Animatable? target;
|
||||
inherit attribute (Element or CSSPseudoElement)? target;
|
||||
// Bug 1216843 - implement animation composition
|
||||
// inherit attribute IterationCompositeOperation iterationComposite;
|
||||
// Bug 1216844 - implement additive animation
|
||||
|
||||
@@ -4,10 +4,6 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// XXX: This must be done prior to including cert.h (directly or indirectly).
|
||||
// CERT_AddTempCertToPerm is exposed as __CERT_AddTempCertToPerm.
|
||||
#define CERT_AddTempCertToPerm __CERT_AddTempCertToPerm
|
||||
|
||||
#include "WifiCertService.h"
|
||||
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
|
||||
@@ -36,5 +36,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
|
||||
'WifiProxyService.cpp',
|
||||
'WifiUtils.cpp',
|
||||
]
|
||||
DEFINES['CERT_AddTempCertToPerm'] = '__CERT_AddTempCertToPerm'
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
@@ -83,6 +83,9 @@ onmessage = function() {
|
||||
{ input: '%a_=a', data: { '%a_' : ['a'] } },
|
||||
{ input: '%61=a', data: { 'a' : ['a'] } },
|
||||
{ input: '%61+%4d%4D=', data: { 'a MM' : [''] } },
|
||||
{ input: '?a=1', data: { 'a' : ['1'] } },
|
||||
{ input: '?', data: {} },
|
||||
{ input: '?=b', data: { '' : ['b'] } },
|
||||
];
|
||||
|
||||
for (var i = 0; i < checks.length; ++i) {
|
||||
|
||||
@@ -113,11 +113,6 @@ nsXBLResourceLoader::LoadResources(bool* aResult)
|
||||
continue;
|
||||
|
||||
if (curr->mType == nsGkAtoms::image) {
|
||||
if (!nsContentUtils::CanLoadImage(url, doc, doc, docPrincipal)) {
|
||||
// We're not permitted to load this image, move on...
|
||||
continue;
|
||||
}
|
||||
|
||||
// Now kick off the image load...
|
||||
// Passing nullptr for pretty much everything -- cause we don't care!
|
||||
// XXX: initialDocumentURI is nullptr!
|
||||
|
||||
@@ -1029,7 +1029,7 @@ nsHTMLEditor::UpdateBaseURL()
|
||||
// If no base tag, then set baseURL to the document's URL. This is very
|
||||
// important, else relative URLs for links and images are wrong
|
||||
if (!nodeList || !nodeList->Item(0)) {
|
||||
return doc->SetBaseURI(doc->GetDocumentURI());
|
||||
doc->SetBaseURI(doc->GetDocumentURI());
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
+54
-46
@@ -682,15 +682,35 @@ struct ParamTraits<mozilla::layers::FrameMetrics::ScrollOffsetUpdateType>
|
||||
mozilla::layers::FrameMetrics::ScrollOffsetUpdateType::eSentinel>
|
||||
{};
|
||||
|
||||
// Helper class for reading bitfields.
|
||||
// If T has bitfields members, derive ParamTraits<T> from BitfieldHelper<T>.
|
||||
template <typename ParamType>
|
||||
struct BitfieldHelper
|
||||
{
|
||||
// We need this helper because we can't get the address of a bitfield to
|
||||
// pass directly to ReadParam. So instead we read it into a temporary bool
|
||||
// and set the bitfield using a setter function
|
||||
static bool ReadBoolForBitfield(const Message* aMsg, void** aIter,
|
||||
ParamType* aResult, void (ParamType::*aSetter)(bool))
|
||||
{
|
||||
bool value;
|
||||
if (ReadParam(aMsg, aIter, &value)) {
|
||||
(aResult->*aSetter)(value);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::layers::FrameMetrics>
|
||||
: BitfieldHelper<mozilla::layers::FrameMetrics>
|
||||
{
|
||||
typedef mozilla::layers::FrameMetrics paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, aParam.mScrollId);
|
||||
WriteParam(aMsg, aParam.mScrollParentId);
|
||||
WriteParam(aMsg, aParam.mPresShellResolution);
|
||||
WriteParam(aMsg, aParam.mCompositionBounds);
|
||||
WriteParam(aMsg, aParam.mDisplayPort);
|
||||
@@ -707,51 +727,17 @@ struct ParamTraits<mozilla::layers::FrameMetrics>
|
||||
WriteParam(aMsg, aParam.mPresShellId);
|
||||
WriteParam(aMsg, aParam.mViewport);
|
||||
WriteParam(aMsg, aParam.mExtraResolution);
|
||||
WriteParam(aMsg, aParam.mBackgroundColor);
|
||||
WriteParam(aMsg, aParam.GetContentDescription());
|
||||
WriteParam(aMsg, aParam.mLineScrollAmount);
|
||||
WriteParam(aMsg, aParam.mPageScrollAmount);
|
||||
WriteParam(aMsg, aParam.mPaintRequestTime);
|
||||
WriteParam(aMsg, aParam.mScrollUpdateType);
|
||||
WriteParam(aMsg, aParam.mIsRootContent);
|
||||
WriteParam(aMsg, aParam.mHasScrollgrab);
|
||||
WriteParam(aMsg, aParam.mDoSmoothScroll);
|
||||
WriteParam(aMsg, aParam.mUseDisplayPortMargins);
|
||||
WriteParam(aMsg, aParam.mAllowVerticalScrollWithWheel);
|
||||
WriteParam(aMsg, aParam.mIsLayersIdRoot);
|
||||
WriteParam(aMsg, aParam.mUsesContainerScrolling);
|
||||
WriteParam(aMsg, aParam.mIsScrollInfoLayer);
|
||||
WriteParam(aMsg, aParam.mForceDisableApz);
|
||||
}
|
||||
|
||||
static bool ReadContentDescription(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
nsCString str;
|
||||
if (!ReadParam(aMsg, aIter, &str)) {
|
||||
return false;
|
||||
}
|
||||
aResult->SetContentDescription(str);
|
||||
return true;
|
||||
}
|
||||
|
||||
// We need this helper because we can't get the address of a bitfield to
|
||||
// pass directly to ReadParam. So instead we read it into a temporary bool
|
||||
// and set the bitfield using a setter function
|
||||
static bool ReadBoolForBitfield(const Message* aMsg, void** aIter,
|
||||
paramType* aResult, void (paramType::*aSetter)(bool))
|
||||
{
|
||||
bool value;
|
||||
if (ReadParam(aMsg, aIter, &value)) {
|
||||
(aResult->*aSetter)(value);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
return (ReadParam(aMsg, aIter, &aResult->mScrollId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mScrollParentId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mPresShellResolution) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mCompositionBounds) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mDisplayPort) &&
|
||||
@@ -768,21 +754,12 @@ struct ParamTraits<mozilla::layers::FrameMetrics>
|
||||
ReadParam(aMsg, aIter, &aResult->mPresShellId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mViewport) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mExtraResolution) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mBackgroundColor) &&
|
||||
ReadContentDescription(aMsg, aIter, aResult) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mLineScrollAmount) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mPageScrollAmount) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mPaintRequestTime) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mScrollUpdateType) &&
|
||||
ReadBoolForBitfield(aMsg, aIter, aResult, ¶mType::SetIsRootContent) &&
|
||||
ReadBoolForBitfield(aMsg, aIter, aResult, ¶mType::SetHasScrollgrab) &&
|
||||
ReadBoolForBitfield(aMsg, aIter, aResult, ¶mType::SetDoSmoothScroll) &&
|
||||
ReadBoolForBitfield(aMsg, aIter, aResult, ¶mType::SetUseDisplayPortMargins) &&
|
||||
ReadBoolForBitfield(aMsg, aIter, aResult, ¶mType::SetAllowVerticalScrollWithWheel) &&
|
||||
ReadBoolForBitfield(aMsg, aIter, aResult, ¶mType::SetIsLayersIdRoot) &&
|
||||
ReadBoolForBitfield(aMsg, aIter, aResult, ¶mType::SetUsesContainerScrolling) &&
|
||||
ReadBoolForBitfield(aMsg, aIter, aResult, ¶mType::SetIsScrollInfoLayer) &&
|
||||
ReadBoolForBitfield(aMsg, aIter, aResult, ¶mType::SetForceDisableApz));
|
||||
ReadBoolForBitfield(aMsg, aIter, aResult, ¶mType::SetIsScrollInfoLayer));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -814,6 +791,7 @@ struct ParamTraits<mozilla::layers::ScrollSnapInfo>
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::layers::ScrollMetadata>
|
||||
: BitfieldHelper<mozilla::layers::ScrollMetadata>
|
||||
{
|
||||
typedef mozilla::layers::ScrollMetadata paramType;
|
||||
|
||||
@@ -821,16 +799,46 @@ struct ParamTraits<mozilla::layers::ScrollMetadata>
|
||||
{
|
||||
WriteParam(aMsg, aParam.mMetrics);
|
||||
WriteParam(aMsg, aParam.mSnapInfo);
|
||||
WriteParam(aMsg, aParam.mScrollParentId);
|
||||
WriteParam(aMsg, aParam.mBackgroundColor);
|
||||
WriteParam(aMsg, aParam.GetContentDescription());
|
||||
WriteParam(aMsg, aParam.mLineScrollAmount);
|
||||
WriteParam(aMsg, aParam.mPageScrollAmount);
|
||||
WriteParam(aMsg, aParam.mMaskLayerIndex);
|
||||
WriteParam(aMsg, aParam.mClipRect);
|
||||
WriteParam(aMsg, aParam.mHasScrollgrab);
|
||||
WriteParam(aMsg, aParam.mAllowVerticalScrollWithWheel);
|
||||
WriteParam(aMsg, aParam.mIsLayersIdRoot);
|
||||
WriteParam(aMsg, aParam.mUsesContainerScrolling);
|
||||
WriteParam(aMsg, aParam.mForceDisableApz);
|
||||
}
|
||||
|
||||
static bool ReadContentDescription(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
nsCString str;
|
||||
if (!ReadParam(aMsg, aIter, &str)) {
|
||||
return false;
|
||||
}
|
||||
aResult->SetContentDescription(str);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
return (ReadParam(aMsg, aIter, &aResult->mMetrics) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mSnapInfo) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mScrollParentId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mBackgroundColor) &&
|
||||
ReadContentDescription(aMsg, aIter, aResult) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mLineScrollAmount) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mPageScrollAmount) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mMaskLayerIndex) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mClipRect));
|
||||
ReadParam(aMsg, aIter, &aResult->mClipRect) &&
|
||||
ReadBoolForBitfield(aMsg, aIter, aResult, ¶mType::SetHasScrollgrab) &&
|
||||
ReadBoolForBitfield(aMsg, aIter, aResult, ¶mType::SetAllowVerticalScrollWithWheel) &&
|
||||
ReadBoolForBitfield(aMsg, aIter, aResult, ¶mType::SetIsLayersIdRoot) &&
|
||||
ReadBoolForBitfield(aMsg, aIter, aResult, ¶mType::SetUsesContainerScrolling) &&
|
||||
ReadBoolForBitfield(aMsg, aIter, aResult, ¶mType::SetForceDisableApz));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace layers {
|
||||
const FrameMetrics::ViewID FrameMetrics::NULL_SCROLL_ID = 0;
|
||||
|
||||
void
|
||||
FrameMetrics::SetUsesContainerScrolling(bool aValue) {
|
||||
ScrollMetadata::SetUsesContainerScrolling(bool aValue) {
|
||||
MOZ_ASSERT_IF(aValue, gfxPrefs::LayoutUseContainersForRootFrames());
|
||||
mUsesContainerScrolling = aValue;
|
||||
}
|
||||
|
||||
+153
-165
@@ -62,7 +62,6 @@ public:
|
||||
|
||||
FrameMetrics()
|
||||
: mScrollId(NULL_SCROLL_ID)
|
||||
, mScrollParentId(NULL_SCROLL_ID)
|
||||
, mPresShellResolution(1)
|
||||
, mCompositionBounds(0, 0, 0, 0)
|
||||
, mDisplayPort(0, 0, 0, 0)
|
||||
@@ -79,21 +78,12 @@ public:
|
||||
, mPresShellId(-1)
|
||||
, mViewport(0, 0, 0, 0)
|
||||
, mExtraResolution()
|
||||
, mBackgroundColor()
|
||||
, mContentDescription()
|
||||
, mLineScrollAmount(0, 0)
|
||||
, mPageScrollAmount(0, 0)
|
||||
, mPaintRequestTime()
|
||||
, mScrollUpdateType(eNone)
|
||||
, mIsRootContent(false)
|
||||
, mHasScrollgrab(false)
|
||||
, mDoSmoothScroll(false)
|
||||
, mUseDisplayPortMargins(false)
|
||||
, mAllowVerticalScrollWithWheel(false)
|
||||
, mIsLayersIdRoot(false)
|
||||
, mUsesContainerScrolling(false)
|
||||
, mIsScrollInfoLayer(false)
|
||||
, mForceDisableApz(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -103,7 +93,6 @@ public:
|
||||
{
|
||||
// Put mScrollId at the top since it's the most likely one to fail.
|
||||
return mScrollId == aOther.mScrollId &&
|
||||
mScrollParentId == aOther.mScrollParentId &&
|
||||
mPresShellResolution == aOther.mPresShellResolution &&
|
||||
mCompositionBounds.IsEqualEdges(aOther.mCompositionBounds) &&
|
||||
mDisplayPort.IsEqualEdges(aOther.mDisplayPort) &&
|
||||
@@ -120,21 +109,12 @@ public:
|
||||
mPresShellId == aOther.mPresShellId &&
|
||||
mViewport.IsEqualEdges(aOther.mViewport) &&
|
||||
mExtraResolution == aOther.mExtraResolution &&
|
||||
mBackgroundColor == aOther.mBackgroundColor &&
|
||||
// don't compare mContentDescription
|
||||
mLineScrollAmount == aOther.mLineScrollAmount &&
|
||||
mPageScrollAmount == aOther.mPageScrollAmount &&
|
||||
mPaintRequestTime == aOther.mPaintRequestTime &&
|
||||
mScrollUpdateType == aOther.mScrollUpdateType &&
|
||||
mIsRootContent == aOther.mIsRootContent &&
|
||||
mHasScrollgrab == aOther.mHasScrollgrab &&
|
||||
mDoSmoothScroll == aOther.mDoSmoothScroll &&
|
||||
mUseDisplayPortMargins == aOther.mUseDisplayPortMargins &&
|
||||
mAllowVerticalScrollWithWheel == aOther.mAllowVerticalScrollWithWheel &&
|
||||
mIsLayersIdRoot == aOther.mIsLayersIdRoot &&
|
||||
mUsesContainerScrolling == aOther.mUsesContainerScrolling &&
|
||||
mIsScrollInfoLayer == aOther.mIsScrollInfoLayer &&
|
||||
mForceDisableApz == aOther.mForceDisableApz;
|
||||
mIsScrollInfoLayer == aOther.mIsScrollInfoLayer;
|
||||
}
|
||||
|
||||
bool operator!=(const FrameMetrics& aOther) const
|
||||
@@ -260,16 +240,6 @@ public:
|
||||
mScrollUpdateType = ePending;
|
||||
}
|
||||
|
||||
// Make a copy of this FrameMetrics object which does not have any pointers
|
||||
// to heap-allocated memory (i.e. is Plain Old Data, or 'POD'), and is
|
||||
// therefore safe to be placed into shared memory.
|
||||
FrameMetrics MakePODObject() const
|
||||
{
|
||||
FrameMetrics copy = *this;
|
||||
copy.mContentDescription.Truncate();
|
||||
return copy;
|
||||
}
|
||||
|
||||
public:
|
||||
void SetPresShellResolution(float aPresShellResolution)
|
||||
{
|
||||
@@ -341,16 +311,6 @@ public:
|
||||
return mIsRootContent;
|
||||
}
|
||||
|
||||
void SetHasScrollgrab(bool aHasScrollgrab)
|
||||
{
|
||||
mHasScrollgrab = aHasScrollgrab;
|
||||
}
|
||||
|
||||
bool GetHasScrollgrab() const
|
||||
{
|
||||
return mHasScrollgrab;
|
||||
}
|
||||
|
||||
void SetScrollOffset(const CSSPoint& aScrollOffset)
|
||||
{
|
||||
mScrollOffset = aScrollOffset;
|
||||
@@ -423,16 +383,6 @@ public:
|
||||
mScrollId = scrollId;
|
||||
}
|
||||
|
||||
ViewID GetScrollParentId() const
|
||||
{
|
||||
return mScrollParentId;
|
||||
}
|
||||
|
||||
void SetScrollParentId(ViewID aParentId)
|
||||
{
|
||||
mScrollParentId = aParentId;
|
||||
}
|
||||
|
||||
void SetRootCompositionSize(const CSSSize& aRootCompositionSize)
|
||||
{
|
||||
mRootCompositionSize = aRootCompositionSize;
|
||||
@@ -493,46 +443,6 @@ public:
|
||||
return mExtraResolution;
|
||||
}
|
||||
|
||||
const gfx::Color& GetBackgroundColor() const
|
||||
{
|
||||
return mBackgroundColor;
|
||||
}
|
||||
|
||||
void SetBackgroundColor(const gfx::Color& aBackgroundColor)
|
||||
{
|
||||
mBackgroundColor = aBackgroundColor;
|
||||
}
|
||||
|
||||
const nsCString& GetContentDescription() const
|
||||
{
|
||||
return mContentDescription;
|
||||
}
|
||||
|
||||
void SetContentDescription(const nsCString& aContentDescription)
|
||||
{
|
||||
mContentDescription = aContentDescription;
|
||||
}
|
||||
|
||||
const LayoutDeviceIntSize& GetLineScrollAmount() const
|
||||
{
|
||||
return mLineScrollAmount;
|
||||
}
|
||||
|
||||
void SetLineScrollAmount(const LayoutDeviceIntSize& size)
|
||||
{
|
||||
mLineScrollAmount = size;
|
||||
}
|
||||
|
||||
const LayoutDeviceIntSize& GetPageScrollAmount() const
|
||||
{
|
||||
return mPageScrollAmount;
|
||||
}
|
||||
|
||||
void SetPageScrollAmount(const LayoutDeviceIntSize& size)
|
||||
{
|
||||
mPageScrollAmount = size;
|
||||
}
|
||||
|
||||
const CSSRect& GetScrollableRect() const
|
||||
{
|
||||
return mScrollableRect;
|
||||
@@ -543,16 +453,6 @@ public:
|
||||
mScrollableRect = aScrollableRect;
|
||||
}
|
||||
|
||||
bool AllowVerticalScrollWithWheel() const
|
||||
{
|
||||
return mAllowVerticalScrollWithWheel;
|
||||
}
|
||||
|
||||
void SetAllowVerticalScrollWithWheel(bool aValue)
|
||||
{
|
||||
mAllowVerticalScrollWithWheel = aValue;
|
||||
}
|
||||
|
||||
void SetPaintRequestTime(const TimeStamp& aTime) {
|
||||
mPaintRequestTime = aTime;
|
||||
}
|
||||
@@ -560,20 +460,6 @@ public:
|
||||
return mPaintRequestTime;
|
||||
}
|
||||
|
||||
void SetIsLayersIdRoot(bool aValue) {
|
||||
mIsLayersIdRoot = aValue;
|
||||
}
|
||||
bool IsLayersIdRoot() const {
|
||||
return mIsLayersIdRoot;
|
||||
}
|
||||
|
||||
// Implemented out of line because the implementation needs gfxPrefs.h
|
||||
// and we don't want to include that from FrameMetrics.h.
|
||||
void SetUsesContainerScrolling(bool aValue);
|
||||
bool UsesContainerScrolling() const {
|
||||
return mUsesContainerScrolling;
|
||||
}
|
||||
|
||||
void SetIsScrollInfoLayer(bool aIsScrollInfoLayer) {
|
||||
mIsScrollInfoLayer = aIsScrollInfoLayer;
|
||||
}
|
||||
@@ -581,20 +467,10 @@ public:
|
||||
return mIsScrollInfoLayer;
|
||||
}
|
||||
|
||||
void SetForceDisableApz(bool aForceDisable) {
|
||||
mForceDisableApz = aForceDisable;
|
||||
}
|
||||
bool IsApzForceDisabled() const {
|
||||
return mForceDisableApz;
|
||||
}
|
||||
|
||||
private:
|
||||
// A unique ID assigned to each scrollable frame.
|
||||
ViewID mScrollId;
|
||||
|
||||
// The ViewID of the scrollable frame to which overscroll should be handed off.
|
||||
ViewID mScrollParentId;
|
||||
|
||||
// The pres-shell resolution that has been induced on the document containing
|
||||
// this scroll frame as a result of zooming this scroll frame (whether via
|
||||
// user action, or choosing an initial zoom level on page load). This can
|
||||
@@ -727,20 +603,6 @@ private:
|
||||
// that necessary to draw one Layer pixel per Screen pixel.
|
||||
ScreenToLayerScale2D mExtraResolution;
|
||||
|
||||
// The background color to use when overscrolling.
|
||||
gfx::Color mBackgroundColor;
|
||||
|
||||
// A description of the content element corresponding to this frame.
|
||||
// This is empty unless this is a scrollable layer and the
|
||||
// apz.printtree pref is turned on.
|
||||
nsCString mContentDescription;
|
||||
|
||||
// The value of GetLineScrollAmount(), for scroll frames.
|
||||
LayoutDeviceIntSize mLineScrollAmount;
|
||||
|
||||
// The value of GetPageScrollAmount(), for scroll frames.
|
||||
LayoutDeviceIntSize mPageScrollAmount;
|
||||
|
||||
// The time at which the APZC last requested a repaint for this scrollframe.
|
||||
TimeStamp mPaintRequestTime;
|
||||
|
||||
@@ -751,9 +613,6 @@ private:
|
||||
// Whether or not this is the root scroll frame for the root content document.
|
||||
bool mIsRootContent:1;
|
||||
|
||||
// Whether or not this frame is for an element marked 'scrollgrab'.
|
||||
bool mHasScrollgrab:1;
|
||||
|
||||
// When mDoSmoothScroll, the scroll offset should be animated to
|
||||
// smoothly transition to mScrollOffset rather than be updated instantly.
|
||||
bool mDoSmoothScroll:1;
|
||||
@@ -762,35 +621,24 @@ private:
|
||||
// otherwise use the display port rect.
|
||||
bool mUseDisplayPortMargins:1;
|
||||
|
||||
// Whether or not the frame can be vertically scrolled with a mouse wheel.
|
||||
bool mAllowVerticalScrollWithWheel:1;
|
||||
|
||||
// Whether these framemetrics are for the root scroll frame (root element if
|
||||
// we don't have a root scroll frame) for its layers id.
|
||||
bool mIsLayersIdRoot:1;
|
||||
|
||||
// True if scrolling using containers, false otherwise. This can be removed
|
||||
// when containerful scrolling is eliminated.
|
||||
bool mUsesContainerScrolling:1;
|
||||
|
||||
// Whether or not this frame has a "scroll info layer" to capture events.
|
||||
bool mIsScrollInfoLayer:1;
|
||||
|
||||
// Whether or not the compositor should actually do APZ-scrolling on this
|
||||
// scrollframe.
|
||||
bool mForceDisableApz:1;
|
||||
|
||||
// WARNING!!!!
|
||||
//
|
||||
// When adding new fields to FrameMetrics, the following places should be
|
||||
// updated to include them (as needed):
|
||||
// FrameMetrics::operator ==
|
||||
// AsyncPanZoomController::NotifyLayersUpdated
|
||||
// The ParamTraits specialization in GfxMessageUtils.h
|
||||
// When adding a new field:
|
||||
//
|
||||
// - First, consider whether the field can be added to ScrollMetadata
|
||||
// instead. If so, prefer that.
|
||||
//
|
||||
// - Otherwise, the following places should be updated to include them
|
||||
// (as needed):
|
||||
// FrameMetrics::operator ==
|
||||
// AsyncPanZoomController::NotifyLayersUpdated
|
||||
// The ParamTraits specialization in GfxMessageUtils.h
|
||||
//
|
||||
// Please add new fields above this comment.
|
||||
|
||||
|
||||
// Private helpers for IPC purposes
|
||||
void SetDoSmoothScroll(bool aValue) {
|
||||
mDoSmoothScroll = aValue;
|
||||
@@ -803,6 +651,16 @@ struct ScrollSnapInfo {
|
||||
, mScrollSnapTypeY(NS_STYLE_SCROLL_SNAP_TYPE_NONE)
|
||||
{}
|
||||
|
||||
bool operator==(const ScrollSnapInfo& aOther) const
|
||||
{
|
||||
return mScrollSnapTypeX == aOther.mScrollSnapTypeX &&
|
||||
mScrollSnapTypeY == aOther.mScrollSnapTypeY &&
|
||||
mScrollSnapIntervalX == aOther.mScrollSnapIntervalX &&
|
||||
mScrollSnapIntervalY == aOther.mScrollSnapIntervalY &&
|
||||
mScrollSnapDestination == aOther.mScrollSnapDestination &&
|
||||
mScrollSnapCoordinates == aOther.mScrollSnapCoordinates;
|
||||
}
|
||||
|
||||
// The scroll frame's scroll-snap-type.
|
||||
// One of NS_STYLE_SCROLL_SNAP_{NONE, MANDATORY, PROXIMITY}.
|
||||
uint8_t mScrollSnapTypeX;
|
||||
@@ -830,22 +688,44 @@ struct ScrollSnapInfo {
|
||||
*/
|
||||
struct ScrollMetadata {
|
||||
friend struct IPC::ParamTraits<mozilla::layers::ScrollMetadata>;
|
||||
|
||||
typedef FrameMetrics::ViewID ViewID;
|
||||
public:
|
||||
static StaticAutoPtr<const ScrollMetadata> sNullMetadata; // We sometimes need an empty metadata
|
||||
|
||||
ScrollMetadata()
|
||||
: mMetrics()
|
||||
, mSnapInfo()
|
||||
, mScrollParentId(FrameMetrics::NULL_SCROLL_ID)
|
||||
, mBackgroundColor()
|
||||
, mContentDescription()
|
||||
, mLineScrollAmount(0, 0)
|
||||
, mPageScrollAmount(0, 0)
|
||||
, mMaskLayerIndex()
|
||||
, mClipRect()
|
||||
, mHasScrollgrab(false)
|
||||
, mAllowVerticalScrollWithWheel(false)
|
||||
, mIsLayersIdRoot(false)
|
||||
, mUsesContainerScrolling(false)
|
||||
, mForceDisableApz(false)
|
||||
{}
|
||||
|
||||
bool operator==(const ScrollMetadata& aOther) const
|
||||
{
|
||||
// TODO(botond): Should we include mSnapInfo in the comparison?
|
||||
return mMetrics == aOther.mMetrics &&
|
||||
mSnapInfo == aOther.mSnapInfo &&
|
||||
mScrollParentId == aOther.mScrollParentId &&
|
||||
mBackgroundColor == aOther.mBackgroundColor &&
|
||||
// don't compare mContentDescription
|
||||
mLineScrollAmount == aOther.mLineScrollAmount &&
|
||||
mPageScrollAmount == aOther.mPageScrollAmount &&
|
||||
mMaskLayerIndex == aOther.mMaskLayerIndex &&
|
||||
mClipRect == aOther.mClipRect;
|
||||
mClipRect == aOther.mClipRect &&
|
||||
mHasScrollgrab == aOther.mHasScrollgrab &&
|
||||
mAllowVerticalScrollWithWheel == aOther.mAllowVerticalScrollWithWheel &&
|
||||
mIsLayersIdRoot == aOther.mIsLayersIdRoot &&
|
||||
mUsesContainerScrolling == aOther.mUsesContainerScrolling &&
|
||||
mForceDisableApz == aOther.mForceDisableApz;
|
||||
}
|
||||
|
||||
bool operator!=(const ScrollMetadata& aOther) const
|
||||
@@ -869,6 +749,37 @@ public:
|
||||
}
|
||||
const ScrollSnapInfo& GetSnapInfo() const { return mSnapInfo; }
|
||||
|
||||
ViewID GetScrollParentId() const {
|
||||
return mScrollParentId;
|
||||
}
|
||||
|
||||
void SetScrollParentId(ViewID aParentId) {
|
||||
mScrollParentId = aParentId;
|
||||
}
|
||||
const gfx::Color& GetBackgroundColor() const {
|
||||
return mBackgroundColor;
|
||||
}
|
||||
void SetBackgroundColor(const gfx::Color& aBackgroundColor) {
|
||||
mBackgroundColor = aBackgroundColor;
|
||||
}
|
||||
const nsCString& GetContentDescription() const {
|
||||
return mContentDescription;
|
||||
}
|
||||
void SetContentDescription(const nsCString& aContentDescription) {
|
||||
mContentDescription = aContentDescription;
|
||||
}
|
||||
const LayoutDeviceIntSize& GetLineScrollAmount() const {
|
||||
return mLineScrollAmount;
|
||||
}
|
||||
void SetLineScrollAmount(const LayoutDeviceIntSize& size) {
|
||||
mLineScrollAmount = size;
|
||||
}
|
||||
const LayoutDeviceIntSize& GetPageScrollAmount() const {
|
||||
return mPageScrollAmount;
|
||||
}
|
||||
void SetPageScrollAmount(const LayoutDeviceIntSize& size) {
|
||||
mPageScrollAmount = size;
|
||||
}
|
||||
void SetMaskLayerIndex(const Maybe<size_t>& aIndex) {
|
||||
mMaskLayerIndex = aIndex;
|
||||
}
|
||||
@@ -890,12 +801,61 @@ public:
|
||||
const ParentLayerIntRect& ClipRect() const {
|
||||
return mClipRect.ref();
|
||||
}
|
||||
|
||||
void SetHasScrollgrab(bool aHasScrollgrab) {
|
||||
mHasScrollgrab = aHasScrollgrab;
|
||||
}
|
||||
bool GetHasScrollgrab() const {
|
||||
return mHasScrollgrab;
|
||||
}
|
||||
bool AllowVerticalScrollWithWheel() const {
|
||||
return mAllowVerticalScrollWithWheel;
|
||||
}
|
||||
void SetAllowVerticalScrollWithWheel(bool aValue) {
|
||||
mAllowVerticalScrollWithWheel = aValue;
|
||||
}
|
||||
void SetIsLayersIdRoot(bool aValue) {
|
||||
mIsLayersIdRoot = aValue;
|
||||
}
|
||||
bool IsLayersIdRoot() const {
|
||||
return mIsLayersIdRoot;
|
||||
}
|
||||
// Implemented out of line because the implementation needs gfxPrefs.h
|
||||
// and we don't want to include that from FrameMetrics.h.
|
||||
void SetUsesContainerScrolling(bool aValue);
|
||||
bool UsesContainerScrolling() const {
|
||||
return mUsesContainerScrolling;
|
||||
}
|
||||
void SetForceDisableApz(bool aForceDisable) {
|
||||
mForceDisableApz = aForceDisable;
|
||||
}
|
||||
bool IsApzForceDisabled() const {
|
||||
return mForceDisableApz;
|
||||
}
|
||||
|
||||
private:
|
||||
FrameMetrics mMetrics;
|
||||
|
||||
// Information used to determine where to snap to for a given scroll.
|
||||
ScrollSnapInfo mSnapInfo;
|
||||
|
||||
// The ViewID of the scrollable frame to which overscroll should be handed off.
|
||||
ViewID mScrollParentId;
|
||||
|
||||
// The background color to use when overscrolling.
|
||||
gfx::Color mBackgroundColor;
|
||||
|
||||
// A description of the content element corresponding to this frame.
|
||||
// This is empty unless this is a scrollable layer and the
|
||||
// apz.printtree pref is turned on.
|
||||
nsCString mContentDescription;
|
||||
|
||||
// The value of GetLineScrollAmount(), for scroll frames.
|
||||
LayoutDeviceIntSize mLineScrollAmount;
|
||||
|
||||
// The value of GetPageScrollAmount(), for scroll frames.
|
||||
LayoutDeviceIntSize mPageScrollAmount;
|
||||
|
||||
// An extra clip mask layer to use when compositing a layer with this
|
||||
// FrameMetrics. This is an index into the MetricsMaskLayers array on
|
||||
// the Layer.
|
||||
@@ -903,6 +863,34 @@ private:
|
||||
|
||||
// The clip rect to use when compositing a layer with this FrameMetrics.
|
||||
Maybe<ParentLayerIntRect> mClipRect;
|
||||
|
||||
// Whether or not this frame is for an element marked 'scrollgrab'.
|
||||
bool mHasScrollgrab:1;
|
||||
|
||||
// Whether or not the frame can be vertically scrolled with a mouse wheel.
|
||||
bool mAllowVerticalScrollWithWheel:1;
|
||||
|
||||
// Whether these framemetrics are for the root scroll frame (root element if
|
||||
// we don't have a root scroll frame) for its layers id.
|
||||
bool mIsLayersIdRoot:1;
|
||||
|
||||
// True if scrolling using containers, false otherwise. This can be removed
|
||||
// when containerful scrolling is eliminated.
|
||||
bool mUsesContainerScrolling:1;
|
||||
|
||||
// Whether or not the compositor should actually do APZ-scrolling on this
|
||||
// scrollframe.
|
||||
bool mForceDisableApz:1;
|
||||
|
||||
// WARNING!!!!
|
||||
//
|
||||
// When adding new fields to ScrollMetadata, the following places should be
|
||||
// updated to include them (as needed):
|
||||
// ScrollMetadata::operator ==
|
||||
// AsyncPanZoomController::NotifyLayersUpdated
|
||||
// The ParamTraits specialization in GfxMessageUtils.h
|
||||
//
|
||||
// Please add new fields above this comment.
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -149,11 +149,15 @@ AppendToString(std::stringstream& aStream, const ScrollMetadata& m,
|
||||
const char* pfx, const char* sfx)
|
||||
{
|
||||
aStream << pfx;
|
||||
AppendToString(aStream, m.GetMetrics(), "{ [metrics=", "]");
|
||||
if (m.HasClipRect()) {
|
||||
AppendToString(aStream, m.ClipRect(), " [clip=", "]");
|
||||
AppendToString(aStream, m.GetMetrics(), "{ [metrics=");
|
||||
AppendToString(aStream, m.GetBackgroundColor(), "] [color=");
|
||||
if (m.GetScrollParentId() != FrameMetrics::NULL_SCROLL_ID) {
|
||||
AppendToString(aStream, m.GetScrollParentId(), "] [scrollParent=");
|
||||
}
|
||||
aStream << "}" << sfx;
|
||||
if (m.HasClipRect()) {
|
||||
AppendToString(aStream, m.ClipRect(), "] [clip=");
|
||||
}
|
||||
aStream << "] }" << sfx;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -169,12 +173,8 @@ AppendToString(std::stringstream& aStream, const FrameMetrics& m,
|
||||
}
|
||||
AppendToString(aStream, m.GetDisplayPort(), "] [dp=");
|
||||
AppendToString(aStream, m.GetCriticalDisplayPort(), "] [cdp=");
|
||||
AppendToString(aStream, m.GetBackgroundColor(), "] [color=");
|
||||
if (!detailed) {
|
||||
AppendToString(aStream, m.GetScrollId(), "] [scrollId=");
|
||||
if (m.GetScrollParentId() != FrameMetrics::NULL_SCROLL_ID) {
|
||||
AppendToString(aStream, m.GetScrollParentId(), "] [scrollParent=");
|
||||
}
|
||||
if (m.IsRootContent()) {
|
||||
aStream << "] [rcd";
|
||||
}
|
||||
@@ -193,7 +193,6 @@ AppendToString(std::stringstream& aStream, const FrameMetrics& m,
|
||||
aStream << nsPrintfCString(")] [u=(%d %d %lu)",
|
||||
m.GetScrollUpdateType(), m.GetDoSmoothScroll(),
|
||||
m.GetScrollGeneration()).get();
|
||||
AppendToString(aStream, m.GetScrollParentId(), "] [p=");
|
||||
aStream << nsPrintfCString("] [i=(%ld %lld %d)] }",
|
||||
m.GetPresShellId(), m.GetScrollId(), m.IsRootContent()).get();
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ APZCTreeManager::PrintAPZCInfo(const LayerMetricsWrapper& aLayer,
|
||||
<< "\tsr=" << metrics.GetScrollableRect()
|
||||
<< (aLayer.IsScrollInfoLayer() ? "\tscrollinfo" : "")
|
||||
<< (apzc->HasScrollgrab() ? "\tscrollgrab" : "") << "\t"
|
||||
<< metrics.GetContentDescription().get();
|
||||
<< aLayer.Metadata().GetContentDescription().get();
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -887,6 +887,7 @@ AsyncPanZoomController::AsyncPanZoomController(uint64_t aLayersId,
|
||||
mSharingFrameMetricsAcrossProcesses(false),
|
||||
mFrameMetrics(mScrollMetadata.GetMetrics()),
|
||||
mMonitor("AsyncPanZoomController"),
|
||||
mLastContentPaintMetrics(mLastContentPaintMetadata.GetMetrics()),
|
||||
mX(this),
|
||||
mY(this),
|
||||
mPanDirRestricted(false),
|
||||
@@ -1662,8 +1663,8 @@ AsyncPanZoomController::GetScrollWheelDelta(const ScrollWheelInput& aEvent) cons
|
||||
{
|
||||
// Grab the lock to access the frame metrics.
|
||||
ReentrantMonitorAutoEnter lock(mMonitor);
|
||||
LayoutDeviceIntSize scrollAmountLD = mFrameMetrics.GetLineScrollAmount();
|
||||
LayoutDeviceIntSize pageScrollSizeLD = mFrameMetrics.GetPageScrollAmount();
|
||||
LayoutDeviceIntSize scrollAmountLD = mScrollMetadata.GetLineScrollAmount();
|
||||
LayoutDeviceIntSize pageScrollSizeLD = mScrollMetadata.GetPageScrollAmount();
|
||||
isRootContent = mFrameMetrics.IsRootContent();
|
||||
scrollAmount = scrollAmountLD /
|
||||
mFrameMetrics.GetDevPixelsPerCSSPixel() * mFrameMetrics.GetZoom();
|
||||
@@ -1765,7 +1766,7 @@ AsyncPanZoomController::CanScrollWithWheel(const ParentLayerPoint& aDelta) const
|
||||
if (mX.CanScroll(aDelta.x)) {
|
||||
return true;
|
||||
}
|
||||
if (mY.CanScroll(aDelta.y) && mFrameMetrics.AllowVerticalScrollWithWheel()) {
|
||||
if (mY.CanScroll(aDelta.y) && mScrollMetadata.AllowVerticalScrollWithWheel()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -2448,7 +2449,7 @@ bool AsyncPanZoomController::AttemptScroll(ParentLayerPoint& aStartPoint,
|
||||
ParentLayerPoint adjustedDisplacement;
|
||||
bool forceVerticalOverscroll =
|
||||
(aOverscrollHandoffState.mScrollSource == ScrollSource::Wheel &&
|
||||
!mFrameMetrics.AllowVerticalScrollWithWheel());
|
||||
!mScrollMetadata.AllowVerticalScrollWithWheel());
|
||||
bool yChanged = mY.AdjustDisplacement(displacement.y, adjustedDisplacement.y, overscroll.y,
|
||||
forceVerticalOverscroll);
|
||||
bool xChanged = mX.AdjustDisplacement(displacement.x, adjustedDisplacement.x, overscroll.x);
|
||||
@@ -3098,7 +3099,7 @@ AsyncPanZoomController::GetOverscrollTransform(AsyncMode aMode) const
|
||||
{
|
||||
ReentrantMonitorAutoEnter lock(mMonitor);
|
||||
|
||||
if (aMode == RESPECT_FORCE_DISABLE && mFrameMetrics.IsApzForceDisabled()) {
|
||||
if (aMode == RESPECT_FORCE_DISABLE && mScrollMetadata.IsApzForceDisabled()) {
|
||||
return AsyncTransformComponentMatrix();
|
||||
}
|
||||
|
||||
@@ -3199,7 +3200,7 @@ AsyncPanZoomController::GetCurrentAsyncScrollOffset(AsyncMode aMode) const
|
||||
{
|
||||
ReentrantMonitorAutoEnter lock(mMonitor);
|
||||
|
||||
if (aMode == RESPECT_FORCE_DISABLE && mFrameMetrics.IsApzForceDisabled()) {
|
||||
if (aMode == RESPECT_FORCE_DISABLE && mScrollMetadata.IsApzForceDisabled()) {
|
||||
return mLastContentPaintMetrics.GetScrollOffset() * mLastContentPaintMetrics.GetZoom();
|
||||
}
|
||||
|
||||
@@ -3212,7 +3213,7 @@ AsyncPanZoomController::GetCurrentAsyncTransform(AsyncMode aMode) const
|
||||
{
|
||||
ReentrantMonitorAutoEnter lock(mMonitor);
|
||||
|
||||
if (aMode == RESPECT_FORCE_DISABLE && mFrameMetrics.IsApzForceDisabled()) {
|
||||
if (aMode == RESPECT_FORCE_DISABLE && mScrollMetadata.IsApzForceDisabled()) {
|
||||
return AsyncTransform();
|
||||
}
|
||||
|
||||
@@ -3373,16 +3374,16 @@ void AsyncPanZoomController::NotifyLayersUpdated(const ScrollMetadata& aScrollMe
|
||||
|
||||
const FrameMetrics& aLayerMetrics = aScrollMetadata.GetMetrics();
|
||||
|
||||
if ((aLayerMetrics == mLastContentPaintMetrics) && !isDefault) {
|
||||
if ((aScrollMetadata == mLastContentPaintMetadata) && !isDefault) {
|
||||
// No new information here, skip it.
|
||||
APZC_LOG("%p NotifyLayersUpdated short-circuit\n", this);
|
||||
return;
|
||||
}
|
||||
if (aLayerMetrics.GetScrollUpdateType() != FrameMetrics::ScrollOffsetUpdateType::ePending) {
|
||||
mLastContentPaintMetrics = aLayerMetrics;
|
||||
mLastContentPaintMetadata = aScrollMetadata;
|
||||
}
|
||||
|
||||
mFrameMetrics.SetScrollParentId(aLayerMetrics.GetScrollParentId());
|
||||
mScrollMetadata.SetScrollParentId(aScrollMetadata.GetScrollParentId());
|
||||
APZC_LOG_FM(aLayerMetrics, "%p got a NotifyLayersUpdated with aIsFirstPaint=%d, aThisLayerTreeUpdated=%d",
|
||||
this, aIsFirstPaint, aThisLayerTreeUpdated);
|
||||
|
||||
@@ -3504,16 +3505,16 @@ void AsyncPanZoomController::NotifyLayersUpdated(const ScrollMetadata& aScrollMe
|
||||
mFrameMetrics.SetRootCompositionSize(aLayerMetrics.GetRootCompositionSize());
|
||||
mFrameMetrics.SetPresShellResolution(aLayerMetrics.GetPresShellResolution());
|
||||
mFrameMetrics.SetCumulativeResolution(aLayerMetrics.GetCumulativeResolution());
|
||||
mFrameMetrics.SetHasScrollgrab(aLayerMetrics.GetHasScrollgrab());
|
||||
mFrameMetrics.SetLineScrollAmount(aLayerMetrics.GetLineScrollAmount());
|
||||
mFrameMetrics.SetPageScrollAmount(aLayerMetrics.GetPageScrollAmount());
|
||||
mScrollMetadata.SetHasScrollgrab(aScrollMetadata.GetHasScrollgrab());
|
||||
mScrollMetadata.SetLineScrollAmount(aScrollMetadata.GetLineScrollAmount());
|
||||
mScrollMetadata.SetPageScrollAmount(aScrollMetadata.GetPageScrollAmount());
|
||||
mScrollMetadata.SetSnapInfo(ScrollSnapInfo(aScrollMetadata.GetSnapInfo()));
|
||||
mScrollMetadata.SetClipRect(aScrollMetadata.GetClipRect());
|
||||
mScrollMetadata.SetMaskLayerIndex(aScrollMetadata.GetMaskLayerIndex());
|
||||
mFrameMetrics.SetIsLayersIdRoot(aLayerMetrics.IsLayersIdRoot());
|
||||
mFrameMetrics.SetUsesContainerScrolling(aLayerMetrics.UsesContainerScrolling());
|
||||
mScrollMetadata.SetIsLayersIdRoot(aScrollMetadata.IsLayersIdRoot());
|
||||
mScrollMetadata.SetUsesContainerScrolling(aScrollMetadata.UsesContainerScrolling());
|
||||
mFrameMetrics.SetIsScrollInfoLayer(aLayerMetrics.IsScrollInfoLayer());
|
||||
mFrameMetrics.SetForceDisableApz(aLayerMetrics.IsApzForceDisabled());
|
||||
mScrollMetadata.SetForceDisableApz(aScrollMetadata.IsApzForceDisabled());
|
||||
|
||||
if (scrollOffsetUpdated) {
|
||||
APZC_LOG("%p updating scroll offset from %s to %s\n", this,
|
||||
@@ -3889,7 +3890,7 @@ void AsyncPanZoomController::UpdateSharedCompositorFrameMetrics()
|
||||
|
||||
if (frame && mSharedLock && gfxPlatform::GetPlatform()->UseProgressivePaint()) {
|
||||
mSharedLock->Lock();
|
||||
*frame = mFrameMetrics.MakePODObject();
|
||||
*frame = mFrameMetrics;
|
||||
mSharedLock->Unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ public:
|
||||
* Returns whether this APZC is for an element marked with the 'scrollgrab'
|
||||
* attribute.
|
||||
*/
|
||||
bool HasScrollgrab() const { return mFrameMetrics.GetHasScrollgrab(); }
|
||||
bool HasScrollgrab() const { return mScrollMetadata.GetHasScrollgrab(); }
|
||||
|
||||
/**
|
||||
* Returns whether this APZC has room to be panned (in any direction).
|
||||
@@ -660,13 +660,14 @@ protected:
|
||||
mutable ReentrantMonitor mMonitor;
|
||||
|
||||
private:
|
||||
// Metrics of the container layer corresponding to this APZC. This is
|
||||
// Metadata of the container layer corresponding to this APZC. This is
|
||||
// stored here so that it is accessible from the UI/controller thread.
|
||||
// These are the metrics at last content paint, the most recent
|
||||
// values we were notified of in NotifyLayersUpdate(). Since it represents
|
||||
// the Gecko state, it should be used as a basis for untransformation when
|
||||
// sending messages back to Gecko.
|
||||
FrameMetrics mLastContentPaintMetrics;
|
||||
ScrollMetadata mLastContentPaintMetadata;
|
||||
FrameMetrics& mLastContentPaintMetrics; // for convenience, refers to mLastContentPaintMetadata.mMetrics
|
||||
// The last metrics used for a content repaint request.
|
||||
FrameMetrics mLastPaintRequestMetrics;
|
||||
// The metrics that we expect content to have. This is updated when we
|
||||
@@ -919,7 +920,7 @@ public:
|
||||
|
||||
bool IsRootForLayersId() const {
|
||||
ReentrantMonitorAutoEnter lock(mMonitor);
|
||||
return mFrameMetrics.IsLayersIdRoot();
|
||||
return mScrollMetadata.IsLayersIdRoot();
|
||||
}
|
||||
|
||||
bool IsRootContent() const {
|
||||
@@ -940,7 +941,7 @@ private:
|
||||
*/
|
||||
public:
|
||||
FrameMetrics::ViewID GetScrollHandoffParentId() const {
|
||||
return mFrameMetrics.GetScrollParentId();
|
||||
return mScrollMetadata.GetScrollParentId();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -67,7 +67,7 @@ WheelScrollAnimation::DoSample(FrameMetrics& aFrameMetrics, const TimeDuration&
|
||||
ParentLayerPoint adjustedOffset, overscroll;
|
||||
mApzc.mX.AdjustDisplacement(displacement.x, adjustedOffset.x, overscroll.x);
|
||||
mApzc.mY.AdjustDisplacement(displacement.y, adjustedOffset.y, overscroll.y,
|
||||
!aFrameMetrics.AllowVerticalScrollWithWheel());
|
||||
!mApzc.mScrollMetadata.AllowVerticalScrollWithWheel());
|
||||
|
||||
// If we expected to scroll, but there's no more scroll range on either axis,
|
||||
// then end the animation early. Note that the initial displacement could be 0
|
||||
|
||||
@@ -57,38 +57,58 @@ protected:
|
||||
RefPtr<TestAPZCTreeManager> manager;
|
||||
|
||||
protected:
|
||||
static void SetScrollableFrameMetrics(Layer* aLayer, FrameMetrics::ViewID aScrollId,
|
||||
CSSRect aScrollableRect = CSSRect(-1, -1, -1, -1)) {
|
||||
static ScrollMetadata BuildScrollMetadata(FrameMetrics::ViewID aScrollId,
|
||||
const CSSRect& aScrollableRect,
|
||||
const ParentLayerRect& aCompositionBounds)
|
||||
{
|
||||
ScrollMetadata metadata;
|
||||
FrameMetrics& metrics = metadata.GetMetrics();
|
||||
metrics.SetScrollId(aScrollId);
|
||||
// By convention in this test file, START_SCROLL_ID is the root, so mark it as such.
|
||||
if (aScrollId == FrameMetrics::START_SCROLL_ID) {
|
||||
metrics.SetIsLayersIdRoot(true);
|
||||
metadata.SetIsLayersIdRoot(true);
|
||||
}
|
||||
IntRect layerBound = aLayer->GetVisibleRegion().ToUnknownRegion().GetBounds();
|
||||
metrics.SetCompositionBounds(ParentLayerRect(layerBound.x, layerBound.y,
|
||||
layerBound.width, layerBound.height));
|
||||
metrics.SetCompositionBounds(aCompositionBounds);
|
||||
metrics.SetScrollableRect(aScrollableRect);
|
||||
metrics.SetScrollOffset(CSSPoint(0, 0));
|
||||
metrics.SetPageScrollAmount(LayoutDeviceIntSize(50, 100));
|
||||
metrics.SetAllowVerticalScrollWithWheel(true);
|
||||
aLayer->SetScrollMetadata(metadata);
|
||||
aLayer->SetClipRect(Some(ViewAs<ParentLayerPixel>(layerBound)));
|
||||
if (!aScrollableRect.IsEqualEdges(CSSRect(-1, -1, -1, -1))) {
|
||||
metadata.SetPageScrollAmount(LayoutDeviceIntSize(50, 100));
|
||||
metadata.SetLineScrollAmount(LayoutDeviceIntSize(5, 10));
|
||||
metadata.SetAllowVerticalScrollWithWheel(true);
|
||||
return metadata;
|
||||
}
|
||||
|
||||
static void SetEventRegionsBasedOnBottommostMetrics(Layer* aLayer)
|
||||
{
|
||||
const FrameMetrics& metrics = aLayer->GetScrollMetadata(0).GetMetrics();
|
||||
CSSRect scrollableRect = metrics.GetScrollableRect();
|
||||
if (!scrollableRect.IsEqualEdges(CSSRect(-1, -1, -1, -1))) {
|
||||
// The purpose of this is to roughly mimic what layout would do in the
|
||||
// case of a scrollable frame with the event regions and clip. This lets
|
||||
// us exercise the hit-testing code in APZCTreeManager
|
||||
EventRegions er = aLayer->GetEventRegions();
|
||||
IntRect scrollRect = RoundedToInt(aScrollableRect * metrics.LayersPixelsPerCSSPixel()).ToUnknownRect();
|
||||
er.mHitRegion = nsIntRegion(IntRect(layerBound.TopLeft(), scrollRect.Size()));
|
||||
IntRect scrollRect = RoundedToInt(
|
||||
scrollableRect * metrics.LayersPixelsPerCSSPixel()).ToUnknownRect();
|
||||
er.mHitRegion = nsIntRegion(IntRect(
|
||||
RoundedToInt(metrics.GetCompositionBounds().TopLeft().ToUnknownPoint()),
|
||||
scrollRect.Size()));
|
||||
aLayer->SetEventRegions(er);
|
||||
}
|
||||
}
|
||||
|
||||
static void SetScrollableFrameMetrics(Layer* aLayer, FrameMetrics::ViewID aScrollId,
|
||||
CSSRect aScrollableRect = CSSRect(-1, -1, -1, -1)) {
|
||||
ParentLayerIntRect compositionBounds = ViewAs<ParentLayerPixel>(
|
||||
aLayer->GetVisibleRegion().ToUnknownRegion().GetBounds());
|
||||
ScrollMetadata metadata = BuildScrollMetadata(aScrollId, aScrollableRect,
|
||||
ParentLayerRect(compositionBounds));
|
||||
aLayer->SetScrollMetadata(metadata);
|
||||
aLayer->SetClipRect(Some(compositionBounds));
|
||||
SetEventRegionsBasedOnBottommostMetrics(aLayer);
|
||||
}
|
||||
|
||||
void SetScrollHandoff(Layer* aChild, Layer* aParent) {
|
||||
ScrollMetadata metadata = aChild->GetScrollMetadata(0);
|
||||
metadata.GetMetrics().SetScrollParentId(aParent->GetFrameMetrics(0).GetScrollId());
|
||||
metadata.SetScrollParentId(aParent->GetFrameMetrics(0).GetScrollId());
|
||||
aChild->SetScrollMetadata(metadata);
|
||||
}
|
||||
|
||||
@@ -97,6 +117,11 @@ protected:
|
||||
return (TestAsyncPanZoomController*)aLayer->GetAsyncPanZoomController(0);
|
||||
}
|
||||
|
||||
static TestAsyncPanZoomController* ApzcOf(Layer* aLayer, uint32_t aIndex) {
|
||||
EXPECT_LT(aIndex, aLayer->GetScrollMetadataCount());
|
||||
return (TestAsyncPanZoomController*)aLayer->GetAsyncPanZoomController(aIndex);
|
||||
}
|
||||
|
||||
void CreateSimpleScrollingLayer() {
|
||||
const char* layerTreeSyntax = "t";
|
||||
nsIntRegion layerVisibleRegion[] = {
|
||||
|
||||
@@ -221,6 +221,11 @@ public:
|
||||
return mFrameMetrics;
|
||||
}
|
||||
|
||||
ScrollMetadata& GetScrollMetadata() {
|
||||
ReentrantMonitorAutoEnter lock(mMonitor);
|
||||
return mScrollMetadata;
|
||||
}
|
||||
|
||||
const FrameMetrics& GetFrameMetrics() const {
|
||||
ReentrantMonitorAutoEnter lock(mMonitor);
|
||||
return mFrameMetrics;
|
||||
|
||||
@@ -480,4 +480,26 @@ DoubleTapAndCheckStatus(const RefPtr<InputReceiver>& aTarget,
|
||||
EXPECT_EQ(nsEventStatus_eConsumeDoDefault, statuses[3]);
|
||||
}
|
||||
|
||||
template<class InputReceiver>
|
||||
nsEventStatus
|
||||
Wheel(const RefPtr<InputReceiver>& aTarget, const ScreenIntPoint& aPoint,
|
||||
const ScreenPoint& aDelta, TimeStamp aTime, uint64_t* aOutInputBlockId = nullptr)
|
||||
{
|
||||
ScrollWheelInput input(MillisecondsSinceStartup(aTime), aTime, 0,
|
||||
ScrollWheelInput::SCROLLMODE_INSTANT, ScrollWheelInput::SCROLLDELTA_PIXEL,
|
||||
aPoint, aDelta.x, aDelta.y, false);
|
||||
return aTarget->ReceiveInputEvent(input, nullptr, aOutInputBlockId);
|
||||
}
|
||||
|
||||
template<class InputReceiver>
|
||||
nsEventStatus
|
||||
SmoothWheel(const RefPtr<InputReceiver>& aTarget, const ScreenIntPoint& aPoint,
|
||||
const ScreenPoint& aDelta, TimeStamp aTime, uint64_t* aOutInputBlockId = nullptr)
|
||||
{
|
||||
ScrollWheelInput input(MillisecondsSinceStartup(aTime), aTime, 0,
|
||||
ScrollWheelInput::SCROLLMODE_SMOOTH, ScrollWheelInput::SCROLLDELTA_LINE,
|
||||
aPoint, aDelta.x, aDelta.y, false);
|
||||
return aTarget->ReceiveInputEvent(input, nullptr, aOutInputBlockId);
|
||||
}
|
||||
|
||||
#endif // mozilla_layers_InputUtils_h
|
||||
|
||||
@@ -592,3 +592,19 @@ TEST_F(APZCGestureDetectorTester, TapFollowedByMultipleTouches) {
|
||||
apzc->AssertStateIsReset();
|
||||
}
|
||||
|
||||
TEST_F(APZCGestureDetectorTester, LongPressInterruptedByWheel) {
|
||||
// Since the wheel block interrupted the long-press, we don't expect
|
||||
// any long-press notifications. However, this also shouldn't crash, which
|
||||
// is what it used to do.
|
||||
EXPECT_CALL(*mcc, HandleLongTap(_, _, _, _)).Times(0);
|
||||
|
||||
uint64_t touchBlockId = 0;
|
||||
uint64_t wheelBlockId = 0;
|
||||
TouchDown(apzc, ScreenIntPoint(10, 10), mcc->Time(), &touchBlockId);
|
||||
mcc->AdvanceByMillis(10);
|
||||
Wheel(apzc, ScreenIntPoint(10, 10), ScreenPoint(0, -10), mcc->Time(), &wheelBlockId);
|
||||
EXPECT_NE(touchBlockId, wheelBlockId);
|
||||
mcc->AdvanceByMillis(1000);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -58,6 +58,12 @@ protected:
|
||||
SetScrollableFrameMetrics(layers[3], FrameMetrics::START_SCROLL_ID + 2, CSSRect(0, 0, 80, 80));
|
||||
}
|
||||
|
||||
void DisableApzOn(Layer* aLayer) {
|
||||
ScrollMetadata m = aLayer->GetScrollMetadata(0);
|
||||
m.SetForceDisableApz(true);
|
||||
aLayer->SetScrollMetadata(m);
|
||||
}
|
||||
|
||||
void CreateComplexMultiLayerTree() {
|
||||
const char* layerTreeSyntax = "c(tc(t)tc(c(t)tt))";
|
||||
// LayerID 0 12 3 45 6 7 89
|
||||
@@ -453,6 +459,48 @@ TEST_F(APZHitTestingTester, TestRepaintFlushOnWheelEvents) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(APZHitTestingTester, TestForceDisableApz) {
|
||||
CreateSimpleScrollingLayer();
|
||||
DisableApzOn(root);
|
||||
ScopedLayerTreeRegistration registration(manager, 0, root, mcc);
|
||||
manager->UpdateHitTestingTree(nullptr, root, false, 0, 0);
|
||||
TestAsyncPanZoomController* apzcroot = ApzcOf(root);
|
||||
|
||||
ScreenPoint origin(100, 50);
|
||||
ScrollWheelInput swi(MillisecondsSinceStartup(mcc->Time()), mcc->Time(), 0,
|
||||
ScrollWheelInput::SCROLLMODE_INSTANT, ScrollWheelInput::SCROLLDELTA_PIXEL,
|
||||
origin, 0, 10, false);
|
||||
EXPECT_EQ(nsEventStatus_eConsumeDoDefault, manager->ReceiveInputEvent(swi, nullptr, nullptr));
|
||||
EXPECT_EQ(origin, swi.mOrigin);
|
||||
|
||||
AsyncTransform viewTransform;
|
||||
ParentLayerPoint point;
|
||||
apzcroot->SampleContentTransformForFrame(&viewTransform, point);
|
||||
// Since APZ is force-disabled, we expect to see the async transform via
|
||||
// the NORMAL AsyncMode, but not via the RESPECT_FORCE_DISABLE AsyncMode.
|
||||
EXPECT_EQ(0, point.x);
|
||||
EXPECT_EQ(10, point.y);
|
||||
EXPECT_EQ(0, viewTransform.mTranslation.x);
|
||||
EXPECT_EQ(-10, viewTransform.mTranslation.y);
|
||||
viewTransform = apzcroot->GetCurrentAsyncTransform(AsyncPanZoomController::RESPECT_FORCE_DISABLE);
|
||||
point = apzcroot->GetCurrentAsyncScrollOffset(AsyncPanZoomController::RESPECT_FORCE_DISABLE);
|
||||
EXPECT_EQ(0, point.x);
|
||||
EXPECT_EQ(0, point.y);
|
||||
EXPECT_EQ(0, viewTransform.mTranslation.x);
|
||||
EXPECT_EQ(0, viewTransform.mTranslation.y);
|
||||
|
||||
mcc->AdvanceByMillis(10);
|
||||
|
||||
// With untransforming events we should get normal behaviour (in this case,
|
||||
// no noticeable untransform, because the repaint request already got
|
||||
// flushed).
|
||||
swi = ScrollWheelInput(MillisecondsSinceStartup(mcc->Time()), mcc->Time(), 0,
|
||||
ScrollWheelInput::SCROLLMODE_INSTANT, ScrollWheelInput::SCROLLDELTA_PIXEL,
|
||||
origin, 0, 0, false);
|
||||
EXPECT_EQ(nsEventStatus_eConsumeDoDefault, manager->ReceiveInputEvent(swi, nullptr, nullptr));
|
||||
EXPECT_EQ(origin, swi.mOrigin);
|
||||
}
|
||||
|
||||
TEST_F(APZHitTestingTester, Bug1148350) {
|
||||
CreateBug1148350LayerTree();
|
||||
ScopedLayerTreeRegistration registration(manager, 0, root, mcc);
|
||||
|
||||
@@ -83,7 +83,7 @@ protected:
|
||||
registration = MakeUnique<ScopedLayerTreeRegistration>(manager, 0, root, mcc);
|
||||
manager->UpdateHitTestingTree(nullptr, root, false, 0, 0);
|
||||
rootApzc = ApzcOf(root);
|
||||
rootApzc->GetFrameMetrics().SetHasScrollgrab(true);
|
||||
rootApzc->GetScrollMetadata().SetHasScrollgrab(true);
|
||||
}
|
||||
|
||||
void TestFlingAcceleration() {
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set sw=2 ts=8 et 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/. */
|
||||
|
||||
#include "APZCTreeManagerTester.h"
|
||||
#include "APZTestCommon.h"
|
||||
#include "InputUtils.h"
|
||||
|
||||
class APZCSnappingTester : public APZCTreeManagerTester
|
||||
{
|
||||
};
|
||||
|
||||
TEST_F(APZCSnappingTester, Bug1265510)
|
||||
{
|
||||
const char* layerTreeSyntax = "c(t)";
|
||||
nsIntRegion layerVisibleRegion[] = {
|
||||
nsIntRegion(IntRect(0, 0, 100, 100)),
|
||||
nsIntRegion(IntRect(0, 100, 100, 100))
|
||||
};
|
||||
root = CreateLayerTree(layerTreeSyntax, layerVisibleRegion, nullptr, lm, layers);
|
||||
SetScrollableFrameMetrics(root, FrameMetrics::START_SCROLL_ID, CSSRect(0, 0, 100, 200));
|
||||
SetScrollableFrameMetrics(layers[1], FrameMetrics::START_SCROLL_ID + 1, CSSRect(0, 0, 100, 200));
|
||||
SetScrollHandoff(layers[1], root);
|
||||
|
||||
ScrollSnapInfo snap;
|
||||
snap.mScrollSnapTypeY = NS_STYLE_SCROLL_SNAP_TYPE_MANDATORY;
|
||||
snap.mScrollSnapIntervalY = Some(100 * AppUnitsPerCSSPixel());
|
||||
|
||||
ScrollMetadata metadata = root->GetScrollMetadata(0);
|
||||
metadata.SetSnapInfo(ScrollSnapInfo(snap));
|
||||
root->SetScrollMetadata(metadata);
|
||||
|
||||
UniquePtr<ScopedLayerTreeRegistration> registration = MakeUnique<ScopedLayerTreeRegistration>(manager, 0, root, mcc);
|
||||
manager->UpdateHitTestingTree(nullptr, root, false, 0, 0);
|
||||
|
||||
TestAsyncPanZoomController* outer = ApzcOf(layers[0]);
|
||||
TestAsyncPanZoomController* inner = ApzcOf(layers[1]);
|
||||
|
||||
// Position the mouse near the bottom of the outer frame and scroll by 60px.
|
||||
// (6 lines of 10px each). APZC will actually scroll to y=100 because of the
|
||||
// mandatory snap coordinate there.
|
||||
TimeStamp now = mcc->Time();
|
||||
SmoothWheel(manager, ScreenIntPoint(50, 80), ScreenPoint(0, 6), now);
|
||||
// Advance in 5ms increments until we've scrolled by 70px. At this point, the
|
||||
// closest snap point is y=100, and the inner frame should be under the mouse
|
||||
// cursor.
|
||||
while (outer->GetCurrentAsyncScrollOffset(AsyncPanZoomController::AsyncMode::NORMAL).y < 70) {
|
||||
mcc->AdvanceByMillis(5);
|
||||
outer->AdvanceAnimations(mcc->Time());
|
||||
}
|
||||
// Now do another wheel in a new transaction. This should start scrolling the
|
||||
// inner frame; we verify that it does by checking the inner scroll position.
|
||||
TimeStamp newTransactionTime = now + TimeDuration::FromMilliseconds(gfxPrefs::MouseWheelTransactionTimeoutMs() + 100);
|
||||
SmoothWheel(manager, ScreenIntPoint(50, 80), ScreenPoint(0, 6), newTransactionTime);
|
||||
inner->AdvanceAnimationsUntilEnd();
|
||||
EXPECT_LT(0.0f, inner->GetCurrentAsyncScrollOffset(AsyncPanZoomController::AsyncMode::NORMAL).y);
|
||||
|
||||
// However, the outer frame should also continue to the snap point, otherwise
|
||||
// it is demonstrating incorrect behaviour by violating the mandatory snapping.
|
||||
outer->AdvanceAnimationsUntilEnd();
|
||||
EXPECT_EQ(100.0f, outer->GetCurrentAsyncScrollOffset(AsyncPanZoomController::AsyncMode::NORMAL).y);
|
||||
}
|
||||
@@ -12,6 +12,7 @@ UNIFIED_SOURCES += [
|
||||
'TestPanning.cpp',
|
||||
'TestPinching.cpp',
|
||||
'TestScrollHandoff.cpp',
|
||||
'TestSnapping.cpp',
|
||||
'TestTreeManager.cpp',
|
||||
]
|
||||
|
||||
|
||||
@@ -899,7 +899,7 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer,
|
||||
// Transform the current local clip by this APZC's async transform. If we're
|
||||
// using containerful scrolling, then the clip is not part of the scrolled
|
||||
// frame and should not be transformed.
|
||||
if (asyncClip && !metrics.UsesContainerScrolling()) {
|
||||
if (asyncClip && !scrollMetadata.UsesContainerScrolling()) {
|
||||
MOZ_ASSERT(asyncTransform.Is2D());
|
||||
asyncClip = Some(TransformBy(asyncTransform, *asyncClip));
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ LayerHasCheckerboardingAPZC(Layer* aLayer, Color* aOutColor)
|
||||
}
|
||||
if (i.GetApzc() && i.GetApzc()->IsCurrentlyCheckerboarding()) {
|
||||
if (aOutColor) {
|
||||
*aOutColor = i.Metrics().GetBackgroundColor();
|
||||
*aOutColor = i.Metadata().GetBackgroundColor();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -428,7 +428,7 @@ TiledContentHost::Composite(LayerComposite* aLayer,
|
||||
// the one from the nearest scrollable ancestor layer.
|
||||
for (LayerMetricsWrapper ancestor(GetLayer(), LayerMetricsWrapper::StartAt::BOTTOM); ancestor; ancestor = ancestor.GetParent()) {
|
||||
if (ancestor.Metrics().IsScrollable()) {
|
||||
backgroundColor = ancestor.Metrics().GetBackgroundColor();
|
||||
backgroundColor = ancestor.Metadata().GetBackgroundColor();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,24 +122,6 @@ gfxContext::~gfxContext()
|
||||
MOZ_COUNT_DTOR(gfxContext);
|
||||
}
|
||||
|
||||
already_AddRefed<gfxASurface>
|
||||
gfxContext::CurrentSurface()
|
||||
{
|
||||
if (mDT->GetBackendType() == BackendType::CAIRO) {
|
||||
cairo_t* ctx = static_cast<cairo_t*>
|
||||
(mDT->GetNativeSurface(NativeSurfaceType::CAIRO_CONTEXT));
|
||||
if (ctx) {
|
||||
cairo_surface_t* s = cairo_get_group_target(ctx);
|
||||
if (s) {
|
||||
return gfxASurface::Wrap(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// An Azure context doesn't have a surface backing it.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
gfxContext::Save()
|
||||
{
|
||||
|
||||
@@ -77,12 +77,6 @@ public:
|
||||
static already_AddRefed<gfxContext>
|
||||
ForDrawTargetWithTransform(mozilla::gfx::DrawTarget* aTarget);
|
||||
|
||||
/**
|
||||
* Return the current transparency group target, if any. If no group is
|
||||
* active, returns the surface the gfxContext was created with.
|
||||
*/
|
||||
already_AddRefed<gfxASurface> CurrentSurface();
|
||||
|
||||
mozilla::gfx::DrawTarget *GetDrawTarget() { return mDT; }
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -7037,7 +7037,7 @@ PreInit()
|
||||
{
|
||||
#ifdef XP_WIN
|
||||
const char* crash_option = getenv("XRE_NO_WINDOWS_CRASH_DIALOG");
|
||||
if (crash_option && strncmp(crash_option, "1", 1)) {
|
||||
if (crash_option && crash_option[0] == '1') {
|
||||
// Disable the segfault dialog. We want to fail the tests immediately
|
||||
// instead of hanging automation.
|
||||
UINT newMode = SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX;
|
||||
|
||||
@@ -37,7 +37,7 @@ static const clockid_t WhichClock = CLOCK_MONOTONIC;
|
||||
// timespec structure is largely lacking such conveniences. Thankfully, the
|
||||
// utilities available in MFBT make implementing our own quite easy.
|
||||
static void
|
||||
timespecadd(struct timespec* lhs, struct timespec* rhs, struct timespec* result)
|
||||
moz_timespecadd(struct timespec* lhs, struct timespec* rhs, struct timespec* result)
|
||||
{
|
||||
// Add nanoseconds. This may wrap, but not above 2 billion.
|
||||
MOZ_RELEASE_ASSERT(lhs->tv_nsec < NanoSecPerSec);
|
||||
@@ -149,7 +149,7 @@ js::ConditionVariable::wait_for(UniqueLock<Mutex>& lock,
|
||||
MOZ_RELEASE_ASSERT(!r);
|
||||
|
||||
struct timespec abs_ts;
|
||||
timespecadd(&now_ts, &rel_ts, &abs_ts);
|
||||
moz_timespecadd(&now_ts, &rel_ts, &abs_ts);
|
||||
|
||||
r = pthread_cond_timedwait(ptCond, ptMutex, &abs_ts);
|
||||
#else
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user