import changes from `dev' branch of rmottola/Arctic-Fox:

- Bug 1261578 - Part 1. Correct text color in selection range; r=jfkthame (6895ebe313)
- Bug 1261578 - Part 2. Correct text decoration color; r=jfkthame (348ba5a946)
- Bug 1261578 - Part 3. Correct MathML text color; r=jfkthame (99dfb99af4)
- Bug 1261578 - Part 4. Correct text overflow color; r=jfkthame (96318becf6)
- Bug 1261578 - Part 5. web-platform-test reftest; r=jfkthame (781bba0317)
- Bug 1110460, part 1 - Add operator= to nsCSSValuePair. r=dholbert (7d836b786b)
- Bug 1110460, part 2 - Move AddPositions() further up StyleAnimationValue.cpp and add asserts. r=dholbert (5f00295917)
- Bug 1110460, part 3 - Factor out a AddCSSValuePair helper in StyleAnimationValue.cpp. r=dholbert (9947835334)
- Bug 1110460, part 4 - Fix MOZ_ASSERT bug in nsComputedDOMStyle.cpp. r=dholbert (5403c0c377)
- Bug 1110460, part 5 - Factor out a nsStyleBasicShape::GetShapeTypeName method. r=dholbert (d27623d42f)
- Bug 1110460, part 6 - Make StyleAnimationValue support css::URLValue backed nsCSSValue objects. r=dholbert (dc006d1cae)
- Bug 1110460, part 7 - Factor out code for adding two nsCSSValuePairList lists. r=dholbert (f27f780005)
- Bug 1260655 - Allow StyleAnimationValue::UncomputeValue to produce values whose storage is independent of the passed-in computed value; r=heycam (abcc77ede5)
- Bug 1110460, part 8 - Support CSS animation of clip-path basic shapes. r=dholbert (cfe5bf883b)
- Bug 1238243 - Reftests involving possibly-ignorable hangul choseong filler. r=xidorn Bug 1238243 followup - Mark test 1238243-2.html as random on OS X 10.6, due to dependency on available fonts. Bug 1239564 - Add reftest for mask layer composition. r=roc (bb3bf56d52)
- Bug 1260543 - Treat currentcolor as computed value which is not interpolatable with actual color for text-emphasis-color and -webkit-text-fill-color. r=birtles (7b90f37e2f)
- Bug 1260543 followup - Fix the function name in test_transitions_per_property.html. DONTBUILD (1362d30c6a)
- Bug 1248708 - Part1: parse and compute -webkit-text-stroke property. r=heycam (c77332031d)
- Bug 1248708 - Part2.1: use mfbt/TypedEnumBits.h for DrawMode. r=jwatt (55bfbdf5dd)
- Bug 1266101, part 1 - Remove various bits of dead code related to painting SVG text. r=heycam (c5140a911c)
- Bug 1266101, part 2 - Remove most of the GLYPH_STROKE/GLYPH_STROKE_UNDERNEATH checking code. r=heycam (6d8f17bc19)
- Bug 1248708 - Part2.2: render -webkit-text-stroke property. r=jfkthame (bccc308ddc)
- Bug 1248708 - Part3: add reftests. r=jfkthame (0fc0864749)
- Bug 1248708 followup: Use MOZ_ARRAY_LENGTH instead of ArrayLength for expression used at compile time, to fix MSVC 2013 bustage. (trivial/bustage-fix, no review) (25cecd7585)
- Bug 1266341 - Pass the right kind of enum constants for script codes. r=masayuki (723e784a37)
- Bug 1245866 - A better buffer size check in nsIDNService::IDNA2008ToUnicode, r=jfkthame (683db7d93c)
- Bug 1233610 - IDN service should return NS_ERROR_MALFORMED_URI instead of NS_ERROR_FAILURE r=mcmanus (d70d4425ca)
- Bug 1266391 - Introduce an enum class mozilla::unicode::Script, and use this instead of bare integers to specify script codes for better type checking. r=masayuki (363a23049f)
- fix 1389436 backport (a8f96f6b33)
- Bug 1258228 - create special child accessibles in owner's constructor, part1, r=marcoz (2bbb819f76)
- Bug 1258228 - create special child accessibles in owner's constructor, part2, r=marcoz (5e20a7761a)
- Bug 1258228 - create special child accessibles in owner's constructor, part3, r=marcoz (6574efb1e7)
- Bug 1258228 - create special child accessibles in owner's constructor, part4, r=marcoz (15420c5a12)
- Bug 1188818 - DataTransfer must deal with nsIFile of directories, r=jwatt (715a857dd1)
- Bug 1126295 - Move TestAtoms.cpp to gtest and enable it; r=froydnj (9275ebeb3c)
- Bug 1257128 (part 1) - Remove nsIAtom.equalsUTF8. r=froydnj. (17238a04e6)
- Bug 1257128 (part 2) - Remove nsIAtomService.get{,Permanent}AtomUTF8. r=froydnj. (f4131f1024)
- Bug 1257128 (part 3) - Remove unused createAtom() function in a test. r=tbsaunde. (e082c1bc17)
- Bug 1257128 (part 4) - Remove unused nsIAtomService references in toolkit/. r=froydnj. (5ddae71ae8)
- Bug 1257402 - Remove NS_NewPermanentAtom() and nsIAtomService.getPermanentAtom(). r=froydnj,kmag. (4b9ad7894e)
- Bug 1145395 - Pass Element& to nsHTMLEditor::RemoveElementIfNoStyleOrIdOrClass; r=ehsan (83080cb024)
- Bug 1140105 - Can't query for a specific font face when the selection is collapsed. r=ehsan (b534c04e7f)
- Bug 1145395 - Introduce an overload of nsHTMLEditor::RemoveStyleInside that takes nsIContent&; r=ehsan (c5cb3bfb1d)
- Bug 1170326 - nsHTMLCSSUtils::ParseLength should check if the input is an empty string, r=ehsan (1950f67c9f)
- Bug 1260871 - Remove do_GetAtom() and rename NS_NewAtom() as NS_Atomize(). r=erahm. (984bc596bf)
- Bug 1254128 - Make the Mozilla .lldbinit use the full path for topsrcdir. r=sparky (20856a94b4)
- Bug 1259659 - rename from InternalUIEvent.detail to InternalUIEvent.mDetail. r=masayuki (37165bd487)
- Bug 1249664 - Make stateful frames responsible for their own keys r=dbaron (03a4365aa1)
- Bug 1232338 - part 1, Add better mouse support to InputData MouseInput r=kats (8be234631e)
- Bug 1259655 - part 1 Rename WidgetEventTime::time to WidgetEventTime::mTime r=masayuki (cd679b408e)
- Bug 1235908 - measure total event wait and process time. r=smaug (4364242809)
- Bug 1259655 - part 2 Rename WidgetEventTime::timeStamp to WidgetEventTime::mTimeStamp r=masayuki (94a507904d)
- Bug 1263785 - Kill off the deprecated nsINode::GetCurrentDoc. r=baku (670e175017)
- Bug 1245748 - Remove no-longer-needed code for directly setting up properties in KeyframeEffect(ReadOnly) constructor; r=heycam (166ed7697c)
- Bug 1259285 - Part1 - Move CSS/Web Animations-specific visibility handling. r=birtles (13a4ac2b94)
- Bug 1259285 - Part2 - Add web-platform test for visibility handling. r=birtles (b7cee58cf7)
- Bug 1260655 - Add KeyframeEffectReadOnly::SetFrames; r=heycam (7da27828da)
- Bug 1260655 - Wrap lines in keyframe-effect/constructor.html to 80 chars; r=whitespace-only (32b6412db2)
- Bug 1260655 - Update keyframe-effect/constructor.html to no longer refer to PropertyIndexedKeyframes or Keyframe; r=heycam (dbe0acf873)
- Bug 1260655 - Return the stored Keyframe objects from GetFrames, when available ; r=heycam (5b8cbc1773)
- Bug 1245748 - Add a Move constructor to Keyframe; r=heycam (eeabc9396a)
- Bug 1260655 - Add an assignment operator to Keyframe that takes an rvalue reference; r=heycam (e81f1f6d7c)
- Bug 1260655 - Add methods to CSSAnimationBuilder to build a set of Keyframe objects; r=heycam (93e2a7b3aa)
- Bug 1260655 - Use CSSAnimationBuilder::BuildAnimationFrames to set up CSS animations using Keyframe objects; r=heycam (4df3ad20cd)
- Bug 1260655 - Drop some no-longer-needed code for setting up CSS animations using AnimationProperty objects; r=heycam (e1d8e020aa)
- Bug 1260655 - Add a copy constructor and copy assignment operator to Keyframe; r=heycam (d9a1ca5d24)
- Bug 1249564 - Part 1: Assign the parent object of AnimationEffectTiming(ReadOnly). r=birtles,bz (298bdcf084)
- Bug 1249564 - Part 2: Cycle collect AnimationEffectTimingReadOnly. r=birtles (25d959d057)
- Bug 1263063 - Part 1: Remove unnecessary clamping of TimingParams::mIterationStart, since it's guaranteed to be nonnegative. r=dholbert (35362749d7)
- Bug 1263063 - Part 2: Add an assertion to ensure that iteration count is nonnegative and finite. r=dholbert (7df13df139)
- Bug 1263063 - Part 3: Change logic in KeyFrameEffect to assume that TimingParams' iteration-count has already been validated as nonnegative & finite. r=dholbert (6dd3f0d984)
- Bug 1263063 - Part 4: Move ActiveDuration() into TimingParams. r=dholbert (6760bdeaa7)
- Bug 1263063 - Part 5: Introduce TimingParams::EndTime(). r=dholbert (af9a4ddd95)
- Bug 1260983 - Allow creating animations with a target element not bound to a document; r=heycam (7d71619cfb)
- Bug 1244591 - Part 1: Implement KeyframeEffect.setFrames r=birtles,smaug (e090fa68b6)
- Bug 1244591 - Part 2: Extract useful keyframes tests to a new file r=birtles (780797fe53)
- Bug 1244591 - Part 3: Add web-platform tests for KeyframeEffect.setFrames r=birtles (997d26427b)
- Bug 1259878 - remove unnecessary isSome(). r=birtles (cb21268a0a)
- Bug 1248532 - Part 1: steps-start does not produce correct value at the beginning of the interval. r=birtles (9131923815)
- Bug 1248532 - Part 2: Add tests for step-start. r=birtles (04ae44375d)
- Bug 1248532 - Part 3: add a test for step-end with iterationStart. r=birtles (769827746b)
- Bug 1266257 - Revise timing model calculations to use fraction-based approach; r=hiro (c1de969ef0)
- Bug 1260572 - Replace AnimValuesStyleRule::AddEmptyValue with an overload of AddValue that takes an rvalue reference; r=heycam (08e01a4cdc)
- Bug 1260572 - Use 50% switch behavior if StyleAnimationValue::Interpolate fails; r=heycam (e67754e770)
- Bug 1260976 - Remove the old AnimationProperty-based GetFrames; r=heycam (efc88117e6)
- Bug 1259248. Add an ArrayView class. r=botond (5bb9e22500)
- Bug 1265648 - Remove the global nsTextFrameTextRunCache, as it no longer serves any useful purpose. r=mats (3ffbf42634)
- Bug 1238243 - Don't filter out Hangul jamo fillers as 'ignorable', because the font may require them to provide advance width. r=xidorn (9fc2f82853)
- Bug 1265648 followup - Use an array of UniquePtr<> for mTextRunsToDelete. r=mats (8745a7566e)
- Bug 1263956 - Adopt the new harfbuzz API for char-to-glyph mapping functions. r=jrmuizel (1f061d7b0f)
- Bug 1265568 - Don't require component alpha layers for text with -moz-osx-font-smoothing:grayscale. r=jfkthame,mattwoodrow (f819591273)
- Bug 1199547 - Backout workaround from bug 722676 as it causes issues on at least OSX 10.10 and 10.11. r=mstange (c96fb3a69d)
- Bug 1265953, part 1 - Convert most of the cocoa widget code from nsAutoPtr to UniquePtr. r=mstange (74aa93eaf9)
- Bug 1249915 - Add ability to synthesize native touch events on GTK for mochitests. r=karlt (b734a366fb)
- Bug 1259670 Rename WidgetPluginEvent::retargetToFocusedDocument to WidgetPluginEvent::mRetargetToFocusedDocument r=smaug (24c12b3bb4)
- Bug 1249915 - Fix synthesized touch injection code on Windows to not apply the scale factor twice. r=jimm (b590300aa3)
- Bug 1250505 - Convert SynthesizeNativeTouchPoint and SynthesizeNativeTouchTap to take a LayoutDeviceIntPoint instead of a ScreenPoint. r=njn (8ddd066519)
- Bug 1256731 - patch 1 - Don't apply theme-dpi scaling to metrics of window border elements, because Windows doesn't respect per-monitor dpi scaling when it draws them. r=emk (582676e33e)
- Bug 1247935 - Part 1: double-buffer nsShmImage. r=jrmuizel (2392a1e916)
- Bug 1247935 - Part 2: use shared pixmaps with XShm for nsShmImage. r=jrmuizel (b3dd105fcc)
- Bug 1265953, part 2 - Convert much of the rest of the widget code from nsAutoPtr to UniquePtr. r=mstange (e0c1c49ef8)
- Bug 1265953, part 3 - Convert more widget code from nsAutoPtr to UniquePtr. r=mstange (17e1be57d2)
- Bug 1265953, part 4 - Convert nsMenuX::LoadSubMenu and nsMenuX::AddMenu to UniquePtr. r=mstange (f4ea50b802)
- Bug 1259664 part.1 Rename WidgetWheelEvent::deltaX to WidgetWheelEvent::mDeltaX r=smaug (8c7ef861eb)
- Bug 1259664 part.2 Rename WidgetWheelEvent::deltaY to WidgetWheelEvent::mDeltaY r=smaug (03529452fb)
- Bug 1259664 part.3 Rename WidgetWheelEvent::deltaZ to WidgetWheelEvent::mDeltaZ r=smaug (0d664b2900)
- Bug 1259664 part.4 Rename WidgetWheelEvent::deltaMode to WidgetWheelEvent::mDeltaMode r=smaug (dc8283ee70)
- Bug 1253041 - Don't apply user wheel prefs more than once. r=smaug (2386a9da14)
- Bug 1259664 part.5 Rename WidgetWheelEvent::customizedByUserPrefs to WidgetWheelEvent::mCustomizedByUserPrefs r=smaug (3b16757c1e)
- Bug 1258820 - making root scrollable element not scroll if mouse wheel is used on xul dropdown r=masayuki (58ab750981)
- Bug 1250050 Add a pref to disable supporting mouse wheel of windowless plugins on Windows r=smaug (1560cfcb35)
- Bug 1256162, use last drag target for dragexit event when comparing to a remote browser, r=smaug (2d03394037)
- Bug 1110030 - part1 - add flags:IsSynthesizedByTIP and InputMethodAppState in WidgetKeyboardEvent. r=masayuki (c8f7802ee0)
- Bug 1110030 - part2 - Prevent PostHandleKeyboardEvent if it's handling by IME. r=masayuki (29fab0d4fe)
- Bug 1110030 - part3 - Interface between PresShell and HardwareKeyHandler. r=masayuki, r=smaug (cb152d6b4b)
- Bug 1110030 - part4 - HardwareKeyHandler component. r=masayuki, r=smaug (9e372e8f19)
- Bug 1110030 - part5 - Expose KeyboardEventInit dictionary. r=masayuki, r=smaug (3c38bf2f37)
- Bug 1110030 - part6 - Expose DefaultPreventedBy*. r=masayuki, r=smaug (5c94c067be)
- Bug 1110030 - part7 - Interface between HardwareKeyHandler and Input Method App. r=masayuki, r=smaug (f33b7f5ad5)
- Bug 1244546 part 1 - Apply proper unit conversion for SynthesizeNativeMouseEvent. r=karlt (8596ff8068)
- Bug 1244546 part 2 - Align the center point for pointerlock to meet widget's requirement. r=smaug (c447b8c770)
- Bug 1259664 part.6 Rename WidgetWheelEvent::mayHaveMomentum to WidgetWheelEvent::mMayHaveMomentum r=smaug (ef95784e26)
- Bug 1259664 part.7 Rename WidgetWheelEvent::isMomentum to WidgetWheelEvent::mIsMomentum r=smaug (983c8dc9e3)
- Bug 1259664 part.8 Rename WidgetWheelEvent::scrollType to WidgetWheelEvent::mScrollType r=smaug (c6731aee2d)
- Bug 1259664 part.9 Rename WidgetWheelEvent::lineOrPageDeltaX to WidgetWheelEvent::mLineOrPageDeltaX r=smaug (9c6d3d7f6b)
- Bug 1259664 part.10 Rename WidgetWheelEvent::lineOrPageDeltaY to WidgetWheelEvent::mLineOrPageDeltaY r=smaug (8a0d549eee)
- Bug 1259664 part.11 Rename WidgetWheelEvent::overflowDeltaX to WidgetWheelEvent::mOverflowDeltaX r=smaug (6200509b12)
- Bug 1259664 part.12 Rename WidgetWheelEvent::overflowDeltaY to Widget¦WheelEvent::mOverflowDeltaY r=smaug (3827fc7cef)
- Bug 1259664 part.13 Reorder the definition of members of WidgetWheelEvent r=smaug (ea69305e49)
- Bug 1243628 - Allow for presshell to have been destroyed and disconnected from prescontext during event dispatch. r=dholbert (b98e7ed1a2)
- Bug 1256952, send a dragexit at remote process when leaving the remote frame, r=smaug (1037c6a425)
- Bug 1261818 - don't pass nsAutoCStrings into nsBaseWidget debugging methods; r=karlt (36b2b66795)
- Bug 1250560 - Fix crash in HandleTouchEvent. r=roc (9586890edf)
- Bug 1121468 - Go to NoActionState after receiving release on LongTapState. r=roc (4e05f9ad70)
- Bug 1248847 - Assert AccessibleCaretEventHub mRefCnt > 1 in all its entry points. r=mats (89ced3c3e2)
- Bug 1251915 - Correct AccessibleCaretEventHub coding style by clang-format. r=roc (12d5b507d7)
- Bug 1259668 Rename WidgetTouchEvent::touches to WidgetTouchEvent::mTouches r=smaug (9c53824e17)
- Bug 1259657 Rename WidgetGUIEvent::widget to WidgetGUIEvent::mWidget r=smaug (8707f57a28)
- Bug 1246477 - Fix carets not updated by scroll events in LongTapState. r=roc (ba6f12001c)
- Bug 1259662 part.1 Rename WidgetDragEvent::dataTransfer to WidgetDragEvent::mDataTransfer r=smaug (79ffebe3ae)
- Bug 1259662 part.2 Rename WidgetDragEvent::userCancelled to WidgetDragEvent::mUserCancelled r=smaug (4b7ee565e7)
- Bug 1241008 - Add preference to show or hide selection bars. r=mtseng (aefd4c430d)
- Bug 1242349 - Provide unique AccessibleCaret pref for JS selection changes, r=TYLin (e964cb16cf)
- Bug 1240917 - Do not show caret in empty input on Fennec. r=roc (d73c6bd94d)
- Bug 1121468 - Show carets when long-pressing on selection highlight. r=roc (bf134067de)
- Bug 1246064 - Support long press to show AccessibleCaret on empty input for Fennec. r=roc (90791443cb)
- Bug 1246918 - Fix carets missing after scrolling down in selection mode on Fennec. r=roc (bc0915ad70)
- Bug 1246918 - Handle PresShell gone after FlushLayout(). r=roc (b2f18c9a03)
- Bug 1251915 - Ignore handling eTouchCancel events. r=roc (a04c3ad8eb)
- Bug 1121468 - Use auto* to explicit declare 'self' as a pointer. r=roc (d83a6020e3)
- Bug 1251346 - Fennec should not generate touch events from mouse events. r=kats (d8077748fc)
- Bug 1259656 part.1 Rename WidgetEvent::refPoint to WidgetEvent::mRefPoint r=smaug (fa66825fc9)
- Bug 1259656 part.2 Rename WidgetEvent::lastRefPoint to WidgetEvent::mLastRefPoint r=smaug (c964d62185)
- Bug 1259656 part.3 Rename WidgetEvent::userType to WidgetEvent::mSpecifiedEventType r=smaug (218ae50355)
- Bug 1259656 part.4 Rename WidgetEvent::typeString to WidgetEvent::mSpecifiedEventTypeString r=smaug (0192c890c9)
- Bug 1259656 part.5 Rename WidgetEvent::target to WidgetEvent::mTarget r=smaug (031356f40d)
- Bug 1259656 part.6 Rename WidgetEvent::currentTarget to WidgetEvent::mCurrentTarget r=smaug (451810f6d3)
- Bug 1259656 part.7 Rename WidgetEvent::originalTarget to WidgetEvent::mOriginalTarget r=smaug (643379c9cb)
- Bug 1259673 rename from InternalClipboardEvent.clipboardData to InternalClipboardEvent.mClipboardData. r=masayuki (5ad3c180fe)
- Bug 1259674 Part 1 rename InternalFocusEvent::fromRaise to InternalFocusEvent::mFrameRaise r=masayuki (400f1ba6e9)
- Bug 1259674 Part 2 rename InternalFocusEvent::isRefocus to InternalFocusEvent::mIsRefocus r=masayuki (93b5799c31)
- Bug 1259674 Part 3 rename InternalFocusEvent::relatedTarget to InternalFocusEvent::mRelatedTarget r=masayuki (2382b8de82)
- Bug 1256589 part.7 Add PropagationStopped() to WidgetEvent r=smaug (09325f188d)
- Bug 1259663 - Clean up WidgetMouseScrollEvent. r=masayuki (48e1389e22)
- Bug 1263782 - Kill off the deprecated nsINode::IsInDoc(). r=baku (ae80ec21f7)
- Bug 1223751 - Assume all frames are visible in subdocuments of a top level content document that's assuming all frames are visible. r=tn (3b4f99b2fc)
- Bug 1223747 - Don't assume all frames are visible in XUL documents. r=tn (7f26104ff8)
- Bug 1180267 - Switch Fennec over to using the MobileViewportManager for computing the CSS viewport. r=snorp (b85a3a5fb7)
- put back some SPS stuff (960414c383)
- Bug 1151152 - Change behavior when pointer is dragged out of the document. r=smaug (64779386f0)
- Bug 1263787 - Kill off the deprecated nsINode::GetCrossShadowCurrentDoc. r=baku (ed490173ff)
- Bug 1261933 - Continue unlocking pointer even if the widget has gone. r=smaug (93a781887a)
- Bug 1259296 - Do not scroll snap on the main thread for wheel events handled by APZ. r=kats (f72a7fef66)
- Bug 1208371 - Pass parent window to DOMMediaStream through constructor. r=roc (1c2cc7e7c7)
- Bug 1208371 - Make AudioCaptureStream startable. r=padenot (15849ae011)
- Bug 1208371 - Move OnTracksAvailableCallback out of DOMMediaStream. r=roc (a772c949e0)
- Bug 1208371 - Remove unused MediaManager::NotifyMediaStreamTrackEnded. r=jib (9157aa056e)
- Bug 1208371 - Introduce MediaStreamTrack logs. r=roc,jib (72ff4d4c59)
- Bug 1208371 - Track original track in MediaStreamTrack clones. r=jib (39e9ae1200)
- Bug 1208371 - Un-nest MediaEngineSource::PhotoCallback. r=roc (b1e0b48012)
- Bug 1253333: Don't cause a second MediaManager to be created if there's a race with NotifyFinished r=jib (d22d6d01e5)
- Bug 1251357 - fix regression where last MediaStreamTrack.stop did not turn off the camera light. r=jesup (11b4880c02)
- Bug 1208371 - Add a MediaStreamTrackSource interface. r=roc (bb1880524b)
- Bug 1208371 - Add MediaStreamTrackSourceGetter interface. r=roc (c57a1c6a74)
- Bug 1208371 - Let MediaStreamTracks know their TrackID at the source. r=roc (62739d72bf)
- Bug 1259236 - throw NotSupportedError on pc.addTrack of track in constructed stream. r=bwc (8b828e80e4)
- Bug 1208371 - Let FindOwnedDOMTrack operate on input stream. r=roc (26c24ad3c7)
- Bug 1208371 - Add some MediaStreamTrack helper methods. r=roc (1627cd36f8)
- Bug 1208371 - Count the users of a MediaStream to ease Destroy() resonsibility. r=roc (613d446b39)
- bug 1223670 assert that connected streams have the same graph r=padenot (17ea987392)
- Bug 1208371 - Add convenience method for checking if TrackID is explicit. r=roc (32c9d5fe45)
- Bug 1208371 - Allow MediaInputPorts mapped to a destination TrackID. r=roc (71d3c66c4d)
- Bug 1208371 - Remove obsolete SetTrackEnabled() from DOMMediaStream r=roc (cbcf54a342)
- Bug 1208371 - Add MediaStreamTrack::Graph(). r=jib (044b348267)
- Bug 1208371 - Add DOMMediaStream::GetTrackById/GetOwnedTrackById. r=jib (6f58360808)
- Bug 1208371 - Add a generic PrincipalChangeObserver interface. r=mt (79dfb91a89)
- Bug 1208371 - Turn DOMMediaStream::PrincipalChangeObserver into PrincipalChangeObserver<DOMMediaStream>. r=mt (41fdd835de)
- Bug 1208371 - Add principal APIs to MediaStreamTrack. r=mt (a8aab0e0d9)
- Bug 1208371 - Create MediaStreamTrackSource::Sink that forwards principal changes from the source. r=mt (d9fefd4e3c)
- Bug 1208371 - Let DOMMediaStream base its principal on the tracks it contains. r=mt (0c046c7c20)
- Bug 1208371 - Add an interface DecoderPrincipalChangeObserver to HTMLMediaElement. r=roc (ecde0ddae0)
- Bug 1208371 - Make HTMLMediaElement::CaptureStream pass its principal to MediaStreamTrack. r=mt (03ccd4ab12)
- Bug 1208371 - Make MediaManager pass its principal to MediaStreamTrack for gUM. r=mt (5a4b1eb0bc)
- Bug 1208371 - Make ImageCapture listen to principal changes of MediaStreamTrack instead. r=mt (d29fc5c36e)
- Bug 1208371 - Break PCImpl::SetRemoteDescription into smaller pieces. r=mt,bwc (e4337cc413)
- Bug 1208371 - Make PeerConnectionImpl pass its principal to MediaStreamTrack through a new RemoteTrackSource. r=mt (9a7c744a19)
- Bug 1208371 - Make remaining DOMMediaStream principal sources use MediaStreamTrack. r=mt (b30919c681)
- Bug 1208371 - Remove some no longer necessary principal methods on DOMMediaStream. r=mt (5279935d2b)
- Bug 1208371 - Add a MediaStreamTrackListener to MediaStreamGraph. r=roc (5d7048793e)
- Bug 1208371 - Move ImageCapture to a MediaStreamTrackListener. r=roc (98d081b034)
- Bug 1208371 - Make it possible to look up stream id by track in PeerConnectionImpl. r=jib (c65d07cb55)
- Bug 1208371 - Fix DOMMediaStream::OwnsTrack. r=roc (092dad3654)
- Bug 1208371 - Remove MediaStreamTrack::GetStream. r=jib (a78f873d89)
- Bug 1208371 - Route ApplyConstraints through MediaStreamTrackSource. r=jib (32dfd76245)
- Bug 1208371 - Kill nsDOMUserMediaStream with fire. r=jib (9550ad61be)
- Bug 1208371 - Make it possible to block tracks in a MediaInputPort initally. r=roc (39fdd2322f)
- Bug 1208371 - Implement MediaStreamTrack::Clone(). r=smaug,jib,roc (1995b87f10)
- Bug 1208371 - Implement DOMMediaStream::Clone() r=smaug,jib,roc (d445dffd30)
- Bug 1208371 - Various cleanups in DOMMediaStream/MediaStreamTrack. r=jib (a174781a1b)
- Bug 1208371 - Forward input stream and track id on regular track changes for union streams. r=roc (36ed98f3e4)
- Bug 1208371 - Move track.stop() helpers to MediaStreamPlayback. r=jib (123bcd8192)
- Bug 1240478 - Add test for video size on 'loadedmetadata'. r=jesup,jib Bug 1208371 - Test DOMMediaStream::Clone(). r=jib (5ff908fcad)
- Bug 1208371 - Test DOMMediaStream::Clone(). r=jib (445556e6b5)
- Bug 1208371 - Rename CreateOwnDOMTrack/CreateClonedDOMTrack to CreateDOMTrack/CloneDOMTrack. r=jib (41c71b073c)
- Bug 1208371 - Resolve ambiguous symbol MediaStreamTrack. r=bwc (f998354d96)
- Bug 1208371 - Test MediaStreamTrack::Clone(). r=jib (34865902b0)
- Bug 1208371 - Add CORSMode methods to MediaStreamTrack. r=mt (2244b06567)
- Bug 1208371 - Add convenience method for forwarding a track to an MSG-stream. r=roc (f21675220b)
- bug 1223670 throw not supported when creating a node from a stream with different channel r=baku (55e1d67356)
- Bug 1208371 - Lock MediaStreamAudioSourceNode onto the first AudioStreamTrack in mInputStream at time of construction. r=mt,padenot (77640fa752)
- Bug 1208371 - Move HTMLMediaElement::CaptureStream to forward CORSMode changes through MediaStreamTrackSource. r=mt (aa533e8945)
- Bug 1208371 - Remove CORSMode methods from DOMMediaStream. r=mt (41447ccea1)
- Bug 1208371 - Change HTMLMediaElement video sinks to check principal for video only tracks. r=mt (b8168de792)
- Bug 1208371 - Remove ref counting from DOMMediaStream::TrackListener. r=roc (fe275597ca)
- Bug 1208371 - Update tests to accomodate the fact that MediaStreamAudioSourceNodes lock onto the first audio track. r=padenot (ee97d9f274)
- bug 916387 remove workarounds in tests r=padenot (0285f2b98a)
- Bug 1208371 - Modify WebAudio source nodes tests to wait for tracks befoure measuring nr of samples. r=padenot (bb3afcdd12)
- Bug 1208371 - Make PeerIdentity RefCounted. r=mt (74320ca464)
- Bug 1208371 - Add GetPeerIdentity() to MediaStreamTrackSource. r=mt (77bffa988f)
- Bug 1208371 - Add PeerIdentity to LocalTrackSource for gUM tracks. r=mt (4b4163b66d)
- Bug 1208371 - Move PeerConnection to use PeerIdentity on MediaStreamTrack. r=mt (30b5ab4b5d)
- Bug 1208371 - Remove PeerIdentity from DOMMediaStream. r=mt (0d6b66614e)
- Bug 1208371 - Add convenience method for checking track forwarding to MediaStreamTrack. r=roc (d9eb5210e0)
- Bug 1208371 - Remove test_mediarecorder_record_nosrc.html. r=roc (5d7b83b51c)
- Bug 1208371 - Inline MediaRecorder::Session::SetupStreams. r=roc (1f8463266e)
- Bug 1153690 - Release the Session and MediaRecorder objects correctly if there is no ExtractRunnable running. r=roc (424117e697)
- Bug 1257318: Move MediaRecorder to use DirectListeners wherever possible. r=roc (1d6336641b)
- Bug 1208371 - Check principal per track instead of per stream in MediaRecorder. r=roc (946080d5e7)
- Bug 1219711 - Add mochitest for track disabling over a peer connection. r=jib (ad345e05e2)
- Bug 1166832 - Add test to verify audio (using AudioStreamAnalyser) after renegotiation. r=bwc (ad11535ee3)
- Bug 1250934: Make tests use the correct audio frequency when fake devices are used r=drno (1b8cb18b8f)
- Bug 1182426 - Test that we can record CanvasCaptureMediaStreams. r=roc (e65a5dce61)
- Bug 1219711 - Refactor captureStream_common.js to accept generic pixel testing method. r=jib (e55194c8f5)
- Bug 1223696 - Make canvas captureStream helper resilient to exceptions when there's no video. r=roc (215711b89d)
- Bug 1223696. Don't destroy VideoFrameContainer when we reach MetadataLoaded without a video track. r=jwwang (2c83a23b24)
- Bug 1166832 - Add test for canvas capture on multiple streams. r=bwc (592db27fc4)
- Bug 1224029: ensure video elements that may be disabled (black) are scaled r=mattwoodrow (bfef6af17d)
- Bug 1208371 - Simplify track disabling test code. r=jib (771d560f40)
- Bug 1208371 - Test disabling track across peerconnection not affecting clones. r=jib (31913dd9e6)
- Bug 1208371 - Add DirectTrackLister to MediaStreamGraph and MediaStreamTrack. r=roc,jesup (ae86375502)
- Bug 1208371 - Switch MediaPipeline to use direct listeners on tracks. r=jesup,bwc (aa32ce43e1)
- Bug 1208371 - Let PeerConnection consume principals from tracks instead of streams. r=mt (825d6775d0)
- Bug 1257318: Make recorder.pause()/resume() work with DirectListeners r=padenot (65ff6bff4e)
- Bug 1208371 - Move FindTrack from SourceMediaStream to MediaStream. r=roc (5725a863ae)
- Bug 1208371 - Switch MediaStreamTrack to enable/disable tracks on owned stream. r=jesup (ea7445369d)
- Bug 1208371 - Make GraphDriver callback log calls verbose. r=padenot (a502ceea55)
- Bug 1208371 - Do not require DOMLocalMediaStream for gUM (audioCapture). r=jib (c27ee1c308)
- Bug 1208371 - Add a track getter to gUM for fake tracks. r=jib (4958d2b392)
- Bug 1208371 - Remove unnecessary fakeTracks:true from test_streams_individual_pause.html. r=jib (2437b932b2)
- Bug 1208371 - Remove debug canvas from addTrackRemoveTrack test to help android perf. r=padenot (38b1ad91e8)
- Bug 1208371 - Remove debug canvas from peerConnection_trackDisabling test to help android perf. r=padenot (a8b5a62ad6)
- Bug 1208371 - Enable test_peerConnection_trackDisabling.html on android 4.3 debug. r=jib (19e14785f3)
- Bug 1208371 - Remove debug canvas from mediaStreamConstructors test to help android perf. r=padenot (b7e3280b68)
- Bug 1208371 - Add disconnect method to test helper AudioStreamAnalyser to improve performance on slow devices. r=padenot (2a18d693a7)
- Bug 1208371 - Guard LoadManagerSingleton with a WeakPtr. r=pkerr (0f6d425cf4)
- Bug 1208371 - Clear output canvas on each drawImage(). r=jib (45731c0c9a)
- Bug 1208371 - Wait for "loadedmetadata" before setting up nodes in test_mediaElementAudioSourceNodeCrossOrigin.html. r=padenot (8e9398fe88)
- Bug 1181051 - Remove BOM from dom/media/test/test*.html. r=kinetik (c98b2c9b96)
- Bug 1070110 - Ensure the testcase will receive at least 2 blob. r=jwwang (028cb09b08)
- Bug 1208371 - Improve reliability of test_mediarecorder_record_timeslice.html. r=jwwang (c89bd3fe0b)
- Bug 1251494 - Remove remaining references to MOZILLA_XPCOMRT_API from dom. r=jesup (5b8e7ef603)
- Bug 1234230: Don't pass null images for video encoding, and don't reencode the same image r=roc (eb09c07d8d)
- Bug 1258567 - per comment 3, ensure volume is only applied once to the AudioSegment. r=kinetik. (a7e184e483)
- Bug 1250934: Modify MediaEngine shutdown to allow neutering the AudioDataListener r=padenot (70f4831508)
- Bug 1208371 - Add PrincipalHandle to MediaChunks. r=mt,jesup (0662c26a97)
- Bug 1208371 - Add NotifyPrincipalHandleChanged to MediaStreamTrackListener. r=mt,jesup (54d896b1ff)
- Bug 1208371 - Add a PrincipalHandleListener to MediaStreamTrack. r=mt,jesup (9b4d2e0996)
- Bug 1256520 - use SyncRunnable to create DecodedStreamData synchronously to ensure the creation and destruction of DecodedStreamData happen in order. r=kikuo. (7d28eaebba)
- Bug 1237482 - Remove MediaDecoderStateMachine::mStreamSink. r=kikuo. (609efed70f)
- Bug 1208371 - Hook up DecodedStream with PrincipalHandle. r=mt,jwwang (9290efb216)
- Bug 1208371 - Hook up MediaPipeline with PrincipalHandle. r=mt,bwc (b00ed70ddc)
- Bug 1208371 - Ensure DOMMediaStream principals reflect what could reside in their playback streams. r=mt,jesup (bd3e32ef16)
- Bug 1208371 - Ensure a media element's ImageContainer is protected when playing a stream. r=mt,jesup (7914faa5dc)
- Bug 1208371 - Forward declare MediaStreamTrack in MediaPipeline.h. r=bwc (4c88b79137)
- Bug 1208371 - Clean up unnecessary virtuals in MediaPipeline. r=bwc (b7112f4b34)
- Bug 1208371 - Move MediaStreamTrack's label to MediaStreamTrackSource. r=jib (045bfcc738)
- Bug 1259590 - Remove B2G ACL code. r=khuey (e13223c0f6)
- Bug 1265452 followup - Make mGlyphExtentsArray an array of UniquePtr. r=jrmuizel (d12ce46244)
- Bug 1250540 - have media.navigator.permission.disabled no longer bypass media.getusermedia.screensharing.allowed_domains. r=jesup (e55aa02580)
- Bug 1247806 - Fix HSTS redirect check in WebSocketChannel, r=mcmanus (4e44becf9e)
- Bug 1251530: Use 'MakeUnique' instead of 'new' to populate UniquePtr variable in AddCSSValuePair. r=jwatt (286bf2289a)
- Bug 1264787: Make nsCSSValue's AdoptListValue & AdoptPairListValue methods take a UniquePtr. r=heycam (0f7dc7164f)
- Bug 1151243 part 3 - [css-grid] Add a generic nsHTMLReflowState::STATIC_POS_IS_CB_ORIGIN flag to place the static-position at the CB origin, and make nsAbsoluteContainingBlock use it in Grid containers where the placeholder is a child too. r=dholbert (7bde498cc4)
- Bug 1151243 part 4 - Some code cleanup in nsHTMLReflowState::CalculateHypotheticalPosition, and make a few methods 'const' (idempotent patch). r=dholbert (e430f9b99d)
- Bug 1250540 - fix string-parsing regression that made screen share whitelisting stop working. r=jesup (f8af7c3053)
- Bug 1265641: Move AEC tail length and delay-agnostic settings to getUserMedia r=padenot (3feaf716ee)
- Bug 950936 - Introduce ui.popup.disable_autohide pref to ease debugging popups. r=neil (bc28dcd531)
- bug 1211892 read -unico-border-gradient of early Unico versions for ThreeDHighlight and ThreeDShadow r=acomminos (39c83b1865)
- bug 1257695 disable GTK3 deprecation warnings in widget/gtk r=acomminos (1ad2ba0271)
- Bug 1258989 - Switch gtk3drawing to a C++ file, r=karlt (55b8ea3cdf)
- Bug 1259433 - remove gtk_widget_style_get() from gtk3drawing, r=karlt a=kwierso (a9fc049140)
- Bug 1266680 - Rename BlockTrackId to BlockSourceTrackId. r=jesup (5066bbf870)
- Bug 1262808: Refactor |PrincipalID| to |PrincipalHandle| in Gonk media code, r=rjesup (49ec99e852)
- Bug 1144096 part 1 - [css-grid] Refactor nsGridContainerFrame state and methods. r=dholbert (502fb7d424)
- Bug 1144096 part 2 - [css-grid] Make GridItemInfo::mFrame available also in non-DEBUG builds since we'll need it to support fragmentation. r=dholbert (fe0b396741)
- Bug 1144096 part 3 - [css-grid] Remove CellMap::ClearOccupied() since it's not needed anymore. r=dholbert (7aeacdccab)
- Bug 1144096 part 4 - [css-grid] Move more local nsGridContainerFrame classes into .cpp file. r=dholbert (896fc410ac)
- Bug 1144096 part 5 - [css-grid] Create a couple of Grid container frame bits. r=dholbert (abd007fd90)
- Bug 1144096 part 6 - [css-grid] Add support for creating Grid container continuations and deal with overflow containers. r=dholbert (3f02728f24)
- Bug 1144096 part 7 - [css-grid] Don't create PageBreakFrames inside a Grid container. The container will handle forced breaks on its items. r=dholbert (5a0c64369c)
- Bug 1144096 part 8 - [css-grid] Add a new state flag, eBreakBefore, to record where breaks occur between tracks. r=dholbert (5f5d8761c6)
- Bug 1144096 part 9 - [css-grid] Create a SharedGridData object owned by the first-in-flow Grid container to share state between its continuations. r=dholbert (7e510f0bf0)
- Bug 1144096 part 10 - [css-grid] Add a few helper methods to do a break before a row, and resize a row. r=dholbert (d3fec771a6)
- Bug 1144096 part 11 - [css-grid] Add a GetNearestFragmentainer() method that collects some data from the nearest enclosing fragmentainer needed for fragmentation. r=dholbert (20d4736a1c)
- Bug 1144096 part 12 - [css-grid] Collect and merge child frames we need for reflow. r=dholbert (3b5c619f34)
- Bug 1144096 part 13 - [css-grid] Refactor ReflowChildren() by separating out the code that reflows normal flow children (grid items and placeholders) into a new method ReflowInFlowChild(). r=dholbert (ba8a1edc7b)
- Bug 1144096 part 14 - [css-grid] Make ReflowInFlowChild() deal with a constrained available block-size. r=dholbert (292df4167a)
- Bug 1144096 part 15 - [css-grid] Compute our pre-reflow logical skip sides and cache the result of ComputedLogicalBorderPadding() with that applied. r=dholbert (0c7f59389e)
- Bug 1144096 part 16 - [css-grid] Implement fragmentation. r=dholbert (af8b8aac41)
- Bug 1144096 part 17 - [css-grid] Add helper methods that add a sorted list of child frames to the Overflow and ExcessOverflowContainers child lists. r=dholbert (a6c80c9e9c)
- Bug 1144096 part 18 - [css-grid] Fix a couple of bugs in how we handle child existing continuations when pushing/pulling children. r=dholbert (b8a62fab65)
- Bug 1144096 part 19 - [css-grid] Sanity check the initial child lists we get from the frame constructor (DEBUG only). r=dholbert (f56955c3ec)
- Bug 1144096 part 20 - [css-grid] Sanity check our child lists before starting a Reflow (DEBUG only). r=dholbert (d89c771238)
- Bug 1144096 part 21 - [css-grid] Deal with dynamically inserted/appended/removed child frames. r=dholbert (a07ecc06e2)
- Bug 1144096 part 22 - [css-grid] Check NS_INLINE_IS_BREAK_BEFORE before checking other completion status. r=dholbert (731dcd0ac5)
- Bug 1144096 part 23 - [css-grid] A grid container fragment that is an overflow container can't be INCOMPLETE, only OVERFLOW_INCOMPLETE and it should always have zero BSize. r=dholbert (afcd6c1741)
- Bug 1144096 part 24 - [css-grid] Move the child frame merging code at the start of ReflowOverflowContainerChildren into a new method: DrainExcessOverflowContainersList. Make both take a param so that we can override how the OC child lists are merged together (normally just an Append; MergeSortedFrameLists for Grid). r=dholbert (95323b0a56)
- Bug 1144096 part 25 - [css-grid] Enable fragmentation to occur by reporting our actual reflow status. r=dholbert (767c389238)
- Bug 1144096 part 26 - [css-grid] Fragmentation reftests. (07e62f8fd6)
- Bug 1244006 - Use const instead of MOZ_CONSTEXPR to avoid startup crash; r=dbaron (39b0bb32fb)
- Bug 1053986 - Fix comment referring to a GetBorder method that no longer exists. r=dholbert (2cde22a42c)
- Bug 1264784 - part 1 - call nsIFrame::{GetScreenRect,GetView} instead of their *External counterparts; r=dholbert (a2cd84b7a2)
- Bug 963238: Support isTypeSupported() in MediaRecorder, and throw on invalid mimetypes at construction r=cpearce,khuey (5a3709e45f)
- Bug 963238: Fix compilation errors. r=me (09b541337f)
- Bug 1157654 - 1. Do not call MediaRecorder.stop immediately after MediaRecorder.start, because we want to receive an onerror callback. 2. Make the NofityError async. r=roc (ad56918042)
- Bug 1128448 - 1. Close the pref media.encoder.omx.enabled for newer android version. 2. Modify testcase and MR to eusure no timing issue. r=roc (9dfff44a2c)
- Bug 1197669 - Part3 - Ensure the start event comes before any blobs. r=jwwang (d4e950fa49)
- Bug 1225327 - fix |mEncoder| null-dereference. r=jwwang (5ffce18e33)
- Bug 1260702: Don't crash on input sources from WebAudio in MediaRecorder r=padenot (28bcb80a03)
- Bug 1018299 - Throw security error if principal check fails in MediaRecorder::Start(). r=jib, r=mt (1130168c8d)
- Bug 1261007 - Part 1 - Force to send video sample into encoder if we got the same video sample more than 1 seconds. Enable testcases. r=jolin (5698b39b45)
- Bug 1182426 - Test that changing video resolution of a recorded stream throws an error. r=roc (edaf49f2cf)
- Bug 1261007 - Part 2 - fix test_mediarecorder_webm_support. r=rillian (16ef931949)
- Bug 1250054. Part 1 - implement MediaDecoderReaderWrapper. r=jya. (4b78b4335d)
- Bug 1242841 - Make MDSM::mDecodedAudioEndTime zero-based. r=kikuo. (c6c756d554)
- Bug 1242843 - Make MDSM::mDecodedVideoEndTime zero-based. r=kikuo. (c194178323)
- Bug 1242783. Part 1 - per comment 11, increase mAmpleAudioThresholdUsecs to 2s to avoid audio underrun when BT is connected. r=kinetik. (49567f587e)
- Bug 1242783. Part 2 - per comment 12, buffer only 1s when audio is captured. r=kinetik. (e0f0cd9826)
- Bug 1230641: P1. Use UYVY (YUV422) format in decoders. r=mattwoodrow (17d4de398c)
- Bug 1230641: P2. Increase the video queue size on mac. r=cpearce (e575c85f44)
- Bug 1230641 - Make our NSOpenGLContext opaque when in fullscreen mode. r=mstange (51da9e1e70)
- Bug 1257094 - Remove MediaDecoderStateMachine::DECODER_STATE_DECODING_NONE. r=cpearce. (f0993582c7)
- Bug 1252344. Part 1 - remove unnecessary checks from MediaDecoderStateMachine::NeedToDecodeVideo(). r=bechen. (1c9b7aadf4)
- Bug 1252344. Part 2 - remove unnecessary checks from MediaDecoderStateMachine::NeedToDecodeAudio(). r=bechen. (6896d7d1f6)
- Bug 1252360 - remove some check from NeedToDecodeAudio(). r=bechen. (1c064a9985)
- Bug 1252762 - Decode at most one audio/video sample before finishing seeking. r=cpearce. (73ec7691df)
- Bug 1253928 - adjust the time passed to RequestVideoData() by the start time to avoid incorrectly skipping key frames. r=jya. (1bc203d8e6)
- Bug 1252766 - Remove MediaDecoderStateMachine::mDecodeToSeekTarget which is never read. r=kaku. (aac1fe8018)
- Bug 1251460 - MDSM now waits on a promise to enqueue first frame loaded. r=jya (0e7e67e006)
- Bug 1257013 - Part 3: Stop checking for corrupt frames in MediaDecoderStateMachine since we no longer produce them. r=ajones (fbbbabafbb)
This commit is contained in:
2024-04-24 23:53:16 +08:00
parent c7dc12e90f
commit c6e1bfdcf2
836 changed files with 28642 additions and 9297 deletions
+1 -1
View File
@@ -9,7 +9,7 @@
# you are either running lldb from the top level source directory, the objdir,
# or the dist/bin directory. (.lldbinit files in the objdir and dist/bin set
# topsrcdir appropriately.)
script topsrcdir = topsrcdir if locals().has_key("topsrcdir") else "."; sys.path.append(os.path.join(topsrcdir, "python/lldbutils")); import lldbutils; lldbutils.init()
script topsrcdir = topsrcdir if locals().has_key("topsrcdir") else os.getcwd(); sys.path.append(os.path.join(topsrcdir, "python/lldbutils")); import lldbutils; lldbutils.init()
# Mozilla's use of UNIFIED_SOURCES to include multiple source files into a
# single compiled file breaks lldb breakpoint setting. This works around that.
+1 -1
View File
@@ -257,7 +257,7 @@ IDRefsIterator::
nsIAtom* aIDRefsAttr) :
mContent(aContent), mDoc(aDoc), mCurrIdx(0)
{
if (mContent->IsInDoc())
if (mContent->IsInUncomposedDoc())
mContent->GetAttr(kNameSpaceID_None, aIDRefsAttr, mIDs);
}
+1 -1
View File
@@ -702,7 +702,7 @@ TextAttrsMgr::TextDecorValue::
bool isForegroundColor = false;
textReset->GetDecorationColor(mColor, isForegroundColor);
if (isForegroundColor)
mColor = aFrame->StyleColor()->mColor;
mColor = aFrame->StyleContext()->GetTextFillColor();
mLine = textReset->mTextDecorationLine &
(NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE |
+3 -3
View File
@@ -360,7 +360,7 @@ nsAccessibilityService::Observe(nsISupports *aSubject, const char *aTopic,
void
nsAccessibilityService::NotifyOfAnchorJumpTo(nsIContent* aTargetNode)
{
nsIDocument* documentNode = aTargetNode->GetCurrentDoc();
nsIDocument* documentNode = aTargetNode->GetUncomposedDoc();
if (documentNode) {
DocAccessible* document = GetDocAccessible(documentNode);
if (document)
@@ -416,7 +416,7 @@ public:
NS_IMETHODIMP Notify(nsITimer* aTimer) final
{
if (!mContent->IsInDoc())
if (!mContent->IsInUncomposedDoc())
return NS_OK;
nsIPresShell* ps = mContent->OwnerDoc()->GetShell();
@@ -1039,7 +1039,7 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
}
// We have a content node.
if (!aNode->GetCrossShadowCurrentDoc()) {
if (!aNode->GetComposedDoc()) {
NS_WARNING("Creating accessible for node with no document");
return nullptr;
}
+6 -6
View File
@@ -78,7 +78,7 @@ nsCoreUtils::DispatchClickEvent(nsITreeBoxObject *aTreeBoxObj,
return;
nsCOMPtr<nsIContent> tcContent(do_QueryInterface(tcElm));
nsIDocument *document = tcContent->GetCurrentDoc();
nsIDocument *document = tcContent->GetUncomposedDoc();
if (!document)
return;
@@ -113,7 +113,7 @@ nsCoreUtils::DispatchClickEvent(nsITreeBoxObject *aTreeBoxObj,
nsPoint offset;
nsIWidget *rootWidget =
rootFrame->GetViewExternal()->GetNearestWidget(&offset);
rootFrame->GetView()->GetNearestWidget(&offset);
RefPtr<nsPresContext> presContext = presShell->GetPresContext();
@@ -138,11 +138,11 @@ nsCoreUtils::DispatchMouseEvent(EventMessage aMessage, int32_t aX, int32_t aY,
WidgetMouseEvent event(true, aMessage, aRootWidget,
WidgetMouseEvent::eReal, WidgetMouseEvent::eNormal);
event.refPoint = LayoutDeviceIntPoint(aX, aY);
event.mRefPoint = LayoutDeviceIntPoint(aX, aY);
event.clickCount = 1;
event.button = WidgetMouseEvent::eLeftButton;
event.time = PR_IntervalNow();
event.mTime = PR_IntervalNow();
event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
nsEventStatus status = nsEventStatus_eIgnore;
@@ -159,13 +159,13 @@ nsCoreUtils::DispatchTouchEvent(EventMessage aMessage, int32_t aX, int32_t aY,
WidgetTouchEvent event(true, aMessage, aRootWidget);
event.time = PR_IntervalNow();
event.mTime = PR_IntervalNow();
// XXX: Touch has an identifier of -1 to hint that it is synthesized.
RefPtr<dom::Touch> t = new dom::Touch(-1, LayoutDeviceIntPoint(aX, aY),
LayoutDeviceIntPoint(1, 1), 0.0f, 1.0f);
t->SetTarget(aContent);
event.touches.AppendElement(t);
event.mTouches.AppendElement(t);
nsEventStatus status = nsEventStatus_eIgnore;
aPresShell->HandleEventWithTarget(&event, aFrame, aContent, &status);
}
+3 -3
View File
@@ -275,7 +275,7 @@ Accessible::AccessKey() const
}
// Determine the access modifier used in this context.
nsIDocument* document = mContent->GetCurrentDoc();
nsIDocument* document = mContent->GetUncomposedDoc();
if (!document)
return KeyBinding();
@@ -537,7 +537,7 @@ Accessible::ChildAtPoint(int32_t aX, int32_t aY,
WidgetMouseEvent dummyEvent(true, eMouseMove, rootWidget,
WidgetMouseEvent::eSynthesized);
dummyEvent.refPoint = LayoutDeviceIntPoint(aX - rootRect.x, aY - rootRect.y);
dummyEvent.mRefPoint = LayoutDeviceIntPoint(aX - rootRect.x, aY - rootRect.y);
nsIFrame* popupFrame = nsLayoutUtils::
GetPopupFrameForEventCoordinates(accDocument->PresContext()->GetRootPresContext(),
@@ -1614,7 +1614,7 @@ Accessible::RelationByType(RelationType aType)
// above it).
nsIFrame *frame = GetFrame();
if (frame) {
nsView *view = frame->GetViewExternal();
nsView *view = frame->GetView();
if (view) {
nsIScrollableFrame *scrollFrame = do_QueryFrame(frame);
if (scrollFrame || view->GetWidget() || !frame->GetParent())
+2 -2
View File
@@ -123,7 +123,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(DocAccessible, Accessible)
AttrRelProvider* provider = (*providers)[jdx];
cb.NoteXPCOMChild(provider->mContent);
NS_ASSERTION(provider->mContent->IsInDoc(),
NS_ASSERTION(provider->mContent->IsInUncomposedDoc(),
"Referred content is not in document!");
}
}
@@ -1227,7 +1227,7 @@ DocAccessible::GetAccessibleByUniqueIDInSubtree(void* aUniqueID)
Accessible*
DocAccessible::GetAccessibleOrContainer(nsINode* aNode) const
{
if (!aNode || !aNode->GetCrossShadowCurrentDoc())
if (!aNode || !aNode->GetComposedDoc())
return nullptr;
nsINode* currNode = aNode;
+9 -17
View File
@@ -29,6 +29,15 @@ OuterDocAccessible::
AccessibleWrap(aContent, aDoc)
{
mType = eOuterDocType;
// Request document accessible for the content document to make sure it's
// created. It will appended to outerdoc accessible children asynchronously.
nsIDocument* outerDoc = mContent->GetUncomposedDoc();
if (outerDoc) {
nsIDocument* innerDoc = outerDoc->GetSubDocumentFor(mContent);
if (innerDoc)
GetAccService()->GetDocAccessible(innerDoc);
}
}
OuterDocAccessible::~OuterDocAccessible()
@@ -168,23 +177,6 @@ OuterDocAccessible::RemoveChild(Accessible* aAccessible)
return wasRemoved;
}
////////////////////////////////////////////////////////////////////////////////
// Accessible protected
void
OuterDocAccessible::CacheChildren()
{
// Request document accessible for the content document to make sure it's
// created. It will appended to outerdoc accessible children asynchronously.
nsIDocument* outerDoc = mContent->GetCurrentDoc();
if (outerDoc) {
nsIDocument* innerDoc = outerDoc->GetSubDocumentFor(mContent);
if (innerDoc)
GetAccService()->GetDocAccessible(innerDoc);
}
}
ProxyAccessible*
OuterDocAccessible::RemoteChildDoc() const
{
-3
View File
@@ -42,9 +42,6 @@ public:
protected:
virtual ~OuterDocAccessible() override;
// Accessible
virtual void CacheChildren() override;
};
inline OuterDocAccessible*
+2 -19
View File
@@ -30,6 +30,8 @@ HTMLImageMapAccessible::
ImageAccessibleWrap(aContent, aDoc)
{
mType = eImageMapType;
UpdateChildAreas(false);
}
////////////////////////////////////////////////////////////////////////////////
@@ -150,16 +152,6 @@ HTMLImageMapAccessible::GetChildAccessibleFor(const nsINode* aNode) const
return nullptr;
}
////////////////////////////////////////////////////////////////////////////////
// HTMLImageMapAccessible: Accessible protected
void
HTMLImageMapAccessible::CacheChildren()
{
UpdateChildAreas(false);
}
////////////////////////////////////////////////////////////////////////////////
// HTMLAreaAccessible
////////////////////////////////////////////////////////////////////////////////
@@ -231,15 +223,6 @@ HTMLAreaAccessible::EndOffset()
return IndexInParent() + 1;
}
////////////////////////////////////////////////////////////////////////////////
// HTMLAreaAccessible: Accessible protected
void
HTMLAreaAccessible::CacheChildren()
{
// No children for aria accessible.
}
nsRect
HTMLAreaAccessible::RelativeBounds(nsIFrame** aBoundingFrame) const
{
+3 -4
View File
@@ -44,9 +44,6 @@ public:
protected:
virtual ~HTMLImageMapAccessible() { }
// Accessible
virtual void CacheChildren() override;
};
/**
@@ -68,10 +65,12 @@ public:
virtual uint32_t StartOffset() override;
virtual uint32_t EndOffset() override;
virtual bool IsAcceptableChild(nsIContent* aEl) const override
{ return false; }
protected:
// Accessible
virtual ENameValueFlag NativeName(nsString& aName) override;
virtual void CacheChildren() override;
};
+10 -20
View File
@@ -360,6 +360,16 @@ HTMLComboboxAccessible::
{
mType = eHTMLComboboxType;
mGenericTypes |= eCombobox;
nsIComboboxControlFrame* comboFrame = do_QueryFrame(GetFrame());
if (comboFrame) {
nsIFrame* listFrame = comboFrame->GetDropDown();
if (listFrame) {
mListAccessible = new HTMLComboboxListAccessible(mParent, mContent, mDoc);
Document()->BindToDocument(mListAccessible, nullptr);
AppendChild(mListAccessible);
}
}
}
////////////////////////////////////////////////////////////////////////////////
@@ -394,26 +404,6 @@ HTMLComboboxAccessible::RemoveChild(Accessible* aChild)
void
HTMLComboboxAccessible::CacheChildren()
{
nsIComboboxControlFrame* comboFrame = do_QueryFrame(GetFrame());
if (!comboFrame)
return;
nsIFrame* listFrame = comboFrame->GetDropDown();
if (!listFrame)
return;
if (!mListAccessible) {
mListAccessible = new HTMLComboboxListAccessible(mParent, mContent, mDoc);
// Initialize and put into cache.
Document()->BindToDocument(mListAccessible, nullptr);
}
if (AppendChild(mListAccessible)) {
// Cache combobox option accessibles so that we build complete accessible
// tree for combobox.
mListAccessible->EnsureChildren();
}
}
void
+1 -1
View File
@@ -40,7 +40,7 @@ RootAccessibleWrap::GetNativeWidget(void** aOutView)
{
nsIFrame *frame = GetFrame();
if (frame) {
nsView *view = frame->GetViewExternal();
nsView *view = frame->GetView();
if (view) {
nsIWidget *widget = view->GetWidget();
if (widget) {
-6
View File
@@ -277,12 +277,6 @@ function treeItem(aText, aOpen, aChildren)
this.children = aChildren;
}
function createAtom(aName)
{
return Components.classes["@mozilla.org/atom-service;1"]
.getService(Components.interfaces.nsIAtomService).getAtom(aName);
}
/**
* Used in conjunction with loadXULTreeAndDoTest and addA11yXULTreeLoadEvent.
*/
+1 -1
View File
@@ -496,7 +496,7 @@ AccessibleWrap::get_accRole(
nsAutoString roleString;
if (msaaRole != ROLE_SYSTEM_CLIENT &&
!content->GetAttr(kNameSpaceID_None, nsGkAtoms::role, roleString)) {
nsIDocument * document = content->GetCurrentDoc();
nsIDocument * document = content->GetUncomposedDoc();
if (!document)
return E_FAIL;
@@ -20,8 +20,10 @@ HTMLWin32ObjectOwnerAccessible::
AccessibleWrap(aContent, aDoc), mHwnd(aHwnd)
{
// Our only child is a HTMLWin32ObjectAccessible object.
if (mHwnd)
if (mHwnd) {
mNativeAccessible = new HTMLWin32ObjectAccessible(mHwnd, aDoc);
AppendChild(mNativeAccessible);
}
}
////////////////////////////////////////////////////////////////////////////////
@@ -54,8 +56,6 @@ HTMLWin32ObjectOwnerAccessible::NativelyUnavailable() const
void
HTMLWin32ObjectOwnerAccessible::CacheChildren()
{
if (mNativeAccessible)
AppendChild(mNativeAccessible);
}
+3
View File
@@ -702,6 +702,9 @@
; InputMethod API
@RESPATH@/components/MozKeyboard.js
@RESPATH@/components/InputMethod.manifest
#ifdef MOZ_B2G
@RESPATH@/components/inputmethod.xpt
#endif
@RESPATH@/components/EngineeringMode.manifest
@RESPATH@/components/EngineeringModeAPI.js
+1
View File
@@ -245,6 +245,7 @@ cairo-atsui.h
cairo-beos.h
cairo-ft.h
cairo-glitz.h
cairo-gobject.h
cairo-pdf.h
cairo-ps.h
cairo-tee.h
+1 -1
View File
@@ -348,7 +348,7 @@ ForEachPing(nsIContent* aContent, ForEachPingCallback aCallback, void* aClosure)
return;
}
nsCOMPtr<nsIAtom> pingAtom = do_GetAtom("ping");
nsCOMPtr<nsIAtom> pingAtom = NS_Atomize("ping");
if (!pingAtom) {
return;
}
+3 -4
View File
@@ -36,7 +36,7 @@ public:
void List(FILE* out = stdout, int32_t aIndent = 0) const override;
#endif
void AddValue(nsCSSProperty aProperty, StyleAnimationValue &aStartValue)
void AddValue(nsCSSProperty aProperty, const StyleAnimationValue &aStartValue)
{
PropertyValuePair v = { aProperty, aStartValue };
mPropertyValuePairs.AppendElement(v);
@@ -44,14 +44,13 @@ public:
nsCachedStyleData::GetBitForSID(nsCSSProps::kSIDTable[aProperty]);
}
// Caller must fill in returned value.
StyleAnimationValue* AddEmptyValue(nsCSSProperty aProperty)
void AddValue(nsCSSProperty aProperty, StyleAnimationValue&& aStartValue)
{
PropertyValuePair *p = mPropertyValuePairs.AppendElement();
p->mProperty = aProperty;
p->mValue = Move(aStartValue);
mStyleBits |=
nsCachedStyleData::GetBitForSID(nsCSSProps::kSIDTable[aProperty]);
return &p->mValue;
}
struct PropertyValuePair {
+4 -2
View File
@@ -16,8 +16,10 @@ namespace dom {
class AnimationEffectTiming : public AnimationEffectTimingReadOnly
{
public:
AnimationEffectTiming(const TimingParams& aTiming, KeyframeEffect* aEffect)
: AnimationEffectTimingReadOnly(aTiming)
AnimationEffectTiming(nsISupports* aParent,
const TimingParams& aTiming,
KeyframeEffect* aEffect)
: AnimationEffectTimingReadOnly(aParent, aTiming)
, mEffect(aEffect) { }
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
@@ -40,7 +40,7 @@ AnimationEffectTimingReadOnly::GetDuration(
void
AnimationEffectTimingReadOnly::GetEasing(nsString& aRetVal) const
{
if (mTiming.mFunction.isSome()) {
if (mTiming.mFunction) {
mTiming.mFunction->AppendToString(aRetVal);
} else {
aRetVal.AssignLiteral("linear");
@@ -23,8 +23,10 @@ class AnimationEffectTimingReadOnly : public nsWrapperCache
{
public:
AnimationEffectTimingReadOnly() = default;
explicit AnimationEffectTimingReadOnly(const TimingParams& aTiming)
: mTiming(aTiming) { }
AnimationEffectTimingReadOnly(nsISupports* aParent,
const TimingParams& aTiming)
: mParent(aParent)
, mTiming(aTiming) { }
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(AnimationEffectTimingReadOnly)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(AnimationEffectTimingReadOnly)
+4
View File
@@ -9,6 +9,7 @@
#include "mozilla/dom/Nullable.h"
#include "mozilla/StickyTimeDuration.h"
#include "mozilla/ComputedTimingFunction.h"
// X11 has a #define for None
#ifdef None
@@ -67,6 +68,9 @@ struct ComputedTiming
After // Sampled after (or at) the end of the active interval
};
AnimationPhase mPhase = AnimationPhase::Null;
ComputedTimingFunction::BeforeFlag mBeforeFlag =
ComputedTimingFunction::BeforeFlag::Unset;
};
} // namespace mozilla
+32 -13
View File
@@ -24,15 +24,44 @@ ComputedTimingFunction::Init(const nsTimingFunction &aFunction)
}
static inline double
StepEnd(uint32_t aSteps, double aPortion)
StepTiming(uint32_t aSteps,
double aPortion,
ComputedTimingFunction::BeforeFlag aBeforeFlag,
nsTimingFunction::Type aType)
{
MOZ_ASSERT(0.0 <= aPortion && aPortion <= 1.0, "out of range");
MOZ_ASSERT(aType != nsTimingFunction::Type::StepStart ||
aType != nsTimingFunction::Type::StepEnd, "invalid type");
if (aPortion == 1.0) {
return 1.0;
}
// Calculate current step using step-end behavior
uint32_t step = uint32_t(aPortion * aSteps); // floor
// step-start is one step ahead
if (aType == nsTimingFunction::Type::StepStart) {
step++;
}
// If the "before flag" is set and we are at a transition point,
// drop back a step (but only if we are not already at the zero point--
// we do this clamping here since |step| is an unsigned integer)
if (step != 0 &&
aBeforeFlag == ComputedTimingFunction::BeforeFlag::Set &&
fmod(aPortion * aSteps, 1) == 0) {
step--;
}
// Convert to a progress value
return double(step) / double(aSteps);
}
double
ComputedTimingFunction::GetValue(double aPortion) const
ComputedTimingFunction::GetValue(
double aPortion,
ComputedTimingFunction::BeforeFlag aBeforeFlag) const
{
if (HasSpline()) {
// Check for a linear curve.
@@ -84,17 +113,7 @@ ComputedTimingFunction::GetValue(double aPortion) const
// Clamp in case of steps(end) and steps(start) for values greater than 1.
aPortion = clamped(aPortion, 0.0, 1.0);
if (mType == nsTimingFunction::Type::StepStart) {
// There are diagrams in the spec that seem to suggest this check
// and the bounds point should not be symmetric with StepEnd, but
// should actually step up at rather than immediately after the
// fraction points. However, we rely on rounding negative values
// up to zero, so we can't do that. And it's not clear the spec
// really meant it.
return 1.0 - StepEnd(mSteps, 1.0 - aPortion);
}
MOZ_ASSERT(mType == nsTimingFunction::Type::StepEnd, "bad type");
return StepEnd(mSteps, aPortion);
return StepTiming(mSteps, aPortion, aBeforeFlag, mType);
}
int32_t
+10 -3
View File
@@ -15,8 +15,14 @@ namespace mozilla {
class ComputedTimingFunction
{
public:
// BeforeFlag is used in step timing function.
// https://w3c.github.io/web-animations/#before-flag
enum class BeforeFlag {
Unset,
Set
};
void Init(const nsTimingFunction &aFunction);
double GetValue(double aPortion) const;
double GetValue(double aPortion, BeforeFlag aBeforeFlag) const;
const nsSMILKeySpline* GetFunction() const
{
NS_ASSERTION(HasSpline(), "Type mismatch");
@@ -42,9 +48,10 @@ public:
void AppendToString(nsAString& aResult) const;
static double GetPortion(const Maybe<ComputedTimingFunction>& aFunction,
double aPortion)
double aPortion,
BeforeFlag aBeforeFlag)
{
return aFunction.isSome() ? aFunction->GetValue(aPortion) : aPortion;
return aFunction ? aFunction->GetValue(aPortion, aBeforeFlag) : aPortion;
}
static int32_t Compare(const Maybe<ComputedTimingFunction>& aLhs,
const Maybe<ComputedTimingFunction>& aRhs);
+229 -309
View File
@@ -20,7 +20,6 @@
#include "nsCSSProps.h" // For nsCSSProps::PropHasFlags
#include "nsCSSPseudoElements.h" // For CSSPseudoElementType
#include "nsDOMMutationObserver.h" // For nsAutoAnimationMutationBatch
#include <algorithm> // For std::max
namespace mozilla {
@@ -62,7 +61,8 @@ namespace dom {
NS_IMPL_CYCLE_COLLECTION_INHERITED(KeyframeEffectReadOnly,
AnimationEffectReadOnly,
mTarget,
mAnimation)
mAnimation,
mTiming)
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(KeyframeEffectReadOnly,
AnimationEffectReadOnly)
@@ -80,7 +80,8 @@ KeyframeEffectReadOnly::KeyframeEffectReadOnly(
CSSPseudoElementType aPseudoType,
const TimingParams& aTiming)
: KeyframeEffectReadOnly(aDocument, aTarget, aPseudoType,
new AnimationEffectTimingReadOnly(aTiming))
new AnimationEffectTimingReadOnly(aDocument,
aTiming))
{
}
@@ -91,7 +92,7 @@ KeyframeEffectReadOnly::KeyframeEffectReadOnly(
AnimationEffectTimingReadOnly* aTiming)
: AnimationEffectReadOnly(aDocument)
, mTarget(aTarget)
, mTiming(*aTiming)
, mTiming(aTiming)
, mPseudoType(aPseudoType)
, mInEffectOnLastAnimationTimingUpdate(false)
{
@@ -217,7 +218,8 @@ KeyframeEffectReadOnly::GetLocalTime() const
}
void
KeyframeEffectReadOnly::GetComputedTimingAsDict(ComputedTimingProperties& aRetVal) const
KeyframeEffectReadOnly::GetComputedTimingAsDict(
ComputedTimingProperties& aRetVal) const
{
const Nullable<TimeDuration> currentTime = GetLocalTime();
GetComputedTimingDictionary(GetComputedTimingAt(currentTime,
@@ -229,8 +231,8 @@ KeyframeEffectReadOnly::GetComputedTimingAsDict(ComputedTimingProperties& aRetVa
ComputedTiming
KeyframeEffectReadOnly::GetComputedTimingAt(
const Nullable<TimeDuration>& aLocalTime,
const TimingParams& aTiming)
const Nullable<TimeDuration>& aLocalTime,
const TimingParams& aTiming)
{
const StickyTimeDuration zeroDuration;
@@ -243,14 +245,18 @@ KeyframeEffectReadOnly::GetComputedTimingAt(
result.mDuration = aTiming.mDuration.ref();
}
result.mIterations = IsNaN(aTiming.mIterations) || aTiming.mIterations < 0.0f ?
1.0f :
aTiming.mIterations;
result.mIterationStart = std::max(aTiming.mIterationStart, 0.0);
MOZ_ASSERT(aTiming.mIterations >= 0.0 && !IsNaN(aTiming.mIterations),
"mIterations should be nonnegative & finite, as ensured by "
"ValidateIterations or CSSParser");
result.mIterations = aTiming.mIterations;
result.mActiveDuration = ActiveDuration(result.mDuration, result.mIterations);
result.mEndTime = aTiming.mDelay + result.mActiveDuration +
aTiming.mEndDelay;
MOZ_ASSERT(aTiming.mIterationStart >= 0.0,
"mIterationStart should be nonnegative, as ensured by "
"ValidateIterationStart");
result.mIterationStart = aTiming.mIterationStart;
result.mActiveDuration = aTiming.ActiveDuration();
result.mEndTime = aTiming.EndTime();
result.mFill = aTiming.mFill == dom::FillMode::Auto ?
dom::FillMode::None :
aTiming.mFill;
@@ -262,12 +268,8 @@ KeyframeEffectReadOnly::GetComputedTimingAt(
}
const TimeDuration& localTime = aLocalTime.Value();
// When we finish exactly at the end of an iteration we need to report
// the end of the final iteration and not the start of the next iteration
// so we set up a flag for that case.
bool isEndOfFinalIteration = false;
// Get the normalized time within the active interval.
// Calculate the time within the active interval.
// https://w3c.github.io/web-animations/#active-time
StickyTimeDuration activeTime;
if (localTime >=
std::min(StickyTimeDuration(aTiming.mDelay + result.mActiveDuration),
@@ -275,21 +277,14 @@ KeyframeEffectReadOnly::GetComputedTimingAt(
result.mPhase = ComputedTiming::AnimationPhase::After;
if (!result.FillsForwards()) {
// The animation isn't active or filling at this time.
result.mProgress.SetNull();
return result;
}
activeTime = result.mActiveDuration;
double finiteProgress =
(IsInfinite(result.mIterations) ? 0.0 : result.mIterations)
+ result.mIterationStart;
isEndOfFinalIteration = result.mIterations != 0.0 &&
fmod(finiteProgress, 1.0) == 0;
} else if (localTime <
std::min(StickyTimeDuration(aTiming.mDelay), result.mEndTime)) {
result.mPhase = ComputedTiming::AnimationPhase::Before;
if (!result.FillsBackwards()) {
// The animation isn't active or filling at this time.
result.mProgress.SetNull();
return result;
}
// activeTime is zero
@@ -300,70 +295,50 @@ KeyframeEffectReadOnly::GetComputedTimingAt(
activeTime = localTime - aTiming.mDelay;
}
// Calculate the scaled active time
// (We handle the case where the iterationStart is zero separately in case
// the duration is infinity, since 0 * Infinity is undefined.)
StickyTimeDuration startOffset =
result.mIterationStart == 0.0
? StickyTimeDuration(0)
: result.mDuration.MultDouble(result.mIterationStart);
StickyTimeDuration scaledActiveTime = activeTime + startOffset;
// Convert active time to a multiple of iterations.
// https://w3c.github.io/web-animations/#overall-progress
double overallProgress;
if (result.mDuration == zeroDuration) {
overallProgress = result.mPhase == ComputedTiming::AnimationPhase::Before
? 0.0
: result.mIterations;
} else {
overallProgress = activeTime / result.mDuration;
}
// Get the position within the current iteration.
StickyTimeDuration iterationTime;
if (result.mDuration != zeroDuration &&
scaledActiveTime != StickyTimeDuration::Forever()) {
iterationTime = isEndOfFinalIteration
? result.mDuration
: scaledActiveTime % result.mDuration;
} /* else, either the duration is zero and iterationTime is zero,
or the scaledActiveTime is infinity in which case the iterationTime
should become infinity but we will not use the iterationTime in that
case so we just leave it as zero */
// Factor in iteration start offset.
if (IsFinite(overallProgress)) {
overallProgress += result.mIterationStart;
}
// Determine the 0-based index of the current iteration.
if (result.mPhase == ComputedTiming::AnimationPhase::Before ||
result.mIterations == 0) {
result.mCurrentIteration = static_cast<uint64_t>(result.mIterationStart);
} else if (result.mPhase == ComputedTiming::AnimationPhase::After) {
result.mCurrentIteration =
IsInfinite(result.mIterations)
? UINT64_MAX // In GetComputedTimingDictionary(), we will convert this
// into Infinity.
: static_cast<uint64_t>(ceil(result.mIterations +
result.mIterationStart)) - 1;
} else if (result.mDuration == StickyTimeDuration::Forever()) {
result.mCurrentIteration = static_cast<uint64_t>(result.mIterationStart);
} else {
result.mCurrentIteration =
static_cast<uint64_t>(scaledActiveTime / result.mDuration); // floor
}
// https://w3c.github.io/web-animations/#current-iteration
result.mCurrentIteration =
IsInfinite(result.mIterations) &&
result.mPhase == ComputedTiming::AnimationPhase::After
? UINT64_MAX // In GetComputedTimingDictionary(),
// we will convert this into Infinity
: static_cast<uint64_t>(overallProgress);
// Normalize the iteration time into a fraction of the iteration duration.
if (result.mPhase == ComputedTiming::AnimationPhase::Before ||
result.mIterations == 0) {
double progress = fmod(result.mIterationStart, 1.0);
result.mProgress.SetValue(progress);
} else if (result.mPhase == ComputedTiming::AnimationPhase::After) {
double progress;
if (isEndOfFinalIteration) {
progress = 1.0;
} else if (IsInfinite(result.mIterations)) {
progress = fmod(result.mIterationStart, 1.0);
} else {
progress = fmod(result.mIterations + result.mIterationStart, 1.0);
// Convert the overall progress to a fraction of a single iteration--the
// simply iteration progress.
// https://w3c.github.io/web-animations/#simple-iteration-progress
double progress = IsFinite(overallProgress)
? fmod(overallProgress, 1.0)
: fmod(result.mIterationStart, 1.0);
// When we finish exactly at the end of an iteration we need to report
// the end of the final iteration and not the start of the next iteration.
if (result.mPhase == ComputedTiming::AnimationPhase::After &&
progress == 0.0 &&
result.mIterations != 0.0) {
progress = 1.0;
if (result.mCurrentIteration != UINT64_MAX) {
result.mCurrentIteration--;
}
result.mProgress.SetValue(progress);
} else {
// We are in the active phase so the iteration duration can't be zero.
MOZ_ASSERT(result.mDuration != zeroDuration,
"In the active phase of a zero-duration animation?");
double progress = result.mDuration == StickyTimeDuration::Forever()
? fmod(result.mIterationStart, 1.0)
: iterationTime / result.mDuration;
result.mProgress.SetValue(progress);
}
// Factor in the direction.
bool thisIterationReverse = false;
switch (aTiming.mDirection) {
case PlaybackDirection::Normal:
@@ -382,34 +357,28 @@ KeyframeEffectReadOnly::GetComputedTimingAt(
MOZ_ASSERT(true, "Unknown PlaybackDirection type");
}
if (thisIterationReverse) {
result.mProgress.SetValue(1.0 - result.mProgress.Value());
progress = 1.0 - progress;
}
// Calculate the 'before flag' which we use when applying step timing
// functions.
if ((result.mPhase == ComputedTiming::AnimationPhase::After &&
thisIterationReverse) ||
(result.mPhase == ComputedTiming::AnimationPhase::Before &&
!thisIterationReverse)) {
result.mBeforeFlag = ComputedTimingFunction::BeforeFlag::Set;
}
// Apply the easing.
if (aTiming.mFunction) {
result.mProgress.SetValue(
aTiming.mFunction->GetValue(result.mProgress.Value()));
progress = aTiming.mFunction->GetValue(progress, result.mBeforeFlag);
}
MOZ_ASSERT(IsFinite(progress), "Progress value should be finite");
result.mProgress.SetValue(progress);
return result;
}
StickyTimeDuration
KeyframeEffectReadOnly::ActiveDuration(
const StickyTimeDuration& aIterationDuration,
double aIterationCount)
{
// If either the iteration duration or iteration count is zero,
// Web Animations says that the active duration is zero. This is to
// ensure that the result is defined when the other argument is Infinity.
const StickyTimeDuration zeroDuration;
if (aIterationDuration == zeroDuration ||
aIterationCount == 0.0) {
return zeroDuration;
}
return aIterationDuration.MultDouble(aIterationCount);
}
// https://w3c.github.io/web-animations/#in-play
bool
KeyframeEffectReadOnly::IsInPlay() const
@@ -449,6 +418,77 @@ KeyframeEffectReadOnly::SetAnimation(Animation* aAnimation)
NotifyAnimationTimingUpdated();
}
static bool
KeyframesEqualIgnoringComputedOffsets(const nsTArray<Keyframe>& aLhs,
const nsTArray<Keyframe>& aRhs)
{
if (aLhs.Length() != aRhs.Length()) {
return false;
}
for (size_t i = 0, len = aLhs.Length(); i < len; ++i) {
const Keyframe& a = aLhs[i];
const Keyframe& b = aRhs[i];
if (a.mOffset != b.mOffset ||
a.mTimingFunction != b.mTimingFunction ||
a.mPropertyValues != b.mPropertyValues) {
return false;
}
}
return true;
}
// https://w3c.github.io/web-animations/#dom-keyframeeffect-setframes
void
KeyframeEffectReadOnly::SetFrames(JSContext* aContext,
JS::Handle<JSObject*> aFrames,
ErrorResult& aRv)
{
nsIDocument* doc = AnimationUtils::GetCurrentRealmDocument(aContext);
if (!doc) {
aRv.Throw(NS_ERROR_FAILURE);
return;
}
nsTArray<Keyframe> keyframes =
KeyframeUtils::GetKeyframesFromObject(aContext, aFrames, aRv);
if (aRv.Failed()) {
return;
}
RefPtr<nsStyleContext> styleContext;
nsIPresShell* shell = doc->GetShell();
if (shell && mTarget) {
nsIAtom* pseudo =
mPseudoType < CSSPseudoElementType::Count ?
nsCSSPseudoElements::GetPseudoAtom(mPseudoType) : nullptr;
styleContext =
nsComputedDOMStyle::GetStyleContextForElement(mTarget, pseudo, shell);
}
SetFrames(Move(keyframes), styleContext);
}
void
KeyframeEffectReadOnly::SetFrames(nsTArray<Keyframe>&& aFrames,
nsStyleContext* aStyleContext)
{
if (KeyframesEqualIgnoringComputedOffsets(aFrames, mFrames)) {
return;
}
mFrames = Move(aFrames);
KeyframeUtils::ApplyDistributeSpacing(mFrames);
if (mAnimation && mAnimation->IsRelevant()) {
nsNodeUtils::AnimationChanged(mAnimation);
}
if (aStyleContext) {
UpdateProperties(aStyleContext);
}
}
const AnimationProperty*
KeyframeEffectReadOnly::GetAnimationOfProperty(nsCSSProperty aProperty) const
{
@@ -478,17 +518,25 @@ KeyframeEffectReadOnly::HasAnimationOfProperties(
return false;
}
bool
KeyframeEffectReadOnly::UpdateProperties(
const InfallibleTArray<AnimationProperty>& aProperties)
void
KeyframeEffectReadOnly::UpdateProperties(nsStyleContext* aStyleContext)
{
// AnimationProperty::operator== does not compare mWinsInCascade and
// mIsRunningOnCompositor, we don't need to update anything here because
// we want to preserve
if (mProperties == aProperties) {
return false;
MOZ_ASSERT(aStyleContext);
nsTArray<AnimationProperty> properties;
if (mTarget) {
properties =
KeyframeUtils::GetAnimationPropertiesFromKeyframes(aStyleContext,
mTarget,
mPseudoType,
mFrames);
}
if (mProperties == properties) {
return;
}
// Preserve the state of mWinsInCascade and mIsRunningOnCompositor flags.
nsCSSPropertySet winningInCascadeProperties;
nsCSSPropertySet runningOnCompositorProperties;
@@ -501,7 +549,7 @@ KeyframeEffectReadOnly::UpdateProperties(
}
}
mProperties = aProperties;
mProperties = Move(properties);
for (AnimationProperty& property : mProperties) {
property.mWinsInCascade =
@@ -510,6 +558,13 @@ KeyframeEffectReadOnly::UpdateProperties(
runningOnCompositorProperties.HasProperty(property.mProperty);
}
if (mTarget) {
EffectSet* effectSet = EffectSet::GetEffectSet(mTarget, mPseudoType);
if (effectSet) {
effectSet->MarkCascadeNeedsUpdate();
}
}
if (mAnimation) {
nsPresContext* presContext = GetPresContext();
if (presContext) {
@@ -519,8 +574,6 @@ KeyframeEffectReadOnly::UpdateProperties(
mAnimation->CascadeLevel());
}
}
return true;
}
void
@@ -590,14 +643,12 @@ KeyframeEffectReadOnly::ComposeStyle(RefPtr<AnimValuesStyleRule>& aStyleRule,
aStyleRule = new AnimValuesStyleRule();
}
StyleAnimationValue* val = aStyleRule->AddEmptyValue(prop.mProperty);
// Special handling for zero-length segments
if (segment->mToKey == segment->mFromKey) {
if (computedTiming.mProgress.Value() < 0) {
*val = segment->mFromValue;
aStyleRule->AddValue(prop.mProperty, segment->mFromValue);
} else {
*val = segment->mToValue;
aStyleRule->AddValue(prop.mProperty, segment->mToValue);
}
continue;
}
@@ -607,16 +658,20 @@ KeyframeEffectReadOnly::ComposeStyle(RefPtr<AnimValuesStyleRule>& aStyleRule,
(segment->mToKey - segment->mFromKey);
double valuePosition =
ComputedTimingFunction::GetPortion(segment->mTimingFunction,
positionInSegment);
positionInSegment,
computedTiming.mBeforeFlag);
#ifdef DEBUG
bool result =
#endif
StyleAnimationValue::Interpolate(prop.mProperty,
segment->mFromValue,
segment->mToValue,
valuePosition, *val);
MOZ_ASSERT(result, "interpolate must succeed now");
StyleAnimationValue val;
if (StyleAnimationValue::Interpolate(prop.mProperty,
segment->mFromValue,
segment->mToValue,
valuePosition, val)) {
aStyleRule->AddValue(prop.mProperty, Move(val));
} else if (valuePosition < 0.5) {
aStyleRule->AddValue(prop.mProperty, segment->mFromValue);
} else {
aStyleRule->AddValue(prop.mProperty, segment->mToValue);
}
}
}
@@ -701,42 +756,14 @@ KeyframeEffectReadOnly::ConstructKeyframeEffect(
pseudoType = target.GetAsCSSPseudoElement().GetType();
}
if (!targetElement->GetComposedDoc()) {
aRv.Throw(NS_ERROR_DOM_ANIM_TARGET_NOT_IN_DOC_ERR);
return nullptr;
}
nsTArray<Keyframe> keyframes =
KeyframeUtils::GetKeyframesFromObject(aGlobal.Context(), aFrames, aRv);
if (aRv.Failed()) {
return nullptr;
}
KeyframeUtils::ApplyDistributeSpacing(keyframes);
RefPtr<nsStyleContext> styleContext;
nsIPresShell* shell = doc->GetShell();
if (shell && targetElement) {
nsIAtom* pseudo =
pseudoType < CSSPseudoElementType::Count ?
nsCSSPseudoElements::GetPseudoAtom(pseudoType) : nullptr;
styleContext =
nsComputedDOMStyle::GetStyleContextForElement(targetElement, pseudo,
shell);
}
nsTArray<AnimationProperty> animationProperties;
if (styleContext) {
animationProperties =
KeyframeUtils::GetAnimationPropertiesFromKeyframes(styleContext,
targetElement,
pseudoType,
keyframes);
}
RefPtr<KeyframeEffectType> effect =
new KeyframeEffectType(targetElement->OwnerDoc(), targetElement,
pseudoType, timingParams);
effect->mProperties = Move(animationProperties);
effect->SetFrames(aGlobal.Context(), aFrames, aRv);
if (aRv.Failed()) {
return nullptr;
}
return effect.forget();
}
@@ -810,81 +837,6 @@ struct KeyframeValue
StyleAnimationValue mValue;
};
/**
* Represents a relative position for a value in a keyframe animation.
*/
enum class ValuePosition
{
First, // value at 0 used for reverse filling
Left, // value coming in to a given offset
Right, // value coming out from a given offset
Last // value at 1 used for forward filling
};
/**
* A single value in a keyframe animation, used by GetFrames to produce a
* minimal set of keyframe objects.
*/
struct OrderedKeyframeValueEntry : KeyframeValue
{
float mOffset;
const Maybe<ComputedTimingFunction>* mTimingFunction;
ValuePosition mPosition;
bool SameKeyframe(const OrderedKeyframeValueEntry& aOther) const
{
return mOffset == aOther.mOffset &&
!!mTimingFunction == !!aOther.mTimingFunction &&
(!mTimingFunction || *mTimingFunction == *aOther.mTimingFunction) &&
mPosition == aOther.mPosition;
}
struct ForKeyframeGenerationComparator
{
static bool Equals(const OrderedKeyframeValueEntry& aLhs,
const OrderedKeyframeValueEntry& aRhs)
{
return aLhs.SameKeyframe(aRhs) &&
aLhs.mProperty == aRhs.mProperty;
}
static bool LessThan(const OrderedKeyframeValueEntry& aLhs,
const OrderedKeyframeValueEntry& aRhs)
{
// First, sort by offset.
if (aLhs.mOffset != aRhs.mOffset) {
return aLhs.mOffset < aRhs.mOffset;
}
// Second, by position.
if (aLhs.mPosition != aRhs.mPosition) {
return aLhs.mPosition < aRhs.mPosition;
}
// Third, by easing.
if (aLhs.mTimingFunction) {
if (aRhs.mTimingFunction) {
int32_t order =
ComputedTimingFunction::Compare(*aLhs.mTimingFunction,
*aRhs.mTimingFunction);
if (order != 0) {
return order < 0;
}
} else {
return true;
}
} else {
if (aRhs.mTimingFunction) {
return false;
}
}
// Last, by property IDL name.
return nsCSSProps::PropertyIDLNameSortPosition(aLhs.mProperty) <
nsCSSProps::PropertyIDLNameSortPosition(aRhs.mProperty);
}
};
};
/* static */ already_AddRefed<KeyframeEffectReadOnly>
KeyframeEffectReadOnly::Constructor(
const GlobalObject& aGlobal,
@@ -1016,67 +968,25 @@ KeyframeEffectReadOnly::GetFrames(JSContext*& aCx,
nsTArray<JSObject*>& aResult,
ErrorResult& aRv)
{
nsTArray<OrderedKeyframeValueEntry> entries;
MOZ_ASSERT(aResult.IsEmpty());
MOZ_ASSERT(!aRv.Failed());
for (const AnimationProperty& property : mProperties) {
for (size_t i = 0, n = property.mSegments.Length(); i < n; i++) {
const AnimationPropertySegment& segment = property.mSegments[i];
// We append the mFromValue for each segment. If the mToValue
// differs from the following segment's mFromValue, or if we're on
// the last segment, then we append the mToValue as well.
//
// Each value is annotated with whether it is a "first", "left", "right",
// or "last" value. "left" and "right" values represent the value coming
// in to and out of a given offset, in the middle of an animation. For
// most segments, the mToValue is the "left" and the following segment's
// mFromValue is the "right". The "first" and "last" values are the
// additional values assigned to offset 0 or 1 for reverse and forward
// filling. These annotations are used to ensure multiple values for a
// given property are sorted correctly and that we do not merge Keyframes
// with different values for the same offset.
OrderedKeyframeValueEntry* entry = entries.AppendElement();
entry->mProperty = property.mProperty;
entry->mValue = segment.mFromValue;
entry->mOffset = segment.mFromKey;
entry->mTimingFunction = &segment.mTimingFunction;
entry->mPosition =
segment.mFromKey == segment.mToKey && segment.mFromKey == 0.0f ?
ValuePosition::First :
ValuePosition::Right;
if (i == n - 1 ||
segment.mToValue != property.mSegments[i + 1].mFromValue) {
entry = entries.AppendElement();
entry->mProperty = property.mProperty;
entry->mValue = segment.mToValue;
entry->mOffset = segment.mToKey;
entry->mTimingFunction = segment.mToKey == 1.0f ?
nullptr : &segment.mTimingFunction;
entry->mPosition =
segment.mFromKey == segment.mToKey && segment.mToKey == 1.0f ?
ValuePosition::Last :
ValuePosition::Left;
}
}
if (!aResult.SetCapacity(mFrames.Length(), mozilla::fallible)) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return;
}
entries.Sort(OrderedKeyframeValueEntry::ForKeyframeGenerationComparator());
for (size_t i = 0, n = entries.Length(); i < n; ) {
OrderedKeyframeValueEntry* entry = &entries[i];
OrderedKeyframeValueEntry* previousEntry = nullptr;
// Create a JS object with the BaseComputedKeyframe dictionary members.
for (const Keyframe& keyframe : mFrames) {
// Set up a dictionary object for the explicit members
BaseComputedKeyframe keyframeDict;
keyframeDict.mOffset.SetValue(entry->mOffset);
keyframeDict.mComputedOffset.Construct(entry->mOffset);
if (entry->mTimingFunction && entry->mTimingFunction->isSome()) {
// If null, leave easing as its default "linear".
keyframeDict.mEasing.Truncate();
entry->mTimingFunction->value().AppendToString(keyframeDict.mEasing);
if (keyframe.mOffset) {
keyframeDict.mOffset.SetValue(keyframe.mOffset.value());
}
keyframeDict.mComputedOffset.Construct(keyframe.mComputedOffset);
if (keyframe.mTimingFunction) {
keyframeDict.mEasing.Truncate();
keyframe.mTimingFunction.ref().AppendToString(keyframeDict.mEasing);
} // else if null, leave easing as its default "linear".
JS::Rooted<JS::Value> keyframeJSValue(aCx);
if (!ToJSValue(aCx, keyframeDict, &keyframeJSValue)) {
@@ -1084,27 +994,33 @@ KeyframeEffectReadOnly::GetFrames(JSContext*& aCx,
return;
}
JS::Rooted<JSObject*> keyframe(aCx, &keyframeJSValue.toObject());
do {
const char* name = nsCSSProps::PropertyIDLName(entry->mProperty);
nsString stringValue;
StyleAnimationValue::UncomputeValue(entry->mProperty,
entry->mValue,
stringValue);
JS::Rooted<JSObject*> keyframeObject(aCx, &keyframeJSValue.toObject());
for (const PropertyValuePair& propertyValue : keyframe.mPropertyValues) {
const char* name = nsCSSProps::PropertyIDLName(propertyValue.mProperty);
// nsCSSValue::AppendToString does not accept shorthands properties but
// works with token stream values if we pass eCSSProperty_UNKNOWN as
// the property.
nsCSSProperty propertyForSerializing =
nsCSSProps::IsShorthand(propertyValue.mProperty)
? eCSSProperty_UNKNOWN
: propertyValue.mProperty;
nsAutoString stringValue;
propertyValue.mValue.AppendToString(
propertyForSerializing, stringValue, nsCSSValue::eNormalized);
JS::Rooted<JS::Value> value(aCx);
if (!ToJSValue(aCx, stringValue, &value) ||
!JS_DefineProperty(aCx, keyframe, name, value, JSPROP_ENUMERATE)) {
!JS_DefineProperty(aCx, keyframeObject, name, value,
JSPROP_ENUMERATE)) {
aRv.Throw(NS_ERROR_FAILURE);
return;
}
if (++i == n) {
break;
}
previousEntry = entry;
entry = &entries[i];
} while (entry->SameKeyframe(*previousEntry));
}
aResult.AppendElement(keyframe);
aResult.AppendElement(keyframeObject);
}
}
@@ -1405,7 +1321,7 @@ KeyframeEffect::KeyframeEffect(nsIDocument* aDocument,
CSSPseudoElementType aPseudoType,
const TimingParams& aTiming)
: KeyframeEffectReadOnly(aDocument, aTarget, aPseudoType,
new AnimationEffectTiming(aTiming, this))
new AnimationEffectTiming(aDocument, aTiming, this))
{
}
@@ -1464,7 +1380,11 @@ void KeyframeEffect::NotifySpecifiedTimingUpdated()
KeyframeEffect::~KeyframeEffect()
{
mTiming->Unlink();
// mTiming is cycle collected, so we have to do null check first even though
// mTiming shouldn't be null during the lifetime of KeyframeEffect.
if (mTiming) {
mTiming->Unlink();
}
}
} // namespace dom
+35 -14
View File
@@ -63,6 +63,11 @@ struct PropertyValuePair
// property values, we store the specified property value as a token stream
// (string).
nsCSSValue mValue;
bool operator==(const PropertyValuePair& aOther) const {
return mProperty == aOther.mProperty &&
mValue == aOther.mValue;
}
};
/**
@@ -82,6 +87,23 @@ struct PropertyValuePair
*/
struct Keyframe
{
Keyframe() = default;
Keyframe(const Keyframe& aOther) = default;
Keyframe(Keyframe&& aOther)
{
*this = Move(aOther);
}
Keyframe& operator=(const Keyframe& aOther) = default;
Keyframe& operator=(Keyframe&& aOther)
{
mOffset = aOther.mOffset;
mComputedOffset = aOther.mComputedOffset;
mTimingFunction = Move(aOther.mTimingFunction);
mPropertyValues = Move(aOther.mPropertyValues);
return *this;
}
Maybe<double> mOffset;
double mComputedOffset = 0.0;
Maybe<ComputedTimingFunction> mTimingFunction; // Nothing() here means
@@ -252,12 +274,6 @@ public:
void
GetComputedTimingAsDict(ComputedTimingProperties& aRetVal) const override;
// Return the duration of the active interval for the given duration and
// iteration count.
static StickyTimeDuration
ActiveDuration(const StickyTimeDuration& aIterationDuration,
double aIterationCount);
bool IsInPlay() const;
bool IsCurrent() const;
bool IsInEffect() const;
@@ -265,6 +281,9 @@ public:
void SetAnimation(Animation* aAnimation);
Animation* GetAnimation() const { return mAnimation; }
void SetFrames(JSContext* aContext, JS::Handle<JSObject*> aFrames,
ErrorResult& aRv);
void SetFrames(nsTArray<Keyframe>&& aFrames, nsStyleContext* aStyleContext);
const AnimationProperty*
GetAnimationOfProperty(nsCSSProperty aProperty) const;
bool HasAnimationOfProperty(nsCSSProperty aProperty) const {
@@ -278,12 +297,10 @@ public:
InfallibleTArray<AnimationProperty>& Properties() {
return mProperties;
}
// Updates the set of properties using the supplied list whilst preserving
// the mWinsInCascade and mIsRunningOnCompositor state of any matching
// properties.
// Returns true if we updated anything in the properties.
bool UpdateProperties(
const InfallibleTArray<AnimationProperty>& aProperties);
// Update |mProperties| by recalculating from |mFrames| using |aStyleContext|
// to resolve specified values.
void UpdateProperties(nsStyleContext* aStyleContext);
// Updates |aStyleRule| with the animation values produced by this
// AnimationEffect for the current time except any properties already
@@ -351,10 +368,14 @@ protected:
nsCOMPtr<Element> mTarget;
RefPtr<Animation> mAnimation;
OwningNonNull<AnimationEffectTimingReadOnly> mTiming;
RefPtr<AnimationEffectTimingReadOnly> mTiming;
CSSPseudoElementType mPseudoType;
InfallibleTArray<AnimationProperty> mProperties;
// The specified keyframes.
nsTArray<Keyframe> mFrames;
// A set of per-property value arrays, derived from |mFrames|.
nsTArray<AnimationProperty> mProperties;
// The computed progress last time we composed the style rule. This is
// used to detect when the progress is not changing (e.g. due to a step
+8 -592
View File
@@ -21,11 +21,6 @@
#include "nsTArray.h"
#include <algorithm> // For std::stable_sort
// TODO: Remove once we drop LookupStyleContext
#include "nsComputedDOMStyle.h"
#include "nsIDocument.h"
#include "nsIPresShell.h"
namespace mozilla {
// ------------------------------------------------------------------
@@ -231,17 +226,6 @@ struct PropertyValuesPair
typedef TPropertyPriorityComparator<PropertyValuesPair> Comparator;
};
/**
* The result of parsing a JS object as a BaseKeyframe dictionary
* and getting its property-value pairs from its open-ended
* properties.
*/
struct OffsetIndexedKeyframe
{
dom::binding_detail::FastBaseKeyframe mKeyframeDict;
nsTArray<PropertyValuesPair> mPropertyValuePairs;
};
/**
* An additional property (for a property-values pair) found on a
* BaseKeyframe or BasePropertyIndexedKeyframe object.
@@ -267,25 +251,17 @@ struct AdditionalProperty
};
};
/**
* A property and StyleAnimationValue pair.
*/
struct KeyframeValue
{
nsCSSProperty mProperty;
StyleAnimationValue mValue;
};
/**
* Data for a segment in a keyframe animation of a given property
* whose value is a StyleAnimationValue.
*
* KeyframeValueEntry is used in BuildAnimationPropertyListFromKeyframeSequence
* to gather data for each individual segment described by an author-supplied
* an IDL sequence<Keyframe> value so that they can be parsed into mProperties.
* KeyframeValueEntry is used in GetAnimationPropertiesFromKeyframes
* to gather data for each individual segment.
*/
struct KeyframeValueEntry : KeyframeValue
struct KeyframeValueEntry
{
nsCSSProperty mProperty;
StyleAnimationValue mValue;
float mOffset;
Maybe<ComputedTimingFunction> mTimingFunction;
@@ -334,26 +310,12 @@ public:
//
// ------------------------------------------------------------------
static void
BuildAnimationPropertyListFromKeyframeSequence(
JSContext* aCx,
Element* aTarget,
CSSPseudoElementType aPseudoType,
JS::ForOfIterator& aIterator,
nsTArray<AnimationProperty>& aResult,
ErrorResult& aRv);
static void
GetKeyframeListFromKeyframeSequence(JSContext* aCx,
JS::ForOfIterator& aIterator,
nsTArray<Keyframe>& aResult,
ErrorResult& aRv);
static bool
ConvertKeyframeSequence(JSContext* aCx,
JS::ForOfIterator& aIterator,
nsTArray<OffsetIndexedKeyframe>& aResult);
static bool
ConvertKeyframeSequence(JSContext* aCx,
JS::ForOfIterator& aIterator,
@@ -380,35 +342,13 @@ static PropertyValuePair
MakePropertyValuePair(nsCSSProperty aProperty, const nsAString& aStringValue,
nsCSSParser& aParser, nsIDocument* aDocument);
static bool
HasValidOffsets(const nsTArray<OffsetIndexedKeyframe>& aKeyframes);
static bool
HasValidOffsets(const nsTArray<Keyframe>& aKeyframes);
static void
ApplyDistributeSpacing(nsTArray<OffsetIndexedKeyframe>& aKeyframes);
static void
GenerateValueEntries(Element* aTarget,
CSSPseudoElementType aPseudoType,
nsTArray<OffsetIndexedKeyframe>& aKeyframes,
nsTArray<KeyframeValueEntry>& aResult,
ErrorResult& aRv);
static void
BuildSegmentsFromValueEntries(nsTArray<KeyframeValueEntry>& aEntries,
nsTArray<AnimationProperty>& aResult);
static void
BuildAnimationPropertyListFromPropertyIndexedKeyframes(
JSContext* aCx,
Element* aTarget,
CSSPseudoElementType aPseudoType,
JS::Handle<JS::Value> aValue,
InfallibleTArray<AnimationProperty>& aResult,
ErrorResult& aRv);
static void
GetKeyframeListFromPropertyIndexedKeyframe(JSContext* aCx,
JS::Handle<JS::Value> aValue,
@@ -420,64 +360,12 @@ RequiresAdditiveAnimation(const nsTArray<Keyframe>& aKeyframes,
nsIDocument* aDocument);
// TODO: This is only temporary until we remove the call sites for this.
already_AddRefed<nsStyleContext>
LookupStyleContext(dom::Element* aElement, CSSPseudoElementType aPseudoType);
// ------------------------------------------------------------------
//
// Public API
//
// ------------------------------------------------------------------
/* static */ void
KeyframeUtils::BuildAnimationPropertyList(
JSContext* aCx,
Element* aTarget,
CSSPseudoElementType aPseudoType,
JS::Handle<JSObject*> aFrames,
InfallibleTArray<AnimationProperty>& aResult,
ErrorResult& aRv)
{
MOZ_ASSERT(aResult.IsEmpty());
// See the description of frame lists in the spec:
//
// https://w3c.github.io/web-animations/#processing-a-frames-argument
//
// We don't support SharedKeyframeList yet, but we do support the other
// types of arguments. We manually implement the parts of JS-to-IDL union
// conversion algorithm from the Web IDL spec, since we have to represent
// this as an object? so we can look at the open-ended set of properties
// on these objects.
if (!aFrames) {
// The argument was explicitly null. In this case, the default dictionary
// value for PropertyIndexedKeyframe would result in no keyframes.
return;
}
// At this point we know we have an object. We try to convert it to a
// sequence<Keyframe> first, and if that fails due to not being iterable,
// we try to convert it to PropertyIndexedKeyframe.
JS::Rooted<JS::Value> objectValue(aCx, JS::ObjectValue(*aFrames));
JS::ForOfIterator iter(aCx);
if (!iter.init(objectValue, JS::ForOfIterator::AllowNonIterable)) {
aRv.Throw(NS_ERROR_FAILURE);
return;
}
if (iter.valueIsIterable()) {
BuildAnimationPropertyListFromKeyframeSequence(aCx, aTarget, aPseudoType,
iter, aResult, aRv);
} else {
BuildAnimationPropertyListFromPropertyIndexedKeyframes(aCx, aTarget,
aPseudoType,
objectValue, aResult,
aRv);
}
}
/* static */ nsTArray<Keyframe>
KeyframeUtils::GetKeyframesFromObject(JSContext* aCx,
JS::Handle<JSObject*> aFrames,
@@ -579,6 +467,9 @@ KeyframeUtils::GetAnimationPropertiesFromKeyframes(
CSSPseudoElementType aPseudoType,
const nsTArray<Keyframe>& aFrames)
{
MOZ_ASSERT(aStyleContext);
MOZ_ASSERT(aElement);
nsTArray<KeyframeValueEntry> entries;
for (const Keyframe& frame : aFrames) {
@@ -614,19 +505,6 @@ KeyframeUtils::GetAnimationPropertiesFromKeyframes(
MOZ_ASSERT(values.Length() == 1,
"Longhand properties should produce a single"
" StyleAnimationValue");
// 'visibility' requires special handling that is unique to CSS
// Transitions/CSS Animations/Web Animations (i.e. not SMIL) so we
// apply that here.
//
// Bug 1259285 - Move this code to StyleAnimationValue
if (pair.mProperty == eCSSProperty_visibility) {
MOZ_ASSERT(values[0].mValue.GetUnit() ==
StyleAnimationValue::eUnit_Enumerated,
"unexpected unit");
values[0].mValue.SetIntValue(values[0].mValue.GetIntValue(),
StyleAnimationValue::eUnit_Visibility);
}
}
for (auto& value : values) {
@@ -660,65 +538,6 @@ KeyframeUtils::GetAnimationPropertiesFromKeyframes(
//
// ------------------------------------------------------------------
/**
* Converts a JS object to an IDL sequence<Keyframe> and builds an
* array of AnimationProperty objects for the keyframe animation
* that it specifies.
*
* @param aTarget The target of the animation.
* @param aIterator An already-initialized ForOfIterator for the JS
* object to iterate over as a sequence.
* @param aResult The array into which the resulting AnimationProperty
* objects will be appended.
*/
static void
BuildAnimationPropertyListFromKeyframeSequence(
JSContext* aCx,
Element* aTarget,
CSSPseudoElementType aPseudoType,
JS::ForOfIterator& aIterator,
nsTArray<AnimationProperty>& aResult,
ErrorResult& aRv)
{
// Convert the object in aIterator to sequence<Keyframe>, producing
// an array of OffsetIndexedKeyframe objects.
AutoTArray<OffsetIndexedKeyframe,4> keyframes;
if (!ConvertKeyframeSequence(aCx, aIterator, keyframes)) {
aRv.Throw(NS_ERROR_FAILURE);
return;
}
// If the sequence<> had zero elements, we won't generate any
// keyframes.
if (keyframes.IsEmpty()) {
return;
}
// Check that the keyframes are loosely sorted and with values all
// between 0% and 100%.
if (!HasValidOffsets(keyframes)) {
aRv.ThrowTypeError<dom::MSG_INVALID_KEYFRAME_OFFSETS>();
return;
}
// Fill in 0%/100% values if the first/element keyframes don't have
// a specified offset, and evenly space those that have a missing
// offset. (We don't support paced spacing yet.)
ApplyDistributeSpacing(keyframes);
// Convert the OffsetIndexedKeyframes into a list of KeyframeValueEntry
// objects.
nsTArray<KeyframeValueEntry> entries;
GenerateValueEntries(aTarget, aPseudoType, keyframes, entries, aRv);
if (aRv.Failed()) {
return;
}
// Finally, build an array of AnimationProperty objects in aResult
// corresponding to the entries.
BuildSegmentsFromValueEntries(entries, aResult);
}
/**
* Converts a JS object to an IDL sequence<Keyframe>.
*
@@ -761,52 +580,6 @@ GetKeyframeListFromKeyframeSequence(JSContext* aCx,
}
}
/**
* Converts a JS object wrapped by the given JS::ForIfIterator to an
* IDL sequence<Keyframe> and stores the resulting OffsetIndexedKeyframe
* objects in aResult.
*/
static bool
ConvertKeyframeSequence(JSContext* aCx,
JS::ForOfIterator& aIterator,
nsTArray<OffsetIndexedKeyframe>& aResult)
{
JS::Rooted<JS::Value> value(aCx);
for (;;) {
bool done;
if (!aIterator.next(&value, &done)) {
return false;
}
if (done) {
break;
}
// Each value found when iterating the object must be an object
// or null/undefined (which gets treated as a default {} dictionary
// value).
if (!value.isObject() && !value.isNullOrUndefined()) {
dom::ThrowErrorMessage(aCx, dom::MSG_NOT_OBJECT,
"Element of sequence<Keyframes> argument");
return false;
}
// Convert the JS value into a BaseKeyframe dictionary value.
OffsetIndexedKeyframe* keyframe = aResult.AppendElement();
if (!keyframe->mKeyframeDict.Init(
aCx, value, "Element of sequence<Keyframes> argument")) {
return false;
}
// Look for additional property-values pairs on the object.
if (value.isObject()) {
JS::Rooted<JSObject*> object(aCx, &value.toObject());
if (!GetPropertyValuesPairs(aCx, object,
ListAllowance::eDisallow,
keyframe->mPropertyValuePairs)) {
return false;
}
}
}
return true;
}
/**
* Converts a JS object wrapped by the given JS::ForIfIterator to an
* IDL sequence<Keyframe> and stores the resulting Keyframe objects in
@@ -1058,30 +831,6 @@ MakePropertyValuePair(nsCSSProperty aProperty, const nsAString& aStringValue,
return { aProperty, value };
}
/**
* Checks that the given keyframes are loosely ordered (each keyframe's
* offset that is not null is greater than or equal to the previous
* non-null offset) and that all values are within the range [0.0, 1.0].
*
* @return true if the keyframes' offsets are correctly ordered and
* within range; false otherwise.
*/
static bool
HasValidOffsets(const nsTArray<OffsetIndexedKeyframe>& aKeyframes)
{
double offset = 0.0;
for (const OffsetIndexedKeyframe& keyframe : aKeyframes) {
if (!keyframe.mKeyframeDict.mOffset.IsNull()) {
double thisOffset = keyframe.mKeyframeDict.mOffset.Value();
if (thisOffset < offset || thisOffset > 1.0f) {
return false;
}
offset = thisOffset;
}
}
return true;
}
/**
* Checks that the given keyframes are loosely ordered (each keyframe's
* offset that is not null is greater than or equal to the previous
@@ -1106,147 +855,6 @@ HasValidOffsets(const nsTArray<Keyframe>& aKeyframes)
return true;
}
/**
* Fills in any null offsets for the given keyframes by applying the
* "distribute" spacing algorithm.
*
* http://w3c.github.io/web-animations/#distribute-keyframe-spacing-mode
*/
static void
ApplyDistributeSpacing(nsTArray<OffsetIndexedKeyframe>& aKeyframes)
{
// If the first or last keyframes have an unspecified offset,
// fill them in with 0% and 100%. If there is only a single keyframe,
// then it gets 100%.
if (aKeyframes.LastElement().mKeyframeDict.mOffset.IsNull()) {
aKeyframes.LastElement().mKeyframeDict.mOffset.SetValue(1.0);
}
if (aKeyframes[0].mKeyframeDict.mOffset.IsNull()) {
aKeyframes[0].mKeyframeDict.mOffset.SetValue(0.0);
}
// Fill in remaining missing offsets.
size_t i = 0;
while (i < aKeyframes.Length() - 1) {
MOZ_ASSERT(!aKeyframes[i].mKeyframeDict.mOffset.IsNull());
double start = aKeyframes[i].mKeyframeDict.mOffset.Value();
size_t j = i + 1;
while (aKeyframes[j].mKeyframeDict.mOffset.IsNull()) {
++j;
}
double end = aKeyframes[j].mKeyframeDict.mOffset.Value();
size_t n = j - i;
for (size_t k = 1; k < n; ++k) {
double offset = start + double(k) / n * (end - start);
aKeyframes[i + k].mKeyframeDict.mOffset.SetValue(offset);
}
i = j;
}
}
/**
* Splits out each property's keyframe animation segment information
* from the OffsetIndexedKeyframe objects into an array of KeyframeValueEntry.
*
* The easing string value in OffsetIndexedKeyframe objects is parsed
* into a ComputedTimingFunction value in the corresponding KeyframeValueEntry
* objects.
*
* @param aTarget The target of the animation.
* @param aPseudoType The pseudo type of the target if it is a pseudo element.
* @param aKeyframes The keyframes to read.
* @param aResult The array to append the resulting KeyframeValueEntry
* objects to.
*/
static void
GenerateValueEntries(Element* aTarget,
CSSPseudoElementType aPseudoType,
nsTArray<OffsetIndexedKeyframe>& aKeyframes,
nsTArray<KeyframeValueEntry>& aResult,
ErrorResult& aRv)
{
RefPtr<nsStyleContext> styleContext =
LookupStyleContext(aTarget, aPseudoType);
if (!styleContext) {
aRv.Throw(NS_ERROR_FAILURE);
return;
}
nsCSSPropertySet properties; // All properties encountered.
nsCSSPropertySet propertiesWithFromValue; // Those with a defined 0% value.
nsCSSPropertySet propertiesWithToValue; // Those with a defined 100% value.
for (OffsetIndexedKeyframe& keyframe : aKeyframes) {
Maybe<ComputedTimingFunction> easing =
TimingParams::ParseEasing(keyframe.mKeyframeDict.mEasing,
aTarget->OwnerDoc(), aRv);
if (aRv.Failed()) {
return;
}
float offset = float(keyframe.mKeyframeDict.mOffset.Value());
// We ignore keyframe.mKeyframeDict.mComposite since we don't support
// composite modes on keyframes yet.
// keyframe.mPropertyValuePairs is currently sorted by CSS property IDL
// name, since that was the order we read the properties from the JS
// object. Re-sort the list so that longhand properties appear before
// shorthands, and with shorthands all appearing in increasing order of
// number of components. For two longhand properties, or two shorthands
// with the same number of components, sort by IDL name.
//
// @see PropertyPriorityComparator.
keyframe.mPropertyValuePairs.Sort(PropertyValuesPair::Comparator());
nsCSSPropertySet propertiesOnThisKeyframe;
for (const PropertyValuesPair& pair : keyframe.mPropertyValuePairs) {
MOZ_ASSERT(pair.mValues.Length() == 1,
"ConvertKeyframeSequence should have parsed single "
"DOMString values from the property-values pairs");
// Parse the property's string value and produce a KeyframeValueEntry (or
// more than one, for shorthands) for it.
nsTArray<PropertyStyleAnimationValuePair> values;
if (StyleAnimationValue::ComputeValues(pair.mProperty,
nsCSSProps::eEnabledForAllContent,
aTarget,
styleContext,
pair.mValues[0],
/* aUseSVGMode */ false,
values)) {
for (auto& value : values) {
// If we already got a value for this property on the keyframe,
// skip this one.
if (propertiesOnThisKeyframe.HasProperty(value.mProperty)) {
continue;
}
KeyframeValueEntry* entry = aResult.AppendElement();
entry->mOffset = offset;
entry->mProperty = value.mProperty;
entry->mValue = value.mValue;
entry->mTimingFunction = easing;
if (offset == 0.0) {
propertiesWithFromValue.AddProperty(value.mProperty);
} else if (offset == 1.0) {
propertiesWithToValue.AddProperty(value.mProperty);
}
propertiesOnThisKeyframe.AddProperty(value.mProperty);
properties.AddProperty(value.mProperty);
}
}
}
}
// We don't support additive segments and so can't support missing properties
// using their underlying value in 0% and 100% keyframes. Throw an exception
// until we do support this.
if (!propertiesWithFromValue.Equals(properties) ||
!propertiesWithToValue.Equals(properties)) {
aRv.Throw(NS_ERROR_DOM_ANIM_MISSING_PROPS_ERR);
return;
}
}
/**
* Builds an array of AnimationProperty objects to represent the keyframe
* animation segments in aEntries.
@@ -1347,183 +955,6 @@ BuildSegmentsFromValueEntries(nsTArray<KeyframeValueEntry>& aEntries,
}
}
/**
* Converts a JS object to an IDL PropertyIndexedKeyframe and builds an
* array of AnimationProperty objects for the keyframe animation
* that it specifies.
*
* @param aTarget The target of the animation.
* @param aValue The JS object.
* @param aResult The array into which the resulting AnimationProperty
* objects will be appended.
*/
static void
BuildAnimationPropertyListFromPropertyIndexedKeyframes(
JSContext* aCx,
Element* aTarget,
CSSPseudoElementType aPseudoType,
JS::Handle<JS::Value> aValue,
InfallibleTArray<AnimationProperty>& aResult,
ErrorResult& aRv)
{
MOZ_ASSERT(aValue.isObject());
RefPtr<nsStyleContext> styleContext =
LookupStyleContext(aTarget, aPseudoType);
if (!styleContext) {
aRv.Throw(NS_ERROR_FAILURE);
return;
}
// Convert the object to a PropertyIndexedKeyframe dictionary to
// get its explicit dictionary members.
dom::binding_detail::FastBasePropertyIndexedKeyframe keyframes;
if (!keyframes.Init(aCx, aValue, "BasePropertyIndexedKeyframe argument",
false)) {
aRv.Throw(NS_ERROR_FAILURE);
return;
}
Maybe<ComputedTimingFunction> easing =
TimingParams::ParseEasing(keyframes.mEasing, aTarget->OwnerDoc(), aRv);
// We ignore easing.mComposite since we don't support composite modes on
// keyframes yet.
// Get all the property--value-list pairs off the object.
JS::Rooted<JSObject*> object(aCx, &aValue.toObject());
nsTArray<PropertyValuesPair> propertyValuesPairs;
if (!GetPropertyValuesPairs(aCx, object, ListAllowance::eAllow,
propertyValuesPairs)) {
aRv.Throw(NS_ERROR_FAILURE);
return;
}
// We must keep track of which properties we've already generated
// an AnimationProperty since the author could have specified both a
// shorthand and one of its component longhands on the
// PropertyIndexedKeyframe.
nsCSSPropertySet properties;
// Create AnimationProperty objects for each PropertyValuesPair, applying
// the "distribute" spacing algorithm to the segments.
for (const PropertyValuesPair& pair : propertyValuesPairs) {
size_t count = pair.mValues.Length();
if (count == 0) {
// No animation values for this property.
continue;
}
if (count == 1) {
// We don't support additive segments and so can't support an
// animation that goes from the underlying value to this
// specified value. Throw an exception until we do support this.
aRv.Throw(NS_ERROR_DOM_ANIM_MISSING_PROPS_ERR);
return;
}
// If we find an invalid value, we don't create a segment for it, but
// we adjust the surrounding segments so that the timing of the segments
// is the same as if we did support it. For example, animating with
// values ["red", "green", "yellow", "invalid", "blue"] will generate
// segments with this timing:
//
// 0.00 -> 0.25 : red -> green
// 0.25 -> 0.50 : green -> yellow
// 0.50 -> 1.00 : yellow -> blue
//
// With future spec clarifications we might decide to preserve the invalid
// value on the segment and make the animation code deal with the invalid
// value instead.
nsTArray<PropertyStyleAnimationValuePair> fromValues;
float fromKey = 0.0f;
if (!StyleAnimationValue::ComputeValues(pair.mProperty,
nsCSSProps::eEnabledForAllContent,
aTarget,
styleContext,
pair.mValues[0],
/* aUseSVGMode */ false,
fromValues)) {
// We need to throw for an invalid first value, since that would imply an
// additive animation, which we don't support yet.
aRv.Throw(NS_ERROR_DOM_ANIM_MISSING_PROPS_ERR);
return;
}
if (fromValues.IsEmpty()) {
// All longhand components of a shorthand pair.mProperty must be disabled.
continue;
}
// Create AnimationProperty objects for each property that had a
// value computed. When pair.mProperty is a longhand, it is just
// that property. When pair.mProperty is a shorthand, we'll have
// one property per longhand component.
nsTArray<size_t> animationPropertyIndexes;
animationPropertyIndexes.SetLength(fromValues.Length());
for (size_t i = 0, n = fromValues.Length(); i < n; ++i) {
nsCSSProperty p = fromValues[i].mProperty;
bool found = false;
if (properties.HasProperty(p)) {
// We have already dealt with this property. Look up and
// overwrite the old AnimationProperty object.
for (size_t j = 0, m = aResult.Length(); j < m; ++j) {
if (aResult[j].mProperty == p) {
aResult[j].mSegments.Clear();
animationPropertyIndexes[i] = j;
found = true;
break;
}
}
MOZ_ASSERT(found, "properties is inconsistent with aResult");
}
if (!found) {
// This is the first time we've encountered this property.
animationPropertyIndexes[i] = aResult.Length();
AnimationProperty* animationProperty = aResult.AppendElement();
animationProperty->mProperty = p;
properties.AddProperty(p);
}
}
double portion = 1.0 / (count - 1);
for (size_t i = 0; i < count - 1; ++i) {
nsTArray<PropertyStyleAnimationValuePair> toValues;
float toKey = (i + 1) * portion;
if (!StyleAnimationValue::ComputeValues(pair.mProperty,
nsCSSProps::eEnabledForAllContent,
aTarget,
styleContext,
pair.mValues[i + 1],
/* aUseSVGMode */ false,
toValues)) {
if (i + 1 == count - 1) {
// We need to throw for an invalid last value, since that would
// imply an additive animation, which we don't support yet.
aRv.Throw(NS_ERROR_DOM_ANIM_MISSING_PROPS_ERR);
return;
}
// Otherwise, skip the segment.
continue;
}
MOZ_ASSERT(toValues.Length() == fromValues.Length(),
"should get the same number of properties as the last time "
"we called ComputeValues for pair.mProperty");
for (size_t j = 0, n = toValues.Length(); j < n; ++j) {
size_t index = animationPropertyIndexes[j];
AnimationPropertySegment* segment =
aResult[index].mSegments.AppendElement();
segment->mFromKey = fromKey;
segment->mFromValue = fromValues[j].mValue;
segment->mToKey = toKey;
segment->mToValue = toValues[j].mValue;
segment->mTimingFunction = easing;
}
fromValues = Move(toValues);
fromKey = toKey;
}
}
}
/**
* Converts a JS object representing a property-indexed keyframe into
* an array of Keyframe objects.
@@ -1695,19 +1126,4 @@ RequiresAdditiveAnimation(const nsTArray<Keyframe>& aKeyframes,
!propertiesWithToValue.Equals(properties);
}
already_AddRefed<nsStyleContext>
LookupStyleContext(dom::Element* aElement, CSSPseudoElementType aPseudoType)
{
nsIDocument* doc = aElement->GetCurrentDoc();
nsIPresShell* shell = doc->GetShell();
if (!shell) {
return nullptr;
}
nsIAtom* pseudo =
aPseudoType < CSSPseudoElementType::Count ?
nsCSSPseudoElements::GetPseudoAtom(aPseudoType) : nullptr;
return nsComputedDOMStyle::GetStyleContextForElement(aElement, pseudo, shell);
}
} // namespace mozilla
-19
View File
@@ -33,25 +33,6 @@ namespace mozilla {
class KeyframeUtils
{
public:
/**
* Converts a JS value to a property-indexed keyframe or a sequence of
* regular keyframes and builds an array of AnimationProperty objects for the
* keyframe animation that it specifies.
*
* @param aTarget The target of the animation, used to resolve style
* for a property's underlying value if needed.
* @param aFrames The JS value, provided as an optional IDL |object?| value,
* that is the keyframe list specification.
* @param aResult The array into which the resulting AnimationProperty
* objects will be appended.
*/
static void
BuildAnimationPropertyList(JSContext* aCx, Element* aTarget,
CSSPseudoElementType aPseudoType,
JS::Handle<JSObject*> aFrames,
InfallibleTArray<AnimationProperty>& aResult,
ErrorResult& aRv);
/**
* Converts a JS value representing a property-indexed keyframe or a sequence
* of keyframes to an array of Keyframe objects.
+20
View File
@@ -96,6 +96,26 @@ struct TimingParams
dom::FillMode mFill = dom::FillMode::Auto;
Maybe<ComputedTimingFunction> mFunction;
// Return the duration of the active interval calculated by duration and
// iteration count.
StickyTimeDuration ActiveDuration() const
{
// If either the iteration duration or iteration count is zero,
// Web Animations says that the active duration is zero. This is to
// ensure that the result is defined when the other argument is Infinity.
static const StickyTimeDuration zeroDuration;
if (!mDuration || *mDuration == zeroDuration || mIterations == 0.0) {
return zeroDuration;
}
return mDuration->MultDouble(mIterations);
}
StickyTimeDuration EndTime() const
{
return mDelay + ActiveDuration() + mEndDelay;
}
bool operator==(const TimingParams& aOther) const;
bool operator!=(const TimingParams& aOther) const
{
@@ -15,8 +15,8 @@
}
@keyframes anim-only-non-animatable {
from { display: none; }
to { display: inline; }
from { animation-duration: 3s; }
to { animation-duration: 5s; }
}
@keyframes anim-simple {
@@ -59,6 +59,13 @@
50% { color: blue; }
}
@keyframes anim-partially-omit-to {
from { margin-top: 50px;
margin-bottom: 100px; }
to { margin-top: 150px !important; /* ignored */
margin-bottom: 200px; }
}
@keyframes anim-different-props {
from { color: black; margin-top: 8px; }
25% { color: blue; }
@@ -100,6 +107,27 @@
50% { margin-bottom: 10px; animation-timing-function: step-end; }
to { margin-top: 20px; margin-right: 20px; margin-bottom: 20px; }
}
@keyframes anim-overriding {
from { padding-top: 50px }
50%, from { padding-top: 30px } /* wins: 0% */
75%, 85%, 50% { padding-top: 20px } /* wins: 75%, 50% */
100%, 85% { padding-top: 70px } /* wins: 100% */
85.1% { padding-top: 60px } /* wins: 85.1% */
85% { padding-top: 30px } /* wins: 85% */
}
@keyframes anim-filter {
to { filter: blur(5px) sepia(60%) saturate(30%); }
}
@keyframes anim-text-shadow {
to { text-shadow: none; }
}
@keyframes anim-background-size {
to { background-size: 50%, 6px, contain }
}
</style>
<body>
<script>
@@ -114,7 +142,12 @@ function assert_frames_equal(a, b, name) {
Object.keys(b).sort().toString(),
"properties on " + name);
for (var p in a) {
assert_equals(a[p], b[p], "value for '" + p + "' on " + name);
if (p === 'offset' || p === 'computedOffset') {
assert_approx_equals(a[p], b[p], 0.00001,
"value for '" + p + "' on " + name);
} else {
assert_equals(a[p], b[p], "value for '" + p + "' on " + name);
}
}
}
@@ -142,7 +175,6 @@ const kTimingFunctionValues = [
test(function(t) {
var div = addDiv(t);
var frames;
div.style.animation = 'anim-empty 100s';
assert_equals(getFrames(div).length, 0,
@@ -173,10 +205,8 @@ test(function(t) {
assert_equals(frames.length, 2, "number of frames");
var expected = [
{ offset: 0, computedOffset: 0, easing: "ease",
color: "rgb(0, 0, 0)" },
{ offset: 1, computedOffset: 1, easing: "linear",
color: "rgb(255, 255, 255)" },
{ offset: 0, computedOffset: 0, easing: "ease", color: "black" },
{ offset: 1, computedOffset: 1, easing: "ease", color: "white" },
];
for (var i = 0; i < frames.length; i++) {
@@ -195,7 +225,7 @@ test(function(t) {
assert_equals(frames.length, 3, "number of frames");
for (var i = 0; i < frames.length; i++) {
assert_equals(frames[i].easing, i == frames.length - 1 ? "linear" : easing,
assert_equals(frames[i].easing, easing,
"value for 'easing' on ComputedKeyframe #" + i);
}
});
@@ -214,7 +244,7 @@ test(function(t) {
"value of 'easing' on ComputedKeyframe #0");
assert_equals(frames[1].easing, "ease-in-out",
"value of 'easing' on ComputedKeyframe #1");
assert_equals(frames[2].easing, "linear",
assert_equals(frames[2].easing, "step-end",
"value of 'easing' on ComputedKeyframe #2");
}, 'KeyframeEffectReadOnly.getFrames() returns frames with expected easing ' +
'values, when the easing is specified on each keyframe');
@@ -230,7 +260,7 @@ test(function(t) {
"value of 'easing' on ComputedKeyframe #0");
assert_equals(frames[1].easing, "step-start",
"value of 'easing' on ComputedKeyframe #1");
assert_equals(frames[2].easing, "linear",
assert_equals(frames[2].easing, "step-start",
"value of 'easing' on ComputedKeyframe #2");
}, 'KeyframeEffectReadOnly.getFrames() returns frames with expected easing ' +
'values, when the easing is specified on some keyframes');
@@ -245,11 +275,11 @@ test(function(t) {
var expected = [
{ offset: 0, computedOffset: 0, easing: "ease",
marginTop: "8px", marginRight: "8px",
marginBottom: "8px", marginLeft: "8px" },
{ offset: 1, computedOffset: 1, easing: "linear",
marginTop: "16px", marginRight: "16px",
marginBottom: "16px", marginLeft: "16px" },
marginBottom: "8px", marginLeft: "8px",
marginRight: "8px", marginTop: "8px" },
{ offset: 1, computedOffset: 1, easing: "ease",
marginBottom: "16px", marginLeft: "16px",
marginRight: "16px", marginTop: "16px" },
];
for (var i = 0; i < frames.length; i++) {
@@ -268,9 +298,8 @@ test(function(t) {
assert_equals(frames.length, 2, "number of frames");
var expected = [
{ offset: 0, computedOffset: 0, easing: "ease",
color: "rgb(0, 0, 255)" },
{ offset: 1, computedOffset: 1, easing: "linear",
{ offset: 0, computedOffset: 0, easing: "ease", color: "blue" },
{ offset: 1, computedOffset: 1, easing: "ease",
color: "rgb(255, 255, 255)" },
];
@@ -292,8 +321,7 @@ test(function(t) {
var expected = [
{ offset: 0, computedOffset: 0, easing: "ease",
color: "rgb(255, 255, 255)" },
{ offset: 1, computedOffset: 1, easing: "linear",
color: "rgb(0, 0, 255)" },
{ offset: 1, computedOffset: 1, easing: "ease", color: "blue" },
];
for (var i = 0; i < frames.length; i++) {
@@ -312,11 +340,10 @@ test(function(t) {
assert_equals(frames.length, 3, "number of frames");
var expected = [
{ offset: 0, computedOffset: 0, easing: "ease",
{ offset: 0, computedOffset: 0, easing: "ease",
color: "rgb(255, 255, 255)" },
{ offset: 0.5, computedOffset: 0.5, easing: "ease",
color: "rgb(0, 0, 255)" },
{ offset: 1, computedOffset: 1, easing: "linear",
{ offset: 0.5, computedOffset: 0.5, easing: "ease", color: "blue" },
{ offset: 1, computedOffset: 1, easing: "ease",
color: "rgb(255, 255, 255)" },
];
@@ -326,6 +353,29 @@ test(function(t) {
}, 'KeyframeEffectReadOnly.getFrames() returns expected frames for an ' +
'animation with no 0% or 100% keyframe but with a 50% keyframe');
test(function(t) {
var div = addDiv(t);
div.style.animation = 'anim-partially-omit-to 100s';
div.style.marginTop = '250px';
var frames = getFrames(div);
assert_equals(frames.length, 2, "number of frames");
var expected = [
{ offset: 0, computedOffset: 0, easing: "ease",
marginTop: '50px', marginBottom: '100px' },
{ offset: 1, computedOffset: 1, easing: "ease",
marginTop: '250px', marginBottom: '200px' },
];
for (var i = 0; i < frames.length; i++) {
assert_frames_equal(frames[i], expected[i], "ComputedKeyframe #" + i);
}
}, 'KeyframeEffectReadOnly.getFrames() returns expected frames for an ' +
'animation with a partially complete 100% keyframe (because the ' +
'!important rule is ignored)');
test(function(t) {
var div = addDiv(t);
@@ -336,13 +386,13 @@ test(function(t) {
var expected = [
{ offset: 0, computedOffset: 0, easing: "ease",
color: "rgb(0, 0, 0)", marginTop: "8px" },
color: "black", marginTop: "8px" },
{ offset: 0.25, computedOffset: 0.25, easing: "ease",
color: "rgb(0, 0, 255)" },
color: "blue" },
{ offset: 0.75, computedOffset: 0.75, easing: "ease",
marginTop: "12px" },
{ offset: 1, computedOffset: 1, easing: "linear",
color: "rgb(255, 255, 255)", marginTop: "16px" },
{ offset: 1, computedOffset: 1, easing: "ease",
color: "white", marginTop: "16px" },
];
for (var i = 0; i < frames.length; i++) {
@@ -362,13 +412,13 @@ test(function(t) {
var expected = [
{ offset: 0, computedOffset: 0, easing: "linear",
color: "rgb(0, 0, 0)", marginTop: "8px" },
color: "black", marginTop: "8px" },
{ offset: 0.25, computedOffset: 0.25, easing: "step-end",
color: "rgb(0, 0, 255)" },
color: "blue" },
{ offset: 0.75, computedOffset: 0.75, easing: "ease-in",
marginTop: "12px" },
{ offset: 1, computedOffset: 1, easing: "linear",
color: "rgb(255, 255, 255)", marginTop: "16px" },
{ offset: 1, computedOffset: 1, easing: "ease",
color: "white", marginTop: "16px" },
];
for (var i = 0; i < frames.length; i++) {
@@ -388,9 +438,9 @@ test(function(t) {
var expected = [
{ offset: 0, computedOffset: 0, easing: "ease",
color: "rgb(0, 0, 0)", marginTop: "8px" },
{ offset: 1, computedOffset: 1, easing: "linear",
color: "rgb(255, 255, 255)", marginTop: "16px" },
color: "black", marginTop: "8px" },
{ offset: 1, computedOffset: 1, easing: "ease",
color: "white", marginTop: "16px" },
];
for (var i = 0; i < frames.length; i++) {
@@ -409,12 +459,12 @@ test(function(t) {
assert_equals(frames.length, 3, "number of frames");
var expected = [
{ offset: 0, computedOffset: 0, easing: "step-end",
color: "black", fontSize: "16px" },
{ offset: 0, computedOffset: 0, easing: "linear",
marginTop: "8px", paddingLeft: "2px" },
{ offset: 0, computedOffset: 0, easing: "step-end",
color: "rgb(0, 0, 0)", fontSize: "16px" },
{ offset: 1, computedOffset: 1, easing: "linear",
color: "rgb(255, 255, 255)", fontSize: "32px", marginTop: "16px",
{ offset: 1, computedOffset: 1, easing: "ease",
color: "white", fontSize: "32px", marginTop: "16px",
paddingLeft: "4px" },
];
@@ -434,15 +484,15 @@ test(function(t) {
assert_equals(frames.length, 5, "number of frames");
var expected = [
{ offset: 0, computedOffset: 0, easing: "steps(1, end)",
marginTop: "0px" },
{ offset: 0, computedOffset: 0, easing: "step-end",
marginRight: "0px" },
{ offset: 0, computedOffset: 0, easing: "steps(1)",
marginBottom: "0px" },
{ offset: 0, computedOffset: 0, easing: "steps(1, end)",
marginTop: "0px" },
{ offset: 0.5, computedOffset: 0.5, easing: "step-end",
marginTop: "10px", marginRight: "10px", marginBottom: "10px" },
{ offset: 1, computedOffset: 1, easing: "linear",
{ offset: 1, computedOffset: 1, easing: "ease",
marginTop: "20px", marginRight: "20px", marginBottom: "20px" },
];
@@ -453,6 +503,122 @@ test(function(t) {
'animation with multiple keyframes for the same time and with ' +
'different but equivalent easing functions');
test(function(t) {
var div = addDiv(t);
div.style.animation = 'anim-overriding 100s';
var frames = getFrames(div);
assert_equals(frames.length, 6, "number of frames");
var expected = [
{ offset: 0, computedOffset: 0, easing: "ease",
paddingTop: "30px" },
{ offset: 0.5, computedOffset: 0.5, easing: "ease",
paddingTop: "20px" },
{ offset: 0.75, computedOffset: 0.75, easing: "ease",
paddingTop: "20px" },
{ offset: 0.85, computedOffset: 0.85, easing: "ease",
paddingTop: "30px" },
{ offset: 0.851, computedOffset: 0.851, easing: "ease",
paddingTop: "60px" },
{ offset: 1, computedOffset: 1, easing: "ease",
paddingTop: "70px" },
];
for (var i = 0; i < frames.length; i++) {
assert_frames_equal(frames[i], expected[i], "ComputedKeyframe #" + i);
}
}, 'KeyframeEffectReadOnly.getFrames() returns expected frames for ' +
'overlapping keyframes');
// Gecko-specific test case: We are specifically concerned here that the
// computed value for filter, "none", is correctly represented.
test(function(t) {
var div = addDiv(t);
div.style.animation = 'anim-filter 100s';
var frames = getFrames(div);
assert_equals(frames.length, 2, "number of frames");
var expected = [
{ offset: 0, computedOffset: 0, easing: "ease",
filter: "none" },
{ offset: 1, computedOffset: 1, easing: "ease",
filter: "blur(5px) sepia(60%) saturate(30%)" },
];
for (var i = 0; i < frames.length; i++) {
assert_frames_equal(frames[i], expected[i], "ComputedKeyframe #" + i);
}
}, 'KeyframeEffectReadOnly.getFrames() returns expected values for ' +
'animations with filter properties and missing keyframes');
// Gecko-specific test case: We are specifically concerned here that the
// computed value for text-shadow and a "none" specified on a keyframe
// are correctly represented.
test(function(t) {
var div = addDiv(t);
div.style.textShadow = '1px 1px 2px black, 0 0 16px blue, 0 0 3.2px blue';
div.style.animation = 'anim-text-shadow 100s';
var frames = getFrames(div);
assert_equals(frames.length, 2, "number of frames");
var expected = [
{ offset: 0, computedOffset: 0, easing: "ease",
textShadow: "1px 1px 2px 0px rgb(0, 0, 0),"
+ " 0px 0px 16px 0px rgb(0, 0, 255),"
+ " 0px 0px 3.2px 0px rgb(0, 0, 255)" },
{ offset: 1, computedOffset: 1, easing: "ease", textShadow: "none" },
];
for (var i = 0; i < frames.length; i++) {
assert_frames_equal(frames[i], expected[i], "ComputedKeyframe #" + i);
}
}, 'KeyframeEffectReadOnly.getFrames() returns expected values for ' +
'animations with text-shadow properties and missing keyframes');
// Gecko-specific test case: We are specifically concerned here that the
// initial value for background-size and the specified list are correctly
// represented.
test(function(t) {
var div = addDiv(t);
div.style.animation = 'anim-background-size 100s';
var frames = getFrames(div);
assert_equals(frames.length, 2, "number of frames");
var expected = [
{ offset: 0, computedOffset: 0, easing: "ease",
backgroundSize: "auto auto" },
{ offset: 1, computedOffset: 1, easing: "ease",
backgroundSize: "50% auto, 6px auto, contain" },
];
for (var i = 0; i < frames.length; i++) {
assert_frames_equal(frames[i], expected[i], "ComputedKeyframe #" + i);
}
// Test inheriting a background-size value
expected[0].backgroundSize = div.style.backgroundSize =
"30px auto, 40% auto, auto auto";
frames = getFrames(div);
for (var i = 0; i < frames.length; i++) {
assert_frames_equal(frames[i], expected[i], "ComputedKeyframe #" + i
+ " after updating current style");
}
}, 'KeyframeEffectReadOnly.getFrames() returns expected values for ' +
'animations with background-size properties and missing keyframes');
done();
</script>
</body>
-5
View File
@@ -487,11 +487,6 @@ this.PermissionsTable = { geolocation: {
privileged: DENY_ACTION,
certified: ALLOW_ACTION
},
"external-app": {
app: DENY_ACTION,
privileged: ALLOW_ACTION,
certified: ALLOW_ACTION
},
"system-update": {
app: DENY_ACTION,
privileged: DENY_ACTION,
+1 -1
View File
@@ -141,7 +141,7 @@ Element*
AnonymousContent::GetElementById(const nsAString& aElementId)
{
// This can be made faster in the future if needed.
nsCOMPtr<nsIAtom> elementId = do_GetAtom(aElementId);
nsCOMPtr<nsIAtom> elementId = NS_Atomize(aElementId);
for (nsIContent* kid = mContentNode->GetFirstChild(); kid;
kid = kid->GetNextNode(mContentNode)) {
if (!kid->IsElement()) {
+1 -1
View File
@@ -70,7 +70,7 @@ DOMImplementation::CreateDocumentType(const nsAString& aQualifiedName,
return nullptr;
}
nsCOMPtr<nsIAtom> name = do_GetAtom(aQualifiedName);
nsCOMPtr<nsIAtom> name = NS_Atomize(aQualifiedName);
if (!name) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return nullptr;
+12 -12
View File
@@ -206,7 +206,7 @@ Element::IntrinsicState() const
void
Element::NotifyStateChange(EventStates aStates)
{
nsIDocument* doc = GetCrossShadowCurrentDoc();
nsIDocument* doc = GetComposedDoc();
if (doc) {
nsAutoScriptBlocker scriptBlocker;
doc->ContentStateChanged(this, aStates);
@@ -232,7 +232,7 @@ Element::UpdateState(bool aNotify)
if (aNotify) {
EventStates changedStates = oldState ^ mState;
if (!changedStates.IsEmpty()) {
nsIDocument* doc = GetCrossShadowCurrentDoc();
nsIDocument* doc = GetComposedDoc();
if (doc) {
nsAutoScriptBlocker scriptBlocker;
doc->ContentStateChanged(this, changedStates);
@@ -1019,7 +1019,7 @@ Element::CreateShadowRoot(ErrorResult& aError)
return nullptr;
}
nsIDocument* doc = GetCrossShadowCurrentDoc();
nsIDocument* doc = GetComposedDoc();
nsIContent* destroyedFramesFor = nullptr;
if (doc) {
nsIPresShell* shell = doc->GetShell();
@@ -1070,7 +1070,7 @@ Element::CreateShadowRoot(ErrorResult& aError)
// Recreate the frame for the bound content because binding a ShadowRoot
// changes how things are rendered.
if (doc) {
MOZ_ASSERT(doc == GetCrossShadowCurrentDoc());
MOZ_ASSERT(doc == GetComposedDoc());
nsIPresShell* shell = doc->GetShell();
if (shell) {
shell->CreateFramesFor(destroyedFramesFor);
@@ -2117,8 +2117,8 @@ Element::DispatchClickEvent(nsPresContext* aPresContext,
NS_PRECONDITION(aStatus, "Null out param?");
WidgetMouseEvent event(aSourceEvent->IsTrusted(), eMouseClick,
aSourceEvent->widget, WidgetMouseEvent::eReal);
event.refPoint = aSourceEvent->refPoint;
aSourceEvent->mWidget, WidgetMouseEvent::eReal);
event.mRefPoint = aSourceEvent->mRefPoint;
uint32_t clickCount = 1;
float pressure = 0;
uint16_t inputSource = 0;
@@ -2133,7 +2133,7 @@ Element::DispatchClickEvent(nsPresContext* aPresContext,
event.pressure = pressure;
event.clickCount = clickCount;
event.inputSource = inputSource;
event.modifiers = aSourceEvent->modifiers;
event.mModifiers = aSourceEvent->mModifiers;
if (aExtraEventFlags) {
// Be careful not to overwrite existing flags!
event.mFlags.Union(*aExtraEventFlags);
@@ -2497,7 +2497,7 @@ Element::SetAttrAndNotify(int32_t aNamespaceID,
nsAutoString newValue;
GetAttr(aNamespaceID, aName, newValue);
if (!newValue.IsEmpty()) {
mutation.mNewAttrValue = do_GetAtom(newValue);
mutation.mNewAttrValue = NS_Atomize(newValue);
}
if (!oldValue->IsEmptyString()) {
mutation.mPrevAttrValue = oldValue->GetAsAtom();
@@ -2735,7 +2735,7 @@ Element::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aName,
nsAutoString value;
oldValue.ToString(value);
if (!value.IsEmpty())
mutation.mPrevAttrValue = do_GetAtom(value);
mutation.mPrevAttrValue = NS_Atomize(value);
mutation.mAttrChange = nsIDOMMutationEvent::REMOVAL;
mozAutoSubtreeModified subtree(OwnerDoc(), this);
@@ -2974,7 +2974,7 @@ Element::PreHandleEventForLinks(EventChainPreVisitor& aVisitor)
MOZ_FALLTHROUGH;
case eFocus: {
InternalFocusEvent* focusEvent = aVisitor.mEvent->AsFocusEvent();
if (!focusEvent || !focusEvent->isRefocus) {
if (!focusEvent || !focusEvent->mIsRefocus) {
nsAutoString target;
GetLinkTarget(target);
nsContentUtils::TriggerLink(this, aVisitor.mPresContext, absURI, target,
@@ -3066,7 +3066,7 @@ Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor)
// DOMActive event should be trusted since the activation is actually
// occurred even if the cause is an untrusted click event.
InternalUIEvent actEvent(true, eLegacyDOMActivate, mouseEvent);
actEvent.detail = 1;
actEvent.mDetail = 1;
rv = shell->HandleDOMEventWithTarget(this, &actEvent, &status);
if (NS_SUCCEEDED(rv)) {
@@ -3078,7 +3078,7 @@ Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor)
}
case eLegacyDOMActivate:
{
if (aVisitor.mEvent->originalTarget == this) {
if (aVisitor.mEvent->mOriginalTarget == this) {
nsAutoString target;
GetLinkTarget(target);
const InternalUIEvent* activeEvent = aVisitor.mEvent->AsUIEvent();
+1 -1
View File
@@ -715,7 +715,7 @@ public:
aError.Throw(NS_ERROR_DOM_INVALID_POINTER_ERR);
return;
}
if (!IsInDoc()) {
if (!IsInUncomposedDoc()) {
aError.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return;
}
+9 -8
View File
@@ -275,7 +275,7 @@ nsIContent::LookupNamespaceURIInternal(const nsAString& aNamespacePrefix,
nsCOMPtr<nsIAtom> name;
if (!aNamespacePrefix.IsEmpty()) {
name = do_GetAtom(aNamespacePrefix);
name = NS_Atomize(aNamespacePrefix);
NS_ENSURE_TRUE(name, NS_ERROR_OUT_OF_MEMORY);
}
else {
@@ -637,7 +637,7 @@ FragmentOrElement::FragmentOrElement(already_AddRefed<mozilla::dom::NodeInfo>&&
FragmentOrElement::~FragmentOrElement()
{
NS_PRECONDITION(!IsInDoc(),
NS_PRECONDITION(!IsInUncomposedDoc(),
"Please remove this from the document properly");
if (GetParent()) {
NS_RELEASE(mParent);
@@ -687,7 +687,7 @@ nsIContent::PreHandleEvent(EventChainPreVisitor& aVisitor)
// dispatched or when we're about to propagate from
// chrome access only subtree or if we are about to propagate out of
// a shadow root to a shadow root host.
((this == aVisitor.mEvent->originalTarget &&
((this == aVisitor.mEvent->mOriginalTarget &&
!ChromeOnlyAccess()) || isAnonForEvents || GetShadowRoot())) {
nsCOMPtr<nsIContent> relatedTarget =
do_QueryInterface(aVisitor.mEvent->AsMouseEvent()->relatedTarget);
@@ -712,7 +712,7 @@ nsIContent::PreHandleEvent(EventChainPreVisitor& aVisitor)
// If this is the original target, aVisitor.mRelatedTargetIsInAnon
// must be updated.
if (isAnonForEvents || aVisitor.mRelatedTargetIsInAnon ||
(aVisitor.mEvent->originalTarget == this &&
(aVisitor.mEvent->mOriginalTarget == this &&
(aVisitor.mRelatedTargetIsInAnon =
relatedTarget->ChromeOnlyAccess()))) {
nsIContent* anonOwner = FindChromeAccessOnlySubtreeOwner(this);
@@ -731,7 +731,7 @@ nsIContent::PreHandleEvent(EventChainPreVisitor& aVisitor)
if (anonOwner == anonOwnerRelated) {
#ifdef DEBUG_smaug
nsCOMPtr<nsIContent> originalTarget =
do_QueryInterface(aVisitor.mEvent->originalTarget);
do_QueryInterface(aVisitor.mEvent->mOriginalTarget);
nsAutoString ot, ct, rt;
if (originalTarget) {
originalTarget->NodeInfo()->NameAtom()->ToString(ot);
@@ -870,7 +870,8 @@ nsIContent::PreHandleEvent(EventChainPreVisitor& aVisitor)
#ifdef DEBUG
// If a DOM event is explicitly dispatched using node.dispatchEvent(), then
// all the events are allowed even in the native anonymous content..
nsCOMPtr<nsIContent> t = do_QueryInterface(aVisitor.mEvent->originalTarget);
nsCOMPtr<nsIContent> t =
do_QueryInterface(aVisitor.mEvent->mOriginalTarget);
NS_ASSERTION(!t || !t->ChromeOnlyAccess() ||
aVisitor.mEvent->mClass != eMutationEventClass ||
aVisitor.mDOMEvent,
@@ -878,7 +879,7 @@ nsIContent::PreHandleEvent(EventChainPreVisitor& aVisitor)
#endif
aVisitor.mEventTargetAtParent = parent;
} else if (parent && aVisitor.mOriginalTargetIsInAnon) {
nsCOMPtr<nsIContent> content(do_QueryInterface(aVisitor.mEvent->target));
nsCOMPtr<nsIContent> content(do_QueryInterface(aVisitor.mEvent->mTarget));
if (content && content->GetBindingParent() == parent) {
aVisitor.mEventTargetAtParent = parent;
}
@@ -1870,7 +1871,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(FragmentOrElement)
}
nsAutoCString orphan;
if (!tmp->IsInDoc() &&
if (!tmp->IsInUncomposedDoc() &&
// Ignore xbl:content, which is never in the document and hence always
// appears to be orphaned.
!tmp->NodeInfo()->Equals(nsGkAtoms::content, kNameSpaceID_XBL)) {
+7 -4
View File
@@ -254,8 +254,9 @@ TextInputProcessor::IsValidEventTypeForComposition(
return true;
}
if (aKeyboardEvent.mMessage == eUnidentifiedEvent &&
aKeyboardEvent.userType &&
nsDependentAtomString(aKeyboardEvent.userType).EqualsLiteral("on")) {
aKeyboardEvent.mSpecifiedEventType &&
nsDependentAtomString(
aKeyboardEvent.mSpecifiedEventType).EqualsLiteral("on")) {
return true;
}
return false;
@@ -766,6 +767,8 @@ TextInputProcessor::PrepareKeyboardEventToDispatch(
aKeyboardEvent.mKeyNameIndex);
}
aKeyboardEvent.mIsSynthesizedByTIP = (mForTests)? false : true;
return NS_OK;
}
@@ -826,7 +829,7 @@ TextInputProcessor::KeydownInternal(const WidgetKeyboardEvent& aKeyboardEvent,
} else if (NS_WARN_IF(aKeyFlags & KEY_DONT_DISPATCH_MODIFIER_KEY_EVENT)) {
return NS_ERROR_INVALID_ARG;
}
keyEvent.modifiers = GetActiveModifiers();
keyEvent.mModifiers = GetActiveModifiers();
RefPtr<TextEventDispatcher> kungfuDeathGrip(mDispatcher);
rv = IsValidStateForComposition();
@@ -906,7 +909,7 @@ TextInputProcessor::KeyupInternal(const WidgetKeyboardEvent& aKeyboardEvent,
} else if (NS_WARN_IF(aKeyFlags & KEY_DONT_DISPATCH_MODIFIER_KEY_EVENT)) {
return NS_ERROR_INVALID_ARG;
}
keyEvent.modifiers = GetActiveModifiers();
keyEvent.mModifiers = GetActiveModifiers();
RefPtr<TextEventDispatcher> kungfuDeathGrip(mDispatcher);
rv = IsValidStateForComposition();
-1
View File
@@ -119,7 +119,6 @@ DOM4_MSG_DEF(BtAuthRejectedError, "Authentication rejected", NS_ERROR_DOM_BLUET
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 a target not bound to a document is not yet supported.", NS_ERROR_DOM_ANIM_TARGET_NOT_IN_DOC_ERR)
/* common global codes (from nsError.h) */
+1 -1
View File
@@ -1228,7 +1228,7 @@ nsAttrValue::ParseAtom(const nsAString& aValue)
{
ResetIfSet();
nsCOMPtr<nsIAtom> atom = NS_NewAtom(aValue);
nsCOMPtr<nsIAtom> atom = NS_Atomize(aValue);
if (atom) {
SetPtrValueAndType(atom.forget().take(), eAtomBase);
}
+3 -3
View File
@@ -229,12 +229,12 @@ NS_GetContentList(nsINode* aRootNode,
if (!list) {
// We need to create a ContentList and add it to our new entry, if
// we have an entry
nsCOMPtr<nsIAtom> xmlAtom = do_GetAtom(aTagname);
nsCOMPtr<nsIAtom> xmlAtom = NS_Atomize(aTagname);
nsCOMPtr<nsIAtom> htmlAtom;
if (aMatchNameSpaceId == kNameSpaceID_Unknown) {
nsAutoString lowercaseName;
nsContentUtils::ASCIIToLower(aTagname, lowercaseName);
htmlAtom = do_GetAtom(lowercaseName);
htmlAtom = NS_Atomize(lowercaseName);
} else {
htmlAtom = xmlAtom;
}
@@ -518,7 +518,7 @@ nsContentList::NamedItem(const nsAString& aName, bool aDoFlush)
uint32_t i, count = mElements.Length();
// Typically IDs and names are atomized
nsCOMPtr<nsIAtom> name = do_GetAtom(aName);
nsCOMPtr<nsIAtom> name = NS_Atomize(aName);
NS_ENSURE_TRUE(name, nullptr);
for (i = 0; i < count; i++) {
+1 -1
View File
@@ -811,7 +811,7 @@ nsContentSink::ProcessMETATag(nsIContent* aContent)
nsAutoString result;
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::content, result);
if (!result.IsEmpty()) {
nsCOMPtr<nsIAtom> fieldAtom(do_GetAtom(header));
nsCOMPtr<nsIAtom> fieldAtom(NS_Atomize(header));
rv = ProcessHeaderData(fieldAtom, result, aContent);
}
}
+24 -22
View File
@@ -3888,7 +3888,7 @@ nsContentUtils::MatchElementId(nsIContent *aContent, const nsAString& aId)
NS_PRECONDITION(!aId.IsEmpty(), "Will match random elements");
// ID attrs are generally stored as atoms, so just atomize this up front
nsCOMPtr<nsIAtom> id(do_GetAtom(aId));
nsCOMPtr<nsIAtom> id(NS_Atomize(aId));
if (!id) {
// OOM, so just bail
return nullptr;
@@ -4005,7 +4005,7 @@ nsContentUtils::HasMutationListeners(nsINode* aNode,
doc->MayDispatchMutationEvent(aTargetForSubtreeModified);
// If we have a window, we can check it for mutation listeners now.
if (aNode->IsInDoc()) {
if (aNode->IsInUncomposedDoc()) {
nsCOMPtr<EventTarget> piTarget(do_QueryInterface(window));
if (piTarget) {
EventListenerManager* manager = piTarget->GetExistingListenerManager();
@@ -4103,7 +4103,7 @@ nsContentUtils::UnmarkGrayJSListenersInCCGenerationDocuments()
for (auto i = sEventListenerManagersHash->Iter(); !i.Done(); i.Next()) {
auto entry = static_cast<EventListenerManagerMapEntry*>(i.Get());
nsINode* n = static_cast<nsINode*>(entry->mListenerManager->GetTarget());
if (n && n->IsInDoc() &&
if (n && n->IsInUncomposedDoc() &&
nsCCUncollectableMarker::InGeneration(n->OwnerDoc()->GetMarkedCCGeneration())) {
entry->mListenerManager->MarkForCC();
}
@@ -5143,7 +5143,7 @@ static void ProcessViewportToken(nsIDocument *aDocument,
/* Check for known keys. If we find a match, insert the appropriate
* information into the document header. */
nsCOMPtr<nsIAtom> key_atom = do_GetAtom(key);
nsCOMPtr<nsIAtom> key_atom = NS_Atomize(key);
if (key_atom == nsGkAtoms::height)
aDocument->SetHeaderData(nsGkAtoms::viewport_height, value);
else if (key_atom == nsGkAtoms::width)
@@ -5246,7 +5246,7 @@ nsContentUtils::GetDragSession()
nsresult
nsContentUtils::SetDataTransferInEvent(WidgetDragEvent* aDragEvent)
{
if (aDragEvent->dataTransfer || !aDragEvent->IsTrusted()) {
if (aDragEvent->mDataTransfer || !aDragEvent->IsTrusted()) {
return NS_OK;
}
@@ -5274,7 +5274,7 @@ nsContentUtils::SetDataTransferInEvent(WidgetDragEvent* aDragEvent)
// from another application. In either case, a new dataTransfer should
// be created that reflects the data.
initialDataTransfer =
new DataTransfer(aDragEvent->target, aDragEvent->mMessage, true, -1);
new DataTransfer(aDragEvent->mTarget, aDragEvent->mMessage, true, -1);
// now set it in the drag session so we don't need to create it again
dragSession->SetDataTransfer(initialDataTransfer);
@@ -5287,11 +5287,13 @@ nsContentUtils::SetDataTransferInEvent(WidgetDragEvent* aDragEvent)
}
// each event should use a clone of the original dataTransfer.
initialDataTransfer->Clone(aDragEvent->target, aDragEvent->mMessage,
aDragEvent->userCancelled,
initialDataTransfer->Clone(aDragEvent->mTarget, aDragEvent->mMessage,
aDragEvent->mUserCancelled,
isCrossDomainSubFrameDrop,
getter_AddRefs(aDragEvent->dataTransfer));
NS_ENSURE_TRUE(aDragEvent->dataTransfer, NS_ERROR_OUT_OF_MEMORY);
getter_AddRefs(aDragEvent->mDataTransfer));
if (NS_WARN_IF(!aDragEvent->mDataTransfer)) {
return NS_ERROR_OUT_OF_MEMORY;
}
// for the dragenter and dragover events, initialize the drop effect
// from the drop action, which platform specific widget code sets before
@@ -5299,8 +5301,9 @@ nsContentUtils::SetDataTransferInEvent(WidgetDragEvent* aDragEvent)
if (aDragEvent->mMessage == eDragEnter || aDragEvent->mMessage == eDragOver) {
uint32_t action, effectAllowed;
dragSession->GetDragAction(&action);
aDragEvent->dataTransfer->GetEffectAllowedInt(&effectAllowed);
aDragEvent->dataTransfer->SetDropEffectInt(FilterDropEffect(action, effectAllowed));
aDragEvent->mDataTransfer->GetEffectAllowedInt(&effectAllowed);
aDragEvent->mDataTransfer->SetDropEffectInt(
FilterDropEffect(action, effectAllowed));
}
else if (aDragEvent->mMessage == eDrop ||
aDragEvent->mMessage == eLegacyDragDrop ||
@@ -5311,7 +5314,7 @@ nsContentUtils::SetDataTransferInEvent(WidgetDragEvent* aDragEvent)
// dragover event.
uint32_t dropEffect;
initialDataTransfer->GetDropEffectInt(&dropEffect);
aDragEvent->dataTransfer->SetDropEffectInt(dropEffect);
aDragEvent->mDataTransfer->SetDropEffectInt(dropEffect);
}
return NS_OK;
@@ -5355,7 +5358,7 @@ bool
nsContentUtils::CheckForSubFrameDrop(nsIDragSession* aDragSession,
WidgetDragEvent* aDropEvent)
{
nsCOMPtr<nsIContent> target = do_QueryInterface(aDropEvent->originalTarget);
nsCOMPtr<nsIContent> target = do_QueryInterface(aDropEvent->mOriginalTarget);
if (!target) {
return true;
}
@@ -6682,7 +6685,7 @@ nsContentUtils::HasPluginWithUncontrolledEventDispatch(nsIContent* aContent)
// We control dispatch to all mac plugins.
return false;
#else
if (!aContent || !aContent->IsInDoc()) {
if (!aContent || !aContent->IsInUncomposedDoc()) {
return false;
}
@@ -7702,7 +7705,7 @@ nsContentUtils::SendKeyEvent(nsIWidget* aWidget,
return NS_ERROR_FAILURE;
WidgetKeyboardEvent event(true, msg, aWidget);
event.modifiers = GetWidgetModifiers(aModifiers);
event.mModifiers = GetWidgetModifiers(aModifiers);
if (msg == eKeyPress) {
event.keyCode = aCharCode ? 0 : aKeyCode;
@@ -7765,8 +7768,8 @@ nsContentUtils::SendKeyEvent(nsIWidget* aWidget,
break;
}
event.refPoint.x = event.refPoint.y = 0;
event.time = PR_IntervalNow();
event.mRefPoint = LayoutDeviceIntPoint(0, 0);
event.mTime = PR_IntervalNow();
if (!(aAdditionalFlags & nsIDOMWindowUtils::KEY_FLAG_NOT_SYNTHESIZED_FOR_TESTS)) {
event.mFlags.mIsSynthesizedForTests = true;
}
@@ -7834,21 +7837,20 @@ nsContentUtils::SendMouseEvent(nsCOMPtr<nsIPresShell> aPresShell,
WidgetMouseEvent event(true, msg, widget, WidgetMouseEvent::eReal,
contextMenuKey ? WidgetMouseEvent::eContextMenuKey :
WidgetMouseEvent::eNormal);
event.modifiers = GetWidgetModifiers(aModifiers);
event.mModifiers = GetWidgetModifiers(aModifiers);
event.button = aButton;
event.buttons = GetButtonsFlagForButton(aButton);
event.widget = widget;
event.pressure = aPressure;
event.inputSource = aInputSourceArg;
event.clickCount = aClickCount;
event.time = PR_IntervalNow();
event.mTime = PR_IntervalNow();
event.mFlags.mIsSynthesizedForTests = aIsSynthesized;
nsPresContext* presContext = aPresShell->GetPresContext();
if (!presContext)
return NS_ERROR_FAILURE;
event.refPoint = ToWidgetPoint(CSSPoint(aX, aY), offset, presContext);
event.mRefPoint = ToWidgetPoint(CSSPoint(aX, aY), offset, presContext);
event.ignoreRootScrollFrame = aIgnoreRootScrollFrame;
nsEventStatus status = nsEventStatus_eIgnore;
+1 -1
View File
@@ -697,7 +697,7 @@ nsCopySupport::FireClipboardEvent(EventMessage aEventMessage,
nsEventStatus status = nsEventStatus_eIgnore;
InternalClipboardEvent evt(true, aEventMessage);
evt.clipboardData = clipboardData;
evt.mClipboardData = clipboardData;
EventDispatcher::Dispatch(content, presShell->GetPresContext(), &evt,
nullptr, &status);
// If the event was cancelled, don't do the clipboard operation
+1 -1
View File
@@ -683,7 +683,7 @@ nsDOMMutationObserver::Observe(nsINode& aTarget,
filters.SetCapacity(len);
for (uint32_t i = 0; i < len; ++i) {
nsCOMPtr<nsIAtom> a = do_GetAtom(filtersAsString[i]);
nsCOMPtr<nsIAtom> a = NS_Atomize(filtersAsString[i]);
filters.AppendObject(a);
}
}
+47 -56
View File
@@ -247,7 +247,7 @@ nsDOMWindowUtils::GetDocumentMetadata(const nsAString& aName,
nsIDocument* doc = GetDocument();
if (doc) {
nsCOMPtr<nsIAtom> name = do_GetAtom(aName);
nsCOMPtr<nsIAtom> name = NS_Atomize(aName);
doc->GetHeaderData(name, aValue);
return NS_OK;
}
@@ -346,7 +346,7 @@ nsDOMWindowUtils::SetDisplayPortForElement(float aXPx, float aYPx,
return NS_ERROR_INVALID_ARG;
}
if (content->GetCurrentDoc() != presShell->GetDocument()) {
if (content->GetUncomposedDoc() != presShell->GetDocument()) {
return NS_ERROR_INVALID_ARG;
}
@@ -428,7 +428,7 @@ nsDOMWindowUtils::SetDisplayPortMarginsForElement(float aLeftMargin,
return NS_ERROR_INVALID_ARG;
}
if (content->GetCurrentDoc() != presShell->GetDocument()) {
if (content->GetUncomposedDoc() != presShell->GetDocument()) {
return NS_ERROR_INVALID_ARG;
}
@@ -470,7 +470,7 @@ nsDOMWindowUtils::SetDisplayPortBaseForElement(int32_t aX,
return NS_ERROR_INVALID_ARG;
}
if (content->GetCurrentDoc() != presShell->GetDocument()) {
if (content->GetUncomposedDoc() != presShell->GetDocument()) {
return NS_ERROR_INVALID_ARG;
}
@@ -697,10 +697,9 @@ nsDOMWindowUtils::SendPointerEventCommon(const nsAString& aType,
}
WidgetPointerEvent event(true, msg, widget);
event.modifiers = nsContentUtils::GetWidgetModifiers(aModifiers);
event.mModifiers = nsContentUtils::GetWidgetModifiers(aModifiers);
event.button = aButton;
event.buttons = nsContentUtils::GetButtonsFlagForButton(aButton);
event.widget = widget;
event.pressure = aPressure;
event.inputSource = aInputSourceArg;
event.pointerId = aPointerId;
@@ -710,7 +709,7 @@ nsDOMWindowUtils::SendPointerEventCommon(const nsAString& aType,
event.tiltY = aTiltY;
event.isPrimary = (nsIDOMMouseEvent::MOZ_SOURCE_MOUSE == aInputSourceArg) ? true : aIsPrimary;
event.clickCount = aClickCount;
event.time = PR_IntervalNow();
event.mTime = PR_IntervalNow();
event.mFlags.mIsSynthesizedForTests = aOptionalArgCount >= 10 ? aIsSynthesized : true;
nsPresContext* presContext = GetPresContext();
@@ -718,7 +717,8 @@ nsDOMWindowUtils::SendPointerEventCommon(const nsAString& aType,
return NS_ERROR_FAILURE;
}
event.refPoint = nsContentUtils::ToWidgetPoint(CSSPoint(aX, aY), offset, presContext);
event.mRefPoint =
nsContentUtils::ToWidgetPoint(CSSPoint(aX, aY), offset, presContext);
event.ignoreRootScrollFrame = aIgnoreRootScrollFrame;
nsEventStatus status;
@@ -822,27 +822,27 @@ nsDOMWindowUtils::SendWheelEvent(float aX,
}
WidgetWheelEvent wheelEvent(true, eWheel, widget);
wheelEvent.modifiers = nsContentUtils::GetWidgetModifiers(aModifiers);
wheelEvent.deltaX = aDeltaX;
wheelEvent.deltaY = aDeltaY;
wheelEvent.deltaZ = aDeltaZ;
wheelEvent.deltaMode = aDeltaMode;
wheelEvent.isMomentum =
wheelEvent.mModifiers = nsContentUtils::GetWidgetModifiers(aModifiers);
wheelEvent.mDeltaX = aDeltaX;
wheelEvent.mDeltaY = aDeltaY;
wheelEvent.mDeltaZ = aDeltaZ;
wheelEvent.mDeltaMode = aDeltaMode;
wheelEvent.mIsMomentum =
(aOptions & WHEEL_EVENT_CAUSED_BY_MOMENTUM) != 0;
wheelEvent.mIsNoLineOrPageDelta =
(aOptions & WHEEL_EVENT_CAUSED_BY_NO_LINE_OR_PAGE_DELTA_DEVICE) != 0;
wheelEvent.customizedByUserPrefs =
wheelEvent.mCustomizedByUserPrefs =
(aOptions & WHEEL_EVENT_CUSTOMIZED_BY_USER_PREFS) != 0;
wheelEvent.lineOrPageDeltaX = aLineOrPageDeltaX;
wheelEvent.lineOrPageDeltaY = aLineOrPageDeltaY;
wheelEvent.widget = widget;
wheelEvent.mLineOrPageDeltaX = aLineOrPageDeltaX;
wheelEvent.mLineOrPageDeltaY = aLineOrPageDeltaY;
wheelEvent.time = PR_Now() / 1000;
wheelEvent.mTime = PR_Now() / 1000;
nsPresContext* presContext = GetPresContext();
NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE);
wheelEvent.refPoint = nsContentUtils::ToWidgetPoint(CSSPoint(aX, aY), offset, presContext);
wheelEvent.mRefPoint =
nsContentUtils::ToWidgetPoint(CSSPoint(aX, aY), offset, presContext);
widget->DispatchInputEvent(&wheelEvent);
@@ -854,40 +854,40 @@ nsDOMWindowUtils::SendWheelEvent(float aX,
bool failedX = false;
if ((aOptions & WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_X_ZERO) &&
wheelEvent.overflowDeltaX != 0) {
wheelEvent.mOverflowDeltaX != 0) {
failedX = true;
}
if ((aOptions & WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_X_POSITIVE) &&
wheelEvent.overflowDeltaX <= 0) {
wheelEvent.mOverflowDeltaX <= 0) {
failedX = true;
}
if ((aOptions & WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_X_NEGATIVE) &&
wheelEvent.overflowDeltaX >= 0) {
wheelEvent.mOverflowDeltaX >= 0) {
failedX = true;
}
bool failedY = false;
if ((aOptions & WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_Y_ZERO) &&
wheelEvent.overflowDeltaY != 0) {
wheelEvent.mOverflowDeltaY != 0) {
failedY = true;
}
if ((aOptions & WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_Y_POSITIVE) &&
wheelEvent.overflowDeltaY <= 0) {
wheelEvent.mOverflowDeltaY <= 0) {
failedY = true;
}
if ((aOptions & WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_Y_NEGATIVE) &&
wheelEvent.overflowDeltaY >= 0) {
wheelEvent.mOverflowDeltaY >= 0) {
failedY = true;
}
#ifdef DEBUG
if (failedX) {
nsPrintfCString debugMsg("SendWheelEvent(): unexpected overflowDeltaX: %f",
wheelEvent.overflowDeltaX);
nsPrintfCString debugMsg("SendWheelEvent(): unexpected mOverflowDeltaX: %f",
wheelEvent.mOverflowDeltaX);
NS_WARNING(debugMsg.get());
}
if (failedY) {
nsPrintfCString debugMsg("SendWheelEvent(): unexpected overflowDeltaY: %f",
wheelEvent.overflowDeltaY);
nsPrintfCString debugMsg("SendWheelEvent(): unexpected mOverflowDeltaY: %f",
wheelEvent.mOverflowDeltaY);
NS_WARNING(debugMsg.get());
}
#endif
@@ -969,15 +969,14 @@ nsDOMWindowUtils::SendTouchEventCommon(const nsAString& aType,
return NS_ERROR_UNEXPECTED;
}
WidgetTouchEvent event(true, msg, widget);
event.modifiers = nsContentUtils::GetWidgetModifiers(aModifiers);
event.widget = widget;
event.time = PR_Now();
event.mModifiers = nsContentUtils::GetWidgetModifiers(aModifiers);
event.mTime = PR_Now();
nsPresContext* presContext = GetPresContext();
if (!presContext) {
return NS_ERROR_FAILURE;
}
event.touches.SetCapacity(aCount);
event.mTouches.SetCapacity(aCount);
for (uint32_t i = 0; i < aCount; ++i) {
LayoutDeviceIntPoint pt =
nsContentUtils::ToWidgetPoint(CSSPoint(aXs[i], aYs[i]), offset, presContext);
@@ -989,7 +988,7 @@ nsDOMWindowUtils::SendTouchEventCommon(const nsAString& aType,
RefPtr<Touch> t =
new Touch(aIdentifiers[i], pt, radius, aRotationAngles[i], aForces[i]);
event.touches.AppendElement(t);
event.mTouches.AppendElement(t);
}
nsEventStatus status;
@@ -1139,10 +1138,10 @@ nsDOMWindowUtils::SendNativeTouchPoint(uint32_t aPointerId,
}
NS_DispatchToMainThread(NS_NewRunnableMethodWithArgs
<uint32_t, nsIWidget::TouchPointerState, ScreenIntPoint, double, uint32_t, nsIObserver*>
<uint32_t, nsIWidget::TouchPointerState, LayoutDeviceIntPoint, double, uint32_t, nsIObserver*>
(widget, &nsIWidget::SynthesizeNativeTouchPoint, aPointerId,
(nsIWidget::TouchPointerState)aTouchState,
ScreenIntPoint(aScreenX, aScreenY),
LayoutDeviceIntPoint(aScreenX, aScreenY),
aPressure, aOrientation, aObserver));
return NS_OK;
}
@@ -1161,9 +1160,9 @@ nsDOMWindowUtils::SendNativeTouchTap(int32_t aScreenX,
}
NS_DispatchToMainThread(NS_NewRunnableMethodWithArgs
<ScreenIntPoint, bool, nsIObserver*>
<LayoutDeviceIntPoint, bool, nsIObserver*>
(widget, &nsIWidget::SynthesizeNativeTouchTap,
ScreenIntPoint(aScreenX, aScreenY), aLongTap, aObserver));
LayoutDeviceIntPoint(aScreenX, aScreenY), aLongTap, aObserver));
return NS_OK;
}
@@ -1230,7 +1229,7 @@ nsDOMWindowUtils::GetWidgetForElement(nsIDOMElement* aElement)
return GetWidget();
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
nsIDocument* doc = content->GetCurrentDoc();
nsIDocument* doc = content->GetUncomposedDoc();
nsIPresShell* presShell = doc ? doc->GetShell() : nullptr;
if (presShell) {
@@ -1349,17 +1348,18 @@ nsDOMWindowUtils::SendSimpleGestureEvent(const nsAString& aType,
}
WidgetSimpleGestureEvent event(true, msg, widget);
event.modifiers = nsContentUtils::GetWidgetModifiers(aModifiers);
event.mModifiers = nsContentUtils::GetWidgetModifiers(aModifiers);
event.direction = aDirection;
event.delta = aDelta;
event.clickCount = aClickCount;
event.time = PR_IntervalNow();
event.mTime = PR_IntervalNow();
nsPresContext* presContext = GetPresContext();
if (!presContext)
return NS_ERROR_FAILURE;
event.refPoint = nsContentUtils::ToWidgetPoint(CSSPoint(aX, aY), offset, presContext);
event.mRefPoint =
nsContentUtils::ToWidgetPoint(CSSPoint(aX, aY), offset, presContext);
nsEventStatus status;
return widget->DispatchEvent(&event, status);
@@ -1874,7 +1874,7 @@ nsDOMWindowUtils::DispatchDOMEventViaPresShell(nsIDOMNode* aTarget,
if (content->OwnerDoc()->GetWindow() != window) {
return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
}
nsCOMPtr<nsIDocument> targetDoc = content->GetCurrentDoc();
nsCOMPtr<nsIDocument> targetDoc = content->GetUncomposedDoc();
NS_ENSURE_STATE(targetDoc);
RefPtr<nsIPresShell> targetShell = targetDoc->GetShell();
NS_ENSURE_STATE(targetShell);
@@ -1891,9 +1891,9 @@ static void
InitEvent(WidgetGUIEvent& aEvent, LayoutDeviceIntPoint* aPt = nullptr)
{
if (aPt) {
aEvent.refPoint = *aPt;
aEvent.mRefPoint = *aPt;
}
aEvent.time = PR_IntervalNow();
aEvent.mTime = PR_IntervalNow();
}
NS_IMETHODIMP
@@ -2370,7 +2370,7 @@ ComputeAnimationValue(nsCSSProperty aProperty,
const nsAString& aInput,
StyleAnimationValue& aOutput)
{
nsIDocument* doc = aElement->GetCurrentDoc();
nsIDocument* doc = aElement->GetUncomposedDoc();
nsIPresShell* shell = doc->GetShell();
if (!shell) {
return false;
@@ -2383,15 +2383,6 @@ ComputeAnimationValue(nsCSSProperty aProperty,
aInput, false, aOutput)) {
return false;
}
// This matches TransExtractComputedValue in nsTransitionManager.cpp.
if (aProperty == eCSSProperty_visibility) {
MOZ_ASSERT(aOutput.GetUnit() == StyleAnimationValue::eUnit_Enumerated,
"unexpected unit");
aOutput.SetIntValue(aOutput.GetIntValue(),
StyleAnimationValue::eUnit_Visibility);
}
return true;
}
+35 -47
View File
@@ -5506,7 +5506,7 @@ nsDocument::SetupCustomElement(Element* aElement,
nsCOMPtr<nsIAtom> tagAtom = aElement->NodeInfo()->NameAtom();
nsCOMPtr<nsIAtom> typeAtom = aTypeExtension ?
do_GetAtom(*aTypeExtension) : tagAtom;
NS_Atomize(*aTypeExtension) : tagAtom;
if (aTypeExtension && !aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::is)) {
// Custom element setup in the parser happens after the "is"
@@ -5833,7 +5833,7 @@ nsDocument::CustomElementConstructor(JSContext* aCx, unsigned aArgc, JS::Value*
return true;
}
nsCOMPtr<nsIAtom> typeAtom(do_GetAtom(elemName));
nsCOMPtr<nsIAtom> typeAtom(NS_Atomize(elemName));
CustomElementHashKey key(kNameSpaceID_Unknown, typeAtom);
CustomElementDefinition* definition;
if (!document->mRegistry ||
@@ -6127,7 +6127,7 @@ nsDocument::RegisterElement(JSContext* aCx, const nsAString& aType,
lcName.Assign(aOptions.mExtends);
}
nsCOMPtr<nsIAtom> typeAtom(do_GetAtom(lcType));
nsCOMPtr<nsIAtom> typeAtom(NS_Atomize(lcType));
if (!nsContentUtils::IsCustomElementName(typeAtom)) {
rv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
return;
@@ -6248,7 +6248,7 @@ nsDocument::RegisterElement(JSContext* aCx, const nsAString& aType,
if (!lcName.IsEmpty()) {
// Let BASE be the element interface for NAME and NAMESPACE.
bool known = false;
nameAtom = do_GetAtom(lcName);
nameAtom = NS_Atomize(lcName);
if (namespaceID == kNameSpaceID_XHTML) {
nsIParserService* ps = nsContentUtils::GetParserService();
if (!ps) {
@@ -6865,7 +6865,7 @@ nsIDocument::GetAnonymousElementByAttribute(Element& aElement,
const nsAString& aAttrName,
const nsAString& aAttrValue)
{
nsCOMPtr<nsIAtom> attribute = do_GetAtom(aAttrName);
nsCOMPtr<nsIAtom> attribute = NS_Atomize(aAttrName);
return GetAnonymousElementByAttribute(&aElement, attribute, aAttrValue);
}
@@ -7789,7 +7789,7 @@ nsIDocument::AdoptNode(nsINode& aAdoptedNode, ErrorResult& rv)
MOZ_ASSERT(idx >= 0);
parent->RemoveChildAt(idx, true);
} else {
MOZ_ASSERT(!adoptedNode->IsInDoc());
MOZ_ASSERT(!adoptedNode->IsInUncomposedDoc());
// If we're adopting a node that's not in a document, it might still
// have a binding applied. Remove the binding from the element now
@@ -8609,7 +8609,7 @@ nsDocument::RetrieveRelevantHeaders(nsIChannel *aChannel)
rv =
httpChannel->GetResponseHeader(nsDependentCString(*name), headerVal);
if (NS_SUCCEEDED(rv) && !headerVal.IsEmpty()) {
nsCOMPtr<nsIAtom> key = do_GetAtom(*name);
nsCOMPtr<nsIAtom> key = NS_Atomize(*name);
SetHeaderData(key, NS_ConvertASCIItoUTF16(headerVal));
}
++name;
@@ -11665,7 +11665,7 @@ nsDocument::FullScreenStackPop()
// no longer in this document.
while (!mFullScreenStack.IsEmpty()) {
Element* element = FullScreenStackTop();
if (!element || !element->IsInDoc() || element->OwnerDoc() != this) {
if (!element || !element->IsInUncomposedDoc() || element->OwnerDoc() != this) {
NS_ASSERTION(!element->IsFullScreenAncestor(),
"Should have already removed full-screen styles");
uint32_t last = mFullScreenStack.Length() - 1;
@@ -11688,7 +11688,7 @@ nsDocument::FullScreenStackTop()
uint32_t last = mFullScreenStack.Length() - 1;
nsCOMPtr<Element> element(do_QueryReferent(mFullScreenStack[last]));
NS_ASSERTION(element, "Should have full-screen element!");
NS_ASSERTION(element->IsInDoc(), "Full-screen element should be in doc");
NS_ASSERTION(element->IsInUncomposedDoc(), "Full-screen element should be in doc");
NS_ASSERTION(element->OwnerDoc() == this, "Full-screen element should be in this doc");
return element;
}
@@ -11799,7 +11799,7 @@ nsDocument::RequestFullScreen(Element* aElement,
if (!aElement || aElement == GetFullScreenElement()) {
return;
}
if (!aElement->IsInDoc()) {
if (!aElement->IsInUncomposedDoc()) {
LogFullScreenDenied(true, "FullScreenDeniedNotInDocument", this);
return;
}
@@ -12491,7 +12491,7 @@ nsDocument::ShouldLockPointer(Element* aElement, Element* aCurrentLock,
return false;
}
if (!aElement->IsInDoc()) {
if (!aElement->IsInUncomposedDoc()) {
NS_WARNING("ShouldLockPointer(): Element without Document");
return false;
}
@@ -12538,49 +12538,37 @@ nsDocument::ShouldLockPointer(Element* aElement, Element* aCurrentLock,
bool
nsDocument::SetPointerLock(Element* aElement, int aCursorStyle)
{
// NOTE: aElement will be nullptr when unlocking.
nsCOMPtr<nsPIDOMWindow> window = GetWindow();
if (!window) {
NS_WARNING("SetPointerLock(): No Window");
return false;
MOZ_ASSERT(!aElement || aElement->OwnerDoc() == this,
"We should be either unlocking pointer (aElement is nullptr), "
"or locking pointer to an element in this document");
#ifdef DEBUG
if (!aElement) {
nsCOMPtr<nsIDocument> pointerLockedDoc =
do_QueryReferent(EventStateManager::sPointerLockedDoc);
MOZ_ASSERT(pointerLockedDoc == this);
}
#endif
nsIDocShell *docShell = window->GetDocShell();
if (!docShell) {
NS_WARNING("SetPointerLock(): No DocShell (window already closed?)");
return false;
}
RefPtr<nsPresContext> presContext;
docShell->GetPresContext(getter_AddRefs(presContext));
if (!presContext) {
NS_WARNING("SetPointerLock(): Unable to get presContext in \
domWindow->GetDocShell()->GetPresContext()");
return false;
}
nsCOMPtr<nsIPresShell> shell = presContext->PresShell();
nsIPresShell* shell = GetShell();
if (!shell) {
NS_WARNING("SetPointerLock(): Unable to find presContext->PresShell()");
NS_WARNING("SetPointerLock(): No PresShell");
return false;
}
nsPresContext* presContext = shell->GetPresContext();
if (!presContext) {
NS_WARNING("SetPointerLock(): Unable to get PresContext");
return false;
}
nsCOMPtr<nsIWidget> widget;
nsIFrame* rootFrame = shell->GetRootFrame();
if (!rootFrame) {
NS_WARNING("SetPointerLock(): Unable to get root frame");
return false;
}
nsCOMPtr<nsIWidget> widget = rootFrame->GetNearestWidget();
if (!widget) {
NS_WARNING("SetPointerLock(): Unable to find widget in \
shell->GetRootFrame()->GetNearestWidget();");
return false;
}
if (aElement && (aElement->OwnerDoc() != this)) {
NS_WARNING("SetPointerLock(): Element not in this document.");
return false;
if (!NS_WARN_IF(!rootFrame)) {
widget = rootFrame->GetNearestWidget();
NS_WARN_IF_FALSE(widget, "SetPointerLock(): Unable to find widget "
"in shell->GetRootFrame()->GetNearestWidget();");
if (aElement && !widget) {
return false;
}
}
// Hide the cursor and set pointer lock for future mouse events
+2 -2
View File
@@ -1973,8 +1973,8 @@ public:
InternalFocusEvent event(true, mEventMessage);
event.mFlags.mBubbles = false;
event.mFlags.mCancelable = false;
event.fromRaise = mWindowRaised;
event.isRefocus = mIsRefocus;
event.mFromRaise = mWindowRaised;
event.mIsRefocus = mIsRefocus;
return EventDispatcher::Dispatch(mTarget, mContext, &event);
}
+4 -4
View File
@@ -64,7 +64,7 @@ nsGenericDOMDataNode::nsGenericDOMDataNode(already_AddRefed<mozilla::dom::NodeIn
nsGenericDOMDataNode::~nsGenericDOMDataNode()
{
NS_PRECONDITION(!IsInDoc(),
NS_PRECONDITION(!IsInUncomposedDoc(),
"Please remove this from the document properly");
if (GetParent()) {
NS_RELEASE(mParent);
@@ -392,7 +392,7 @@ nsGenericDOMDataNode::SetTextInternal(uint32_t aOffset, uint32_t aCount,
if (aLength > 0) {
nsAutoString val;
mText.AppendTo(val);
mutation.mNewAttrValue = do_GetAtom(val);
mutation.mNewAttrValue = NS_Atomize(val);
}
mozAutoSubtreeModified subtree(OwnerDoc(), this);
@@ -467,7 +467,7 @@ nsGenericDOMDataNode::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
"Must have the same owner document");
NS_PRECONDITION(!aParent || aDocument == aParent->GetUncomposedDoc(),
"aDocument must be current doc of aParent");
NS_PRECONDITION(!GetUncomposedDoc() && !IsInDoc(),
NS_PRECONDITION(!GetUncomposedDoc() && !IsInUncomposedDoc(),
"Already have a document. Unbind first!");
// Note that as we recurse into the kids, they'll have a non-null parent. So
// only assert if our parent is _changing_ while we have a parent.
@@ -1097,7 +1097,7 @@ nsGenericDOMDataNode::GetCurrentValueAtom()
{
nsAutoString val;
GetData(val);
return NS_NewAtom(val);
return NS_Atomize(val);
}
NS_IMETHODIMP
-1
View File
@@ -372,7 +372,6 @@ GK_ATOM(excludeResultPrefixes, "exclude-result-prefixes")
GK_ATOM(excludes, "excludes")
GK_ATOM(expr, "expr")
GK_ATOM(expectingSystemMessage, "expecting-system-message")
GK_ATOM(extapp, "extapp")
GK_ATOM(extends, "extends")
GK_ATOM(extensionElementPrefixes, "extension-element-prefixes")
GK_ATOM(face, "face")
+4 -4
View File
@@ -3106,17 +3106,17 @@ nsGlobalWindow::PreHandleEvent(EventChainPreVisitor& aVisitor)
//let's only take the lowest half of the point structure.
int16_t myCoord[2];
myCoord[0] = aVisitor.mEvent->refPoint.x;
myCoord[1] = aVisitor.mEvent->refPoint.y;
myCoord[0] = aVisitor.mEvent->mRefPoint.x;
myCoord[1] = aVisitor.mEvent->mRefPoint.y;
gEntropyCollector->RandomUpdate((void*)myCoord, sizeof(myCoord));
gEntropyCollector->RandomUpdate((void*)&(aVisitor.mEvent->time),
gEntropyCollector->RandomUpdate((void*)&(aVisitor.mEvent->mTime),
sizeof(uint32_t));
}
} else if (msg == eResize && aVisitor.mEvent->IsTrusted()) {
// QIing to window so that we can keep the old behavior also in case
// a child window is handling resize.
nsCOMPtr<nsPIDOMWindow> window =
do_QueryInterface(aVisitor.mEvent->originalTarget);
do_QueryInterface(aVisitor.mEvent->mOriginalTarget);
if (window) {
mIsHandlingResizeEvent = true;
}
+4 -4
View File
@@ -74,8 +74,8 @@ public:
* @param aDocument The new document for the content node. May not be null
* if aParent is null. Must match the current document of
* aParent, if aParent is not null (note that
* aParent->GetCurrentDoc() can be null, in which case this
* must also be null).
* aParent->GetUncomposedDoc() can be null, in which case
* this must also be null).
* @param aParent The new parent for the content node. May be null if the
* node is being bound as a direct child of the document.
* @param aBindingParent The new binding parent for the content node.
@@ -229,7 +229,7 @@ public:
bool IsInAnonymousSubtree() const
{
NS_ASSERTION(!IsInNativeAnonymousSubtree() || GetBindingParent() ||
(!IsInDoc() &&
(!IsInUncomposedDoc() &&
static_cast<nsIContent*>(SubtreeRoot())->IsInNativeAnonymousSubtree()),
"Must have binding parent when in native anonymous subtree which is in document.\n"
"Native anonymous subtree which is not in document must have native anonymous root.");
@@ -897,7 +897,7 @@ public:
*/
nsIFrame* GetPrimaryFrame() const
{
return (IsInDoc() || IsInShadowTree()) ? mPrimaryFrame : nullptr;
return (IsInUncomposedDoc() || IsInShadowTree()) ? mPrimaryFrame : nullptr;
}
// Defined in nsIContentInlines.h because it needs nsIFrame.
+15 -15
View File
@@ -261,7 +261,7 @@ nsINode::SubtreeRoot() const
// 4. nsIAttribute nodes - Are never in the document, and mSubtreeRoot
// is always 'this' (as set in nsINode's ctor).
nsINode* node;
if (IsInDoc()) {
if (IsInUncomposedDoc()) {
node = OwnerDocAsNode();
} else if (IsContent()) {
ShadowRoot* containingShadow = AsContent()->GetContainingShadow();
@@ -317,7 +317,7 @@ nsINode::GetSelectionRootContent(nsIPresShell* aPresShell)
if (!IsNodeOfType(eCONTENT))
return nullptr;
if (GetCrossShadowCurrentDoc() != aPresShell->GetDocument()) {
if (GetComposedDoc() != aPresShell->GetDocument()) {
return nullptr;
}
@@ -333,7 +333,7 @@ nsINode::GetSelectionRootContent(nsIPresShell* aPresShell)
nsIEditor* editor = nsContentUtils::GetHTMLEditor(presContext);
if (editor) {
// This node is in HTML editor.
nsIDocument* doc = GetCrossShadowCurrentDoc();
nsIDocument* doc = GetComposedDoc();
if (!doc || doc->HasFlag(NODE_IS_EDITABLE) ||
!HasFlag(NODE_IS_EDITABLE)) {
nsIContent* editorRoot = GetEditorRootContent(editor);
@@ -780,7 +780,7 @@ nsINode::SetUserData(const nsAString &aKey, nsIVariant *aData, nsIVariant **aRes
OwnerDoc()->WarnOnceAbout(nsIDocument::eGetSetUserData);
*aResult = nullptr;
nsCOMPtr<nsIAtom> key = do_GetAtom(aKey);
nsCOMPtr<nsIAtom> key = NS_Atomize(aKey);
if (!key) {
return NS_ERROR_OUT_OF_MEMORY;
}
@@ -833,7 +833,7 @@ nsIVariant*
nsINode::GetUserData(const nsAString& aKey)
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eGetSetUserData);
nsCOMPtr<nsIAtom> key = do_GetAtom(aKey);
nsCOMPtr<nsIAtom> key = NS_Atomize(aKey);
if (!key) {
return nullptr;
}
@@ -1568,7 +1568,7 @@ nsINode::doInsertChildAt(nsIContent* aKid, uint32_t aIndex,
// Do this before checking the child-count since this could cause mutations
nsIDocument* doc = GetUncomposedDoc();
mozAutoDocUpdate updateBatch(GetCrossShadowCurrentDoc(), UPDATE_CONTENT_MODEL, aNotify);
mozAutoDocUpdate updateBatch(GetComposedDoc(), UPDATE_CONTENT_MODEL, aNotify);
if (OwnerDoc() != aKid->OwnerDoc()) {
rv = AdoptNodeIntoOwnerDoc(this, aKid);
@@ -1896,7 +1896,7 @@ nsINode::doRemoveChildAt(uint32_t aIndex, bool aNotify,
IndexOf(aKid) == (int32_t)aIndex, "Bogus aKid");
nsMutationGuard::DidMutate();
mozAutoDocUpdate updateBatch(GetCrossShadowCurrentDoc(), UPDATE_CONTENT_MODEL, aNotify);
mozAutoDocUpdate updateBatch(GetComposedDoc(), UPDATE_CONTENT_MODEL, aNotify);
nsIContent* previousSibling = aKid->GetPreviousSibling();
@@ -2334,7 +2334,7 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
}
}
mozAutoDocUpdate batch(GetCrossShadowCurrentDoc(), UPDATE_CONTENT_MODEL, true);
mozAutoDocUpdate batch(GetComposedDoc(), UPDATE_CONTENT_MODEL, true);
nsAutoMutationBatch mb;
// Figure out which index we want to insert at. Note that we use
@@ -2602,7 +2602,7 @@ nsINode::Contains(const nsINode* aOther) const
}
if (!aOther ||
OwnerDoc() != aOther->OwnerDoc() ||
IsInDoc() != aOther->IsInDoc() ||
IsInUncomposedDoc() != aOther->IsInUncomposedDoc() ||
!(aOther->IsElement() ||
aOther->IsNodeOfType(nsINode::eCONTENT)) ||
!GetFirstChild()) {
@@ -2613,7 +2613,7 @@ nsINode::Contains(const nsINode* aOther) const
if (this == OwnerDoc()) {
// document.contains(aOther) returns true if aOther is in the document,
// but is not in any anonymous subtree.
// IsInDoc() check is done already before this.
// IsInUncomposedDoc() check is done already before this.
return !other->IsInAnonymousSubtree();
}
@@ -2740,13 +2740,13 @@ FindMatchingElementsWithId(const nsAString& aId, nsINode* aRoot,
SelectorMatchInfo* aMatchInfo,
T& aList)
{
MOZ_ASSERT(aRoot->IsInDoc(),
MOZ_ASSERT(aRoot->IsInUncomposedDoc(),
"Don't call me if the root is not in the document");
MOZ_ASSERT(aRoot->IsElement() || aRoot->IsNodeOfType(nsINode::eDOCUMENT),
"The optimization below to check ContentIsDescendantOf only for "
"elements depends on aRoot being either an element or a "
"document if it's in the document. Note that document fragments "
"can't be IsInDoc(), so should never show up here.");
"can't be IsInUncomposedDoc(), so should never show up here.");
const nsTArray<Element*>* elements = aRoot->OwnerDoc()->GetAllElementsForId(aId);
if (!elements) {
@@ -2797,11 +2797,11 @@ FindMatchingElements(nsINode* aRoot, nsCSSSelectorList* aSelectorList, T &aList,
// this if aSelectorList only has one selector, because otherwise
// ordering the elements correctly is a pain.
NS_ASSERTION(aRoot->IsElement() || aRoot->IsNodeOfType(nsINode::eDOCUMENT) ||
!aRoot->IsInDoc(),
!aRoot->IsInUncomposedDoc(),
"The optimization below to check ContentIsDescendantOf only for "
"elements depends on aRoot being either an element or a "
"document if it's in the document.");
if (aRoot->IsInDoc() &&
if (aRoot->IsInUncomposedDoc() &&
doc->GetCompatibilityMode() != eCompatibility_NavQuirks &&
!aSelectorList->mNext &&
aSelectorList->mSelectors->mIDList) {
@@ -2909,7 +2909,7 @@ nsINode::GetElementById(const nsAString& aId)
{
MOZ_ASSERT(IsElement() || IsNodeOfType(eDOCUMENT_FRAGMENT),
"Bogus this object for GetElementById call");
if (IsInDoc()) {
if (IsInUncomposedDoc()) {
ElementHolder holder;
FindMatchingElementsWithId<true>(aId, this, nullptr, holder);
return holder.mElement;
+1 -25
View File
@@ -507,14 +507,6 @@ public:
return GetBoolFlag(IsInDocument);
}
/**
* @deprecated
*/
bool IsInDoc() const
{
return IsInUncomposedDoc();
}
/**
* Get the document that this content is currently in, if any. This will be
* null if the content has no ancestor that is a document.
@@ -527,14 +519,6 @@ public:
return IsInUncomposedDoc() ? OwnerDoc() : nullptr;
}
/**
* @deprecated
*/
nsIDocument *GetCurrentDoc() const
{
return GetUncomposedDoc();
}
/**
* This method returns the owner doc if the node is in the
* composed document (as defined in the Shadow DOM spec), otherwise
@@ -546,14 +530,6 @@ public:
GetComposedDocInternal() : GetUncomposedDoc();
}
/**
* @deprecated
*/
nsIDocument* GetCrossShadowCurrentDoc() const
{
return GetComposedDoc();
}
/**
* Returns true if GetComposedDoc() would return a non-null value.
*/
@@ -1687,7 +1663,7 @@ protected:
void SetSubtreeRootPointer(nsINode* aSubtreeRoot)
{
NS_ASSERTION(aSubtreeRoot, "aSubtreeRoot can never be null!");
NS_ASSERTION(!(IsNodeOfType(eCONTENT) && IsInDoc()) &&
NS_ASSERTION(!(IsNodeOfType(eCONTENT) && IsInUncomposedDoc()) &&
!IsInShadowTree(), "Shouldn't be here!");
mSubtreeRoot = aSubtreeRoot;
}
+2 -2
View File
@@ -265,7 +265,7 @@ nsNodeInfoManager::GetNodeInfo(const nsAString& aName, nsIAtom *aPrefix,
{
#ifdef DEBUG
{
nsCOMPtr<nsIAtom> nameAtom = do_GetAtom(aName);
nsCOMPtr<nsIAtom> nameAtom = NS_Atomize(aName);
CheckValidNodeInfo(aNodeType, nameAtom, aNamespaceID, nullptr);
}
#endif
@@ -282,7 +282,7 @@ nsNodeInfoManager::GetNodeInfo(const nsAString& aName, nsIAtom *aPrefix,
return NS_OK;
}
nsCOMPtr<nsIAtom> nameAtom = do_GetAtom(aName);
nsCOMPtr<nsIAtom> nameAtom = NS_Atomize(aName);
NS_ENSURE_TRUE(nameAtom, NS_ERROR_OUT_OF_MEMORY);
RefPtr<NodeInfo> newNodeInfo =
+3 -3
View File
@@ -2912,14 +2912,14 @@ nsRange::CollectClientRects(nsLayoutUtils::RectCallback* aCollector,
nsCOMPtr<nsINode> endContainer = aEndParent;
// Flush out layout so our frames are up to date.
if (!aStartParent->IsInDoc()) {
if (!aStartParent->IsInUncomposedDoc()) {
return;
}
if (aFlushLayout) {
aStartParent->OwnerDoc()->FlushPendingNotifications(Flush_Layout);
// Recheck whether we're still in the document
if (!aStartParent->IsInDoc()) {
if (!aStartParent->IsInUncomposedDoc()) {
return;
}
}
@@ -3047,7 +3047,7 @@ nsRange::GetUsedFontFaces(nsIDOMFontFaceList** aResult)
doc->FlushPendingNotifications(Flush_Frames);
// Recheck whether we're still in the document
NS_ENSURE_TRUE(mStartParent->IsInDoc(), NS_ERROR_UNEXPECTED);
NS_ENSURE_TRUE(mStartParent->IsInUncomposedDoc(), NS_ERROR_UNEXPECTED);
RefPtr<nsFontFaceList> fontFaceList = new nsFontFaceList();
+2 -2
View File
@@ -109,7 +109,7 @@ nsReferencedElement::Reset(nsIContent* aFromContent, nsIURI* aURI,
}
if (aWatch) {
nsCOMPtr<nsIAtom> atom = do_GetAtom(ref);
nsCOMPtr<nsIAtom> atom = NS_Atomize(ref);
if (!atom)
return;
atom.swap(mWatchID);
@@ -131,7 +131,7 @@ nsReferencedElement::ResetWithID(nsIContent* aFromContent, const nsString& aID,
// XXX Need to take care of XBL/XBL2
if (aWatch) {
nsCOMPtr<nsIAtom> atom = do_GetAtom(aID);
nsCOMPtr<nsIAtom> atom = NS_Atomize(aID);
if (!atom)
return;
atom.swap(mWatchID);
+1 -1
View File
@@ -117,7 +117,7 @@ nsScriptElement::MaybeProcessScript()
"You forgot to add self as observer");
if (mAlreadyStarted || !mDoneAddingChildren ||
!cont->GetCrossShadowCurrentDoc() || mMalformed || !HasScriptContent()) {
!cont->GetComposedDoc() || mMalformed || !HasScriptContent()) {
return false;
}
+1 -1
View File
@@ -73,7 +73,7 @@ nsStyledElementNotElementCSSInlineStyle::SetInlineStyleDeclaration(css::Declarat
oldValue.SetTo(oldValueStr);
}
}
else if (aNotify && IsInDoc()) {
else if (aNotify && IsInUncomposedDoc()) {
modification = !!mAttrsAndChildren.GetAttr(nsGkAtoms::style);
}
+1 -1
View File
@@ -1336,7 +1336,7 @@ nsTreeSanitizer::Sanitize(nsIContent* aFragment)
// in tree.
NS_PRECONDITION(aFragment->IsNodeOfType(nsINode::eDOCUMENT_FRAGMENT),
"Argument was not DOM fragment.");
NS_PRECONDITION(!aFragment->IsInDoc(), "The fragment is in doc?");
NS_PRECONDITION(!aFragment->IsInUncomposedDoc(), "The fragment is in doc?");
mFullDocument = false;
SanitizeChildren(aFragment);
+1 -1
View File
@@ -189,7 +189,7 @@ BrowserElementParent::DispatchOpenWindowEvent(Element* aOpenerFrameElement,
val, &status);
if (dispatchSucceeded) {
if (aPopupFrameElement->IsInDoc()) {
if (aPopupFrameElement->IsInUncomposedDoc()) {
return BrowserElementParent::OPEN_WINDOW_ADDED;
} else if (status == nsEventStatus_eConsumeNoDefault) {
// If the frame was not added to a document, report to callers whether
+9 -7
View File
@@ -250,7 +250,7 @@ nsDOMCameraControl::nsDOMCameraControl(uint32_t aCameraId,
const CameraConfiguration& aInitialConfig,
Promise* aPromise,
nsPIDOMWindow* aWindow)
: DOMMediaStream()
: DOMMediaStream(aWindow, nullptr)
, mCameraControl(nullptr)
, mAudioChannelAgent(nullptr)
, mGetCameraPromise(aPromise)
@@ -331,11 +331,6 @@ nsDOMCameraControl::nsDOMCameraControl(uint32_t aCameraId,
// we are not user/DOM facing anyway.
CreateAndAddPlaybackStreamListener(mInput);
MOZ_ASSERT(mWindow, "Shouldn't be created with a null window!");
if (mWindow->GetExtantDoc()) {
CombineWithPrincipal(mWindow->GetExtantDoc()->NodePrincipal());
}
// Register a listener for camera events.
mListener = new DOMCameraControlListener(this, mInput);
mCameraControl->AddListener(mListener);
@@ -526,10 +521,17 @@ nsDOMCameraControl::GetCameraStream() const
void
nsDOMCameraControl::TrackCreated(TrackID aTrackID) {
MOZ_ASSERT(NS_IsMainThread());
MOZ_RELEASE_ASSERT(mWindow, "Shouldn't have been created with a null window!");
nsIPrincipal* principal = mWindow->GetExtantDoc()
? mWindow->GetExtantDoc()->NodePrincipal()
: nullptr;
// This track is not connected through a port.
MediaInputPort* inputPort = nullptr;
dom::VideoStreamTrack* track =
new dom::VideoStreamTrack(this, aTrackID, nsString());
new dom::VideoStreamTrack(this, aTrackID, aTrackID,
new BasicUnstoppableTrackSource(principal));
RefPtr<TrackPort> port =
new TrackPort(inputPort, track,
TrackPort::InputPortOwnership::OWNED);
+5 -5
View File
@@ -1037,7 +1037,7 @@ CanvasRenderingContext2D::ParseColor(const nsAString& aString,
// otherwise resolve it
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
RefPtr<nsStyleContext> parentContext;
if (mCanvasElement && mCanvasElement->IsInDoc()) {
if (mCanvasElement && mCanvasElement->IsInUncomposedDoc()) {
// Inherit from the canvas element.
parentContext = nsComputedDOMStyle::GetStyleContextForElement(
mCanvasElement, nullptr, presShell);
@@ -1560,7 +1560,7 @@ CanvasRenderingContext2D::ClearTarget(int32_t aWidth, int32_t aHeight)
// For vertical writing-mode, unless text-orientation is sideways,
// we'll modify the initial value of textBaseline to 'middle'.
RefPtr<nsStyleContext> canvasStyle;
if (mCanvasElement && mCanvasElement->IsInDoc()) {
if (mCanvasElement && mCanvasElement->IsInUncomposedDoc()) {
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
if (presShell) {
canvasStyle =
@@ -2206,7 +2206,7 @@ static already_AddRefed<nsStyleContext>
GetFontParentStyleContext(Element* aElement, nsIPresShell* aPresShell,
ErrorResult& aError)
{
if (aElement && aElement->IsInDoc()) {
if (aElement && aElement->IsInUncomposedDoc()) {
// Inherit from the canvas element.
RefPtr<nsStyleContext> result =
nsComputedDOMStyle::GetStyleContextForElement(aElement, nullptr,
@@ -3825,7 +3825,7 @@ CanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
bool isRTL = false;
RefPtr<nsStyleContext> canvasStyle;
if (mCanvasElement && mCanvasElement->IsInDoc()) {
if (mCanvasElement && mCanvasElement->IsInUncomposedDoc()) {
// try to find the closest context
canvasStyle =
nsComputedDOMStyle::GetStyleContextForElement(mCanvasElement,
@@ -4514,7 +4514,7 @@ CanvasRenderingContext2D::DrawImage(const CanvasImageSource& aImage,
}
// If it doesn't have a principal, just bail
nsCOMPtr<nsIPrincipal> principal = video->GetCurrentPrincipal();
nsCOMPtr<nsIPrincipal> principal = video->GetCurrentVideoPrincipal();
if (!principal) {
aError.Throw(NS_ERROR_NOT_AVAILABLE);
return;
+1 -1
View File
@@ -627,7 +627,7 @@ ImageBitmap::CreateInternal(nsIGlobalObject* aGlobal, HTMLVideoElement& aVideoEl
}
// Check security.
nsCOMPtr<nsIPrincipal> principal = aVideoEl.GetCurrentPrincipal();
nsCOMPtr<nsIPrincipal> principal = aVideoEl.GetCurrentVideoPrincipal();
bool CORSUsed = aVideoEl.GetCORSMode() != CORS_NONE;
if (!CheckSecurityForHTMLElements(false, CORSUsed, principal)) {
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
+89 -35
View File
@@ -25,8 +25,11 @@ function CaptureStreamTestHelper(width, height) {
CaptureStreamTestHelper.prototype = {
/* Predefined colors for use in the methods below. */
black: { data: [0, 0, 0, 255], name: "black" },
blackTransparent: { data: [0, 0, 0, 0], name: "blackTransparent" },
green: { data: [0, 255, 0, 255], name: "green" },
red: { data: [255, 0, 0, 255], name: "red" },
blue: { data: [0, 0, 255, 255], name: "blue"},
grey: { data: [128, 128, 128, 255], name: "grey" },
/* Default element size for createAndAppendElement() */
elemWidth: 100,
@@ -52,55 +55,106 @@ CaptureStreamTestHelper.prototype = {
video.srcObject.requestFrame();
},
/* Tests the top left pixel of |video| against |refData|. Format [R,G,B,A]. */
testPixel: function (video, refData, threshold) {
/*
* Returns the pixel at (|offsetX|, |offsetY|) (from top left corner) of
* |video| as an array of the pixel's color channels: [R,G,B,A]. Allows
* optional scaling of the drawImage() call (so that a 1x1 black image
* won't just draw 1 pixel in the corner)
*/
getPixel: function (video, offsetX, offsetY, width, height) {
offsetX = offsetX || 0; // Set to 0 if not passed in.
offsetY = offsetY || 0; // Set to 0 if not passed in.
width = width || 0; // Set to 0 if not passed in.
height = height || 0; // Set to 0 if not passed in.
// Avoids old values in case of a transparent image.
CaptureStreamTestHelper2D.prototype.clear.call(this, this.cout);
var ctxout = this.cout.getContext('2d');
ctxout.drawImage(video, 0, 0);
var pixel = ctxout.getImageData(0, 0, 1, 1).data;
return pixel.every((val, i) => Math.abs(val - refData[i]) <= threshold);
if (width != 0 || height != 0) {
ctxout.drawImage(video, 0, 0, width, height);
} else {
ctxout.drawImage(video, 0, 0);
}
return ctxout.getImageData(offsetX, offsetY, 1, 1).data;
},
/*
* Returns a promise that resolves when the pixel matches. Use |threshold|
* for fuzzy matching the color on each channel, in the range [0,255].
* Returns true if px lies within the per-channel |threshold| of the
* referenced color for all channels. px is on the form of an array of color
* channels, [R,G,B,A]. Each channel is in the range [0, 255].
*/
waitForPixel: function (video, refColor, threshold, infoString) {
isPixel: function (px, refColor, threshold) {
threshold = threshold || 0; // Default to 0 (exact match) if not passed in.
return px.every((ch, i) => Math.abs(ch - refColor.data[i]) <= threshold);
},
/*
* Returns true if px lies further away than |threshold| of the
* referenced color for any channel. px is on the form of an array of color
* channels, [R,G,B,A]. Each channel is in the range [0, 255].
*/
isPixelNot: function (px, refColor, threshold) {
if (threshold === undefined) {
// Default to 127 (should be sufficiently far away) if not passed in.
threshold = 127;
}
return px.some((ch, i) => Math.abs(ch - refColor.data[i]) > threshold);
},
/*
* Returns a promise that resolves when the provided function |test|
* returns true.
*/
waitForPixel: function (video, offsetX, offsetY, test, timeout, width, height) {
return new Promise(resolve => {
info("Testing " + video.id + " against [" + refColor.data.join(',') + "]");
CaptureStreamTestHelper2D.prototype.clear.call(this, this.cout);
video.ontimeupdate = () => {
if (this.testPixel(video, refColor.data, threshold)) {
ok(true, video.id + " " + infoString);
video.ontimeupdate = null;
resolve();
const startTime = video.currentTime;
var ontimeupdate = () => {
var pixelMatch = false;
try {
pixelMatch = test(this.getPixel(video, offsetX, offsetY, width, height));
} catch (NS_ERROR_NOT_AVAILABLE) {
info("Waiting for pixel but no video available");
}
if (!pixelMatch &&
(!timeout || video.currentTime < startTime + (timeout / 1000.0))) {
// No match yet and,
// No timeout (waiting indefinitely) or |timeout| has not passed yet.
return;
}
video.removeEventListener("timeupdate", ontimeupdate);
resolve(pixelMatch);
};
video.addEventListener("timeupdate", ontimeupdate);
});
},
/*
* Returns a promise that resolves after |timeout| ms of playback or when a
* pixel of |video| becomes the color |refData|. The test is failed if the
* Returns a promise that resolves when the top left pixel of |video| matches
* on all channels. Use |threshold| for fuzzy matching the color on each
* channel, in the range [0,255].
*/
waitForPixelColor: function (video, refColor, threshold, infoString) {
info("Waiting for video " + video.id + " to match [" +
refColor.data.join(',') + "] - " + refColor.name +
" (" + infoString + ")");
return this.waitForPixel(video, 0, 0,
px => this.isPixel(px, refColor, threshold))
.then(() => ok(true, video.id + " " + infoString));
},
/*
* Returns a promise that resolves after |timeout| ms of playback or when the
* top left pixel of |video| becomes |refColor|. The test is failed if the
* timeout is not reached.
*/
waitForPixelToTimeout: function (video, refColor, threshold, timeout, infoString) {
return new Promise(resolve => {
info("Waiting for " + video.id + " to time out after " + timeout +
"ms against [" + refColor.data.join(',') + "] - " + refColor.name);
CaptureStreamTestHelper2D.prototype.clear.call(this, this.cout);
var startTime = video.currentTime;
video.ontimeupdate = () => {
if (this.testPixel(video, refColor.data, threshold)) {
ok(false, video.id + " " + infoString);
video.ontimeupdate = null;
resolve();
} else if (video.currentTime > startTime + (timeout / 1000.0)) {
ok(true, video.id + " " + infoString);
video.ontimeupdate = null;
resolve();
}
};
});
waitForPixelColorTimeout: function (video, refColor, threshold, timeout, infoString) {
info("Waiting for " + video.id + " to time out after " + timeout +
"ms against [" + refColor.data.join(',') + "] - " + refColor.name);
return this.waitForPixel(video, 0, 0,
px => this.isPixel(px, refColor, threshold),
timeout)
.then(result => ok(!result, video.id + " " + infoString));
},
/* Create an element of type |type| with id |id| and append it to the body. */
+32 -17
View File
@@ -23,15 +23,21 @@ function checkDrawColorInitialRed() {
vmanual.srcObject = c.captureStream(0);
vrate.srcObject = c.captureStream(10);
ok(h.testPixel(vauto, [0, 0, 0, 0], 0), "vauto hould not be drawn to before stable state");
ok(h.testPixel(vrate, [0, 0, 0, 0], 0), "vrate Should not be drawn to before stable state");
ok(h.testPixel(vmanual, [0, 0, 0, 0], 0), "vmanual Should not be drawn to before stable state");
ok(h.isPixel(h.getPixel(vauto), h.blackTransparent, 0),
"vauto should not be drawn to before stable state");
ok(h.isPixel(h.getPixel(vrate), h.blackTransparent, 0),
"vrate should not be drawn to before stable state");
ok(h.isPixel(h.getPixel(vmanual), h.blackTransparent, 0),
"vmanual should not be drawn to before stable state");
return Promise.resolve()
.then(() => h.waitForPixel(vauto, h.red, 0, "should become red automatically"))
.then(() => h.waitForPixel(vrate, h.red, 0, "should become red automatically"))
.then(() => h.waitForPixel(vmanual, h.red, 0, "should become red when we get" +
" to stable state (first frame)"));
.then(() => h.waitForPixelColor(vauto, h.red, 0,
"should become red automatically"))
.then(() => h.waitForPixelColor(vrate, h.red, 0,
"should become red automatically"))
.then(() => h.waitForPixelColor(vmanual, h.red, 0,
"should become red when we get" +
" to stable state (first frame)"));
}
function checkDrawColorGreen() {
@@ -40,11 +46,15 @@ function checkDrawColorGreen() {
var drawing = h.startDrawing(() => h.drawColor(c, h.green));
return Promise.resolve()
.then(() => h.waitForPixel(vauto, h.green, 0, "should become green automatically"))
.then(() => h.waitForPixel(vrate, h.green, 0, "should become green automatically"))
.then(() => h.waitForPixel(vmanual, h.red, 0, "should still be red"))
.then(() => h.waitForPixelColor(vauto, h.green, 0,
"should become green automatically"))
.then(() => h.waitForPixelColor(vrate, h.green, 0,
"should become green automatically"))
.then(() => h.waitForPixelColor(vmanual, h.red, 0,
"should still be red"))
.then(() => h.requestFrame(vmanual))
.then(() => h.waitForPixel(vmanual, h.green, 0, "should become green after requstFrame()"))
.then(() => h.waitForPixelColor(vmanual, h.green, 0,
"should become green after requstFrame()"))
.catch(err => ok(false, "checkDrawColorGreen failed: ", err))
.then(() => drawing.stop());
}
@@ -54,10 +64,12 @@ function checkRequestFrameOrderGuarantee() {
"call results in the expected frame seen in the stream.");
return Promise.resolve()
.then(() => h.waitForPixel(vmanual, h.green, 0, "should still be green"))
.then(() => h.waitForPixelColor(vmanual, h.green, 0,
"should still be green"))
.then(() => h.drawColor(c, h.red)) // 1. Draw canvas red
.then(() => h.requestFrame(vmanual)) // 2. Immediately request a frame
.then(() => h.waitForPixel(vmanual, h.red, 0, "should become red after call order test"))
.then(() => h.waitForPixelColor(vmanual, h.red, 0,
"should become red after call order test"))
}
function checkDrawImageNotCleanRed() {
@@ -74,11 +86,14 @@ function checkDrawImageNotCleanRed() {
})
.then(() => drawing = h.startDrawing(() => ctx.drawImage(notCleanRed, 0, 0, c.width, c.height)))
.then(() => h.testNotClean(c))
.then(() => h.waitForPixelToTimeout(vauto, h.red, 0, 1000, "should not become red"))
.then(() => h.waitForPixelToTimeout(vrate, h.red, 0, 0, "should not become red"))
.then(() => h.waitForPixel(vmanual, h.green, 0, "should still be green"))
.then(() => h.waitForPixelColorTimeout(vauto, h.red, 0, 1000,
"should not become red"))
.then(() => h.isPixelNot(h.getPixel(vrate), h.red, 250,
"should not have become red"))
.then(() => h.waitForPixelColor(vmanual, h.green, 0, "should still be green"))
.then(() => h.requestFrame(vmanual))
.then(() => h.waitForPixelToTimeout(vmanual, h.red, 0, 1000, "should not become red"))
.then(() => h.waitForPixelColorTimeout(vmanual, h.red, 0, 1000,
"should not become red"))
.catch(err => ok(false, "checkDrawImageNotCleanRed failed: ", err))
.then(() => drawing.stop());
}
@@ -54,14 +54,21 @@ function checkClearColorInitialRed() {
vmanual.srcObject = c.captureStream(0);
vrate.srcObject = c.captureStream(10);
ok(h.testPixel(vauto, [0, 0, 0, 0], 0), "Should not be drawn to before stable state");
ok(h.testPixel(vrate, [0, 0, 0, 0], 0), "Should not be drawn to before stable state");
ok(h.testPixel(vmanual, [0, 0, 0, 0], 0), "Should not be drawn to before stable state");
ok(h.isPixel(h.getPixel(vauto), h.blackTransparent, 0,
"vauto should not be drawn to before stable state"));
ok(h.isPixel(h.getPixel(vrate), h.blackTransparent, 0,
"vrate should not be drawn to before stable state"));
ok(h.isPixel(h.getPixel(vmanual), h.blackTransparent, 0,
"vmanual should not be drawn to before stable state"));
return Promise.resolve()
.then(() => h.waitForPixel(vauto, h.red, 0, "should become red automatically"))
.then(() => h.waitForPixel(vrate, h.red, 0, "should become red automatically"))
.then(() => h.waitForPixel(vmanual, h.red, 0, "should become red when we get to stable state (first frame)"))
.then(() => h.waitForPixelColor(vauto, h.red, 0,
"should become red automatically"))
.then(() => h.waitForPixelColor(vrate, h.red, 0,
"should become red automatically"))
.then(() => h.waitForPixelColor(vmanual, h.red, 0,
"should become red when we get to stable " +
"state (first frame)"))
}
function checkDrawColorGreen() {
@@ -69,11 +76,15 @@ function checkDrawColorGreen() {
var drawing = h.startDrawing(h.drawColor.bind(h, c, h.green));
checkGLError('after DrawColor');
return Promise.resolve()
.then(() => h.waitForPixel(vauto, h.green, 0, "should become green automatically"))
.then(() => h.waitForPixel(vrate, h.green, 0, "should become green automatically"))
.then(() => h.waitForPixel(vmanual, h.red, 0, "should still be red"))
.then(() => h.waitForPixelColor(vauto, h.green, 0,
"should become green automatically"))
.then(() => h.waitForPixelColor(vrate, h.green, 0,
"should become green automatically"))
.then(() => h.waitForPixelColor(vmanual, h.red, 0,
"should still be red"))
.then(() => h.requestFrame(vmanual))
.then(() => h.waitForPixel(vmanual, h.green, 0, "should become green after requstFrame()"))
.then(() => h.waitForPixelColor(vmanual, h.green, 0,
"should become green after requstFrame()"))
.then(() => drawing.stop());
}
@@ -81,11 +92,15 @@ function checkClearColorRed() {
info("Checking that clearing to red works.");
var drawing = h.startDrawing(h.clearColor.bind(h, c, h.red));
return Promise.resolve()
.then(() => h.waitForPixel(vauto, h.red, 0, "should become red automatically"))
.then(() => h.waitForPixel(vrate, h.red, 0, "should become red automatically"))
.then(() => h.waitForPixel(vmanual, h.green, 0, "should still be green"))
.then(() => h.waitForPixelColor(vauto, h.red, 0,
"should become red automatically"))
.then(() => h.waitForPixelColor(vrate, h.red, 0,
"should become red automatically"))
.then(() => h.waitForPixelColor(vmanual, h.green, 0,
"should still be green"))
.then(() => h.requestFrame(vmanual))
.then(() => h.waitForPixel(vmanual, h.red, 0, "should become red after requestFrame()"))
.then(() => h.waitForPixelColor(vmanual, h.red, 0,
"should become red after requestFrame()"))
.then(() => drawing.stop());
}
@@ -93,10 +108,11 @@ function checkRequestFrameOrderGuarantee() {
info("Checking that requestFrame() immediately after a draw " +
"call results in the expected frame seen in the stream.");
return Promise.resolve()
.then(() => h.waitForPixel(vmanual, h.red, 0, "should still be red"))
.then(() => h.waitForPixelColor(vmanual, h.red, 0, "should still be red"))
.then(() => h.drawColor(c, h.green)) // 1. Draw canvas green
.then(() => h.requestFrame(vmanual)) // 2. Immediately request a frame
.then(() => h.waitForPixel(vmanual, h.green, 0, "should become green after call order test"))
.then(() => h.waitForPixelColor(vmanual, h.green, 0,
"should become green after call order test"))
}
function finish() {
+1 -1
View File
@@ -22,7 +22,7 @@ AnimationEvent::AnimationEvent(EventTarget* aOwner,
}
else {
mEventIsInternal = true;
mEvent->time = PR_Now();
mEvent->mTime = PR_Now();
}
}
+1 -1
View File
@@ -26,7 +26,7 @@ BeforeAfterKeyboardEvent::BeforeAfterKeyboardEvent(
if (!aEvent) {
mEventIsInternal = true;
mEvent->time = PR_Now();
mEvent->mTime = PR_Now();
}
}
+6 -6
View File
@@ -22,7 +22,7 @@ ClipboardEvent::ClipboardEvent(EventTarget* aOwner,
mEventIsInternal = false;
} else {
mEventIsInternal = true;
mEvent->time = PR_Now();
mEvent->mTime = PR_Now();
}
}
@@ -54,7 +54,7 @@ ClipboardEvent::InitClipboardEvent(const nsAString& aType, bool aCanBubble,
DataTransfer* aClipboardData)
{
Event::InitEvent(aType, aCanBubble, aCancelable);
mEvent->AsClipboardEvent()->clipboardData = aClipboardData;
mEvent->AsClipboardEvent()->mClipboardData = aClipboardData;
}
already_AddRefed<ClipboardEvent>
@@ -98,19 +98,19 @@ ClipboardEvent::GetClipboardData()
{
InternalClipboardEvent* event = mEvent->AsClipboardEvent();
if (!event->clipboardData) {
if (!event->mClipboardData) {
if (mEventIsInternal) {
event->clipboardData =
event->mClipboardData =
new DataTransfer(ToSupports(this), eCopy, false, -1);
} else {
event->clipboardData =
event->mClipboardData =
new DataTransfer(ToSupports(this), event->mMessage,
event->mMessage == ePaste,
nsIClipboard::kGlobalClipboard);
}
}
return event->clipboardData;
return event->mClipboardData;
}
} // namespace dom
+2 -2
View File
@@ -18,7 +18,7 @@ CommandEvent::CommandEvent(EventTarget* aOwner,
aEvent ? aEvent :
new WidgetCommandEvent(false, nullptr, nullptr, nullptr))
{
mEvent->time = PR_Now();
mEvent->mTime = PR_Now();
if (aEvent) {
mEventIsInternal = false;
} else {
@@ -53,7 +53,7 @@ CommandEvent::InitCommandEvent(const nsAString& aTypeArg,
{
Event::InitEvent(aTypeArg, aCanBubbleArg, aCancelableArg);
mEvent->AsCommandEvent()->command = do_GetAtom(aCommand);
mEvent->AsCommandEvent()->command = NS_Atomize(aCommand);
return NS_OK;
}
+1 -1
View File
@@ -25,7 +25,7 @@ CompositionEvent::CompositionEvent(EventTarget* aOwner,
mEventIsInternal = false;
} else {
mEventIsInternal = true;
mEvent->time = PR_Now();
mEvent->mTime = PR_Now();
// XXX compositionstart is cancelable in draft of DOM3 Events.
// However, it doesn't make sence for us, we cannot cancel composition
+13 -12
View File
@@ -183,9 +183,9 @@ ContentEventHandler::InitCommon()
NS_ENSURE_TRUE(endNode, NS_ERROR_FAILURE);
// See bug 537041 comment 5, the range could have removed node.
NS_ENSURE_TRUE(startNode->GetCurrentDoc() == mPresShell->GetDocument(),
NS_ENSURE_TRUE(startNode->GetUncomposedDoc() == mPresShell->GetDocument(),
NS_ERROR_NOT_AVAILABLE);
NS_ASSERTION(startNode->GetCurrentDoc() == endNode->GetCurrentDoc(),
NS_ASSERTION(startNode->GetUncomposedDoc() == endNode->GetUncomposedDoc(),
"mFirstSelectedRange crosses the document boundary");
mRootContent = startNode->GetSelectionRootContent(mPresShell);
@@ -1525,9 +1525,9 @@ ContentEventHandler::OnQueryCharacterAtPoint(WidgetQueryContentEvent* aEvent)
// The root frame's widget might be different, e.g., the event was fired on
// a popup but the rootFrame is the document root.
if (rootWidget != aEvent->widget) {
NS_PRECONDITION(aEvent->widget, "The event must have the widget");
nsView* view = nsView::GetViewFor(aEvent->widget);
if (rootWidget != aEvent->mWidget) {
NS_PRECONDITION(aEvent->mWidget, "The event must have the widget");
nsView* view = nsView::GetViewFor(aEvent->mWidget);
NS_ENSURE_TRUE(view, NS_ERROR_FAILURE);
rootFrame = view->GetFrame();
NS_ENSURE_TRUE(rootFrame, NS_ERROR_FAILURE);
@@ -1538,9 +1538,9 @@ ContentEventHandler::OnQueryCharacterAtPoint(WidgetQueryContentEvent* aEvent)
WidgetQueryContentEvent eventOnRoot(true, eQueryCharacterAtPoint,
rootWidget);
eventOnRoot.mUseNativeLineBreak = aEvent->mUseNativeLineBreak;
eventOnRoot.refPoint = aEvent->refPoint;
if (rootWidget != aEvent->widget) {
eventOnRoot.refPoint += aEvent->widget->WidgetToScreenOffset() -
eventOnRoot.mRefPoint = aEvent->mRefPoint;
if (rootWidget != aEvent->mWidget) {
eventOnRoot.mRefPoint += aEvent->mWidget->WidgetToScreenOffset() -
rootWidget->WidgetToScreenOffset();
}
nsPoint ptInRoot =
@@ -1602,7 +1602,7 @@ ContentEventHandler::OnQueryCharacterAtPoint(WidgetQueryContentEvent* aEvent)
return rv;
}
WidgetQueryContentEvent textRect(true, eQueryTextRect, aEvent->widget);
WidgetQueryContentEvent textRect(true, eQueryTextRect, aEvent->mWidget);
textRect.InitForQueryTextRect(offset, 1, aEvent->mUseNativeLineBreak);
rv = OnQueryTextRect(&textRect);
NS_ENSURE_SUCCESS(rv, rv);
@@ -1628,14 +1628,15 @@ ContentEventHandler::OnQueryDOMWidgetHittest(WidgetQueryContentEvent* aEvent)
aEvent->mSucceeded = false;
aEvent->mReply.mWidgetIsHit = false;
NS_ENSURE_TRUE(aEvent->widget, NS_ERROR_FAILURE);
NS_ENSURE_TRUE(aEvent->mWidget, NS_ERROR_FAILURE);
nsIDocument* doc = mPresShell->GetDocument();
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
nsIFrame* docFrame = mPresShell->GetRootFrame();
NS_ENSURE_TRUE(docFrame, NS_ERROR_FAILURE);
LayoutDeviceIntPoint eventLoc = aEvent->refPoint + aEvent->widget->WidgetToScreenOffset();
LayoutDeviceIntPoint eventLoc =
aEvent->mRefPoint + aEvent->mWidget->WidgetToScreenOffset();
nsIntRect docFrameRect = docFrame->GetScreenRect(); // Returns CSS pixels
CSSIntPoint eventLocCSS(
mPresContext->DevPixelsToIntCSSPixels(eventLoc.x) - docFrameRect.x,
@@ -1652,7 +1653,7 @@ ContentEventHandler::OnQueryDOMWidgetHittest(WidgetQueryContentEvent* aEvent)
} else if (targetFrame) {
targetWidget = targetFrame->GetNearestWidget();
}
if (aEvent->widget == targetWidget) {
if (aEvent->mWidget == targetWidget) {
aEvent->mReply.mWidgetIsHit = true;
}
}
+16 -10
View File
@@ -162,7 +162,7 @@ DataTransfer::Constructor(const GlobalObject& aGlobal,
{
nsAutoCString onEventType("on");
AppendUTF16toUTF8(aEventType, onEventType);
nsCOMPtr<nsIAtom> eventTypeAtom = do_GetAtom(onEventType);
nsCOMPtr<nsIAtom> eventTypeAtom = NS_Atomize(onEventType);
if (!eventTypeAtom) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return nullptr;
@@ -320,13 +320,19 @@ DataTransfer::GetFileListInternal(ErrorResult& aRv,
RefPtr<File> domFile;
if (file) {
#ifdef DEBUG
if (XRE_GetProcessType() == GeckoProcessType_Default) {
bool isDir;
file->IsDirectory(&isDir);
MOZ_ASSERT(!isDir, "How did we get here?");
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default,
"nsIFile objects are not expected on the content process");
bool isDir;
aRv = file->IsDirectory(&isDir);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
#endif
if (isDir) {
continue;
}
domFile = File::CreateFromFile(GetParentObject(), file);
} else {
nsCOMPtr<BlobImpl> blobImpl = do_QueryInterface(supports);
@@ -940,8 +946,8 @@ DataTransfer::GetTransferables(nsIDOMNode* aDragTarget)
if (!dragNode) {
return nullptr;
}
nsIDocument* doc = dragNode->GetCurrentDoc();
nsIDocument* doc = dragNode->GetUncomposedDoc();
if (!doc) {
return nullptr;
}
@@ -1052,7 +1058,7 @@ DataTransfer::ConvertFromVariant(nsIVariant* aVariant,
nsCOMPtr<nsISupports> data;
if (NS_FAILED(aVariant->GetAsISupports(getter_AddRefs(data))))
return false;
nsCOMPtr<nsIFlavorDataProvider> fdp = do_QueryInterface(data);
if (fdp) {
// for flavour data providers, use kFlavorHasDataProvider (which has the
+5 -5
View File
@@ -24,8 +24,8 @@ DragEvent::DragEvent(EventTarget* aOwner,
}
else {
mEventIsInternal = true;
mEvent->time = PR_Now();
mEvent->refPoint.x = mEvent->refPoint.y = 0;
mEvent->mTime = PR_Now();
mEvent->mRefPoint = LayoutDeviceIntPoint(0, 0);
mEvent->AsMouseEvent()->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
}
}
@@ -66,7 +66,7 @@ DragEvent::InitDragEvent(const nsAString& aType,
}
if (mEventIsInternal && mEvent) {
mEvent->AsDragEvent()->dataTransfer = aDataTransfer;
mEvent->AsDragEvent()->mDataTransfer = aDataTransfer;
}
}
@@ -98,7 +98,7 @@ DragEvent::InitDragEvent(const nsAString& aType,
NS_ENSURE_SUCCESS(rv, rv);
if (mEventIsInternal && mEvent) {
mEvent->AsDragEvent()->dataTransfer = dataTransfer;
mEvent->AsDragEvent()->mDataTransfer = dataTransfer;
}
return NS_OK;
@@ -130,7 +130,7 @@ DragEvent::GetDataTransfer()
NS_ENSURE_SUCCESS(rv, nullptr);
}
return dragEvent->dataTransfer;
return dragEvent->mDataTransfer;
}
// static
+52 -62
View File
@@ -107,7 +107,7 @@ Event::ConstructorInit(EventTarget* aOwner,
}
*/
mEvent = new WidgetEvent(false, eVoidEvent);
mEvent->time = PR_Now();
mEvent->mTime = PR_Now();
}
InitPresContextData(aPresContext);
@@ -153,9 +153,9 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Event)
if (tmp->mEventIsInternal) {
tmp->mEvent->target = nullptr;
tmp->mEvent->currentTarget = nullptr;
tmp->mEvent->originalTarget = nullptr;
tmp->mEvent->mTarget = nullptr;
tmp->mEvent->mCurrentTarget = nullptr;
tmp->mEvent->mOriginalTarget = nullptr;
switch (tmp->mEvent->mClass) {
case eMouseEventClass:
case eMouseScrollEventClass:
@@ -166,18 +166,18 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Event)
break;
case eDragEventClass: {
WidgetDragEvent* dragEvent = tmp->mEvent->AsDragEvent();
dragEvent->dataTransfer = nullptr;
dragEvent->mDataTransfer = nullptr;
dragEvent->relatedTarget = nullptr;
break;
}
case eClipboardEventClass:
tmp->mEvent->AsClipboardEvent()->clipboardData = nullptr;
tmp->mEvent->AsClipboardEvent()->mClipboardData = nullptr;
break;
case eMutationEventClass:
tmp->mEvent->AsMutationEvent()->mRelatedNode = nullptr;
break;
case eFocusEventClass:
tmp->mEvent->AsFocusEvent()->relatedTarget = nullptr;
tmp->mEvent->AsFocusEvent()->mRelatedTarget = nullptr;
break;
default:
break;
@@ -191,9 +191,9 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Event)
if (tmp->mEventIsInternal) {
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mEvent->target)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mEvent->currentTarget)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mEvent->originalTarget)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mEvent->mTarget)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mEvent->mCurrentTarget)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mEvent->mOriginalTarget)
switch (tmp->mEvent->mClass) {
case eMouseEventClass:
case eMouseScrollEventClass:
@@ -205,23 +205,23 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Event)
break;
case eDragEventClass: {
WidgetDragEvent* dragEvent = tmp->mEvent->AsDragEvent();
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->dataTransfer");
cb.NoteXPCOMChild(dragEvent->dataTransfer);
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->mDataTransfer");
cb.NoteXPCOMChild(dragEvent->mDataTransfer);
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->relatedTarget");
cb.NoteXPCOMChild(dragEvent->relatedTarget);
break;
}
case eClipboardEventClass:
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->clipboardData");
cb.NoteXPCOMChild(tmp->mEvent->AsClipboardEvent()->clipboardData);
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->mClipboardData");
cb.NoteXPCOMChild(tmp->mEvent->AsClipboardEvent()->mClipboardData);
break;
case eMutationEventClass:
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->mRelatedNode");
cb.NoteXPCOMChild(tmp->mEvent->AsMutationEvent()->mRelatedNode);
break;
case eFocusEventClass:
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->relatedTarget");
cb.NoteXPCOMChild(tmp->mEvent->AsFocusEvent()->relatedTarget);
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->mRelatedTarget");
cb.NoteXPCOMChild(tmp->mEvent->AsFocusEvent()->mRelatedTarget);
break;
default:
break;
@@ -258,8 +258,8 @@ Event::IsChrome(JSContext* aCx) const
NS_METHOD
Event::GetType(nsAString& aType)
{
if (!mIsMainThreadEvent || !mEvent->typeString.IsEmpty()) {
aType = mEvent->typeString;
if (!mIsMainThreadEvent || !mEvent->mSpecifiedEventTypeString.IsEmpty()) {
aType = mEvent->mSpecifiedEventTypeString;
return NS_OK;
}
const char* name = GetEventName(mEvent->mMessage);
@@ -267,9 +267,11 @@ Event::GetType(nsAString& aType)
if (name) {
CopyASCIItoUTF16(name, aType);
return NS_OK;
} else if (mEvent->mMessage == eUnidentifiedEvent && mEvent->userType) {
aType = Substring(nsDependentAtomString(mEvent->userType), 2); // Remove "on"
mEvent->typeString = aType;
} else if (mEvent->mMessage == eUnidentifiedEvent &&
mEvent->mSpecifiedEventType) {
// Remove "on"
aType = Substring(nsDependentAtomString(mEvent->mSpecifiedEventType), 2);
mEvent->mSpecifiedEventTypeString = aType;
return NS_OK;
}
@@ -286,7 +288,7 @@ GetDOMEventTarget(nsIDOMEventTarget* aTarget)
EventTarget*
Event::GetTarget() const
{
return GetDOMEventTarget(mEvent->target);
return GetDOMEventTarget(mEvent->mTarget);
}
NS_METHOD
@@ -299,7 +301,7 @@ Event::GetTarget(nsIDOMEventTarget** aTarget)
EventTarget*
Event::GetCurrentTarget() const
{
return GetDOMEventTarget(mEvent->currentTarget);
return GetDOMEventTarget(mEvent->mCurrentTarget);
}
NS_IMETHODIMP
@@ -317,7 +319,7 @@ Event::GetTargetFromFrame()
{
if (!mPresContext) { return nullptr; }
// Get the target frame (have to get the ESM first)
// Get the mTarget frame (have to get the ESM first)
nsIFrame* targetFrame = mPresContext->EventStateManager()->GetEventTarget();
if (!targetFrame) { return nullptr; }
@@ -346,8 +348,8 @@ Event::GetExplicitOriginalTarget(nsIDOMEventTarget** aRealEventTarget)
EventTarget*
Event::GetOriginalTarget() const
{
if (mEvent->originalTarget) {
return GetDOMEventTarget(mEvent->originalTarget);
if (mEvent->mOriginalTarget) {
return GetDOMEventTarget(mEvent->mOriginalTarget);
}
return GetTarget();
@@ -421,8 +423,8 @@ Event::EventPhase() const
{
// Note, remember to check that this works also
// if or when Bug 235441 is fixed.
if ((mEvent->currentTarget &&
mEvent->currentTarget == mEvent->target) ||
if ((mEvent->mCurrentTarget &&
mEvent->mCurrentTarget == mEvent->mTarget) ||
mEvent->mFlags.InTargetPhase()) {
return nsIDOMEvent::AT_TARGET;
}
@@ -459,7 +461,7 @@ Event::GetCancelable(bool* aCancelable)
NS_IMETHODIMP
Event::GetTimeStamp(uint64_t* aTimeStamp)
{
*aTimeStamp = mEvent->time;
*aTimeStamp = mEvent->mTime;
return NS_OK;
}
@@ -530,9 +532,9 @@ Event::PreventDefaultInternal(bool aCalledByDefaultHandler)
return;
}
nsCOMPtr<nsINode> node = do_QueryInterface(mEvent->currentTarget);
nsCOMPtr<nsINode> node = do_QueryInterface(mEvent->mCurrentTarget);
if (!node) {
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(mEvent->currentTarget);
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(mEvent->mCurrentTarget);
if (!win) {
return;
}
@@ -547,14 +549,14 @@ void
Event::SetEventType(const nsAString& aEventTypeArg)
{
if (mIsMainThreadEvent) {
mEvent->typeString.Truncate();
mEvent->userType =
mEvent->mSpecifiedEventTypeString.Truncate();
mEvent->mSpecifiedEventType =
nsContentUtils::GetEventMessageAndAtom(aEventTypeArg, mEvent->mClass,
&(mEvent->mMessage));
} else {
mEvent->userType = nullptr;
mEvent->mSpecifiedEventType = nullptr;
mEvent->mMessage = eUnidentifiedEvent;
mEvent->typeString = aEventTypeArg;
mEvent->mSpecifiedEventTypeString = aEventTypeArg;
}
}
@@ -584,8 +586,8 @@ Event::InitEvent(const nsAString& aEventTypeArg,
// Clearing the old targets, so that the event is targeted correctly when
// re-dispatching it.
mEvent->target = nullptr;
mEvent->originalTarget = nullptr;
mEvent->mTarget = nullptr;
mEvent->mOriginalTarget = nullptr;
}
NS_IMETHODIMP
@@ -616,14 +618,14 @@ Event::SetTarget(nsIDOMEventTarget* aTarget)
}
#endif
mEvent->target = do_QueryInterface(aTarget);
mEvent->mTarget = do_QueryInterface(aTarget);
return NS_OK;
}
NS_IMETHODIMP_(bool)
Event::IsDispatchStopped()
{
return mEvent->mFlags.mPropagationStopped;
return mEvent->PropagationStopped();
}
NS_IMETHODIMP_(WidgetEvent*)
@@ -914,18 +916,18 @@ Event::GetScreenCoords(nsPresContext* aPresContext,
// Doing a straight conversion from LayoutDeviceIntPoint to CSSIntPoint
// seem incorrect, but it is needed to maintain legacy functionality.
WidgetGUIEvent* guiEvent = aEvent->AsGUIEvent();
if (!aPresContext || !(guiEvent && guiEvent->widget)) {
if (!aPresContext || !(guiEvent && guiEvent->mWidget)) {
return CSSIntPoint(aPoint.x, aPoint.y);
}
nsPoint pt =
LayoutDevicePixel::ToAppUnits(aPoint, aPresContext->DeviceContext()->AppUnitsPerDevPixelAtUnitFullZoom());
if (aPresContext->PresShell()) {
pt = pt.RemoveResolution(nsLayoutUtils::GetCurrentAPZResolutionScale(aPresContext->PresShell()));
if (nsIPresShell* ps = aPresContext->GetPresShell()) {
pt = pt.RemoveResolution(nsLayoutUtils::GetCurrentAPZResolutionScale(ps));
}
pt += LayoutDevicePixel::ToAppUnits(guiEvent->widget->WidgetToScreenOffset(),
pt += LayoutDevicePixel::ToAppUnits(guiEvent->mWidget->WidgetToScreenOffset(),
aPresContext->DeviceContext()->AppUnitsPerDevPixelAtUnitFullZoom());
return CSSPixel::FromAppUnitsRounded(pt);
@@ -973,7 +975,7 @@ Event::GetClientCoords(nsPresContext* aPresContext,
aEvent->mClass != ePointerEventClass &&
aEvent->mClass != eSimpleGestureEventClass) ||
!aPresContext ||
!aEvent->AsGUIEvent()->widget) {
!aEvent->AsGUIEvent()->mWidget) {
return aDefaultPoint;
}
@@ -998,22 +1000,10 @@ Event::GetOffsetCoords(nsPresContext* aPresContext,
LayoutDeviceIntPoint aPoint,
CSSIntPoint aDefaultPoint)
{
// XXX: Known spec bug (WD 3 August 2016):
// The behavior in the spec doesn't do "during and after the dispatch".
// It just does "during the dispatch", and goes back to "pageX" after the
// dispatch. This is not expected (and cf. implemented) behavior, so we
// don't follow the spec here to align the property with all other browsers.
// Spec-compliant would be:
// if (!aEvent->mFlags.mIsBeingDispatched) {
// return GetPageCoords(aPresContext, aEvent, aPoint, aDefaultPoint);
// }
// See also:
// https://www.w3.org/Bugs/Public/show_bug.cgi?id=16673
if (!aEvent->target) {
if (!aEvent->mTarget) {
return GetPageCoords(aPresContext, aEvent, aPoint, aDefaultPoint);
}
nsCOMPtr<nsIContent> content = do_QueryInterface(aEvent->target);
nsCOMPtr<nsIContent> content = do_QueryInterface(aEvent->mTarget);
if (!content || !aPresContext) {
return CSSIntPoint(0, 0);
}
@@ -1085,10 +1075,10 @@ double
Event::TimeStamp() const
{
if (!sReturnHighResTimeStamp) {
return static_cast<double>(mEvent->time);
return static_cast<double>(mEvent->mTime);
}
if (mEvent->timeStamp.IsNull()) {
if (mEvent->mTimeStamp.IsNull()) {
return 0.0;
}
@@ -1106,7 +1096,7 @@ Event::TimeStamp() const
return 0.0;
}
return perf->GetDOMTiming()->TimeStampToDOMHighRes(mEvent->timeStamp);
return perf->GetDOMTiming()->TimeStampToDOMHighRes(mEvent->mTimeStamp);
}
// For dedicated workers, we should make times relative to the navigation
@@ -1117,7 +1107,7 @@ Event::TimeStamp() const
MOZ_ASSERT(workerPrivate);
TimeDuration duration =
mEvent->timeStamp - workerPrivate->NowBaseTimeStamp();
mEvent->mTimeStamp - workerPrivate->NowBaseTimeStamp();
return duration.ToMilliseconds();
}
+10
View File
@@ -189,6 +189,16 @@ public:
return mEvent->DefaultPrevented();
}
bool DefaultPreventedByChrome() const
{
return mEvent->mFlags.mDefaultPreventedByChrome;
}
bool DefaultPreventedByContent() const
{
return mEvent->mFlags.mDefaultPreventedByContent;
}
bool MultipleActionsPrevented() const
{
return mEvent->mFlags.mMultipleActionsPrevented;
+26 -26
View File
@@ -244,7 +244,7 @@ public:
if (WantsWillHandleEvent()) {
mTarget->WillHandleEvent(aVisitor);
}
if (aVisitor.mEvent->mFlags.mPropagationStopped) {
if (aVisitor.mEvent->PropagationStopped()) {
return;
}
if (aVisitor.mEvent->mFlags.mOnlySystemGroupDispatchInContent &&
@@ -259,13 +259,13 @@ public:
mManager = mTarget->GetExistingListenerManager();
}
if (mManager) {
NS_ASSERTION(aVisitor.mEvent->currentTarget == nullptr,
NS_ASSERTION(aVisitor.mEvent->mCurrentTarget == nullptr,
"CurrentTarget should be null!");
mManager->HandleEvent(aVisitor.mPresContext, aVisitor.mEvent,
&aVisitor.mDOMEvent,
CurrentTarget(),
&aVisitor.mEventStatus);
NS_ASSERTION(aVisitor.mEvent->currentTarget == nullptr,
NS_ASSERTION(aVisitor.mEvent->mCurrentTarget == nullptr,
"CurrentTarget should be null!");
}
}
@@ -333,7 +333,7 @@ EventTargetChainItem::HandleEventTargetChain(
ELMCreationDetector& aCd)
{
// Save the target so that it can be restored later.
nsCOMPtr<EventTarget> firstTarget = aVisitor.mEvent->target;
nsCOMPtr<EventTarget> firstTarget = aVisitor.mEvent->mTarget;
uint32_t chainLength = aChain.Length();
// Capture
@@ -343,7 +343,7 @@ EventTargetChainItem::HandleEventTargetChain(
EventTargetChainItem& item = aChain[i];
if ((!aVisitor.mEvent->mFlags.mNoContentDispatch ||
item.ForceContentDispatch()) &&
!aVisitor.mEvent->mFlags.mPropagationStopped) {
!aVisitor.mEvent->PropagationStopped()) {
item.HandleEvent(aVisitor, aCd);
}
@@ -353,7 +353,7 @@ EventTargetChainItem::HandleEventTargetChain(
uint32_t childIndex = j - 1;
EventTarget* newTarget = aChain[childIndex].GetNewTarget();
if (newTarget) {
aVisitor.mEvent->target = newTarget;
aVisitor.mEvent->mTarget = newTarget;
break;
}
}
@@ -363,7 +363,7 @@ EventTargetChainItem::HandleEventTargetChain(
// Target
aVisitor.mEvent->mFlags.mInBubblingPhase = true;
EventTargetChainItem& targetItem = aChain[0];
if (!aVisitor.mEvent->mFlags.mPropagationStopped &&
if (!aVisitor.mEvent->PropagationStopped() &&
(!aVisitor.mEvent->mFlags.mNoContentDispatch ||
targetItem.ForceContentDispatch())) {
targetItem.HandleEvent(aVisitor, aCd);
@@ -380,13 +380,13 @@ EventTargetChainItem::HandleEventTargetChain(
if (newTarget) {
// Item is at anonymous boundary. Need to retarget for the current item
// and for parent items.
aVisitor.mEvent->target = newTarget;
aVisitor.mEvent->mTarget = newTarget;
}
if (aVisitor.mEvent->mFlags.mBubbles || newTarget) {
if ((!aVisitor.mEvent->mFlags.mNoContentDispatch ||
item.ForceContentDispatch()) &&
!aVisitor.mEvent->mFlags.mPropagationStopped) {
!aVisitor.mEvent->PropagationStopped()) {
item.HandleEvent(aVisitor, aCd);
}
if (aVisitor.mEvent->mFlags.mInSystemGroup) {
@@ -403,7 +403,7 @@ EventTargetChainItem::HandleEventTargetChain(
aVisitor.mEvent->mFlags.mImmediatePropagationStopped = false;
// Setting back the original target of the event.
aVisitor.mEvent->target = aVisitor.mEvent->originalTarget;
aVisitor.mEvent->mTarget = aVisitor.mEvent->mOriginalTarget;
// Special handling if PresShell (or some other caller)
// used a callback object.
@@ -413,7 +413,7 @@ EventTargetChainItem::HandleEventTargetChain(
// Retarget for system event group (which does the default handling too).
// Setting back the target which was used also for default event group.
aVisitor.mEvent->target = firstTarget;
aVisitor.mEvent->mTarget = firstTarget;
aVisitor.mEvent->mFlags.mInSystemGroup = true;
HandleEventTargetChain(aChain,
aVisitor,
@@ -515,7 +515,7 @@ EventDispatcher::Dispatch(nsISupports* aTarget,
do_QueryInterface(content->FindFirstNonChromeOnlyAccessContent());
NS_ENSURE_STATE(newTarget);
aEvent->originalTarget = target;
aEvent->mOriginalTarget = target;
target = newTarget;
retargeted = true;
}
@@ -532,7 +532,7 @@ EventDispatcher::Dispatch(nsISupports* aTarget,
}
// Set the target to be the original dispatch target,
aEvent->target = target;
aEvent->mTarget = target;
// but use chrome event handler or TabChildGlobal for event target chain.
target = piTarget;
} else if (NS_WARN_IF(!doc)) {
@@ -590,30 +590,30 @@ EventDispatcher::Dispatch(nsISupports* aTarget,
// Make sure that nsIDOMEvent::target and nsIDOMEvent::originalTarget
// point to the last item in the chain.
if (!aEvent->target) {
if (!aEvent->mTarget) {
// Note, CurrentTarget() points always to the object returned by
// GetTargetForEventTargetChain().
aEvent->target = targetEtci->CurrentTarget();
aEvent->mTarget = targetEtci->CurrentTarget();
} else {
// XXX But if the target is already set, use that. This is a hack
// for the 'load', 'beforeunload' and 'unload' events,
// which are dispatched to |window| but have document as their target.
//
// Make sure that the event target points to the right object.
aEvent->target = aEvent->target->GetTargetForEventTargetChain();
NS_ENSURE_STATE(aEvent->target);
aEvent->mTarget = aEvent->mTarget->GetTargetForEventTargetChain();
NS_ENSURE_STATE(aEvent->mTarget);
}
if (retargeted) {
aEvent->originalTarget =
aEvent->originalTarget->GetTargetForEventTargetChain();
NS_ENSURE_STATE(aEvent->originalTarget);
aEvent->mOriginalTarget =
aEvent->mOriginalTarget->GetTargetForEventTargetChain();
NS_ENSURE_STATE(aEvent->mOriginalTarget);
}
else {
aEvent->originalTarget = aEvent->target;
aEvent->mOriginalTarget = aEvent->mTarget;
}
nsCOMPtr<nsIContent> content = do_QueryInterface(aEvent->originalTarget);
nsCOMPtr<nsIContent> content = do_QueryInterface(aEvent->mOriginalTarget);
bool isInAnon = (content && (content->IsInAnonymousSubtree() ||
content->IsInShadowTree()));
@@ -637,7 +637,7 @@ EventDispatcher::Dispatch(nsISupports* aTarget,
if (preVisitor.mCanHandle) {
// At least the original target can handle the event.
// Setting the retarget to the |target| simplifies retargeting code.
nsCOMPtr<EventTarget> t = do_QueryInterface(aEvent->target);
nsCOMPtr<EventTarget> t = do_QueryInterface(aEvent->mTarget);
targetEtci->SetNewTarget(t);
EventTargetChainItem* topEtci = targetEtci;
targetEtci = nullptr;
@@ -655,7 +655,7 @@ EventDispatcher::Dispatch(nsISupports* aTarget,
if (preVisitor.mEventTargetAtParent) {
// Need to set the target of the event
// so that also the next retargeting works.
preVisitor.mEvent->target = preVisitor.mEventTargetAtParent;
preVisitor.mEvent->mTarget = preVisitor.mEventTargetAtParent;
parentEtci->SetNewTarget(preVisitor.mEventTargetAtParent);
}
@@ -750,8 +750,8 @@ EventDispatcher::DispatchDOMEvent(nsISupports* aTarget,
bool dontResetTrusted = false;
if (innerEvent->mFlags.mDispatchedAtLeastOnce) {
innerEvent->target = nullptr;
innerEvent->originalTarget = nullptr;
innerEvent->mTarget = nullptr;
innerEvent->mOriginalTarget = nullptr;
} else {
aDOMEvent->GetIsTrusted(&dontResetTrusted);
}
+2 -2
View File
@@ -240,8 +240,8 @@ public:
* aEvent is used as the target (unless there is event
* retargeting) and the originalTarget of the DOM Event.
* aTarget is always used as the starting point for constructing the event
* target chain, no matter what the value of aEvent->target is.
* In other words, aEvent->target is only a property of the event and it has
* target chain, no matter what the value of aEvent->mTarget is.
* In other words, aEvent->mTarget is only a property of the event and it has
* nothing to do with the construction of the event target chain.
* Neither aTarget nor aEvent is allowed to be nullptr.
*
+11 -11
View File
@@ -666,9 +666,9 @@ EventListenerManager::ListenerCanHandle(Listener* aListener,
}
if (aEvent->mMessage == eUnidentifiedEvent) {
if (mIsMainThreadELM) {
return aListener->mTypeAtom == aEvent->userType;
return aListener->mTypeAtom == aEvent->mSpecifiedEventType;
}
return aListener->mTypeString.Equals(aEvent->typeString);
return aListener->mTypeString.Equals(aEvent->mSpecifiedEventTypeString);
}
MOZ_ASSERT(mIsMainThreadELM);
return aListener->mEventMessage == aEvent->mMessage;
@@ -681,7 +681,7 @@ EventListenerManager::AddEventListenerByType(
const EventListenerFlags& aFlags)
{
nsCOMPtr<nsIAtom> atom =
mIsMainThreadELM ? do_GetAtom(NS_LITERAL_STRING("on") + aType) : nullptr;
mIsMainThreadELM ? NS_Atomize(NS_LITERAL_STRING("on") + aType) : nullptr;
EventMessage message = nsContentUtils::GetEventMessage(atom);
AddEventListenerInternal(aListenerHolder, message, atom, aType, aFlags);
}
@@ -693,7 +693,7 @@ EventListenerManager::RemoveEventListenerByType(
const EventListenerFlags& aFlags)
{
nsCOMPtr<nsIAtom> atom =
mIsMainThreadELM ? do_GetAtom(NS_LITERAL_STRING("on") + aType) : nullptr;
mIsMainThreadELM ? NS_Atomize(NS_LITERAL_STRING("on") + aType) : nullptr;
EventMessage message = nsContentUtils::GetEventMessage(atom);
RemoveEventListenerInternal(aListenerHolder, message, atom, aType, aFlags);
}
@@ -1181,16 +1181,16 @@ EventListenerManager::HandleEventInternal(nsPresContext* aPresContext,
if (!*aDOMEvent) {
// This is tiny bit slow, but happens only once per event.
nsCOMPtr<EventTarget> et =
do_QueryInterface(aEvent->originalTarget);
do_QueryInterface(aEvent->mOriginalTarget);
RefPtr<Event> event = EventDispatcher::CreateEvent(et, aPresContext,
aEvent,
EmptyString());
event.forget(aDOMEvent);
}
if (*aDOMEvent) {
if (!aEvent->currentTarget) {
aEvent->currentTarget = aCurrentTarget->GetTargetForDOMEvent();
if (!aEvent->currentTarget) {
if (!aEvent->mCurrentTarget) {
aEvent->mCurrentTarget = aCurrentTarget->GetTargetForDOMEvent();
if (!aEvent->mCurrentTarget) {
break;
}
}
@@ -1232,11 +1232,11 @@ EventListenerManager::HandleEventInternal(nsPresContext* aPresContext,
}
}
aEvent->currentTarget = nullptr;
aEvent->mCurrentTarget = nullptr;
if (mIsMainThreadELM && !hasListener) {
mNoListenerForEvent = aEvent->mMessage;
mNoListenerForEventAtom = aEvent->userType;
mNoListenerForEventAtom = aEvent->mSpecifiedEventType;
}
if (aEvent->DefaultPrevented()) {
@@ -1345,7 +1345,7 @@ bool
EventListenerManager::HasListenersFor(const nsAString& aEventName)
{
if (mIsMainThreadELM) {
nsCOMPtr<nsIAtom> atom = do_GetAtom(NS_LITERAL_STRING("on") + aEventName);
nsCOMPtr<nsIAtom> atom = NS_Atomize(NS_LITERAL_STRING("on") + aEventName);
return HasListenersFor(atom);
}
+2 -2
View File
@@ -328,7 +328,7 @@ public:
dom::EventTarget* aCurrentTarget,
nsEventStatus* aEventStatus)
{
if (mListeners.IsEmpty() || aEvent->mFlags.mPropagationStopped) {
if (mListeners.IsEmpty() || aEvent->PropagationStopped()) {
return;
}
@@ -343,7 +343,7 @@ public:
// Check if we already know that there is no event listener for the event.
if (mNoListenerForEvent == aEvent->mMessage &&
(mNoListenerForEvent != eUnidentifiedEvent ||
mNoListenerForEventAtom == aEvent->userType)) {
mNoListenerForEventAtom == aEvent->mSpecifiedEventType)) {
return;
}
HandleEventInternal(aPresContext, aEvent, aDOMEvent, aCurrentTarget,
+228 -225
View File
@@ -51,6 +51,7 @@
#include "nsFrameManager.h"
#include "nsITabChild.h"
#include "nsPluginFrame.h"
#include "nsMenuPopupFrame.h"
#include "nsIDOMXULElement.h"
#include "nsIDOMKeyEvent.h"
@@ -285,6 +286,7 @@ TimeStamp EventStateManager::sHandlingInputStart;
EventStateManager::WheelPrefs*
EventStateManager::WheelPrefs::sInstance = nullptr;
bool EventStateManager::WheelPrefs::sWheelEventsEnabledOnPlugins = true;
EventStateManager::DeltaAccumulator*
EventStateManager::DeltaAccumulator::sInstance = nullptr;
@@ -590,9 +592,10 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
aEvent->mClass == eWheelEventClass) &&
!sIsPointerLocked) {
sLastScreenPoint =
Event::GetScreenCoords(aPresContext, aEvent, aEvent->refPoint);
Event::GetScreenCoords(aPresContext, aEvent, aEvent->mRefPoint);
sLastClientPoint =
Event::GetClientCoords(aPresContext, aEvent, aEvent->refPoint, CSSIntPoint(0, 0));
Event::GetClientCoords(aPresContext, aEvent, aEvent->mRefPoint,
CSSIntPoint(0, 0));
}
*aStatus = nsEventStatus_eIgnore;
@@ -830,7 +833,7 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
// composition event.
WidgetCompositionEvent* compositionEvent = aEvent->AsCompositionEvent();
WidgetQueryContentEvent selectedText(true, eQuerySelectedText,
compositionEvent->widget);
compositionEvent->mWidget);
HandleQueryContentEvent(&selectedText);
NS_ASSERTION(selectedText.mSucceeded, "Failed to get selected text");
compositionEvent->mData = selectedText.mReply.mString;
@@ -1305,7 +1308,8 @@ EventStateManager::HandleCrossProcessEvent(WidgetEvent* aEvent,
if (aEvent->mClass != eTouchEventClass || aEvent->mMessage == eTouchStart) {
// If this event only has one target, and it's remote, add it to
// the array.
nsIFrame* frame = GetEventTarget();
nsIFrame* frame =
aEvent->mMessage == eDragExit ? sLastDragOverFrame.GetFrame() : GetEventTarget();
nsIContent* target = frame ? frame->GetContent() : nullptr;
if (IsRemoteTarget(target)) {
targets.AppendElement(target);
@@ -1319,7 +1323,7 @@ EventStateManager::HandleCrossProcessEvent(WidgetEvent* aEvent,
// This loop is similar to the one used in
// PresShell::DispatchTouchEvent().
const WidgetTouchEvent::TouchArray& touches =
aEvent->AsTouchEvent()->touches;
aEvent->AsTouchEvent()->mTouches;
for (uint32_t i = 0; i < touches.Length(); ++i) {
Touch* touch = touches[i];
// NB: the |mChanged| check is an optimization, subprocesses can
@@ -1549,7 +1553,7 @@ EventStateManager::FireContextClick()
}
}
nsIDocument* doc = mGestureDownContent->GetCrossShadowCurrentDoc();
nsIDocument* doc = mGestureDownContent->GetComposedDoc();
AutoHandlingUserInputStatePusher userInpStatePusher(true, &event, doc);
// dispatch to DOM
@@ -1589,12 +1593,14 @@ EventStateManager::BeginTrackingDragGesture(nsPresContext* aPresContext,
WidgetMouseEvent* inDownEvent,
nsIFrame* inDownFrame)
{
if (!inDownEvent->widget)
if (!inDownEvent->mWidget) {
return;
}
// Note that |inDownEvent| could be either a mouse down event or a
// synthesized mouse move event.
mGestureDownPoint = inDownEvent->refPoint + inDownEvent->widget->WidgetToScreenOffset();
mGestureDownPoint =
inDownEvent->mRefPoint + inDownEvent->mWidget->WidgetToScreenOffset();
if (inDownFrame) {
inDownFrame->GetContentForEvent(inDownEvent,
@@ -1605,7 +1611,7 @@ EventStateManager::BeginTrackingDragGesture(nsPresContext* aPresContext,
mGestureDownFrameOwner = mGestureDownContent;
}
}
mGestureModifiers = inDownEvent->modifiers;
mGestureModifiers = inDownEvent->mModifiers;
mGestureDownButtons = inDownEvent->buttons;
if (Prefs::ClickHoldContextMenu()) {
@@ -1637,14 +1643,15 @@ EventStateManager::StopTrackingDragGesture()
void
EventStateManager::FillInEventFromGestureDown(WidgetMouseEvent* aEvent)
{
NS_ASSERTION(aEvent->widget == mCurrentTarget->GetNearestWidget(),
NS_ASSERTION(aEvent->mWidget == mCurrentTarget->GetNearestWidget(),
"Incorrect widget in event");
// Set the coordinates in the new event to the coordinates of
// the old event, adjusted for the fact that the widget might be
// different
aEvent->refPoint = mGestureDownPoint - aEvent->widget->WidgetToScreenOffset();
aEvent->modifiers = mGestureModifiers;
aEvent->mRefPoint =
mGestureDownPoint - aEvent->mWidget->WidgetToScreenOffset();
aEvent->mModifiers = mGestureModifiers;
aEvent->buttons = mGestureDownButtons;
}
@@ -1699,7 +1706,8 @@ EventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
}
// fire drag gesture if mouse has moved enough
LayoutDeviceIntPoint pt = aEvent->refPoint + aEvent->widget->WidgetToScreenOffset();
LayoutDeviceIntPoint pt =
aEvent->mRefPoint + aEvent->mWidget->WidgetToScreenOffset();
LayoutDeviceIntPoint distance = pt - mGestureDownPoint;
if (Abs(distance.x) > AssertedCast<uint32_t>(pixelThresholdX) ||
Abs(distance.y) > AssertedCast<uint32_t>(pixelThresholdY)) {
@@ -1747,7 +1755,7 @@ EventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
eLegacyDragGesture, widget);
FillInEventFromGestureDown(&gestureEvent);
startEvent.dataTransfer = gestureEvent.dataTransfer = dataTransfer;
startEvent.mDataTransfer = gestureEvent.mDataTransfer = dataTransfer;
startEvent.inputSource = gestureEvent.inputSource = aEvent->inputSource;
// Dispatch to the DOM. By setting mCurrentTarget we are faking
@@ -2190,32 +2198,32 @@ EventStateManager::DispatchLegacyMouseScrollEvents(nsIFrame* aTargetFrame,
// It doesn't make sense to implement such code for legacy events and
// rare cases.
int32_t scrollDeltaX, scrollDeltaY, pixelDeltaX, pixelDeltaY;
switch (aEvent->deltaMode) {
switch (aEvent->mDeltaMode) {
case nsIDOMWheelEvent::DOM_DELTA_PAGE:
scrollDeltaX =
!aEvent->lineOrPageDeltaX ? 0 :
(aEvent->lineOrPageDeltaX > 0 ? nsIDOMUIEvent::SCROLL_PAGE_DOWN :
nsIDOMUIEvent::SCROLL_PAGE_UP);
!aEvent->mLineOrPageDeltaX ? 0 :
(aEvent->mLineOrPageDeltaX > 0 ? nsIDOMUIEvent::SCROLL_PAGE_DOWN :
nsIDOMUIEvent::SCROLL_PAGE_UP);
scrollDeltaY =
!aEvent->lineOrPageDeltaY ? 0 :
(aEvent->lineOrPageDeltaY > 0 ? nsIDOMUIEvent::SCROLL_PAGE_DOWN :
nsIDOMUIEvent::SCROLL_PAGE_UP);
pixelDeltaX = RoundDown(aEvent->deltaX * scrollAmountInCSSPixels.width);
pixelDeltaY = RoundDown(aEvent->deltaY * scrollAmountInCSSPixels.height);
!aEvent->mLineOrPageDeltaY ? 0 :
(aEvent->mLineOrPageDeltaY > 0 ? nsIDOMUIEvent::SCROLL_PAGE_DOWN :
nsIDOMUIEvent::SCROLL_PAGE_UP);
pixelDeltaX = RoundDown(aEvent->mDeltaX * scrollAmountInCSSPixels.width);
pixelDeltaY = RoundDown(aEvent->mDeltaY * scrollAmountInCSSPixels.height);
break;
case nsIDOMWheelEvent::DOM_DELTA_LINE:
scrollDeltaX = aEvent->lineOrPageDeltaX;
scrollDeltaY = aEvent->lineOrPageDeltaY;
pixelDeltaX = RoundDown(aEvent->deltaX * scrollAmountInCSSPixels.width);
pixelDeltaY = RoundDown(aEvent->deltaY * scrollAmountInCSSPixels.height);
scrollDeltaX = aEvent->mLineOrPageDeltaX;
scrollDeltaY = aEvent->mLineOrPageDeltaY;
pixelDeltaX = RoundDown(aEvent->mDeltaX * scrollAmountInCSSPixels.width);
pixelDeltaY = RoundDown(aEvent->mDeltaY * scrollAmountInCSSPixels.height);
break;
case nsIDOMWheelEvent::DOM_DELTA_PIXEL:
scrollDeltaX = aEvent->lineOrPageDeltaX;
scrollDeltaY = aEvent->lineOrPageDeltaY;
pixelDeltaX = RoundDown(aEvent->deltaX);
pixelDeltaY = RoundDown(aEvent->deltaY);
scrollDeltaX = aEvent->mLineOrPageDeltaX;
scrollDeltaY = aEvent->mLineOrPageDeltaY;
pixelDeltaX = RoundDown(aEvent->mDeltaX);
pixelDeltaY = RoundDown(aEvent->mDeltaY);
break;
default:
@@ -2300,17 +2308,16 @@ EventStateManager::SendLineScrollEvent(nsIFrame* aTargetFrame,
}
WidgetMouseScrollEvent event(aEvent->IsTrusted(),
eLegacyMouseLineOrPageScroll, aEvent->widget);
eLegacyMouseLineOrPageScroll, aEvent->mWidget);
event.mFlags.mDefaultPrevented = aState.mDefaultPrevented;
event.mFlags.mDefaultPreventedByContent = aState.mDefaultPreventedByContent;
event.refPoint = aEvent->refPoint;
event.widget = aEvent->widget;
event.time = aEvent->time;
event.timeStamp = aEvent->timeStamp;
event.modifiers = aEvent->modifiers;
event.mRefPoint = aEvent->mRefPoint;
event.mTime = aEvent->mTime;
event.mTimeStamp = aEvent->mTimeStamp;
event.mModifiers = aEvent->mModifiers;
event.buttons = aEvent->buttons;
event.isHorizontal = (aDeltaDirection == DELTA_DIRECTION_X);
event.delta = aDelta;
event.mIsHorizontal = (aDeltaDirection == DELTA_DIRECTION_X);
event.mDelta = aDelta;
event.inputSource = aEvent->inputSource;
nsEventStatus status = nsEventStatus_eIgnore;
@@ -2340,17 +2347,16 @@ EventStateManager::SendPixelScrollEvent(nsIFrame* aTargetFrame,
}
WidgetMouseScrollEvent event(aEvent->IsTrusted(),
eLegacyMousePixelScroll, aEvent->widget);
eLegacyMousePixelScroll, aEvent->mWidget);
event.mFlags.mDefaultPrevented = aState.mDefaultPrevented;
event.mFlags.mDefaultPreventedByContent = aState.mDefaultPreventedByContent;
event.refPoint = aEvent->refPoint;
event.widget = aEvent->widget;
event.time = aEvent->time;
event.timeStamp = aEvent->timeStamp;
event.modifiers = aEvent->modifiers;
event.mRefPoint = aEvent->mRefPoint;
event.mTime = aEvent->mTime;
event.mTimeStamp = aEvent->mTimeStamp;
event.mModifiers = aEvent->mModifiers;
event.buttons = aEvent->buttons;
event.isHorizontal = (aDeltaDirection == DELTA_DIRECTION_X);
event.delta = aPixelDelta;
event.mIsHorizontal = (aDeltaDirection == DELTA_DIRECTION_X);
event.mDelta = aPixelDelta;
event.inputSource = aEvent->inputSource;
nsEventStatus status = nsEventStatus_eIgnore;
@@ -2366,7 +2372,7 @@ EventStateManager::ComputeScrollTarget(nsIFrame* aTargetFrame,
WidgetWheelEvent* aEvent,
ComputeScrollTargetOptions aOptions)
{
return ComputeScrollTarget(aTargetFrame, aEvent->deltaX, aEvent->deltaY,
return ComputeScrollTarget(aTargetFrame, aEvent->mDeltaX, aEvent->mDeltaY,
aEvent, aOptions);
}
@@ -2380,6 +2386,11 @@ EventStateManager::ComputeScrollTarget(nsIFrame* aTargetFrame,
WidgetWheelEvent* aEvent,
ComputeScrollTargetOptions aOptions)
{
if ((aOptions & INCLUDE_PLUGIN_AS_TARGET) &&
!WheelPrefs::WheelEventsEnabledOnPlugins()) {
aOptions = RemovePluginFromTarget(aOptions);
}
if (aOptions & PREFER_MOUSE_WHEEL_TRANSACTION) {
// If the user recently scrolled with the mousewheel, then they probably
// want to scroll the same view as before instead of the view under the
@@ -2440,6 +2451,10 @@ EventStateManager::ComputeScrollTarget(nsIFrame* aTargetFrame,
return scrollFrame;
}
}
nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(scrollFrame);
if (menuPopupFrame) {
return nullptr;
}
continue;
}
@@ -2501,7 +2516,7 @@ EventStateManager::GetScrollAmount(nsPresContext* aPresContext,
MOZ_ASSERT(aPresContext);
MOZ_ASSERT(aEvent);
bool isPage = (aEvent->deltaMode == nsIDOMWheelEvent::DOM_DELTA_PAGE);
bool isPage = (aEvent->mDeltaMode == nsIDOMWheelEvent::DOM_DELTA_PAGE);
if (aScrollableFrame) {
return isPage ? aScrollableFrame->GetPageScrollAmount() :
aScrollableFrame->GetLineScrollAmount();
@@ -2560,7 +2575,7 @@ EventStateManager::DoScrollText(nsIScrollableFrame* aScrollableFrame,
nsIScrollbarMediator::ScrollSnapMode snapMode = nsIScrollbarMediator::DISABLE_SNAP;
nsIAtom* origin = nullptr;
switch (aEvent->deltaMode) {
switch (aEvent->mDeltaMode) {
case nsIDOMWheelEvent::DOM_DELTA_LINE:
origin = nsGkAtoms::mouseWheel;
snapMode = nsIScrollableFrame::ENABLE_SNAP;
@@ -2596,10 +2611,10 @@ EventStateManager::DoScrollText(nsIScrollableFrame* aScrollableFrame,
}
bool isDeltaModePixel =
(aEvent->deltaMode == nsIDOMWheelEvent::DOM_DELTA_PIXEL);
(aEvent->mDeltaMode == nsIDOMWheelEvent::DOM_DELTA_PIXEL);
nsIScrollableFrame::ScrollMode mode;
switch (aEvent->scrollType) {
switch (aEvent->mScrollType) {
case WidgetWheelEvent::SCROLL_DEFAULT:
if (isDeltaModePixel) {
mode = nsIScrollableFrame::NORMAL;
@@ -2619,12 +2634,12 @@ EventStateManager::DoScrollText(nsIScrollableFrame* aScrollableFrame,
mode = nsIScrollableFrame::SMOOTH;
break;
default:
MOZ_CRASH("Invalid scrollType value comes");
MOZ_CRASH("Invalid mScrollType value comes");
}
nsIScrollableFrame::ScrollMomentum momentum =
aEvent->isMomentum ? nsIScrollableFrame::SYNTHESIZED_MOMENTUM_EVENT
: nsIScrollableFrame::NOT_MOMENTUM;
aEvent->mIsMomentum ? nsIScrollableFrame::SYNTHESIZED_MOMENTUM_EVENT
: nsIScrollableFrame::NOT_MOMENTUM;
nsIntPoint overflow;
aScrollableFrame->ScrollBy(actualDevPixelScrollAmount,
@@ -2635,14 +2650,14 @@ EventStateManager::DoScrollText(nsIScrollableFrame* aScrollableFrame,
// If the scroll causes changing the layout, we can think that the event
// has been completely consumed by the content. Then, users probably don't
// want additional action.
aEvent->overflowDeltaX = aEvent->overflowDeltaY = 0;
aEvent->mOverflowDeltaX = aEvent->mOverflowDeltaY = 0;
} else if (isDeltaModePixel) {
aEvent->overflowDeltaX = overflow.x;
aEvent->overflowDeltaY = overflow.y;
aEvent->mOverflowDeltaX = overflow.x;
aEvent->mOverflowDeltaY = overflow.y;
} else {
aEvent->overflowDeltaX =
aEvent->mOverflowDeltaX =
static_cast<double>(overflow.x) / scrollAmountInDevPixels.width;
aEvent->overflowDeltaY =
aEvent->mOverflowDeltaY =
static_cast<double>(overflow.y) / scrollAmountInDevPixels.height;
}
@@ -2653,26 +2668,26 @@ EventStateManager::DoScrollText(nsIScrollableFrame* aScrollableFrame,
// additional action such as moving history. In such case, overflowDelta
// values should stay zero.
if (scrollFrameWeak.IsAlive()) {
if (aEvent->deltaX &&
if (aEvent->mDeltaX &&
overflowStyle.mHorizontal == NS_STYLE_OVERFLOW_HIDDEN &&
!ComputeScrollTarget(scrollFrame, aEvent,
COMPUTE_SCROLLABLE_ANCESTOR_ALONG_X_AXIS)) {
aEvent->overflowDeltaX = aEvent->deltaX;
aEvent->mOverflowDeltaX = aEvent->mDeltaX;
}
if (aEvent->deltaY &&
if (aEvent->mDeltaY &&
overflowStyle.mVertical == NS_STYLE_OVERFLOW_HIDDEN &&
!ComputeScrollTarget(scrollFrame, aEvent,
COMPUTE_SCROLLABLE_ANCESTOR_ALONG_Y_AXIS)) {
aEvent->overflowDeltaY = aEvent->deltaY;
aEvent->mOverflowDeltaY = aEvent->mDeltaY;
}
}
NS_ASSERTION(aEvent->overflowDeltaX == 0 ||
(aEvent->overflowDeltaX > 0) == (aEvent->deltaX > 0),
"The sign of overflowDeltaX is different from the scroll direction");
NS_ASSERTION(aEvent->overflowDeltaY == 0 ||
(aEvent->overflowDeltaY > 0) == (aEvent->deltaY > 0),
"The sign of overflowDeltaY is different from the scroll direction");
NS_ASSERTION(aEvent->mOverflowDeltaX == 0 ||
(aEvent->mOverflowDeltaX > 0) == (aEvent->mDeltaX > 0),
"The sign of mOverflowDeltaX is different from the scroll direction");
NS_ASSERTION(aEvent->mOverflowDeltaY == 0 ||
(aEvent->mOverflowDeltaY > 0) == (aEvent->mDeltaY > 0),
"The sign of mOverflowDeltaY is different from the scroll direction");
WheelPrefs::GetInstance()->CancelApplyingUserPrefsFromOverflowDelta(aEvent);
}
@@ -2811,7 +2826,8 @@ EventStateManager::PostHandleKeyboardEvent(WidgetKeyboardEvent* aKeyboardEvent,
nsEventStatus& aStatus,
bool dispatchedToContentProcess)
{
if (aStatus == nsEventStatus_eConsumeNoDefault) {
if (aStatus == nsEventStatus_eConsumeNoDefault ||
aKeyboardEvent->mInputMethodAppState == WidgetKeyboardEvent::eHandling) {
return;
}
@@ -2935,19 +2951,19 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
// we click on a visibility: none element.
// We can't use nsIContent::IsFocusable() because we want to blur when
// we click on a non-focusable element like a <div>.
// We have to use |aEvent->target| to not make sure we do not check an
// anonymous node of the targeted element.
// We have to use |aEvent->mTarget| to not make sure we do not check
// an anonymous node of the targeted element.
suppressBlur = (ui->mUserFocus == NS_STYLE_USER_FOCUS_IGNORE);
if (!suppressBlur) {
nsCOMPtr<Element> element = do_QueryInterface(aEvent->target);
nsCOMPtr<Element> element = do_QueryInterface(aEvent->mTarget);
suppressBlur = element &&
element->State().HasState(NS_EVENT_STATE_DISABLED);
}
if (!suppressBlur) {
nsCOMPtr<nsIDOMXULControlElement> xulControl =
do_QueryInterface(aEvent->target);
do_QueryInterface(aEvent->mTarget);
if (xulControl) {
bool disabled;
xulControl->GetDisabled(&disabled);
@@ -2971,7 +2987,7 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
// NOTE: The newFocus isn't editable that also means it's not in
// designMode. In designMode, all contents are not focusable.
if (newFocus && !newFocus->IsEditable()) {
nsIDocument *doc = newFocus->GetCrossShadowCurrentDoc();
nsIDocument *doc = newFocus->GetComposedDoc();
if (doc && newFocus == doc->GetRootElement()) {
nsIContent *bodyContent =
nsLayoutUtils::GetEditableRootContentByContentEditable(doc);
@@ -3172,19 +3188,6 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
if (pluginFrame) {
MOZ_ASSERT(pluginFrame->WantsToHandleWheelEventAsDefaultAction());
action = WheelPrefs::ACTION_SEND_TO_PLUGIN;
} else if (!wheelEvent->mayHaveMomentum &&
nsLayoutUtils::IsScrollFrameWithSnapping(frameToScroll)) {
// If the target has scroll-snapping points then we want to handle
// the wheel event on the main thread even if we have APZ enabled. Do
// so and let the APZ know that it should ignore this event. However,
// if the wheel event is synthesized from a Mac trackpad or other device
// that can generate additional momentum events, then we should allow
// APZ to handle it, because it will track the velocity and predicted
// destination from the momentum.
if (wheelEvent->mFlags.mHandledByAPZ) {
wheelEvent->PreventDefault();
}
action = WheelPrefs::GetInstance()->ComputeActionFor(wheelEvent);
} else if (wheelEvent->mFlags.mHandledByAPZ) {
action = WheelPrefs::ACTION_NONE;
} else {
@@ -3198,7 +3201,7 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
ScrollbarsForWheel::PrepareToScrollText(this, aTargetFrame, wheelEvent);
if (aEvent->mMessage != eWheel ||
(!wheelEvent->deltaX && !wheelEvent->deltaY)) {
(!wheelEvent->mDeltaX && !wheelEvent->mDeltaY)) {
break;
}
@@ -3214,8 +3217,8 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
if (!scrollTarget || scrollTarget == rootScrollableFrame) {
wheelEvent->mViewPortIsOverscrolled = true;
}
wheelEvent->overflowDeltaX = wheelEvent->deltaX;
wheelEvent->overflowDeltaY = wheelEvent->deltaY;
wheelEvent->mOverflowDeltaX = wheelEvent->mDeltaX;
wheelEvent->mOverflowDeltaY = wheelEvent->mDeltaY;
WheelPrefs::GetInstance()->
CancelApplyingUserPrefsFromOverflowDelta(wheelEvent);
if (scrollTarget) {
@@ -3250,7 +3253,7 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
MOZ_ASSERT(pluginFrame);
if (wheelEvent->mMessage != eWheel ||
(!wheelEvent->deltaX && !wheelEvent->deltaY)) {
(!wheelEvent->mDeltaX && !wheelEvent->mDeltaY)) {
break;
}
@@ -3285,8 +3288,8 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
if (!allDeltaOverflown) {
break;
}
wheelEvent->overflowDeltaX = wheelEvent->deltaX;
wheelEvent->overflowDeltaY = wheelEvent->deltaY;
wheelEvent->mOverflowDeltaX = wheelEvent->mDeltaX;
wheelEvent->mOverflowDeltaY = wheelEvent->mDeltaY;
WheelPrefs::GetInstance()->
CancelApplyingUserPrefsFromOverflowDelta(wheelEvent);
wheelEvent->mViewPortIsOverscrolled = true;
@@ -3345,13 +3348,13 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
uint32_t action = nsIDragService::DRAGDROP_ACTION_NONE;
if (nsEventStatus_eConsumeNoDefault == *aStatus) {
// if the event has a dataTransfer set, use it.
if (dragEvent->dataTransfer) {
if (dragEvent->mDataTransfer) {
// get the dataTransfer and the dropEffect that was set on it
dataTransfer = do_QueryInterface(dragEvent->dataTransfer);
dataTransfer = do_QueryInterface(dragEvent->mDataTransfer);
dataTransfer->GetDropEffectInt(&dropEffect);
}
else {
// if dragEvent->dataTransfer is null, it means that no attempt was
// if dragEvent->mDataTransfer is null, it means that no attempt was
// made to access the dataTransfer during the event, yet the event
// was cancelled. Instead, use the initial data transfer available
// from the drag session. The drop effect would not have been
@@ -3431,12 +3434,12 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
WidgetDragEvent event(aEvent->IsTrusted(), eLegacyDragDrop, widget);
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
event.refPoint = mouseEvent->refPoint;
if (mouseEvent->widget) {
event.refPoint += mouseEvent->widget->WidgetToScreenOffset();
event.mRefPoint = mouseEvent->mRefPoint;
if (mouseEvent->mWidget) {
event.mRefPoint += mouseEvent->mWidget->WidgetToScreenOffset();
}
event.refPoint -= widget->WidgetToScreenOffset();
event.modifiers = mouseEvent->modifiers;
event.mRefPoint -= widget->WidgetToScreenOffset();
event.mModifiers = mouseEvent->mModifiers;
event.buttons = mouseEvent->buttons;
event.inputSource = mouseEvent->inputSource;
@@ -3855,7 +3858,7 @@ CreateMouseOrPointerWidgetEvent(WidgetMouseEvent* aMouseEvent,
nsAutoPtr<WidgetPointerEvent> newPointerEvent;
newPointerEvent =
new WidgetPointerEvent(aMouseEvent->IsTrusted(), aMessage,
aMouseEvent->widget);
aMouseEvent->mWidget);
newPointerEvent->isPrimary = sourcePointer->isPrimary;
newPointerEvent->pointerId = sourcePointer->pointerId;
newPointerEvent->width = sourcePointer->width;
@@ -3869,11 +3872,11 @@ CreateMouseOrPointerWidgetEvent(WidgetMouseEvent* aMouseEvent,
} else {
aNewEvent =
new WidgetMouseEvent(aMouseEvent->IsTrusted(), aMessage,
aMouseEvent->widget, WidgetMouseEvent::eReal);
aMouseEvent->mWidget, WidgetMouseEvent::eReal);
aNewEvent->relatedTarget = aRelatedContent;
}
aNewEvent->refPoint = aMouseEvent->refPoint;
aNewEvent->modifiers = aMouseEvent->modifiers;
aNewEvent->mRefPoint = aMouseEvent->mRefPoint;
aNewEvent->mModifiers = aMouseEvent->mModifiers;
aNewEvent->button = aMouseEvent->button;
aNewEvent->buttons = aMouseEvent->buttons;
aNewEvent->pressure = aMouseEvent->pressure;
@@ -4173,47 +4176,24 @@ EventStateManager::NotifyMouseOver(WidgetMouseEvent* aMouseEvent,
wrapper->mFirstOverEventElement = nullptr;
}
// Returns the center point of the window's inner content area.
// This is in widget coordinates, i.e. relative to the widget's top
// left corner, not in screen coordinates, the same units that
// UIEvent::refPoint is in.
//
// XXX Hack alert: XXX
// However, we do the computation in integer CSS pixels, NOT device pix,
// in order to fudge around the one-pixel error in innerHeight in fullscreen
// mode (see bug 799523 comment 35, and bug 729011). Using integer CSS pix
// makes us throw away the fractional error that results, rather than having
// it manifest as a potential one-device-pix discrepancy.
// Returns the center point of the window's client area. This is
// in widget coordinates, i.e. relative to the widget's top-left
// corner, not in screen coordinates, the same units that UIEvent::
// refpoint is in. It may not be the exact center of the window if
// the platform requires rounding the coordinate.
static LayoutDeviceIntPoint
GetWindowInnerRectCenter(nsPIDOMWindow* aWindow,
nsIWidget* aWidget,
nsPresContext* aContext)
GetWindowClientRectCenter(nsIWidget* aWidget)
{
NS_ENSURE_TRUE(aWindow && aWidget && aContext, LayoutDeviceIntPoint(0, 0));
NS_ENSURE_TRUE(aWidget, LayoutDeviceIntPoint(0, 0));
float cssInnerX = 0.0;
aWindow->GetMozInnerScreenX(&cssInnerX);
int32_t innerX = int32_t(NS_round(cssInnerX));
float cssInnerY = 0.0;
aWindow->GetMozInnerScreenY(&cssInnerY);
int32_t innerY = int32_t(NS_round(cssInnerY));
int32_t innerWidth = 0;
aWindow->GetInnerWidth(&innerWidth);
int32_t innerHeight = 0;
aWindow->GetInnerHeight(&innerHeight);
LayoutDeviceIntRect screen;
aWidget->GetScreenBounds(screen);
int32_t cssScreenX = aContext->DevPixelsToIntCSSPixels(screen.x);
int32_t cssScreenY = aContext->DevPixelsToIntCSSPixels(screen.y);
return LayoutDeviceIntPoint(
aContext->CSSPixelsToDevPixels(innerX - cssScreenX + innerWidth / 2),
aContext->CSSPixelsToDevPixels(innerY - cssScreenY + innerHeight / 2));
LayoutDeviceIntRect rect;
aWidget->GetClientBounds(rect);
LayoutDeviceIntPoint point(rect.x + rect.width / 2,
rect.y + rect.height / 2);
int32_t round = aWidget->RoundsWidgetCoordinatesTo();
point.x = point.x / round * round;
point.y = point.y / round * round;
return point - aWidget->WidgetToScreenOffset();
}
void
@@ -4240,8 +4220,8 @@ EventStateManager::GenerateMouseEnterExit(WidgetMouseEvent* aMouseEvent)
{
// Mouse movement is reported on the MouseEvent.movement{X,Y} fields.
// Movement is calculated in UIEvent::GetMovementPoint() as:
// previous_mousemove_refPoint - current_mousemove_refPoint.
if (sIsPointerLocked && aMouseEvent->widget) {
// previous_mousemove_mRefPoint - current_mousemove_mRefPoint.
if (sIsPointerLocked && aMouseEvent->mWidget) {
// The pointer is locked. If the pointer is not located at the center of
// the window, dispatch a synthetic mousemove to return the pointer there.
// Doing this between "real" pointer moves gives the impression that the
@@ -4249,19 +4229,18 @@ EventStateManager::GenerateMouseEnterExit(WidgetMouseEvent* aMouseEvent)
// boundary. We cancel the synthetic event so that we don't end up
// dispatching the centering move event to content.
LayoutDeviceIntPoint center =
GetWindowInnerRectCenter(mDocument->GetWindow(), aMouseEvent->widget,
mPresContext);
aMouseEvent->lastRefPoint = center;
if (aMouseEvent->refPoint != center) {
GetWindowClientRectCenter(aMouseEvent->mWidget);
aMouseEvent->mLastRefPoint = center;
if (aMouseEvent->mRefPoint != center) {
// Mouse move doesn't finish at the center of the window. Dispatch a
// synthetic native mouse event to move the pointer back to the center
// of the window, to faciliate more movement. But first, record that
// we've dispatched a synthetic mouse movement, so we can cancel it
// in the other branch here.
sSynthCenteringPoint = center;
aMouseEvent->widget->SynthesizeNativeMouseMove(
center + aMouseEvent->widget->WidgetToScreenOffset(), nullptr);
} else if (aMouseEvent->refPoint == sSynthCenteringPoint) {
aMouseEvent->mWidget->SynthesizeNativeMouseMove(
center + aMouseEvent->mWidget->WidgetToScreenOffset(), nullptr);
} else if (aMouseEvent->mRefPoint == sSynthCenteringPoint) {
// This is the "synthetic native" event we dispatched to re-center the
// pointer. Cancel it so we don't expose the centering move to content.
aMouseEvent->StopPropagation();
@@ -4270,17 +4249,17 @@ EventStateManager::GenerateMouseEnterExit(WidgetMouseEvent* aMouseEvent)
sSynthCenteringPoint = kInvalidRefPoint;
}
} else if (sLastRefPoint == kInvalidRefPoint) {
// We don't have a valid previous mousemove refPoint. This is either
// We don't have a valid previous mousemove mRefPoint. This is either
// the first move we've encountered, or the mouse has just re-entered
// the application window. We should report (0,0) movement for this
// case, so make the current and previous refPoints the same.
aMouseEvent->lastRefPoint = aMouseEvent->refPoint;
// case, so make the current and previous mRefPoints the same.
aMouseEvent->mLastRefPoint = aMouseEvent->mRefPoint;
} else {
aMouseEvent->lastRefPoint = sLastRefPoint;
aMouseEvent->mLastRefPoint = sLastRefPoint;
}
// Update the last known refPoint with the current refPoint.
sLastRefPoint = aMouseEvent->refPoint;
// Update the last known mRefPoint with the current mRefPoint.
sLastRefPoint = aMouseEvent->mRefPoint;
}
MOZ_FALLTHROUGH;
case ePointerMove:
@@ -4327,7 +4306,7 @@ EventStateManager::GenerateMouseEnterExit(WidgetMouseEvent* aMouseEvent)
OverOutElementsWrapper* helper = GetWrapperByEventID(aMouseEvent);
if (helper->mLastOverFrame &&
nsContentUtils::GetTopLevelWidget(aMouseEvent->widget) !=
nsContentUtils::GetTopLevelWidget(aMouseEvent->mWidget) !=
nsContentUtils::GetTopLevelWidget(helper->mLastOverFrame->GetNearestWidget())) {
// the Mouse/PointerOut event widget doesn't have same top widget with
// mLastOverFrame, it's a spurious event for mLastOverFrame
@@ -4376,10 +4355,6 @@ EventStateManager::SetPointerLock(nsIWidget* aWidget,
// NOTE: aElement will be nullptr when unlocking.
sIsPointerLocked = !!aElement;
if (!aWidget) {
return;
}
// Reset mouse wheel transaction
WheelTransaction::EndTransaction();
@@ -4388,17 +4363,17 @@ EventStateManager::SetPointerLock(nsIWidget* aWidget,
do_GetService("@mozilla.org/widget/dragservice;1");
if (sIsPointerLocked) {
MOZ_ASSERT(aWidget, "Locking pointer requires a widget");
// Store the last known ref point so we can reposition the pointer after unlock.
mPreLockPoint = sLastRefPoint;
// Fire a synthetic mouse move to ensure event state is updated. We first
// set the mouse to the center of the window, so that the mouse event
// doesn't report any movement.
sLastRefPoint = GetWindowInnerRectCenter(aElement->OwnerDoc()->GetWindow(),
aWidget,
mPresContext);
aWidget->SynthesizeNativeMouseMove(sLastRefPoint + aWidget->WidgetToScreenOffset(),
nullptr);
sLastRefPoint = GetWindowClientRectCenter(aWidget);
aWidget->SynthesizeNativeMouseMove(
sLastRefPoint + aWidget->WidgetToScreenOffset(), nullptr);
// Retarget all events to this element via capture.
nsIPresShell::SetCapturingContent(aElement, CAPTURE_POINTERLOCK);
@@ -4413,8 +4388,10 @@ EventStateManager::SetPointerLock(nsIWidget* aWidget,
// pre-pointerlock position, so that the synthetic mouse event reports
// no movement.
sLastRefPoint = mPreLockPoint;
aWidget->SynthesizeNativeMouseMove(mPreLockPoint + aWidget->WidgetToScreenOffset(),
nullptr);
if (aWidget) {
aWidget->SynthesizeNativeMouseMove(
mPreLockPoint + aWidget->WidgetToScreenOffset(), nullptr);
}
// Don't retarget events to this element any more.
nsIPresShell::SetCapturingContent(nullptr, CAPTURE_POINTERLOCK);
@@ -4510,9 +4487,9 @@ EventStateManager::FireDragEnterOrExit(nsPresContext* aPresContext,
nsWeakFrame& aTargetFrame)
{
nsEventStatus status = nsEventStatus_eIgnore;
WidgetDragEvent event(aDragEvent->IsTrusted(), aMessage, aDragEvent->widget);
event.refPoint = aDragEvent->refPoint;
event.modifiers = aDragEvent->modifiers;
WidgetDragEvent event(aDragEvent->IsTrusted(), aMessage, aDragEvent->mWidget);
event.mRefPoint = aDragEvent->mRefPoint;
event.mModifiers = aDragEvent->mModifiers;
event.buttons = aDragEvent->buttons;
event.relatedTarget = aRelatedTarget;
event.inputSource = aDragEvent->inputSource;
@@ -4543,14 +4520,23 @@ EventStateManager::FireDragEnterOrExit(nsPresContext* aPresContext,
// Finally dispatch the event to the frame
if (aTargetFrame)
aTargetFrame->HandleEvent(aPresContext, &event, &status);
if (aMessage == eDragExit && IsRemoteTarget(aTargetContent)) {
nsEventStatus status = nsEventStatus_eIgnore;
WidgetDragEvent remoteEvent(aDragEvent->IsTrusted(), aMessage,
aDragEvent->mWidget);
remoteEvent.AssignDragEventData(*aDragEvent, true);
HandleCrossProcessEvent(&remoteEvent, &status);
}
}
void
EventStateManager::UpdateDragDataTransfer(WidgetDragEvent* dragEvent)
{
NS_ASSERTION(dragEvent, "drag event is null in UpdateDragDataTransfer!");
if (!dragEvent->dataTransfer)
if (!dragEvent->mDataTransfer) {
return;
}
nsCOMPtr<nsIDragSession> dragSession = nsContentUtils::GetDragSession();
@@ -4562,7 +4548,7 @@ EventStateManager::UpdateDragDataTransfer(WidgetDragEvent* dragEvent)
if (initialDataTransfer) {
// retrieve the current moz cursor setting and save it.
nsAutoString mozCursor;
dragEvent->dataTransfer->GetMozCursor(mozCursor);
dragEvent->mDataTransfer->GetMozCursor(mozCursor);
initialDataTransfer->SetMozCursor(mozCursor);
}
}
@@ -4655,14 +4641,14 @@ EventStateManager::InitAndDispatchClickEvent(WidgetMouseEvent* aEvent,
bool aNoContentDispatch)
{
WidgetMouseEvent event(aEvent->IsTrusted(), aMessage,
aEvent->widget, WidgetMouseEvent::eReal);
aEvent->mWidget, WidgetMouseEvent::eReal);
event.refPoint = aEvent->refPoint;
event.mRefPoint = aEvent->mRefPoint;
event.clickCount = aEvent->clickCount;
event.modifiers = aEvent->modifiers;
event.mModifiers = aEvent->mModifiers;
event.buttons = aEvent->buttons;
event.time = aEvent->time;
event.timeStamp = aEvent->timeStamp;
event.mTime = aEvent->mTime;
event.mTimeStamp = aEvent->mTimeStamp;
event.mFlags.mNoContentDispatch = aNoContentDispatch;
event.button = aEvent->button;
event.inputSource = aEvent->inputSource;
@@ -4682,7 +4668,7 @@ EventStateManager::CheckForAndDispatchClick(WidgetMouseEvent* aEvent,
if (0 != aEvent->clickCount) {
//Check that the window isn't disabled before firing a click
//(see bug 366544).
if (aEvent->widget && !aEvent->widget->IsEnabled()) {
if (aEvent->mWidget && !aEvent->mWidget->IsEnabled()) {
return ret;
}
//fire click
@@ -4973,7 +4959,7 @@ EventStateManager::SetContentState(nsIContent* aContent, EventStates aState)
newHover = aContent;
} else {
NS_ASSERTION(!aContent ||
aContent->GetCrossShadowCurrentDoc() ==
aContent->GetComposedDoc() ==
mPresContext->PresShell()->GetDocument(),
"Unexpected document");
nsIFrame *frame = aContent ? aContent->GetPrimaryFrame() : nullptr;
@@ -5383,22 +5369,22 @@ EventStateManager::DeltaAccumulator::InitLineOrPageDelta(
// If we have accumulated delta, we may need to reset it.
if (IsInTransaction()) {
// If wheel event type is changed, reset the values.
if (mHandlingDeltaMode != aEvent->deltaMode ||
if (mHandlingDeltaMode != aEvent->mDeltaMode ||
mIsNoLineOrPageDeltaDevice != aEvent->mIsNoLineOrPageDelta) {
Reset();
} else {
// If the delta direction is changed, we should reset only the
// accumulated values.
if (mX && aEvent->deltaX && ((aEvent->deltaX > 0.0) != (mX > 0.0))) {
if (mX && aEvent->mDeltaX && ((aEvent->mDeltaX > 0.0) != (mX > 0.0))) {
mX = mPendingScrollAmountX = 0.0;
}
if (mY && aEvent->deltaY && ((aEvent->deltaY > 0.0) != (mY > 0.0))) {
if (mY && aEvent->mDeltaY && ((aEvent->mDeltaY > 0.0) != (mY > 0.0))) {
mY = mPendingScrollAmountY = 0.0;
}
}
}
mHandlingDeltaMode = aEvent->deltaMode;
mHandlingDeltaMode = aEvent->mDeltaMode;
mIsNoLineOrPageDeltaDevice = aEvent->mIsNoLineOrPageDelta;
// If it's handling neither a device that does not provide line or page deltas
@@ -5412,22 +5398,22 @@ EventStateManager::DeltaAccumulator::InitLineOrPageDelta(
// is changed.
// NOTE: We shouldn't accumulate the delta values, it might could cause
// overflow even though it's not a realistic situation.
if (aEvent->deltaX) {
mX = aEvent->deltaX;
if (aEvent->mDeltaX) {
mX = aEvent->mDeltaX;
}
if (aEvent->deltaY) {
mY = aEvent->deltaY;
if (aEvent->mDeltaY) {
mY = aEvent->mDeltaY;
}
mLastTime = TimeStamp::Now();
return;
}
mX += aEvent->deltaX;
mY += aEvent->deltaY;
mX += aEvent->mDeltaX;
mY += aEvent->mDeltaY;
if (mHandlingDeltaMode == nsIDOMWheelEvent::DOM_DELTA_PIXEL) {
// Records pixel delta values and init lineOrPageDeltaX and
// lineOrPageDeltaY for wheel events which are caused by pixel only
// Records pixel delta values and init mLineOrPageDeltaX and
// mLineOrPageDeltaY for wheel events which are caused by pixel only
// devices. Ignore mouse wheel transaction for computing this. The
// lineOrPageDelta values will be used by dispatching legacy
// eMouseScrollEventClass (DOMMouseScroll) but not be used for scrolling
@@ -5444,16 +5430,16 @@ EventStateManager::DeltaAccumulator::InitLineOrPageDelta(
nsPresContext::AppUnitsToIntCSSPixels(scrollAmount.width),
nsPresContext::AppUnitsToIntCSSPixels(scrollAmount.height));
aEvent->lineOrPageDeltaX = RoundDown(mX) / scrollAmountInCSSPixels.width;
aEvent->lineOrPageDeltaY = RoundDown(mY) / scrollAmountInCSSPixels.height;
aEvent->mLineOrPageDeltaX = RoundDown(mX) / scrollAmountInCSSPixels.width;
aEvent->mLineOrPageDeltaY = RoundDown(mY) / scrollAmountInCSSPixels.height;
mX -= aEvent->lineOrPageDeltaX * scrollAmountInCSSPixels.width;
mY -= aEvent->lineOrPageDeltaY * scrollAmountInCSSPixels.height;
mX -= aEvent->mLineOrPageDeltaX * scrollAmountInCSSPixels.width;
mY -= aEvent->mLineOrPageDeltaY * scrollAmountInCSSPixels.height;
} else {
aEvent->lineOrPageDeltaX = RoundDown(mX);
aEvent->lineOrPageDeltaY = RoundDown(mY);
mX -= aEvent->lineOrPageDeltaX;
mY -= aEvent->lineOrPageDeltaY;
aEvent->mLineOrPageDeltaX = RoundDown(mX);
aEvent->mLineOrPageDeltaY = RoundDown(mY);
mX -= aEvent->mLineOrPageDeltaX;
mY -= aEvent->mLineOrPageDeltaY;
}
mLastTime = TimeStamp::Now();
@@ -5478,13 +5464,13 @@ EventStateManager::DeltaAccumulator::ComputeScrollAmountForDefaultAction(
// If the wheel event is line scroll and the delta value is computed from
// system settings, allow to override the system speed.
bool allowScrollSpeedOverride =
(!aEvent->customizedByUserPrefs &&
aEvent->deltaMode == nsIDOMWheelEvent::DOM_DELTA_LINE);
(!aEvent->mCustomizedByUserPrefs &&
aEvent->mDeltaMode == nsIDOMWheelEvent::DOM_DELTA_LINE);
DeltaValues acceleratedDelta =
WheelTransaction::AccelerateWheelDelta(aEvent, allowScrollSpeedOverride);
nsIntPoint result(0, 0);
if (aEvent->deltaMode == nsIDOMWheelEvent::DOM_DELTA_PIXEL) {
if (aEvent->mDeltaMode == nsIDOMWheelEvent::DOM_DELTA_PIXEL) {
mPendingScrollAmountX += acceleratedDelta.deltaX;
mPendingScrollAmountY += acceleratedDelta.deltaY;
} else {
@@ -5537,6 +5523,9 @@ EventStateManager::WheelPrefs::WheelPrefs()
{
Reset();
Preferences::RegisterCallback(OnPrefChanged, "mousewheel.", nullptr);
Preferences::AddBoolVarCache(&sWheelEventsEnabledOnPlugins,
"plugin.mousewheel.enabled",
true);
}
EventStateManager::WheelPrefs::~WheelPrefs()
@@ -5559,11 +5548,11 @@ EventStateManager::WheelPrefs::GetIndexFor(WidgetWheelEvent* aEvent)
}
Modifiers modifiers =
(aEvent->modifiers & (MODIFIER_ALT |
MODIFIER_CONTROL |
MODIFIER_META |
MODIFIER_SHIFT |
MODIFIER_OS));
(aEvent->mModifiers & (MODIFIER_ALT |
MODIFIER_CONTROL |
MODIFIER_META |
MODIFIER_SHIFT |
MODIFIER_OS));
switch (modifiers) {
case MODIFIER_ALT:
@@ -5664,25 +5653,29 @@ EventStateManager::WheelPrefs::Init(EventStateManager::WheelPrefs::Index aIndex)
void
EventStateManager::WheelPrefs::ApplyUserPrefsToDelta(WidgetWheelEvent* aEvent)
{
if (aEvent->mCustomizedByUserPrefs) {
return;
}
Index index = GetIndexFor(aEvent);
Init(index);
aEvent->deltaX *= mMultiplierX[index];
aEvent->deltaY *= mMultiplierY[index];
aEvent->deltaZ *= mMultiplierZ[index];
aEvent->mDeltaX *= mMultiplierX[index];
aEvent->mDeltaY *= mMultiplierY[index];
aEvent->mDeltaZ *= mMultiplierZ[index];
// If the multiplier is 1.0 or -1.0, i.e., it doesn't change the absolute
// value, we should use lineOrPageDelta values which were set by widget.
// Otherwise, we need to compute them from accumulated delta values.
if (!NeedToComputeLineOrPageDelta(aEvent)) {
aEvent->lineOrPageDeltaX *= static_cast<int32_t>(mMultiplierX[index]);
aEvent->lineOrPageDeltaY *= static_cast<int32_t>(mMultiplierY[index]);
aEvent->mLineOrPageDeltaX *= static_cast<int32_t>(mMultiplierX[index]);
aEvent->mLineOrPageDeltaY *= static_cast<int32_t>(mMultiplierY[index]);
} else {
aEvent->lineOrPageDeltaX = 0;
aEvent->lineOrPageDeltaY = 0;
aEvent->mLineOrPageDeltaX = 0;
aEvent->mLineOrPageDeltaY = 0;
}
aEvent->customizedByUserPrefs =
aEvent->mCustomizedByUserPrefs =
((mMultiplierX[index] != 1.0) || (mMultiplierY[index] != 1.0) ||
(mMultiplierZ[index] != 1.0));
}
@@ -5701,10 +5694,10 @@ EventStateManager::WheelPrefs::CancelApplyingUserPrefsFromOverflowDelta(
// referrencing the deltaX and deltaY of the event.
if (mMultiplierX[index]) {
aEvent->overflowDeltaX /= mMultiplierX[index];
aEvent->mOverflowDeltaX /= mMultiplierX[index];
}
if (mMultiplierY[index]) {
aEvent->overflowDeltaY /= mMultiplierY[index];
aEvent->mOverflowDeltaY /= mMultiplierY[index];
}
}
@@ -5715,15 +5708,15 @@ EventStateManager::WheelPrefs::ComputeActionFor(WidgetWheelEvent* aEvent)
Init(index);
bool deltaXPreferred =
(Abs(aEvent->deltaX) > Abs(aEvent->deltaY) &&
Abs(aEvent->deltaX) > Abs(aEvent->deltaZ));
(Abs(aEvent->mDeltaX) > Abs(aEvent->mDeltaY) &&
Abs(aEvent->mDeltaX) > Abs(aEvent->mDeltaZ));
Action* actions = deltaXPreferred ? mOverriddenActionsX : mActions;
if (actions[index] == ACTION_NONE || actions[index] == ACTION_SCROLL) {
return actions[index];
}
// Momentum events shouldn't run special actions.
if (aEvent->isMomentum) {
if (aEvent->mIsMomentum) {
// Use the default action. Note that user might kill the wheel scrolling.
Init(INDEX_DEFAULT);
return (actions[INDEX_DEFAULT] == ACTION_SCROLL) ? ACTION_SCROLL :
@@ -5756,6 +5749,16 @@ EventStateManager::WheelPrefs::GetUserPrefsForEvent(WidgetWheelEvent* aEvent,
*aOutMultiplierY = mMultiplierY[index];
}
// static
bool
EventStateManager::WheelPrefs::WheelEventsEnabledOnPlugins()
{
if (!sInstance) {
GetInstance(); // initializing sWheelEventsEnabledOnPlugins
}
return sWheelEventsEnabledOnPlugins;
}
bool
EventStateManager::WheelEventIsScrollAction(WidgetWheelEvent* aEvent)
{
+32 -10
View File
@@ -108,6 +108,10 @@ public:
nsIFrame* aTargetFrame,
nsEventStatus* aStatus);
void PostHandleKeyboardEvent(WidgetKeyboardEvent* aKeyboardEvent,
nsEventStatus& aStatus,
bool dispatchedToContentProcess);
/**
* DispatchLegacyMouseScrollEvents() dispatches eLegacyMouseLineOrPageScroll
* event and eLegacyMousePixelScroll event for compatibility with old Gecko.
@@ -516,6 +520,12 @@ protected:
bool IsOverOnePageScrollAllowedX(WidgetWheelEvent* aEvent);
bool IsOverOnePageScrollAllowedY(WidgetWheelEvent* aEvent);
/**
* WheelEventsEnabledOnPlugins() returns true if user wants to use mouse
* wheel on plugins.
*/
static bool WheelEventsEnabledOnPlugins();
private:
WheelPrefs();
~WheelPrefs();
@@ -579,6 +589,8 @@ protected:
Action mOverriddenActionsX[COUNT_OF_MULTIPLIERS];
static WheelPrefs* sInstance;
static bool sWheelEventsEnabledOnPlugins;
};
/**
@@ -669,12 +681,14 @@ protected:
// Default action prefers the scrolled element immediately before if it's
// still under the mouse cursor. Otherwise, it prefers the nearest
// scrollable ancestor which will be scrolled actually.
COMPUTE_DEFAULT_ACTION_TARGET_EXCEPT_PLUGIN =
(PREFER_MOUSE_WHEEL_TRANSACTION |
PREFER_ACTUAL_SCROLLABLE_TARGET_ALONG_X_AXIS |
PREFER_ACTUAL_SCROLLABLE_TARGET_ALONG_Y_AXIS),
// When this is specified, the result may be nsPluginFrame. In such case,
// the frame doesn't have nsIScrollableFrame interface.
COMPUTE_DEFAULT_ACTION_TARGET =
(PREFER_MOUSE_WHEEL_TRANSACTION |
PREFER_ACTUAL_SCROLLABLE_TARGET_ALONG_X_AXIS |
PREFER_ACTUAL_SCROLLABLE_TARGET_ALONG_Y_AXIS |
(COMPUTE_DEFAULT_ACTION_TARGET_EXCEPT_PLUGIN |
INCLUDE_PLUGIN_AS_TARGET),
// Look for the nearest scrollable ancestor which can be scrollable with
// aEvent.
@@ -683,6 +697,17 @@ protected:
COMPUTE_SCROLLABLE_ANCESTOR_ALONG_Y_AXIS =
(PREFER_ACTUAL_SCROLLABLE_TARGET_ALONG_Y_AXIS | START_FROM_PARENT)
};
static ComputeScrollTargetOptions RemovePluginFromTarget(
ComputeScrollTargetOptions aOptions)
{
switch (aOptions) {
case COMPUTE_DEFAULT_ACTION_TARGET:
return COMPUTE_DEFAULT_ACTION_TARGET_EXCEPT_PLUGIN;
default:
MOZ_ASSERT(!(aOptions & INCLUDE_PLUGIN_AS_TARGET));
return aOptions;
}
}
nsIFrame* ComputeScrollTarget(nsIFrame* aTargetFrame,
WidgetWheelEvent* aEvent,
ComputeScrollTargetOptions aOptions);
@@ -852,7 +877,7 @@ protected:
/**
* Set the fields of aEvent to reflect the mouse position and modifier keys
* that were set when the user first pressed the mouse button (stored by
* BeginTrackingDragGesture). aEvent->widget must be
* BeginTrackingDragGesture). aEvent->mWidget must be
* mCurrentTarget->GetNearestWidget().
*/
void FillInEventFromGestureDown(WidgetMouseEvent* aEvent);
@@ -885,19 +910,16 @@ private:
static void ResetLastOverForContent(const uint32_t& aIdx,
RefPtr<OverOutElementsWrapper>& aChunk,
nsIContent* aClosure);
void PostHandleKeyboardEvent(WidgetKeyboardEvent* aKeyboardEvent,
nsEventStatus& aStatus,
bool dispatchedToContentProcess);
int32_t mLockCursor;
bool mLastFrameConsumedSetCursor;
// Last mouse event refPoint (the offset from the widget's origin in
// Last mouse event mRefPoint (the offset from the widget's origin in
// device pixels) when mouse was locked, used to restore mouse position
// after unlocking.
LayoutDeviceIntPoint mPreLockPoint;
// Stores the refPoint of the last synthetic mouse move we dispatched
// Stores the mRefPoint of the last synthetic mouse move we dispatched
// to re-center the mouse when we were pointer locked. If this is (-1,-1) it
// means we've not recently dispatched a centering event. We use this to
// detect when we receive the synth event, so we can cancel and not send it
@@ -908,7 +930,7 @@ private:
nsCOMPtr<nsIContent> mCurrentTargetContent;
static nsWeakFrame sLastDragOverFrame;
// Stores the refPoint (the offset from the widget's origin in device
// Stores the mRefPoint (the offset from the widget's origin in device
// pixels) of the last mouse event.
static LayoutDeviceIntPoint sLastRefPoint;
+1 -1
View File
@@ -40,7 +40,7 @@ EventTarget::SetEventHandler(const nsAString& aType,
return;
}
if (NS_IsMainThread()) {
nsCOMPtr<nsIAtom> type = do_GetAtom(aType);
nsCOMPtr<nsIAtom> type = NS_Atomize(aType);
SetEventHandler(type, EmptyString(), aHandler);
return;
}
+1 -1
View File
@@ -55,7 +55,7 @@ public:
// Note, this takes the type in onfoo form!
EventHandlerNonNull* GetEventHandler(const nsAString& aType)
{
nsCOMPtr<nsIAtom> type = do_GetAtom(aType);
nsCOMPtr<nsIAtom> type = NS_Atomize(aType);
return GetEventHandler(type, EmptyString());
}
+3 -3
View File
@@ -23,7 +23,7 @@ FocusEvent::FocusEvent(EventTarget* aOwner,
mEventIsInternal = false;
} else {
mEventIsInternal = true;
mEvent->time = PR_Now();
mEvent->mTime = PR_Now();
}
}
@@ -38,7 +38,7 @@ FocusEvent::GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget)
EventTarget*
FocusEvent::GetRelatedTarget()
{
return mEvent->AsFocusEvent()->relatedTarget;
return mEvent->AsFocusEvent()->mRelatedTarget;
}
nsresult
@@ -52,7 +52,7 @@ FocusEvent::InitFocusEvent(const nsAString& aType,
nsresult rv =
UIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail);
NS_ENSURE_SUCCESS(rv, rv);
mEvent->AsFocusEvent()->relatedTarget = aRelatedTarget;
mEvent->AsFocusEvent()->mRelatedTarget = aRelatedTarget;
return NS_OK;
}
+7 -7
View File
@@ -757,7 +757,7 @@ IMEContentObserver::OnMouseButtonEvent(nsPresContext* aPresContext,
}
if (!aMouseEvent->IsTrusted() ||
aMouseEvent->DefaultPrevented() ||
!aMouseEvent->widget) {
!aMouseEvent->mWidget) {
return false;
}
// Now, we need to notify only mouse down and mouse up event.
@@ -775,8 +775,8 @@ IMEContentObserver::OnMouseButtonEvent(nsPresContext* aPresContext,
RefPtr<IMEContentObserver> kungFuDeathGrip(this);
WidgetQueryContentEvent charAtPt(true, eQueryCharacterAtPoint,
aMouseEvent->widget);
charAtPt.refPoint = aMouseEvent->refPoint;
aMouseEvent->mWidget);
charAtPt.mRefPoint = aMouseEvent->mRefPoint;
ContentEventHandler handler(aPresContext);
handler.OnQueryCharacterAtPoint(&charAtPt);
if (NS_WARN_IF(!charAtPt.mSucceeded) ||
@@ -800,8 +800,8 @@ IMEContentObserver::OnMouseButtonEvent(nsPresContext* aPresContext,
}
// The refPt is relative to its widget.
// We should notify it with offset in the widget.
if (aMouseEvent->widget != mWidget) {
charAtPt.refPoint += aMouseEvent->widget->WidgetToScreenOffset() -
if (aMouseEvent->mWidget != mWidget) {
charAtPt.mRefPoint += aMouseEvent->mWidget->WidgetToScreenOffset() -
mWidget->WidgetToScreenOffset();
}
@@ -809,12 +809,12 @@ IMEContentObserver::OnMouseButtonEvent(nsPresContext* aPresContext,
notification.mMouseButtonEventData.mEventMessage = aMouseEvent->mMessage;
notification.mMouseButtonEventData.mOffset = charAtPt.mReply.mOffset;
notification.mMouseButtonEventData.mCursorPos.Set(
charAtPt.refPoint.ToUnknownPoint());
charAtPt.mRefPoint.ToUnknownPoint());
notification.mMouseButtonEventData.mCharRect.Set(
charAtPt.mReply.mRect.ToUnknownRect());
notification.mMouseButtonEventData.mButton = aMouseEvent->button;
notification.mMouseButtonEventData.mButtons = aMouseEvent->buttons;
notification.mMouseButtonEventData.mModifiers = aMouseEvent->modifiers;
notification.mMouseButtonEventData.mModifiers = aMouseEvent->mModifiers;
nsresult rv = IMEStateManager::NotifyIME(notification, mWidget);
if (NS_WARN_IF(NS_FAILED(rv))) {
+14 -14
View File
@@ -1147,7 +1147,7 @@ IMEStateManager::DispatchCompositionEvent(
("ISM: IMEStateManager::DispatchCompositionEvent(aNode=0x%p, "
"aPresContext=0x%p, aCompositionEvent={ mMessage=%s, "
"mNativeIMEContext={ mRawNativeIMEContext=0x%X, "
"mOriginProcessID=0x%X }, widget(0x%p)={ "
"mOriginProcessID=0x%X }, mWidget(0x%p)={ "
"GetNativeIMEContext()={ mRawNativeIMEContext=0x%X, "
"mOriginProcessID=0x%X }, Destroyed()=%s }, "
"mFlags={ mIsTrusted=%s, mPropagationStopped=%s } }, "
@@ -1156,16 +1156,16 @@ IMEStateManager::DispatchCompositionEvent(
ToChar(aCompositionEvent->mMessage),
aCompositionEvent->mNativeIMEContext.mRawNativeIMEContext,
aCompositionEvent->mNativeIMEContext.mOriginProcessID,
aCompositionEvent->widget.get(),
aCompositionEvent->widget->GetNativeIMEContext().mRawNativeIMEContext,
aCompositionEvent->widget->GetNativeIMEContext().mOriginProcessID,
GetBoolName(aCompositionEvent->widget->Destroyed()),
aCompositionEvent->mWidget.get(),
aCompositionEvent->mWidget->GetNativeIMEContext().mRawNativeIMEContext,
aCompositionEvent->mWidget->GetNativeIMEContext().mOriginProcessID,
GetBoolName(aCompositionEvent->mWidget->Destroyed()),
GetBoolName(aCompositionEvent->mFlags.mIsTrusted),
GetBoolName(aCompositionEvent->mFlags.mPropagationStopped),
GetBoolName(aIsSynthesized), tabParent.get()));
if (!aCompositionEvent->IsTrusted() ||
aCompositionEvent->mFlags.mPropagationStopped) {
aCompositionEvent->PropagationStopped()) {
return;
}
@@ -1217,7 +1217,7 @@ IMEStateManager::DispatchCompositionEvent(
composition->WasNativeCompositionEndEventDiscarded()) &&
aCompositionEvent->CausesDOMCompositionEndEvent()) {
TextCompositionArray::index_type i =
sTextCompositions->IndexOf(aCompositionEvent->widget);
sTextCompositions->IndexOf(aCompositionEvent->mWidget);
if (i != TextCompositionArray::NoIndex) {
MOZ_LOG(sISMLog, LogLevel::Debug,
("ISM: IMEStateManager::DispatchCompositionEvent(), "
@@ -1266,7 +1266,7 @@ IMEStateManager::HandleSelectionEvent(nsPresContext* aPresContext,
}
RefPtr<TextComposition> composition = sTextCompositions ?
sTextCompositions->GetCompositionFor(aSelectionEvent->widget) : nullptr;
sTextCompositions->GetCompositionFor(aSelectionEvent->mWidget) : nullptr;
if (composition) {
// When there is a composition, TextComposition should guarantee that the
// selection event will be handled in same target as composition events.
@@ -1290,17 +1290,17 @@ IMEStateManager::OnCompositionEventDiscarded(
MOZ_LOG(sISMLog, LogLevel::Info,
("ISM: IMEStateManager::OnCompositionEventDiscarded(aCompositionEvent={ "
"mMessage=%s, mNativeIMEContext={ mRawNativeIMEContext=0x%X, "
"mOriginProcessID=0x%X }, widget(0x%p)={ "
"mOriginProcessID=0x%X }, mWidget(0x%p)={ "
"GetNativeIMEContext()={ mRawNativeIMEContext=0x%X, "
"mOriginProcessID=0x%X }, Destroyed()=%s }, "
"mFlags={ mIsTrusted=%s } })",
ToChar(aCompositionEvent->mMessage),
aCompositionEvent->mNativeIMEContext.mRawNativeIMEContext,
aCompositionEvent->mNativeIMEContext.mOriginProcessID,
aCompositionEvent->widget.get(),
aCompositionEvent->widget->GetNativeIMEContext().mRawNativeIMEContext,
aCompositionEvent->widget->GetNativeIMEContext().mOriginProcessID,
GetBoolName(aCompositionEvent->widget->Destroyed()),
aCompositionEvent->mWidget.get(),
aCompositionEvent->mWidget->GetNativeIMEContext().mRawNativeIMEContext,
aCompositionEvent->mWidget->GetNativeIMEContext().mOriginProcessID,
GetBoolName(aCompositionEvent->mWidget->Destroyed()),
GetBoolName(aCompositionEvent->mFlags.mIsTrusted)));
if (!aCompositionEvent->IsTrusted()) {
@@ -1314,7 +1314,7 @@ IMEStateManager::OnCompositionEventDiscarded(
}
RefPtr<TextComposition> composition =
sTextCompositions->GetCompositionFor(aCompositionEvent->widget);
sTextCompositions->GetCompositionFor(aCompositionEvent->mWidget);
if (!composition) {
// If the PresShell has been being destroyed during composition,
// a TextComposition instance for the composition was already removed from
+1 -1
View File
@@ -25,7 +25,7 @@ InputEvent::InputEvent(EventTarget* aOwner,
mEventIsInternal = false;
} else {
mEventIsInternal = true;
mEvent->time = PR_Now();
mEvent->mTime = PR_Now();
}
}
+36 -1
View File
@@ -25,7 +25,7 @@ KeyboardEvent::KeyboardEvent(EventTarget* aOwner,
}
else {
mEventIsInternal = true;
mEvent->time = PR_Now();
mEvent->mTime = PR_Now();
mEvent->AsKeyboardEvent()->mKeyNameIndex = KEY_NAME_INDEX_USE_STRING;
}
}
@@ -136,6 +136,41 @@ KeyboardEvent::GetCode(nsAString& aCodeName)
mEvent->AsKeyboardEvent()->GetDOMCodeName(aCodeName);
}
void KeyboardEvent::GetInitDict(KeyboardEventInit& aParam)
{
GetKey(aParam.mKey);
GetCode(aParam.mCode);
aParam.mLocation = Location();
aParam.mRepeat = Repeat();
aParam.mIsComposing = IsComposing();
// legacy attributes
aParam.mKeyCode = KeyCode();
aParam.mCharCode = CharCode();
aParam.mWhich = Which();
// modifiers from EventModifierInit
aParam.mCtrlKey = CtrlKey();
aParam.mShiftKey = ShiftKey();
aParam.mAltKey = AltKey();
aParam.mMetaKey = MetaKey();
WidgetKeyboardEvent* internalEvent = mEvent->AsKeyboardEvent();
aParam.mModifierAltGraph = internalEvent->IsAltGraph();
aParam.mModifierCapsLock = internalEvent->IsCapsLocked();
aParam.mModifierFn = internalEvent->IsFn();
aParam.mModifierFnLock = internalEvent->IsFnLocked();
aParam.mModifierNumLock = internalEvent->IsNumLocked();
aParam.mModifierOS = internalEvent->IsOS();
aParam.mModifierScrollLock = internalEvent->IsScrollLocked();
aParam.mModifierSymbol = internalEvent->IsSymbol();
aParam.mModifierSymbolLock = internalEvent->IsSymbolLocked();
// EventInit
aParam.mBubbles = internalEvent->mFlags.mBubbles;
aParam.mCancelable = internalEvent->mFlags.mCancelable;
}
NS_IMETHODIMP
KeyboardEvent::GetCharCode(uint32_t* aCharCode)
{
+1
View File
@@ -60,6 +60,7 @@ public:
uint32_t Location();
void GetCode(nsAString& aCode);
void GetInitDict(KeyboardEventInit& aParam);
void InitKeyEvent(const nsAString& aType, bool aCanBubble, bool aCancelable,
nsIDOMWindow* aView, bool aCtrlKey, bool aAltKey,
+13 -12
View File
@@ -31,8 +31,8 @@ MouseEvent::MouseEvent(EventTarget* aOwner,
}
else {
mEventIsInternal = true;
mEvent->time = PR_Now();
mEvent->refPoint.x = mEvent->refPoint.y = 0;
mEvent->mTime = PR_Now();
mEvent->mRefPoint = LayoutDeviceIntPoint(0, 0);
mouseEvent->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
}
@@ -84,8 +84,8 @@ MouseEvent::InitMouseEvent(const nsAString& aType,
mouseEventBase->InitBasicModifiers(aCtrlKey, aAltKey, aShiftKey, aMetaKey);
mClientPoint.x = aClientX;
mClientPoint.y = aClientY;
mouseEventBase->refPoint.x = aScreenX;
mouseEventBase->refPoint.y = aScreenY;
mouseEventBase->mRefPoint.x = aScreenX;
mouseEventBase->mRefPoint.y = aScreenY;
WidgetMouseEvent* mouseEvent = mEvent->AsMouseEvent();
if (mouseEvent) {
@@ -132,7 +132,7 @@ MouseEvent::InitMouseEvent(const nsAString& aType,
case eDragEventClass:
case ePointerEventClass:
case eSimpleGestureEventClass:
mEvent->AsInputEvent()->modifiers = modifiers;
mEvent->AsInputEvent()->mModifiers = modifiers;
return NS_OK;
default:
MOZ_CRASH("There is no space to store the modifiers");
@@ -278,7 +278,8 @@ MouseEvent::GetRelatedTarget()
if (relatedTarget) {
nsCOMPtr<nsIContent> content = do_QueryInterface(relatedTarget);
nsCOMPtr<nsIContent> currentTarget = do_QueryInterface(mEvent->currentTarget);
nsCOMPtr<nsIContent> currentTarget =
do_QueryInterface(mEvent->mCurrentTarget);
nsIContent* shadowRelatedTarget = GetShadowRelatedTarget(currentTarget, content);
if (shadowRelatedTarget) {
@@ -337,7 +338,7 @@ MouseEvent::GetScreenX(int32_t* aScreenX)
int32_t
MouseEvent::ScreenX()
{
return Event::GetScreenCoords(mPresContext, mEvent, mEvent->refPoint).x;
return Event::GetScreenCoords(mPresContext, mEvent, mEvent->mRefPoint).x;
}
NS_IMETHODIMP
@@ -351,7 +352,7 @@ MouseEvent::GetScreenY(int32_t* aScreenY)
int32_t
MouseEvent::ScreenY()
{
return Event::GetScreenCoords(mPresContext, mEvent, mEvent->refPoint).y;
return Event::GetScreenCoords(mPresContext, mEvent, mEvent->mRefPoint).y;
}
@@ -366,7 +367,7 @@ MouseEvent::GetClientX(int32_t* aClientX)
int32_t
MouseEvent::ClientX()
{
return Event::GetClientCoords(mPresContext, mEvent, mEvent->refPoint,
return Event::GetClientCoords(mPresContext, mEvent, mEvent->mRefPoint,
mClientPoint).x;
}
@@ -381,21 +382,21 @@ MouseEvent::GetClientY(int32_t* aClientY)
int32_t
MouseEvent::ClientY()
{
return Event::GetClientCoords(mPresContext, mEvent, mEvent->refPoint,
return Event::GetClientCoords(mPresContext, mEvent, mEvent->mRefPoint,
mClientPoint).y;
}
int32_t
MouseEvent::OffsetX()
{
return Event::GetOffsetCoords(mPresContext, mEvent, mEvent->refPoint,
return Event::GetOffsetCoords(mPresContext, mEvent, mEvent->mRefPoint,
mClientPoint).x;
}
int32_t
MouseEvent::OffsetY()
{
return Event::GetOffsetCoords(mPresContext, mEvent, mEvent->refPoint,
return Event::GetOffsetCoords(mPresContext, mEvent, mEvent->mRefPoint,
mClientPoint).y;
}
+6 -5
View File
@@ -22,13 +22,13 @@ MouseScrollEvent::MouseScrollEvent(EventTarget* aOwner,
mEventIsInternal = false;
} else {
mEventIsInternal = true;
mEvent->time = PR_Now();
mEvent->refPoint.x = mEvent->refPoint.y = 0;
mEvent->mTime = PR_Now();
mEvent->mRefPoint = LayoutDeviceIntPoint(0, 0);
static_cast<WidgetMouseEventBase*>(mEvent)->inputSource =
nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
}
mDetail = mEvent->AsMouseScrollEvent()->delta;
mDetail = mEvent->AsMouseScrollEvent()->mDelta;
}
NS_IMPL_ADDREF_INHERITED(MouseScrollEvent, MouseEvent)
@@ -62,7 +62,8 @@ MouseScrollEvent::InitMouseScrollEvent(const nsAString& aType,
aCtrlKey, aAltKey, aShiftKey, aMetaKey, aButton,
aRelatedTarget);
NS_ENSURE_SUCCESS(rv, rv);
mEvent->AsMouseScrollEvent()->isHorizontal = (aAxis == HORIZONTAL_AXIS);
mEvent->AsMouseScrollEvent()->mIsHorizontal =
(aAxis == nsIDOMMouseScrollEvent::HORIZONTAL_AXIS);
return NS_OK;
}
@@ -78,7 +79,7 @@ MouseScrollEvent::GetAxis(int32_t* aResult)
int32_t
MouseScrollEvent::Axis()
{
return mEvent->AsMouseScrollEvent()->isHorizontal ?
return mEvent->AsMouseScrollEvent()->mIsHorizontal ?
static_cast<int32_t>(HORIZONTAL_AXIS) :
static_cast<int32_t>(VERTICAL_AXIS);
}
+3 -3
View File
@@ -101,11 +101,11 @@ MutationEvent::InitMutationEvent(const nsAString& aTypeArg,
InternalMutationEvent* mutation = mEvent->AsMutationEvent();
mutation->mRelatedNode = aRelatedNodeArg;
if (!aPrevValueArg.IsEmpty())
mutation->mPrevAttrValue = do_GetAtom(aPrevValueArg);
mutation->mPrevAttrValue = NS_Atomize(aPrevValueArg);
if (!aNewValueArg.IsEmpty())
mutation->mNewAttrValue = do_GetAtom(aNewValueArg);
mutation->mNewAttrValue = NS_Atomize(aNewValueArg);
if (!aAttrNameArg.IsEmpty()) {
mutation->mAttrName = do_GetAtom(aAttrNameArg);
mutation->mAttrName = NS_Atomize(aAttrNameArg);
}
mutation->mAttrChange = aAttrChangeArg;
+2 -2
View File
@@ -28,8 +28,8 @@ PointerEvent::PointerEvent(EventTarget* aOwner,
mEventIsInternal = false;
} else {
mEventIsInternal = true;
mEvent->time = PR_Now();
mEvent->refPoint.x = mEvent->refPoint.y = 0;
mEvent->mTime = PR_Now();
mEvent->mRefPoint = LayoutDeviceIntPoint(0, 0);
mouseEvent->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
}
}
+2 -2
View File
@@ -26,8 +26,8 @@ SimpleGestureEvent::SimpleGestureEvent(EventTarget* aOwner,
mEventIsInternal = false;
} else {
mEventIsInternal = true;
mEvent->time = PR_Now();
mEvent->refPoint.x = mEvent->refPoint.y = 0;
mEvent->mTime = PR_Now();
mEvent->mRefPoint = LayoutDeviceIntPoint(0, 0);
static_cast<WidgetMouseEventBase*>(mEvent)->inputSource =
nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
}
+8 -8
View File
@@ -95,7 +95,7 @@ TextComposition::MaybeDispatchCompositionUpdate(
{
MOZ_RELEASE_ASSERT(!mTabParent);
if (!IsValidStateForComposition(aCompositionEvent->widget)) {
if (!IsValidStateForComposition(aCompositionEvent->mWidget)) {
return false;
}
@@ -103,7 +103,7 @@ TextComposition::MaybeDispatchCompositionUpdate(
return true;
}
CloneAndDispatchAs(aCompositionEvent, eCompositionUpdate);
return IsValidStateForComposition(aCompositionEvent->widget);
return IsValidStateForComposition(aCompositionEvent->mWidget);
}
BaseEventFlags
@@ -115,13 +115,13 @@ TextComposition::CloneAndDispatchAs(
{
MOZ_RELEASE_ASSERT(!mTabParent);
MOZ_ASSERT(IsValidStateForComposition(aCompositionEvent->widget),
MOZ_ASSERT(IsValidStateForComposition(aCompositionEvent->mWidget),
"Should be called only when it's safe to dispatch an event");
WidgetCompositionEvent compositionEvent(aCompositionEvent->IsTrusted(),
aMessage, aCompositionEvent->widget);
compositionEvent.time = aCompositionEvent->time;
compositionEvent.timeStamp = aCompositionEvent->timeStamp;
aMessage, aCompositionEvent->mWidget);
compositionEvent.mTime = aCompositionEvent->mTime;
compositionEvent.mTimeStamp = aCompositionEvent->mTimeStamp;
compositionEvent.mData = aCompositionEvent->mData;
compositionEvent.mNativeIMEContext = aCompositionEvent->mNativeIMEContext;
compositionEvent.mOriginalMessage = aCompositionEvent->mMessage;
@@ -279,7 +279,7 @@ TextComposition::DispatchCompositionEvent(
aCompositionEvent->mRanges = nullptr;
}
if (!IsValidStateForComposition(aCompositionEvent->widget)) {
if (!IsValidStateForComposition(aCompositionEvent->mWidget)) {
*aStatus = nsEventStatus_eConsumeNoDefault;
return;
}
@@ -377,7 +377,7 @@ TextComposition::DispatchCompositionEvent(
*aStatus = nsEventStatus_eConsumeNoDefault;
}
if (!IsValidStateForComposition(aCompositionEvent->widget)) {
if (!IsValidStateForComposition(aCompositionEvent->mWidget)) {
return;
}
+9 -9
View File
@@ -69,13 +69,13 @@ TouchEvent::TouchEvent(EventTarget* aOwner,
if (aEvent) {
mEventIsInternal = false;
for (uint32_t i = 0; i < aEvent->touches.Length(); ++i) {
Touch* touch = aEvent->touches[i];
for (uint32_t i = 0; i < aEvent->mTouches.Length(); ++i) {
Touch* touch = aEvent->mTouches[i];
touch->InitializePoints(mPresContext, aEvent);
}
} else {
mEventIsInternal = true;
mEvent->time = PR_Now();
mEvent->mTime = PR_Now();
}
}
@@ -118,9 +118,9 @@ TouchEvent::Touches()
if (!mTouches) {
WidgetTouchEvent* touchEvent = mEvent->AsTouchEvent();
if (mEvent->mMessage == eTouchEnd || mEvent->mMessage == eTouchCancel) {
// for touchend events, remove any changed touches from the touches array
// for touchend events, remove any changed touches from mTouches
WidgetTouchEvent::AutoTouchArray unchangedTouches;
const WidgetTouchEvent::TouchArray& touches = touchEvent->touches;
const WidgetTouchEvent::TouchArray& touches = touchEvent->mTouches;
for (uint32_t i = 0; i < touches.Length(); ++i) {
if (!touches[i]->mChanged) {
unchangedTouches.AppendElement(touches[i]);
@@ -128,7 +128,7 @@ TouchEvent::Touches()
}
mTouches = new TouchList(ToSupports(this), unchangedTouches);
} else {
mTouches = new TouchList(ToSupports(this), touchEvent->touches);
mTouches = new TouchList(ToSupports(this), touchEvent->mTouches);
}
}
return mTouches;
@@ -140,13 +140,13 @@ TouchEvent::TargetTouches()
if (!mTargetTouches) {
WidgetTouchEvent::AutoTouchArray targetTouches;
WidgetTouchEvent* touchEvent = mEvent->AsTouchEvent();
const WidgetTouchEvent::TouchArray& touches = touchEvent->touches;
const WidgetTouchEvent::TouchArray& touches = touchEvent->mTouches;
for (uint32_t i = 0; i < touches.Length(); ++i) {
// for touchend/cancel events, don't append to the target list if this is a
// touch that is ending
if ((mEvent->mMessage != eTouchEnd && mEvent->mMessage != eTouchCancel) ||
!touches[i]->mChanged) {
if (touches[i]->mTarget == mEvent->originalTarget) {
if (touches[i]->mTarget == mEvent->mOriginalTarget) {
targetTouches.AppendElement(touches[i]);
}
}
@@ -162,7 +162,7 @@ TouchEvent::ChangedTouches()
if (!mChangedTouches) {
WidgetTouchEvent::AutoTouchArray changedTouches;
WidgetTouchEvent* touchEvent = mEvent->AsTouchEvent();
const WidgetTouchEvent::TouchArray& touches = touchEvent->touches;
const WidgetTouchEvent::TouchArray& touches = touchEvent->mTouches;
for (uint32_t i = 0; i < touches.Length(); ++i) {
if (touches[i]->mChanged) {
changedTouches.AppendElement(touches[i]);
+1 -1
View File
@@ -22,7 +22,7 @@ TransitionEvent::TransitionEvent(EventTarget* aOwner,
}
else {
mEventIsInternal = true;
mEvent->time = PR_Now();
mEvent->mTime = PR_Now();
}
}

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