mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
c6e1bfdcf2
- 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)
2811 lines
89 KiB
C++
2811 lines
89 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
/* representation of simple property values within CSS declarations */
|
|
|
|
#include "nsCSSValue.h"
|
|
|
|
#include "mozilla/CSSStyleSheet.h"
|
|
#include "mozilla/Likely.h"
|
|
#include "mozilla/MemoryReporting.h"
|
|
#include "mozilla/css/ImageLoader.h"
|
|
#include "CSSCalc.h"
|
|
#include "gfxFontConstants.h"
|
|
#include "imgIRequest.h"
|
|
#include "imgRequestProxy.h"
|
|
#include "nsIDocument.h"
|
|
#include "nsIPrincipal.h"
|
|
#include "nsCSSProps.h"
|
|
#include "nsNetUtil.h"
|
|
#include "nsPresContext.h"
|
|
#include "nsStyleUtil.h"
|
|
#include "nsDeviceContext.h"
|
|
#include "nsStyleSet.h"
|
|
|
|
using namespace mozilla;
|
|
|
|
nsCSSValue::nsCSSValue(int32_t aValue, nsCSSUnit aUnit)
|
|
: mUnit(aUnit)
|
|
{
|
|
MOZ_ASSERT(aUnit == eCSSUnit_Integer || aUnit == eCSSUnit_Enumerated ||
|
|
aUnit == eCSSUnit_EnumColor,
|
|
"not an int value");
|
|
if (aUnit == eCSSUnit_Integer || aUnit == eCSSUnit_Enumerated ||
|
|
aUnit == eCSSUnit_EnumColor) {
|
|
mValue.mInt = aValue;
|
|
}
|
|
else {
|
|
mUnit = eCSSUnit_Null;
|
|
mValue.mInt = 0;
|
|
}
|
|
}
|
|
|
|
nsCSSValue::nsCSSValue(float aValue, nsCSSUnit aUnit)
|
|
: mUnit(aUnit)
|
|
{
|
|
MOZ_ASSERT(eCSSUnit_Percent <= aUnit, "not a float value");
|
|
if (eCSSUnit_Percent <= aUnit) {
|
|
mValue.mFloat = aValue;
|
|
MOZ_ASSERT(!mozilla::IsNaN(mValue.mFloat));
|
|
}
|
|
else {
|
|
mUnit = eCSSUnit_Null;
|
|
mValue.mInt = 0;
|
|
}
|
|
}
|
|
|
|
nsCSSValue::nsCSSValue(const nsString& aValue, nsCSSUnit aUnit)
|
|
: mUnit(aUnit)
|
|
{
|
|
MOZ_ASSERT(UnitHasStringValue(), "not a string value");
|
|
if (UnitHasStringValue()) {
|
|
mValue.mString = BufferFromString(aValue).take();
|
|
}
|
|
else {
|
|
mUnit = eCSSUnit_Null;
|
|
mValue.mInt = 0;
|
|
}
|
|
}
|
|
|
|
nsCSSValue::nsCSSValue(nsCSSValue::Array* aValue, nsCSSUnit aUnit)
|
|
: mUnit(aUnit)
|
|
{
|
|
MOZ_ASSERT(UnitHasArrayValue(), "bad unit");
|
|
mValue.mArray = aValue;
|
|
mValue.mArray->AddRef();
|
|
}
|
|
|
|
nsCSSValue::nsCSSValue(mozilla::css::URLValue* aValue)
|
|
: mUnit(eCSSUnit_URL)
|
|
{
|
|
mValue.mURL = aValue;
|
|
mValue.mURL->AddRef();
|
|
}
|
|
|
|
nsCSSValue::nsCSSValue(mozilla::css::ImageValue* aValue)
|
|
: mUnit(eCSSUnit_Image)
|
|
{
|
|
mValue.mImage = aValue;
|
|
mValue.mImage->AddRef();
|
|
}
|
|
|
|
nsCSSValue::nsCSSValue(nsCSSValueGradient* aValue)
|
|
: mUnit(eCSSUnit_Gradient)
|
|
{
|
|
mValue.mGradient = aValue;
|
|
mValue.mGradient->AddRef();
|
|
}
|
|
|
|
nsCSSValue::nsCSSValue(nsCSSValueTokenStream* aValue)
|
|
: mUnit(eCSSUnit_TokenStream)
|
|
{
|
|
mValue.mTokenStream = aValue;
|
|
mValue.mTokenStream->AddRef();
|
|
}
|
|
|
|
nsCSSValue::nsCSSValue(mozilla::css::GridTemplateAreasValue* aValue)
|
|
: mUnit(eCSSUnit_GridTemplateAreas)
|
|
{
|
|
mValue.mGridTemplateAreas = aValue;
|
|
mValue.mGridTemplateAreas->AddRef();
|
|
}
|
|
|
|
nsCSSValue::nsCSSValue(css::FontFamilyListRefCnt* aValue)
|
|
: mUnit(eCSSUnit_FontFamilyList)
|
|
{
|
|
mValue.mFontFamilyList = aValue;
|
|
mValue.mFontFamilyList->AddRef();
|
|
}
|
|
|
|
nsCSSValue::nsCSSValue(const nsCSSValue& aCopy)
|
|
: mUnit(aCopy.mUnit)
|
|
{
|
|
if (mUnit <= eCSSUnit_DummyInherit) {
|
|
// nothing to do, but put this important case first
|
|
}
|
|
else if (eCSSUnit_Percent <= mUnit) {
|
|
mValue.mFloat = aCopy.mValue.mFloat;
|
|
MOZ_ASSERT(!mozilla::IsNaN(mValue.mFloat));
|
|
}
|
|
else if (UnitHasStringValue()) {
|
|
mValue.mString = aCopy.mValue.mString;
|
|
mValue.mString->AddRef();
|
|
}
|
|
else if (eCSSUnit_Integer <= mUnit && mUnit <= eCSSUnit_EnumColor) {
|
|
mValue.mInt = aCopy.mValue.mInt;
|
|
}
|
|
else if (IsIntegerColorUnit()) {
|
|
mValue.mColor = aCopy.mValue.mColor;
|
|
}
|
|
else if (IsFloatColorUnit()) {
|
|
mValue.mFloatColor = aCopy.mValue.mFloatColor;
|
|
mValue.mFloatColor->AddRef();
|
|
}
|
|
else if (UnitHasArrayValue()) {
|
|
mValue.mArray = aCopy.mValue.mArray;
|
|
mValue.mArray->AddRef();
|
|
}
|
|
else if (eCSSUnit_URL == mUnit) {
|
|
mValue.mURL = aCopy.mValue.mURL;
|
|
mValue.mURL->AddRef();
|
|
}
|
|
else if (eCSSUnit_Image == mUnit) {
|
|
mValue.mImage = aCopy.mValue.mImage;
|
|
mValue.mImage->AddRef();
|
|
}
|
|
else if (eCSSUnit_Gradient == mUnit) {
|
|
mValue.mGradient = aCopy.mValue.mGradient;
|
|
mValue.mGradient->AddRef();
|
|
}
|
|
else if (eCSSUnit_TokenStream == mUnit) {
|
|
mValue.mTokenStream = aCopy.mValue.mTokenStream;
|
|
mValue.mTokenStream->AddRef();
|
|
}
|
|
else if (eCSSUnit_Pair == mUnit) {
|
|
mValue.mPair = aCopy.mValue.mPair;
|
|
mValue.mPair->AddRef();
|
|
}
|
|
else if (eCSSUnit_Triplet == mUnit) {
|
|
mValue.mTriplet = aCopy.mValue.mTriplet;
|
|
mValue.mTriplet->AddRef();
|
|
}
|
|
else if (eCSSUnit_Rect == mUnit) {
|
|
mValue.mRect = aCopy.mValue.mRect;
|
|
mValue.mRect->AddRef();
|
|
}
|
|
else if (eCSSUnit_List == mUnit) {
|
|
mValue.mList = aCopy.mValue.mList;
|
|
mValue.mList->AddRef();
|
|
}
|
|
else if (eCSSUnit_ListDep == mUnit) {
|
|
mValue.mListDependent = aCopy.mValue.mListDependent;
|
|
}
|
|
else if (eCSSUnit_SharedList == mUnit) {
|
|
mValue.mSharedList = aCopy.mValue.mSharedList;
|
|
mValue.mSharedList->AddRef();
|
|
}
|
|
else if (eCSSUnit_PairList == mUnit) {
|
|
mValue.mPairList = aCopy.mValue.mPairList;
|
|
mValue.mPairList->AddRef();
|
|
}
|
|
else if (eCSSUnit_PairListDep == mUnit) {
|
|
mValue.mPairListDependent = aCopy.mValue.mPairListDependent;
|
|
}
|
|
else if (eCSSUnit_GridTemplateAreas == mUnit) {
|
|
mValue.mGridTemplateAreas = aCopy.mValue.mGridTemplateAreas;
|
|
mValue.mGridTemplateAreas->AddRef();
|
|
}
|
|
else if (eCSSUnit_FontFamilyList == mUnit) {
|
|
mValue.mFontFamilyList = aCopy.mValue.mFontFamilyList;
|
|
mValue.mFontFamilyList->AddRef();
|
|
}
|
|
else {
|
|
MOZ_ASSERT(false, "unknown unit");
|
|
}
|
|
}
|
|
|
|
nsCSSValue& nsCSSValue::operator=(const nsCSSValue& aCopy)
|
|
{
|
|
if (this != &aCopy) {
|
|
Reset();
|
|
new (this) nsCSSValue(aCopy);
|
|
}
|
|
return *this;
|
|
}
|
|
|
|
bool nsCSSValue::operator==(const nsCSSValue& aOther) const
|
|
{
|
|
MOZ_ASSERT(mUnit != eCSSUnit_ListDep &&
|
|
aOther.mUnit != eCSSUnit_ListDep &&
|
|
mUnit != eCSSUnit_PairListDep &&
|
|
aOther.mUnit != eCSSUnit_PairListDep,
|
|
"don't use operator== with dependent lists");
|
|
|
|
if (mUnit == aOther.mUnit) {
|
|
if (mUnit <= eCSSUnit_DummyInherit) {
|
|
return true;
|
|
}
|
|
else if (UnitHasStringValue()) {
|
|
return (NS_strcmp(GetBufferValue(mValue.mString),
|
|
GetBufferValue(aOther.mValue.mString)) == 0);
|
|
}
|
|
else if ((eCSSUnit_Integer <= mUnit) && (mUnit <= eCSSUnit_EnumColor)) {
|
|
return mValue.mInt == aOther.mValue.mInt;
|
|
}
|
|
else if (IsIntegerColorUnit()) {
|
|
return mValue.mColor == aOther.mValue.mColor;
|
|
}
|
|
else if (IsFloatColorUnit()) {
|
|
return *mValue.mFloatColor == *aOther.mValue.mFloatColor;
|
|
}
|
|
else if (UnitHasArrayValue()) {
|
|
return *mValue.mArray == *aOther.mValue.mArray;
|
|
}
|
|
else if (eCSSUnit_URL == mUnit) {
|
|
return *mValue.mURL == *aOther.mValue.mURL;
|
|
}
|
|
else if (eCSSUnit_Image == mUnit) {
|
|
return *mValue.mImage == *aOther.mValue.mImage;
|
|
}
|
|
else if (eCSSUnit_Gradient == mUnit) {
|
|
return *mValue.mGradient == *aOther.mValue.mGradient;
|
|
}
|
|
else if (eCSSUnit_TokenStream == mUnit) {
|
|
return *mValue.mTokenStream == *aOther.mValue.mTokenStream;
|
|
}
|
|
else if (eCSSUnit_Pair == mUnit) {
|
|
return *mValue.mPair == *aOther.mValue.mPair;
|
|
}
|
|
else if (eCSSUnit_Triplet == mUnit) {
|
|
return *mValue.mTriplet == *aOther.mValue.mTriplet;
|
|
}
|
|
else if (eCSSUnit_Rect == mUnit) {
|
|
return *mValue.mRect == *aOther.mValue.mRect;
|
|
}
|
|
else if (eCSSUnit_List == mUnit) {
|
|
return nsCSSValueList::Equal(mValue.mList, aOther.mValue.mList);
|
|
}
|
|
else if (eCSSUnit_SharedList == mUnit) {
|
|
return *mValue.mSharedList == *aOther.mValue.mSharedList;
|
|
}
|
|
else if (eCSSUnit_PairList == mUnit) {
|
|
return nsCSSValuePairList::Equal(mValue.mPairList,
|
|
aOther.mValue.mPairList);
|
|
}
|
|
else if (eCSSUnit_GridTemplateAreas == mUnit) {
|
|
return *mValue.mGridTemplateAreas == *aOther.mValue.mGridTemplateAreas;
|
|
}
|
|
else if (eCSSUnit_FontFamilyList == mUnit) {
|
|
return *mValue.mFontFamilyList == *aOther.mValue.mFontFamilyList;
|
|
}
|
|
else {
|
|
return mValue.mFloat == aOther.mValue.mFloat;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
double nsCSSValue::GetAngleValueInRadians() const
|
|
{
|
|
double angle = GetFloatValue();
|
|
|
|
switch (GetUnit()) {
|
|
case eCSSUnit_Radian: return angle;
|
|
case eCSSUnit_Turn: return angle * 2 * M_PI;
|
|
case eCSSUnit_Degree: return angle * M_PI / 180.0;
|
|
case eCSSUnit_Grad: return angle * M_PI / 200.0;
|
|
|
|
default:
|
|
MOZ_ASSERT(false, "unrecognized angular unit");
|
|
return 0.0;
|
|
}
|
|
}
|
|
|
|
imgRequestProxy* nsCSSValue::GetImageValue(nsIDocument* aDocument) const
|
|
{
|
|
MOZ_ASSERT(mUnit == eCSSUnit_Image, "not an Image value");
|
|
return mValue.mImage->mRequests.GetWeak(aDocument);
|
|
}
|
|
|
|
nscoord nsCSSValue::GetFixedLength(nsPresContext* aPresContext) const
|
|
{
|
|
MOZ_ASSERT(mUnit == eCSSUnit_PhysicalMillimeter,
|
|
"not a fixed length unit");
|
|
|
|
float inches = mValue.mFloat / MM_PER_INCH_FLOAT;
|
|
return NSToCoordFloorClamped(inches *
|
|
float(aPresContext->DeviceContext()->AppUnitsPerPhysicalInch()));
|
|
}
|
|
|
|
nscoord nsCSSValue::GetPixelLength() const
|
|
{
|
|
MOZ_ASSERT(IsPixelLengthUnit(), "not a fixed length unit");
|
|
|
|
double scaleFactor;
|
|
switch (mUnit) {
|
|
case eCSSUnit_Pixel: return nsPresContext::CSSPixelsToAppUnits(mValue.mFloat);
|
|
case eCSSUnit_Pica: scaleFactor = 16.0; break;
|
|
case eCSSUnit_Point: scaleFactor = 4/3.0; break;
|
|
case eCSSUnit_Inch: scaleFactor = 96.0; break;
|
|
case eCSSUnit_Millimeter: scaleFactor = 96/25.4; break;
|
|
case eCSSUnit_Centimeter: scaleFactor = 96/2.54; break;
|
|
case eCSSUnit_Quarter: scaleFactor = 96/101.6; break;
|
|
default:
|
|
NS_ERROR("should never get here");
|
|
return 0;
|
|
}
|
|
return nsPresContext::CSSPixelsToAppUnits(float(mValue.mFloat*scaleFactor));
|
|
}
|
|
|
|
void nsCSSValue::DoReset()
|
|
{
|
|
if (UnitHasStringValue()) {
|
|
mValue.mString->Release();
|
|
} else if (IsFloatColorUnit()) {
|
|
mValue.mFloatColor->Release();
|
|
} else if (UnitHasArrayValue()) {
|
|
mValue.mArray->Release();
|
|
} else if (eCSSUnit_URL == mUnit) {
|
|
mValue.mURL->Release();
|
|
} else if (eCSSUnit_Image == mUnit) {
|
|
mValue.mImage->Release();
|
|
} else if (eCSSUnit_Gradient == mUnit) {
|
|
mValue.mGradient->Release();
|
|
} else if (eCSSUnit_TokenStream == mUnit) {
|
|
mValue.mTokenStream->Release();
|
|
} else if (eCSSUnit_Pair == mUnit) {
|
|
mValue.mPair->Release();
|
|
} else if (eCSSUnit_Triplet == mUnit) {
|
|
mValue.mTriplet->Release();
|
|
} else if (eCSSUnit_Rect == mUnit) {
|
|
mValue.mRect->Release();
|
|
} else if (eCSSUnit_List == mUnit) {
|
|
mValue.mList->Release();
|
|
} else if (eCSSUnit_SharedList == mUnit) {
|
|
mValue.mSharedList->Release();
|
|
} else if (eCSSUnit_PairList == mUnit) {
|
|
mValue.mPairList->Release();
|
|
} else if (eCSSUnit_GridTemplateAreas == mUnit) {
|
|
mValue.mGridTemplateAreas->Release();
|
|
} else if (eCSSUnit_FontFamilyList == mUnit) {
|
|
mValue.mFontFamilyList->Release();
|
|
}
|
|
mUnit = eCSSUnit_Null;
|
|
}
|
|
|
|
void nsCSSValue::SetIntValue(int32_t aValue, nsCSSUnit aUnit)
|
|
{
|
|
MOZ_ASSERT(aUnit == eCSSUnit_Integer || aUnit == eCSSUnit_Enumerated ||
|
|
aUnit == eCSSUnit_EnumColor,
|
|
"not an int value");
|
|
Reset();
|
|
if (aUnit == eCSSUnit_Integer || aUnit == eCSSUnit_Enumerated ||
|
|
aUnit == eCSSUnit_EnumColor) {
|
|
mUnit = aUnit;
|
|
mValue.mInt = aValue;
|
|
}
|
|
}
|
|
|
|
void nsCSSValue::SetPercentValue(float aValue)
|
|
{
|
|
Reset();
|
|
mUnit = eCSSUnit_Percent;
|
|
mValue.mFloat = aValue;
|
|
MOZ_ASSERT(!mozilla::IsNaN(mValue.mFloat));
|
|
}
|
|
|
|
void nsCSSValue::SetFloatValue(float aValue, nsCSSUnit aUnit)
|
|
{
|
|
MOZ_ASSERT(eCSSUnit_Number <= aUnit, "not a float value");
|
|
Reset();
|
|
if (eCSSUnit_Number <= aUnit) {
|
|
mUnit = aUnit;
|
|
mValue.mFloat = aValue;
|
|
MOZ_ASSERT(!mozilla::IsNaN(mValue.mFloat));
|
|
}
|
|
}
|
|
|
|
void nsCSSValue::SetStringValue(const nsString& aValue,
|
|
nsCSSUnit aUnit)
|
|
{
|
|
Reset();
|
|
mUnit = aUnit;
|
|
MOZ_ASSERT(UnitHasStringValue(), "not a string unit");
|
|
if (UnitHasStringValue()) {
|
|
mValue.mString = BufferFromString(aValue).take();
|
|
} else
|
|
mUnit = eCSSUnit_Null;
|
|
}
|
|
|
|
void nsCSSValue::SetColorValue(nscolor aValue)
|
|
{
|
|
SetIntegerColorValue(aValue, eCSSUnit_RGBAColor);
|
|
}
|
|
|
|
void nsCSSValue::SetIntegerColorValue(nscolor aValue, nsCSSUnit aUnit)
|
|
{
|
|
Reset();
|
|
mUnit = aUnit;
|
|
MOZ_ASSERT(IsIntegerColorUnit(), "bad unit");
|
|
mValue.mColor = aValue;
|
|
}
|
|
|
|
void nsCSSValue::SetFloatColorValue(float aComponent1,
|
|
float aComponent2,
|
|
float aComponent3,
|
|
float aAlpha,
|
|
nsCSSUnit aUnit)
|
|
{
|
|
Reset();
|
|
mUnit = aUnit;
|
|
MOZ_ASSERT(IsFloatColorUnit(), "bad unit");
|
|
mValue.mFloatColor =
|
|
new nsCSSValueFloatColor(aComponent1, aComponent2, aComponent3, aAlpha);
|
|
mValue.mFloatColor->AddRef();
|
|
}
|
|
|
|
void nsCSSValue::SetArrayValue(nsCSSValue::Array* aValue, nsCSSUnit aUnit)
|
|
{
|
|
Reset();
|
|
mUnit = aUnit;
|
|
MOZ_ASSERT(UnitHasArrayValue(), "bad unit");
|
|
mValue.mArray = aValue;
|
|
mValue.mArray->AddRef();
|
|
}
|
|
|
|
void nsCSSValue::SetURLValue(mozilla::css::URLValue* aValue)
|
|
{
|
|
Reset();
|
|
mUnit = eCSSUnit_URL;
|
|
mValue.mURL = aValue;
|
|
mValue.mURL->AddRef();
|
|
}
|
|
|
|
void nsCSSValue::SetImageValue(mozilla::css::ImageValue* aValue)
|
|
{
|
|
Reset();
|
|
mUnit = eCSSUnit_Image;
|
|
mValue.mImage = aValue;
|
|
mValue.mImage->AddRef();
|
|
}
|
|
|
|
void nsCSSValue::SetGradientValue(nsCSSValueGradient* aValue)
|
|
{
|
|
Reset();
|
|
mUnit = eCSSUnit_Gradient;
|
|
mValue.mGradient = aValue;
|
|
mValue.mGradient->AddRef();
|
|
}
|
|
|
|
void nsCSSValue::SetTokenStreamValue(nsCSSValueTokenStream* aValue)
|
|
{
|
|
Reset();
|
|
mUnit = eCSSUnit_TokenStream;
|
|
mValue.mTokenStream = aValue;
|
|
mValue.mTokenStream->AddRef();
|
|
}
|
|
|
|
void nsCSSValue::SetGridTemplateAreas(mozilla::css::GridTemplateAreasValue* aValue)
|
|
{
|
|
Reset();
|
|
mUnit = eCSSUnit_GridTemplateAreas;
|
|
mValue.mGridTemplateAreas = aValue;
|
|
mValue.mGridTemplateAreas->AddRef();
|
|
}
|
|
|
|
void nsCSSValue::SetFontFamilyListValue(css::FontFamilyListRefCnt* aValue)
|
|
{
|
|
Reset();
|
|
mUnit = eCSSUnit_FontFamilyList;
|
|
mValue.mFontFamilyList = aValue;
|
|
mValue.mFontFamilyList->AddRef();
|
|
}
|
|
|
|
void nsCSSValue::SetPairValue(const nsCSSValuePair* aValue)
|
|
{
|
|
// pairs should not be used for null/inherit/initial values
|
|
MOZ_ASSERT(aValue &&
|
|
aValue->mXValue.GetUnit() != eCSSUnit_Null &&
|
|
aValue->mYValue.GetUnit() != eCSSUnit_Null &&
|
|
aValue->mXValue.GetUnit() != eCSSUnit_Inherit &&
|
|
aValue->mYValue.GetUnit() != eCSSUnit_Inherit &&
|
|
aValue->mXValue.GetUnit() != eCSSUnit_Initial &&
|
|
aValue->mYValue.GetUnit() != eCSSUnit_Initial &&
|
|
aValue->mXValue.GetUnit() != eCSSUnit_Unset &&
|
|
aValue->mYValue.GetUnit() != eCSSUnit_Unset,
|
|
"missing or inappropriate pair value");
|
|
Reset();
|
|
mUnit = eCSSUnit_Pair;
|
|
mValue.mPair = new nsCSSValuePair_heap(aValue->mXValue, aValue->mYValue);
|
|
mValue.mPair->AddRef();
|
|
}
|
|
|
|
void nsCSSValue::SetPairValue(const nsCSSValue& xValue,
|
|
const nsCSSValue& yValue)
|
|
{
|
|
MOZ_ASSERT(xValue.GetUnit() != eCSSUnit_Null &&
|
|
yValue.GetUnit() != eCSSUnit_Null &&
|
|
xValue.GetUnit() != eCSSUnit_Inherit &&
|
|
yValue.GetUnit() != eCSSUnit_Inherit &&
|
|
xValue.GetUnit() != eCSSUnit_Initial &&
|
|
yValue.GetUnit() != eCSSUnit_Initial &&
|
|
xValue.GetUnit() != eCSSUnit_Unset &&
|
|
yValue.GetUnit() != eCSSUnit_Unset,
|
|
"inappropriate pair value");
|
|
Reset();
|
|
mUnit = eCSSUnit_Pair;
|
|
mValue.mPair = new nsCSSValuePair_heap(xValue, yValue);
|
|
mValue.mPair->AddRef();
|
|
}
|
|
|
|
void nsCSSValue::SetTripletValue(const nsCSSValueTriplet* aValue)
|
|
{
|
|
// triplet should not be used for null/inherit/initial values
|
|
MOZ_ASSERT(aValue &&
|
|
aValue->mXValue.GetUnit() != eCSSUnit_Null &&
|
|
aValue->mYValue.GetUnit() != eCSSUnit_Null &&
|
|
aValue->mZValue.GetUnit() != eCSSUnit_Null &&
|
|
aValue->mXValue.GetUnit() != eCSSUnit_Inherit &&
|
|
aValue->mYValue.GetUnit() != eCSSUnit_Inherit &&
|
|
aValue->mZValue.GetUnit() != eCSSUnit_Inherit &&
|
|
aValue->mXValue.GetUnit() != eCSSUnit_Initial &&
|
|
aValue->mYValue.GetUnit() != eCSSUnit_Initial &&
|
|
aValue->mZValue.GetUnit() != eCSSUnit_Initial &&
|
|
aValue->mXValue.GetUnit() != eCSSUnit_Unset &&
|
|
aValue->mYValue.GetUnit() != eCSSUnit_Unset &&
|
|
aValue->mZValue.GetUnit() != eCSSUnit_Unset,
|
|
"missing or inappropriate triplet value");
|
|
Reset();
|
|
mUnit = eCSSUnit_Triplet;
|
|
mValue.mTriplet = new nsCSSValueTriplet_heap(aValue->mXValue, aValue->mYValue, aValue->mZValue);
|
|
mValue.mTriplet->AddRef();
|
|
}
|
|
|
|
void nsCSSValue::SetTripletValue(const nsCSSValue& xValue,
|
|
const nsCSSValue& yValue,
|
|
const nsCSSValue& zValue)
|
|
{
|
|
// Only allow Null for the z component
|
|
MOZ_ASSERT(xValue.GetUnit() != eCSSUnit_Null &&
|
|
yValue.GetUnit() != eCSSUnit_Null &&
|
|
xValue.GetUnit() != eCSSUnit_Inherit &&
|
|
yValue.GetUnit() != eCSSUnit_Inherit &&
|
|
zValue.GetUnit() != eCSSUnit_Inherit &&
|
|
xValue.GetUnit() != eCSSUnit_Initial &&
|
|
yValue.GetUnit() != eCSSUnit_Initial &&
|
|
zValue.GetUnit() != eCSSUnit_Initial &&
|
|
xValue.GetUnit() != eCSSUnit_Unset &&
|
|
yValue.GetUnit() != eCSSUnit_Unset &&
|
|
zValue.GetUnit() != eCSSUnit_Unset,
|
|
"inappropriate triplet value");
|
|
Reset();
|
|
mUnit = eCSSUnit_Triplet;
|
|
mValue.mTriplet = new nsCSSValueTriplet_heap(xValue, yValue, zValue);
|
|
mValue.mTriplet->AddRef();
|
|
}
|
|
|
|
nsCSSRect& nsCSSValue::SetRectValue()
|
|
{
|
|
Reset();
|
|
mUnit = eCSSUnit_Rect;
|
|
mValue.mRect = new nsCSSRect_heap;
|
|
mValue.mRect->AddRef();
|
|
return *mValue.mRect;
|
|
}
|
|
|
|
nsCSSValueList* nsCSSValue::SetListValue()
|
|
{
|
|
Reset();
|
|
mUnit = eCSSUnit_List;
|
|
mValue.mList = new nsCSSValueList_heap;
|
|
mValue.mList->AddRef();
|
|
return mValue.mList;
|
|
}
|
|
|
|
void nsCSSValue::SetSharedListValue(nsCSSValueSharedList* aList)
|
|
{
|
|
Reset();
|
|
mUnit = eCSSUnit_SharedList;
|
|
mValue.mSharedList = aList;
|
|
mValue.mSharedList->AddRef();
|
|
}
|
|
|
|
void nsCSSValue::SetDependentListValue(nsCSSValueList* aList)
|
|
{
|
|
Reset();
|
|
if (aList) {
|
|
mUnit = eCSSUnit_ListDep;
|
|
mValue.mListDependent = aList;
|
|
}
|
|
}
|
|
|
|
void
|
|
nsCSSValue::AdoptListValue(UniquePtr<nsCSSValueList> aValue)
|
|
{
|
|
// We have to copy the first element since for owned lists the first
|
|
// element should be an nsCSSValueList_heap object.
|
|
SetListValue();
|
|
// FIXME: If nsCSSValue gets a swap method or move assignment operator,
|
|
// we should use that here to avoid allocating an extra value.
|
|
mValue.mList->mValue = aValue->mValue;
|
|
mValue.mList->mNext = aValue->mNext;
|
|
aValue->mNext = nullptr;
|
|
aValue.reset();
|
|
}
|
|
|
|
nsCSSValuePairList* nsCSSValue::SetPairListValue()
|
|
{
|
|
Reset();
|
|
mUnit = eCSSUnit_PairList;
|
|
mValue.mPairList = new nsCSSValuePairList_heap;
|
|
mValue.mPairList->AddRef();
|
|
return mValue.mPairList;
|
|
}
|
|
|
|
void nsCSSValue::SetDependentPairListValue(nsCSSValuePairList* aList)
|
|
{
|
|
Reset();
|
|
if (aList) {
|
|
mUnit = eCSSUnit_PairListDep;
|
|
mValue.mPairListDependent = aList;
|
|
}
|
|
}
|
|
|
|
void
|
|
nsCSSValue::AdoptPairListValue(UniquePtr<nsCSSValuePairList> aValue)
|
|
{
|
|
// We have to copy the first element, since for owned pair lists, the first
|
|
// element should be an nsCSSValuePairList_heap object.
|
|
SetPairListValue();
|
|
// FIXME: If nsCSSValue gets a swap method or move assignment operator,
|
|
// we should use that here to avoid allocating extra values.
|
|
mValue.mPairList->mXValue = aValue->mXValue;
|
|
mValue.mPairList->mYValue = aValue->mYValue;
|
|
mValue.mPairList->mNext = aValue->mNext;
|
|
aValue->mNext = nullptr;
|
|
aValue.reset();
|
|
}
|
|
|
|
void nsCSSValue::SetAutoValue()
|
|
{
|
|
Reset();
|
|
mUnit = eCSSUnit_Auto;
|
|
}
|
|
|
|
void nsCSSValue::SetInheritValue()
|
|
{
|
|
Reset();
|
|
mUnit = eCSSUnit_Inherit;
|
|
}
|
|
|
|
void nsCSSValue::SetInitialValue()
|
|
{
|
|
Reset();
|
|
mUnit = eCSSUnit_Initial;
|
|
}
|
|
|
|
void nsCSSValue::SetUnsetValue()
|
|
{
|
|
Reset();
|
|
mUnit = eCSSUnit_Unset;
|
|
}
|
|
|
|
void nsCSSValue::SetNoneValue()
|
|
{
|
|
Reset();
|
|
mUnit = eCSSUnit_None;
|
|
}
|
|
|
|
void nsCSSValue::SetAllValue()
|
|
{
|
|
Reset();
|
|
mUnit = eCSSUnit_All;
|
|
}
|
|
|
|
void nsCSSValue::SetNormalValue()
|
|
{
|
|
Reset();
|
|
mUnit = eCSSUnit_Normal;
|
|
}
|
|
|
|
void nsCSSValue::SetSystemFontValue()
|
|
{
|
|
Reset();
|
|
mUnit = eCSSUnit_System_Font;
|
|
}
|
|
|
|
void nsCSSValue::SetDummyValue()
|
|
{
|
|
Reset();
|
|
mUnit = eCSSUnit_Dummy;
|
|
}
|
|
|
|
void nsCSSValue::SetDummyInheritValue()
|
|
{
|
|
Reset();
|
|
mUnit = eCSSUnit_DummyInherit;
|
|
}
|
|
|
|
void nsCSSValue::StartImageLoad(nsIDocument* aDocument) const
|
|
{
|
|
MOZ_ASSERT(eCSSUnit_URL == mUnit, "Not a URL value!");
|
|
mozilla::css::ImageValue* image =
|
|
new mozilla::css::ImageValue(mValue.mURL->GetURI(),
|
|
mValue.mURL->mString,
|
|
mValue.mURL->mReferrer,
|
|
mValue.mURL->mOriginPrincipal,
|
|
aDocument);
|
|
|
|
nsCSSValue* writable = const_cast<nsCSSValue*>(this);
|
|
writable->SetImageValue(image);
|
|
}
|
|
|
|
nscolor nsCSSValue::GetColorValue() const
|
|
{
|
|
MOZ_ASSERT(IsNumericColorUnit(), "not a color value");
|
|
if (IsFloatColorUnit()) {
|
|
return mValue.mFloatColor->GetColorValue(mUnit);
|
|
}
|
|
return mValue.mColor;
|
|
}
|
|
|
|
bool nsCSSValue::IsNonTransparentColor() const
|
|
{
|
|
// We have the value in the form it was specified in at this point, so we
|
|
// have to look for both the keyword 'transparent' and its equivalent in
|
|
// rgba notation.
|
|
nsDependentString buf;
|
|
return
|
|
(IsIntegerColorUnit() && NS_GET_A(GetColorValue()) > 0) ||
|
|
(IsFloatColorUnit() && mValue.mFloatColor->IsNonTransparentColor()) ||
|
|
(mUnit == eCSSUnit_Ident &&
|
|
!nsGkAtoms::transparent->Equals(GetStringValue(buf))) ||
|
|
(mUnit == eCSSUnit_EnumColor);
|
|
}
|
|
|
|
nsCSSValue::Array*
|
|
nsCSSValue::InitFunction(nsCSSKeyword aFunctionId, uint32_t aNumArgs)
|
|
{
|
|
RefPtr<nsCSSValue::Array> func = Array::Create(aNumArgs + 1);
|
|
func->Item(0).SetIntValue(aFunctionId, eCSSUnit_Enumerated);
|
|
SetArrayValue(func, eCSSUnit_Function);
|
|
return func;
|
|
}
|
|
|
|
bool
|
|
nsCSSValue::EqualsFunction(nsCSSKeyword aFunctionId) const
|
|
{
|
|
if (mUnit != eCSSUnit_Function) {
|
|
return false;
|
|
}
|
|
|
|
nsCSSValue::Array* func = mValue.mArray;
|
|
MOZ_ASSERT(func && func->Count() >= 1 &&
|
|
func->Item(0).GetUnit() == eCSSUnit_Enumerated,
|
|
"illegally structured function value");
|
|
|
|
nsCSSKeyword thisFunctionId = func->Item(0).GetKeywordValue();
|
|
return thisFunctionId == aFunctionId;
|
|
}
|
|
|
|
// static
|
|
already_AddRefed<nsStringBuffer>
|
|
nsCSSValue::BufferFromString(const nsString& aValue)
|
|
{
|
|
RefPtr<nsStringBuffer> buffer = nsStringBuffer::FromString(aValue);
|
|
if (buffer) {
|
|
return buffer.forget();
|
|
}
|
|
|
|
nsString::size_type length = aValue.Length();
|
|
|
|
// NOTE: Alloc prouduces a new, already-addref'd (refcnt = 1) buffer.
|
|
// NOTE: String buffer allocation is currently fallible.
|
|
size_t sz = (length + 1) * sizeof(char16_t);
|
|
buffer = nsStringBuffer::Alloc(sz);
|
|
if (MOZ_UNLIKELY(!buffer)) {
|
|
NS_ABORT_OOM(sz);
|
|
}
|
|
|
|
char16_t* data = static_cast<char16_t*>(buffer->Data());
|
|
nsCharTraits<char16_t>::copy(data, aValue.get(), length);
|
|
// Null-terminate.
|
|
data[length] = 0;
|
|
return buffer.forget();
|
|
}
|
|
|
|
namespace {
|
|
|
|
struct CSSValueSerializeCalcOps {
|
|
CSSValueSerializeCalcOps(nsCSSProperty aProperty, nsAString& aResult,
|
|
nsCSSValue::Serialization aSerialization)
|
|
: mProperty(aProperty),
|
|
mResult(aResult),
|
|
mValueSerialization(aSerialization)
|
|
{
|
|
}
|
|
|
|
typedef nsCSSValue input_type;
|
|
typedef nsCSSValue::Array input_array_type;
|
|
|
|
static nsCSSUnit GetUnit(const input_type& aValue) {
|
|
return aValue.GetUnit();
|
|
}
|
|
|
|
void Append(const char* aString)
|
|
{
|
|
mResult.AppendASCII(aString);
|
|
}
|
|
|
|
void AppendLeafValue(const input_type& aValue)
|
|
{
|
|
MOZ_ASSERT(aValue.GetUnit() == eCSSUnit_Percent ||
|
|
aValue.IsLengthUnit() ||
|
|
aValue.GetUnit() == eCSSUnit_Number,
|
|
"unexpected unit");
|
|
aValue.AppendToString(mProperty, mResult, mValueSerialization);
|
|
}
|
|
|
|
void AppendNumber(const input_type& aValue)
|
|
{
|
|
MOZ_ASSERT(aValue.GetUnit() == eCSSUnit_Number, "unexpected unit");
|
|
aValue.AppendToString(mProperty, mResult, mValueSerialization);
|
|
}
|
|
|
|
private:
|
|
nsCSSProperty mProperty;
|
|
nsAString &mResult;
|
|
nsCSSValue::Serialization mValueSerialization;
|
|
};
|
|
|
|
} // namespace
|
|
|
|
void
|
|
nsCSSValue::AppendPolygonToString(nsCSSProperty aProperty, nsAString& aResult,
|
|
Serialization aSerialization) const
|
|
{
|
|
const nsCSSValue::Array* array = GetArrayValue();
|
|
MOZ_ASSERT(array->Count() > 1 && array->Count() <= 3,
|
|
"Polygons must have name and at least one more value.");
|
|
// When the array has 2 elements, the item on index 1 is the coordinate
|
|
// pair list.
|
|
// When the array has 3 elements, the item on index 1 is a fill-rule
|
|
// and item on index 2 is the coordinate pair list.
|
|
size_t index = 1;
|
|
if (array->Count() == 3) {
|
|
const nsCSSValue& fillRuleValue = array->Item(index);
|
|
MOZ_ASSERT(fillRuleValue.GetUnit() == eCSSUnit_Enumerated,
|
|
"Expected polygon fill rule.");
|
|
int32_t fillRule = fillRuleValue.GetIntValue();
|
|
AppendASCIItoUTF16(nsCSSProps::ValueToKeyword(fillRule,
|
|
nsCSSProps::kFillRuleKTable),
|
|
aResult);
|
|
aResult.AppendLiteral(", ");
|
|
++index;
|
|
}
|
|
array->Item(index).AppendToString(aProperty, aResult, aSerialization);
|
|
}
|
|
|
|
inline void
|
|
nsCSSValue::AppendPositionCoordinateToString(
|
|
const nsCSSValue& aValue, nsCSSProperty aProperty,
|
|
nsAString& aResult, Serialization aSerialization) const
|
|
{
|
|
if (aValue.GetUnit() == eCSSUnit_Enumerated) {
|
|
int32_t intValue = aValue.GetIntValue();
|
|
AppendASCIItoUTF16(nsCSSProps::ValueToKeyword(intValue,
|
|
nsCSSProps::kShapeRadiusKTable), aResult);
|
|
} else {
|
|
aValue.AppendToString(aProperty, aResult, aSerialization);
|
|
}
|
|
}
|
|
|
|
void
|
|
nsCSSValue::AppendCircleOrEllipseToString(nsCSSKeyword aFunctionId,
|
|
nsCSSProperty aProperty,
|
|
nsAString& aResult,
|
|
Serialization aSerialization) const
|
|
{
|
|
const nsCSSValue::Array* array = GetArrayValue();
|
|
size_t count = aFunctionId == eCSSKeyword_circle ? 2 : 3;
|
|
MOZ_ASSERT(array->Count() == count + 1, "wrong number of arguments");
|
|
|
|
bool hasRadii = array->Item(1).GetUnit() != eCSSUnit_Null;
|
|
|
|
AppendPositionCoordinateToString(array->Item(1), aProperty,
|
|
aResult, aSerialization);
|
|
|
|
if (hasRadii && aFunctionId == eCSSKeyword_ellipse) {
|
|
aResult.Append(' ');
|
|
AppendPositionCoordinateToString(array->Item(2), aProperty,
|
|
aResult, aSerialization);
|
|
}
|
|
|
|
// Any position specified?
|
|
if (array->Item(count).GetUnit() != eCSSUnit_Array) {
|
|
MOZ_ASSERT(array->Item(count).GetUnit() == eCSSUnit_Null,
|
|
"unexpected value");
|
|
return;
|
|
}
|
|
|
|
if (hasRadii) {
|
|
aResult.Append(' ');
|
|
}
|
|
aResult.AppendLiteral("at ");
|
|
array->Item(count).AppendToString(eCSSProperty_background_position,
|
|
aResult, aSerialization);
|
|
}
|
|
|
|
// Helper to append |aString| with the shorthand sides notation used in e.g.
|
|
// 'padding'. |aProperties| and |aValues| are expected to have 4 elements.
|
|
/*static*/ void
|
|
nsCSSValue::AppendSidesShorthandToString(const nsCSSProperty aProperties[],
|
|
const nsCSSValue* aValues[],
|
|
nsAString& aString,
|
|
nsCSSValue::Serialization
|
|
aSerialization)
|
|
{
|
|
const nsCSSValue& value1 = *aValues[0];
|
|
const nsCSSValue& value2 = *aValues[1];
|
|
const nsCSSValue& value3 = *aValues[2];
|
|
const nsCSSValue& value4 = *aValues[3];
|
|
|
|
MOZ_ASSERT(value1.GetUnit() != eCSSUnit_Null, "null value 1");
|
|
value1.AppendToString(aProperties[0], aString, aSerialization);
|
|
if (value1 != value2 || value1 != value3 || value1 != value4) {
|
|
aString.Append(char16_t(' '));
|
|
MOZ_ASSERT(value2.GetUnit() != eCSSUnit_Null, "null value 2");
|
|
value2.AppendToString(aProperties[1], aString, aSerialization);
|
|
if (value1 != value3 || value2 != value4) {
|
|
aString.Append(char16_t(' '));
|
|
MOZ_ASSERT(value3.GetUnit() != eCSSUnit_Null, "null value 3");
|
|
value3.AppendToString(aProperties[2], aString, aSerialization);
|
|
if (value2 != value4) {
|
|
aString.Append(char16_t(' '));
|
|
MOZ_ASSERT(value4.GetUnit() != eCSSUnit_Null, "null value 4");
|
|
value4.AppendToString(aProperties[3], aString, aSerialization);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/*static*/ void
|
|
nsCSSValue::AppendBasicShapeRadiusToString(const nsCSSProperty aProperties[],
|
|
const nsCSSValue* aValues[],
|
|
nsAString& aResult,
|
|
Serialization aSerialization)
|
|
{
|
|
bool needY = false;
|
|
const nsCSSValue* xVals[4];
|
|
const nsCSSValue* yVals[4];
|
|
for (int i = 0; i < 4; i++) {
|
|
if (aValues[i]->GetUnit() == eCSSUnit_Pair) {
|
|
needY = true;
|
|
xVals[i] = &aValues[i]->GetPairValue().mXValue;
|
|
yVals[i] = &aValues[i]->GetPairValue().mYValue;
|
|
} else {
|
|
xVals[i] = yVals[i] = aValues[i];
|
|
}
|
|
}
|
|
|
|
AppendSidesShorthandToString(aProperties, xVals, aResult, aSerialization);
|
|
if (needY) {
|
|
aResult.AppendLiteral(" / ");
|
|
AppendSidesShorthandToString(aProperties, yVals, aResult, aSerialization);
|
|
}
|
|
}
|
|
|
|
void
|
|
nsCSSValue::AppendInsetToString(nsCSSProperty aProperty, nsAString& aResult,
|
|
Serialization aSerialization) const
|
|
{
|
|
const nsCSSValue::Array* array = GetArrayValue();
|
|
MOZ_ASSERT(array->Count() == 6,
|
|
"inset function has wrong number of arguments");
|
|
if (array->Item(1).GetUnit() != eCSSUnit_Null) {
|
|
array->Item(1).AppendToString(aProperty, aResult, aSerialization);
|
|
if (array->Item(2).GetUnit() != eCSSUnit_Null) {
|
|
aResult.Append(' ');
|
|
array->Item(2).AppendToString(aProperty, aResult, aSerialization);
|
|
if (array->Item(3).GetUnit() != eCSSUnit_Null) {
|
|
aResult.Append(' ');
|
|
array->Item(3).AppendToString(aProperty, aResult, aSerialization);
|
|
if (array->Item(4).GetUnit() != eCSSUnit_Null) {
|
|
aResult.Append(' ');
|
|
array->Item(4).AppendToString(aProperty, aResult, aSerialization);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (array->Item(5).GetUnit() == eCSSUnit_Array) {
|
|
const nsCSSProperty* subprops =
|
|
nsCSSProps::SubpropertyEntryFor(eCSSProperty_border_radius);
|
|
const nsCSSValue::Array* radius = array->Item(5).GetArrayValue();
|
|
MOZ_ASSERT(radius->Count() == 4, "expected 4 radii values");
|
|
const nsCSSValue* vals[4] = {
|
|
&(radius->Item(0)),
|
|
&(radius->Item(1)),
|
|
&(radius->Item(2)),
|
|
&(radius->Item(3))
|
|
};
|
|
aResult.AppendLiteral(" round ");
|
|
AppendBasicShapeRadiusToString(subprops, vals, aResult,
|
|
aSerialization);
|
|
} else {
|
|
MOZ_ASSERT(array->Item(5).GetUnit() == eCSSUnit_Null,
|
|
"unexpected value");
|
|
}
|
|
}
|
|
|
|
/* static */ void
|
|
nsCSSValue::AppendAlignJustifyValueToString(int32_t aValue, nsAString& aResult)
|
|
{
|
|
auto legacy = aValue & NS_STYLE_ALIGN_LEGACY;
|
|
if (legacy) {
|
|
aValue &= ~legacy;
|
|
aResult.AppendLiteral("legacy ");
|
|
}
|
|
auto overflowPos = aValue & (NS_STYLE_ALIGN_SAFE | NS_STYLE_ALIGN_UNSAFE);
|
|
aValue &= ~overflowPos;
|
|
MOZ_ASSERT(!(aValue & NS_STYLE_ALIGN_FLAG_BITS),
|
|
"unknown bits in align/justify value");
|
|
MOZ_ASSERT((aValue != NS_STYLE_ALIGN_AUTO &&
|
|
aValue != NS_STYLE_ALIGN_NORMAL &&
|
|
aValue != NS_STYLE_ALIGN_BASELINE &&
|
|
aValue != NS_STYLE_ALIGN_LAST_BASELINE) ||
|
|
(!legacy && !overflowPos),
|
|
"auto/normal/baseline/last-baseline never have any flags");
|
|
MOZ_ASSERT(legacy == 0 || overflowPos == 0,
|
|
"'legacy' together with <overflow-position>");
|
|
const auto& kwtable(nsCSSProps::kAlignAllKeywords);
|
|
AppendASCIItoUTF16(nsCSSProps::ValueToKeyword(aValue, kwtable), aResult);
|
|
// Don't serialize the 'unsafe' keyword; it's the default.
|
|
if (MOZ_UNLIKELY(overflowPos == NS_STYLE_ALIGN_SAFE)) {
|
|
aResult.Append(' ');
|
|
AppendASCIItoUTF16(nsCSSProps::ValueToKeyword(overflowPos, kwtable),
|
|
aResult);
|
|
}
|
|
}
|
|
|
|
void
|
|
nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult,
|
|
Serialization aSerialization) const
|
|
{
|
|
// eCSSProperty_UNKNOWN gets used for some recursive calls below.
|
|
MOZ_ASSERT((0 <= aProperty &&
|
|
aProperty <= eCSSProperty_COUNT_no_shorthands) ||
|
|
aProperty == eCSSProperty_UNKNOWN,
|
|
"property ID out of range");
|
|
|
|
nsCSSUnit unit = GetUnit();
|
|
if (unit == eCSSUnit_Null) {
|
|
return;
|
|
}
|
|
|
|
if (eCSSUnit_String <= unit && unit <= eCSSUnit_Attr) {
|
|
if (unit == eCSSUnit_Attr) {
|
|
aResult.AppendLiteral("attr(");
|
|
}
|
|
nsAutoString buffer;
|
|
GetStringValue(buffer);
|
|
if (unit == eCSSUnit_String) {
|
|
nsStyleUtil::AppendEscapedCSSString(buffer, aResult);
|
|
} else {
|
|
nsStyleUtil::AppendEscapedCSSIdent(buffer, aResult);
|
|
}
|
|
}
|
|
else if (eCSSUnit_Array <= unit && unit <= eCSSUnit_Symbols) {
|
|
switch (unit) {
|
|
case eCSSUnit_Counter: aResult.AppendLiteral("counter("); break;
|
|
case eCSSUnit_Counters: aResult.AppendLiteral("counters("); break;
|
|
case eCSSUnit_Cubic_Bezier: aResult.AppendLiteral("cubic-bezier("); break;
|
|
case eCSSUnit_Steps: aResult.AppendLiteral("steps("); break;
|
|
case eCSSUnit_Symbols: aResult.AppendLiteral("symbols("); break;
|
|
default: break;
|
|
}
|
|
|
|
nsCSSValue::Array *array = GetArrayValue();
|
|
bool mark = false;
|
|
for (size_t i = 0, i_end = array->Count(); i < i_end; ++i) {
|
|
if (mark && array->Item(i).GetUnit() != eCSSUnit_Null) {
|
|
if ((unit == eCSSUnit_Array &&
|
|
eCSSProperty_transition_timing_function != aProperty) ||
|
|
unit == eCSSUnit_Symbols)
|
|
aResult.Append(' ');
|
|
else if (unit != eCSSUnit_Steps)
|
|
aResult.AppendLiteral(", ");
|
|
}
|
|
if (unit == eCSSUnit_Steps && i == 1) {
|
|
MOZ_ASSERT(array->Item(i).GetUnit() == eCSSUnit_Enumerated,
|
|
"unexpected value");
|
|
int32_t side = array->Item(i).GetIntValue();
|
|
MOZ_ASSERT(side == NS_STYLE_TRANSITION_TIMING_FUNCTION_STEP_START ||
|
|
side == NS_STYLE_TRANSITION_TIMING_FUNCTION_STEP_END ||
|
|
side == -1,
|
|
"unexpected value");
|
|
if (side == NS_STYLE_TRANSITION_TIMING_FUNCTION_STEP_START) {
|
|
aResult.AppendLiteral(", start");
|
|
} else if (side == NS_STYLE_TRANSITION_TIMING_FUNCTION_STEP_END) {
|
|
aResult.AppendLiteral(", end");
|
|
}
|
|
continue;
|
|
}
|
|
if (unit == eCSSUnit_Symbols && i == 0) {
|
|
MOZ_ASSERT(array->Item(i).GetUnit() == eCSSUnit_Enumerated,
|
|
"unexpected value");
|
|
int32_t system = array->Item(i).GetIntValue();
|
|
if (system != NS_STYLE_COUNTER_SYSTEM_SYMBOLIC) {
|
|
AppendASCIItoUTF16(nsCSSProps::ValueToKeyword(
|
|
system, nsCSSProps::kCounterSystemKTable), aResult);
|
|
mark = true;
|
|
}
|
|
continue;
|
|
}
|
|
nsCSSProperty prop =
|
|
((eCSSUnit_Counter <= unit && unit <= eCSSUnit_Counters) &&
|
|
i == array->Count() - 1)
|
|
? eCSSProperty_list_style_type : aProperty;
|
|
if (array->Item(i).GetUnit() != eCSSUnit_Null) {
|
|
array->Item(i).AppendToString(prop, aResult, aSerialization);
|
|
mark = true;
|
|
}
|
|
}
|
|
if (eCSSUnit_Array == unit &&
|
|
aProperty == eCSSProperty_transition_timing_function) {
|
|
aResult.Append(')');
|
|
}
|
|
}
|
|
/* Although Function is backed by an Array, we'll handle it separately
|
|
* because it's a bit quirky.
|
|
*/
|
|
else if (eCSSUnit_Function == unit) {
|
|
const nsCSSValue::Array* array = GetArrayValue();
|
|
MOZ_ASSERT(array->Count() >= 1,
|
|
"Functions must have at least one element for the name.");
|
|
|
|
const nsCSSValue& functionName = array->Item(0);
|
|
MOZ_ASSERT(functionName.GetUnit() == eCSSUnit_Enumerated,
|
|
"Functions must have an enumerated name.");
|
|
|
|
/* Append the function name. */
|
|
// The first argument is always of nsCSSKeyword type.
|
|
const nsCSSKeyword functionId = functionName.GetKeywordValue();
|
|
NS_ConvertASCIItoUTF16 ident(nsCSSKeywords::GetStringValue(functionId));
|
|
// Bug 721136: Normalize the identifier to lowercase, except that things
|
|
// like scaleX should have the last character capitalized. This matches
|
|
// what other browsers do.
|
|
switch (functionId) {
|
|
case eCSSKeyword_rotatex:
|
|
case eCSSKeyword_scalex:
|
|
case eCSSKeyword_skewx:
|
|
case eCSSKeyword_translatex:
|
|
ident.Replace(ident.Length() - 1, 1, char16_t('X'));
|
|
break;
|
|
|
|
case eCSSKeyword_rotatey:
|
|
case eCSSKeyword_scaley:
|
|
case eCSSKeyword_skewy:
|
|
case eCSSKeyword_translatey:
|
|
ident.Replace(ident.Length() - 1, 1, char16_t('Y'));
|
|
break;
|
|
|
|
case eCSSKeyword_rotatez:
|
|
case eCSSKeyword_scalez:
|
|
case eCSSKeyword_translatez:
|
|
ident.Replace(ident.Length() - 1, 1, char16_t('Z'));
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
nsStyleUtil::AppendEscapedCSSIdent(ident, aResult);
|
|
aResult.Append('(');
|
|
|
|
switch (functionId) {
|
|
case eCSSKeyword_polygon:
|
|
AppendPolygonToString(aProperty, aResult, aSerialization);
|
|
break;
|
|
|
|
case eCSSKeyword_circle:
|
|
case eCSSKeyword_ellipse:
|
|
AppendCircleOrEllipseToString(functionId, aProperty, aResult,
|
|
aSerialization);
|
|
break;
|
|
|
|
case eCSSKeyword_inset:
|
|
AppendInsetToString(aProperty, aResult, aSerialization);
|
|
break;
|
|
|
|
default: {
|
|
// Now, step through the function contents, writing each of
|
|
// them as we go.
|
|
for (size_t index = 1; index < array->Count(); ++index) {
|
|
array->Item(index).AppendToString(aProperty, aResult,
|
|
aSerialization);
|
|
|
|
/* If we're not at the final element, append a comma. */
|
|
if (index + 1 != array->Count())
|
|
aResult.AppendLiteral(", ");
|
|
}
|
|
}
|
|
}
|
|
|
|
/* Finally, append the closing parenthesis. */
|
|
aResult.Append(')');
|
|
}
|
|
else if (IsCalcUnit()) {
|
|
MOZ_ASSERT(GetUnit() == eCSSUnit_Calc, "unexpected unit");
|
|
CSSValueSerializeCalcOps ops(aProperty, aResult, aSerialization);
|
|
css::SerializeCalc(*this, ops);
|
|
}
|
|
else if (eCSSUnit_Integer == unit) {
|
|
aResult.AppendInt(GetIntValue(), 10);
|
|
}
|
|
else if (eCSSUnit_Enumerated == unit) {
|
|
int32_t intValue = GetIntValue();
|
|
switch(aProperty) {
|
|
|
|
|
|
case eCSSProperty_text_combine_upright:
|
|
if (intValue <= NS_STYLE_TEXT_COMBINE_UPRIGHT_ALL) {
|
|
AppendASCIItoUTF16(nsCSSProps::LookupPropertyValue(aProperty, intValue),
|
|
aResult);
|
|
} else if (intValue == NS_STYLE_TEXT_COMBINE_UPRIGHT_DIGITS_2) {
|
|
aResult.AppendLiteral("digits 2");
|
|
} else if (intValue == NS_STYLE_TEXT_COMBINE_UPRIGHT_DIGITS_3) {
|
|
aResult.AppendLiteral("digits 3");
|
|
} else {
|
|
aResult.AppendLiteral("digits 4");
|
|
}
|
|
break;
|
|
|
|
case eCSSProperty_text_decoration_line:
|
|
if (NS_STYLE_TEXT_DECORATION_LINE_NONE == intValue) {
|
|
AppendASCIItoUTF16(nsCSSProps::LookupPropertyValue(aProperty, intValue),
|
|
aResult);
|
|
} else {
|
|
// Ignore the "override all" internal value.
|
|
// (It doesn't have a string representation.)
|
|
intValue &= ~NS_STYLE_TEXT_DECORATION_LINE_OVERRIDE_ALL;
|
|
nsStyleUtil::AppendBitmaskCSSValue(
|
|
aProperty, intValue,
|
|
NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE,
|
|
NS_STYLE_TEXT_DECORATION_LINE_PREF_ANCHORS,
|
|
aResult);
|
|
}
|
|
break;
|
|
|
|
case eCSSProperty_paint_order:
|
|
static_assert
|
|
(NS_STYLE_PAINT_ORDER_BITWIDTH * NS_STYLE_PAINT_ORDER_LAST_VALUE <= 8,
|
|
"SVGStyleStruct::mPaintOrder and the following cast not big enough");
|
|
nsStyleUtil::AppendPaintOrderValue(static_cast<uint8_t>(GetIntValue()),
|
|
aResult);
|
|
break;
|
|
|
|
case eCSSProperty_font_synthesis:
|
|
nsStyleUtil::AppendBitmaskCSSValue(aProperty, intValue,
|
|
NS_FONT_SYNTHESIS_WEIGHT,
|
|
NS_FONT_SYNTHESIS_STYLE,
|
|
aResult);
|
|
break;
|
|
|
|
case eCSSProperty_font_variant_east_asian:
|
|
nsStyleUtil::AppendBitmaskCSSValue(aProperty, intValue,
|
|
NS_FONT_VARIANT_EAST_ASIAN_JIS78,
|
|
NS_FONT_VARIANT_EAST_ASIAN_RUBY,
|
|
aResult);
|
|
break;
|
|
|
|
case eCSSProperty_font_variant_ligatures:
|
|
nsStyleUtil::AppendBitmaskCSSValue(aProperty, intValue,
|
|
NS_FONT_VARIANT_LIGATURES_NONE,
|
|
NS_FONT_VARIANT_LIGATURES_NO_CONTEXTUAL,
|
|
aResult);
|
|
break;
|
|
|
|
case eCSSProperty_font_variant_numeric:
|
|
nsStyleUtil::AppendBitmaskCSSValue(aProperty, intValue,
|
|
NS_FONT_VARIANT_NUMERIC_LINING,
|
|
NS_FONT_VARIANT_NUMERIC_ORDINAL,
|
|
aResult);
|
|
break;
|
|
|
|
case eCSSProperty_grid_auto_flow:
|
|
nsStyleUtil::AppendBitmaskCSSValue(aProperty, intValue,
|
|
NS_STYLE_GRID_AUTO_FLOW_ROW,
|
|
NS_STYLE_GRID_AUTO_FLOW_DENSE,
|
|
aResult);
|
|
break;
|
|
|
|
case eCSSProperty_grid_column_start:
|
|
case eCSSProperty_grid_column_end:
|
|
case eCSSProperty_grid_row_start:
|
|
case eCSSProperty_grid_row_end:
|
|
// "span" is the only enumerated-unit value for these properties
|
|
aResult.AppendLiteral("span");
|
|
break;
|
|
|
|
case eCSSProperty_touch_action:
|
|
nsStyleUtil::AppendBitmaskCSSValue(aProperty, intValue,
|
|
NS_STYLE_TOUCH_ACTION_NONE,
|
|
NS_STYLE_TOUCH_ACTION_MANIPULATION,
|
|
aResult);
|
|
break;
|
|
|
|
case eCSSProperty_clip_path:
|
|
AppendASCIItoUTF16(nsCSSProps::ValueToKeyword(intValue,
|
|
nsCSSProps::kClipShapeSizingKTable),
|
|
aResult);
|
|
break;
|
|
|
|
case eCSSProperty_contain:
|
|
if (intValue & NS_STYLE_CONTAIN_STRICT) {
|
|
NS_ASSERTION(intValue == (NS_STYLE_CONTAIN_STRICT | NS_STYLE_CONTAIN_ALL_BITS),
|
|
"contain: strict should imply contain: layout style paint");
|
|
// Only output strict.
|
|
intValue = NS_STYLE_CONTAIN_STRICT;
|
|
}
|
|
nsStyleUtil::AppendBitmaskCSSValue(aProperty,
|
|
intValue,
|
|
NS_STYLE_CONTAIN_STRICT,
|
|
NS_STYLE_CONTAIN_PAINT,
|
|
aResult);
|
|
break;
|
|
|
|
case eCSSProperty_align_content:
|
|
case eCSSProperty_justify_content: {
|
|
AppendAlignJustifyValueToString(intValue & NS_STYLE_ALIGN_ALL_BITS, aResult);
|
|
auto fallback = intValue >> NS_STYLE_ALIGN_ALL_SHIFT;
|
|
if (fallback) {
|
|
MOZ_ASSERT(nsCSSProps::ValueToKeywordEnum(fallback & ~NS_STYLE_ALIGN_FLAG_BITS,
|
|
nsCSSProps::kAlignSelfPosition)
|
|
!= eCSSKeyword_UNKNOWN, "unknown fallback value");
|
|
aResult.Append(' ');
|
|
AppendAlignJustifyValueToString(fallback, aResult);
|
|
}
|
|
break;
|
|
}
|
|
|
|
case eCSSProperty_align_items:
|
|
case eCSSProperty_align_self:
|
|
case eCSSProperty_justify_items:
|
|
case eCSSProperty_justify_self:
|
|
AppendAlignJustifyValueToString(intValue, aResult);
|
|
break;
|
|
|
|
case eCSSProperty_text_emphasis_position: {
|
|
nsStyleUtil::AppendBitmaskCSSValue(aProperty, intValue,
|
|
NS_STYLE_TEXT_EMPHASIS_POSITION_OVER,
|
|
NS_STYLE_TEXT_EMPHASIS_POSITION_RIGHT,
|
|
aResult);
|
|
break;
|
|
}
|
|
|
|
case eCSSProperty_text_emphasis_style: {
|
|
auto fill = intValue & NS_STYLE_TEXT_EMPHASIS_STYLE_FILL_MASK;
|
|
AppendASCIItoUTF16(nsCSSProps::ValueToKeyword(
|
|
fill, nsCSSProps::kTextEmphasisStyleFillKTable), aResult);
|
|
aResult.Append(' ');
|
|
auto shape = intValue & NS_STYLE_TEXT_EMPHASIS_STYLE_SHAPE_MASK;
|
|
AppendASCIItoUTF16(nsCSSProps::ValueToKeyword(
|
|
shape, nsCSSProps::kTextEmphasisStyleShapeKTable), aResult);
|
|
break;
|
|
}
|
|
|
|
default:
|
|
const nsAFlatCString& name = nsCSSProps::LookupPropertyValue(aProperty, intValue);
|
|
AppendASCIItoUTF16(name, aResult);
|
|
break;
|
|
}
|
|
}
|
|
else if (eCSSUnit_EnumColor == unit) {
|
|
// we can lookup the property in the ColorTable and then
|
|
// get a string mapping the name
|
|
nsAutoCString str;
|
|
if (nsCSSProps::GetColorName(GetIntValue(), str)){
|
|
AppendASCIItoUTF16(str, aResult);
|
|
} else {
|
|
MOZ_ASSERT(false, "bad color value");
|
|
}
|
|
}
|
|
else if (IsNumericColorUnit(unit)) {
|
|
if (aSerialization == eNormalized ||
|
|
unit == eCSSUnit_RGBColor ||
|
|
unit == eCSSUnit_RGBAColor) {
|
|
nscolor color = GetColorValue();
|
|
if (aSerialization == eNormalized &&
|
|
color == NS_RGBA(0, 0, 0, 0)) {
|
|
// Use the strictest match for 'transparent' so we do correct
|
|
// round-tripping of all other rgba() values.
|
|
aResult.AppendLiteral("transparent");
|
|
} else {
|
|
uint8_t a = NS_GET_A(color);
|
|
bool showAlpha =
|
|
(aSerialization == eNormalized && a < 255) ||
|
|
(aSerialization == eAuthorSpecified &&
|
|
unit == eCSSUnit_RGBAColor);
|
|
if (showAlpha) {
|
|
aResult.AppendLiteral("rgba(");
|
|
} else {
|
|
aResult.AppendLiteral("rgb(");
|
|
}
|
|
|
|
NS_NAMED_LITERAL_STRING(comma, ", ");
|
|
|
|
aResult.AppendInt(NS_GET_R(color), 10);
|
|
aResult.Append(comma);
|
|
aResult.AppendInt(NS_GET_G(color), 10);
|
|
aResult.Append(comma);
|
|
aResult.AppendInt(NS_GET_B(color), 10);
|
|
if (showAlpha) {
|
|
aResult.Append(comma);
|
|
aResult.AppendFloat(nsStyleUtil::ColorComponentToFloat(a));
|
|
}
|
|
aResult.Append(char16_t(')'));
|
|
}
|
|
} else if (eCSSUnit_HexColor == unit) {
|
|
nscolor color = GetColorValue();
|
|
aResult.Append('#');
|
|
aResult.AppendPrintf("%02x", NS_GET_R(color));
|
|
aResult.AppendPrintf("%02x", NS_GET_G(color));
|
|
aResult.AppendPrintf("%02x", NS_GET_B(color));
|
|
} else if (eCSSUnit_ShortHexColor == unit) {
|
|
nscolor color = GetColorValue();
|
|
aResult.Append('#');
|
|
aResult.AppendInt(NS_GET_R(color) / 0x11, 16);
|
|
aResult.AppendInt(NS_GET_G(color) / 0x11, 16);
|
|
aResult.AppendInt(NS_GET_B(color) / 0x11, 16);
|
|
} else {
|
|
MOZ_ASSERT(IsFloatColorUnit());
|
|
mValue.mFloatColor->AppendToString(unit, aResult);
|
|
}
|
|
}
|
|
else if (eCSSUnit_URL == unit || eCSSUnit_Image == unit) {
|
|
aResult.AppendLiteral("url(");
|
|
nsStyleUtil::AppendEscapedCSSString(
|
|
nsDependentString(GetOriginalURLValue()), aResult);
|
|
aResult.Append(')');
|
|
}
|
|
else if (eCSSUnit_Element == unit) {
|
|
aResult.AppendLiteral("-moz-element(#");
|
|
nsAutoString tmpStr;
|
|
GetStringValue(tmpStr);
|
|
nsStyleUtil::AppendEscapedCSSIdent(tmpStr, aResult);
|
|
aResult.Append(')');
|
|
}
|
|
else if (eCSSUnit_Percent == unit) {
|
|
aResult.AppendFloat(GetPercentValue() * 100.0f);
|
|
}
|
|
else if (eCSSUnit_Percent < unit) { // length unit
|
|
aResult.AppendFloat(GetFloatValue());
|
|
}
|
|
else if (eCSSUnit_Gradient == unit) {
|
|
nsCSSValueGradient* gradient = GetGradientValue();
|
|
|
|
if (gradient->mIsLegacySyntax) {
|
|
aResult.AppendLiteral("-moz-");
|
|
}
|
|
if (gradient->mIsRepeating) {
|
|
aResult.AppendLiteral("repeating-");
|
|
}
|
|
if (gradient->mIsRadial) {
|
|
aResult.AppendLiteral("radial-gradient(");
|
|
} else {
|
|
aResult.AppendLiteral("linear-gradient(");
|
|
}
|
|
|
|
bool needSep = false;
|
|
if (gradient->mIsRadial && !gradient->mIsLegacySyntax) {
|
|
if (!gradient->mIsExplicitSize) {
|
|
if (gradient->GetRadialShape().GetUnit() != eCSSUnit_None) {
|
|
MOZ_ASSERT(gradient->GetRadialShape().GetUnit() ==
|
|
eCSSUnit_Enumerated,
|
|
"bad unit for radial gradient shape");
|
|
int32_t intValue = gradient->GetRadialShape().GetIntValue();
|
|
MOZ_ASSERT(intValue != NS_STYLE_GRADIENT_SHAPE_LINEAR,
|
|
"radial gradient with linear shape?!");
|
|
AppendASCIItoUTF16(nsCSSProps::ValueToKeyword(intValue,
|
|
nsCSSProps::kRadialGradientShapeKTable),
|
|
aResult);
|
|
needSep = true;
|
|
}
|
|
|
|
if (gradient->GetRadialSize().GetUnit() != eCSSUnit_None) {
|
|
if (needSep) {
|
|
aResult.Append(' ');
|
|
}
|
|
MOZ_ASSERT(gradient->GetRadialSize().GetUnit() == eCSSUnit_Enumerated,
|
|
"bad unit for radial gradient size");
|
|
int32_t intValue = gradient->GetRadialSize().GetIntValue();
|
|
AppendASCIItoUTF16(nsCSSProps::ValueToKeyword(intValue,
|
|
nsCSSProps::kRadialGradientSizeKTable),
|
|
aResult);
|
|
needSep = true;
|
|
}
|
|
} else {
|
|
MOZ_ASSERT(gradient->GetRadiusX().GetUnit() != eCSSUnit_None,
|
|
"bad unit for radial gradient explicit size");
|
|
gradient->GetRadiusX().AppendToString(aProperty, aResult,
|
|
aSerialization);
|
|
if (gradient->GetRadiusY().GetUnit() != eCSSUnit_None) {
|
|
aResult.Append(' ');
|
|
gradient->GetRadiusY().AppendToString(aProperty, aResult,
|
|
aSerialization);
|
|
}
|
|
needSep = true;
|
|
}
|
|
}
|
|
if (!gradient->mIsRadial && !gradient->mIsLegacySyntax) {
|
|
if (gradient->mBgPos.mXValue.GetUnit() != eCSSUnit_None ||
|
|
gradient->mBgPos.mYValue.GetUnit() != eCSSUnit_None) {
|
|
MOZ_ASSERT(gradient->mAngle.GetUnit() == eCSSUnit_None);
|
|
MOZ_ASSERT(gradient->mBgPos.mXValue.GetUnit() == eCSSUnit_Enumerated &&
|
|
gradient->mBgPos.mYValue.GetUnit() == eCSSUnit_Enumerated,
|
|
"unexpected unit");
|
|
aResult.AppendLiteral("to");
|
|
if (!(gradient->mBgPos.mXValue.GetIntValue() & NS_STYLE_IMAGELAYER_POSITION_CENTER)) {
|
|
aResult.Append(' ');
|
|
gradient->mBgPos.mXValue.AppendToString(eCSSProperty_background_position,
|
|
aResult, aSerialization);
|
|
}
|
|
if (!(gradient->mBgPos.mYValue.GetIntValue() & NS_STYLE_IMAGELAYER_POSITION_CENTER)) {
|
|
aResult.Append(' ');
|
|
gradient->mBgPos.mYValue.AppendToString(eCSSProperty_background_position,
|
|
aResult, aSerialization);
|
|
}
|
|
needSep = true;
|
|
} else if (gradient->mAngle.GetUnit() != eCSSUnit_None) {
|
|
gradient->mAngle.AppendToString(aProperty, aResult, aSerialization);
|
|
needSep = true;
|
|
}
|
|
} else if (gradient->mBgPos.mXValue.GetUnit() != eCSSUnit_None ||
|
|
gradient->mBgPos.mYValue.GetUnit() != eCSSUnit_None ||
|
|
gradient->mAngle.GetUnit() != eCSSUnit_None) {
|
|
if (needSep) {
|
|
aResult.Append(' ');
|
|
}
|
|
if (gradient->mIsRadial && !gradient->mIsLegacySyntax) {
|
|
aResult.AppendLiteral("at ");
|
|
}
|
|
if (gradient->mBgPos.mXValue.GetUnit() != eCSSUnit_None) {
|
|
gradient->mBgPos.mXValue.AppendToString(eCSSProperty_background_position,
|
|
aResult, aSerialization);
|
|
aResult.Append(' ');
|
|
}
|
|
if (gradient->mBgPos.mYValue.GetUnit() != eCSSUnit_None) {
|
|
gradient->mBgPos.mYValue.AppendToString(eCSSProperty_background_position,
|
|
aResult, aSerialization);
|
|
aResult.Append(' ');
|
|
}
|
|
if (gradient->mAngle.GetUnit() != eCSSUnit_None) {
|
|
MOZ_ASSERT(gradient->mIsLegacySyntax,
|
|
"angle is allowed only for legacy syntax");
|
|
gradient->mAngle.AppendToString(aProperty, aResult, aSerialization);
|
|
}
|
|
needSep = true;
|
|
}
|
|
|
|
if (gradient->mIsRadial && gradient->mIsLegacySyntax &&
|
|
(gradient->GetRadialShape().GetUnit() != eCSSUnit_None ||
|
|
gradient->GetRadialSize().GetUnit() != eCSSUnit_None)) {
|
|
MOZ_ASSERT(!gradient->mIsExplicitSize);
|
|
if (needSep) {
|
|
aResult.AppendLiteral(", ");
|
|
}
|
|
if (gradient->GetRadialShape().GetUnit() != eCSSUnit_None) {
|
|
MOZ_ASSERT(gradient->GetRadialShape().GetUnit() == eCSSUnit_Enumerated,
|
|
"bad unit for radial gradient shape");
|
|
int32_t intValue = gradient->GetRadialShape().GetIntValue();
|
|
MOZ_ASSERT(intValue != NS_STYLE_GRADIENT_SHAPE_LINEAR,
|
|
"radial gradient with linear shape?!");
|
|
AppendASCIItoUTF16(nsCSSProps::ValueToKeyword(intValue,
|
|
nsCSSProps::kRadialGradientShapeKTable),
|
|
aResult);
|
|
aResult.Append(' ');
|
|
}
|
|
|
|
if (gradient->GetRadialSize().GetUnit() != eCSSUnit_None) {
|
|
MOZ_ASSERT(gradient->GetRadialSize().GetUnit() == eCSSUnit_Enumerated,
|
|
"bad unit for radial gradient size");
|
|
int32_t intValue = gradient->GetRadialSize().GetIntValue();
|
|
AppendASCIItoUTF16(nsCSSProps::ValueToKeyword(intValue,
|
|
nsCSSProps::kRadialGradientSizeKTable),
|
|
aResult);
|
|
}
|
|
needSep = true;
|
|
}
|
|
if (needSep) {
|
|
aResult.AppendLiteral(", ");
|
|
}
|
|
|
|
for (uint32_t i = 0 ;;) {
|
|
bool isInterpolationHint = gradient->mStops[i].mIsInterpolationHint;
|
|
if (!isInterpolationHint) {
|
|
gradient->mStops[i].mColor.AppendToString(aProperty, aResult,
|
|
aSerialization);
|
|
}
|
|
if (gradient->mStops[i].mLocation.GetUnit() != eCSSUnit_None) {
|
|
if (!isInterpolationHint) {
|
|
aResult.Append(' ');
|
|
}
|
|
gradient->mStops[i].mLocation.AppendToString(aProperty, aResult,
|
|
aSerialization);
|
|
}
|
|
if (++i == gradient->mStops.Length()) {
|
|
break;
|
|
}
|
|
aResult.AppendLiteral(", ");
|
|
}
|
|
|
|
aResult.Append(')');
|
|
} else if (eCSSUnit_TokenStream == unit) {
|
|
nsCSSProperty shorthand = mValue.mTokenStream->mShorthandPropertyID;
|
|
if (shorthand == eCSSProperty_UNKNOWN ||
|
|
nsCSSProps::PropHasFlags(shorthand, CSS_PROPERTY_IS_ALIAS) ||
|
|
aProperty == eCSSProperty__x_system_font) {
|
|
// We treat serialization of aliases like '-moz-transform' as a special
|
|
// case, since it really wants to be serialized as if it were a longhand
|
|
// even though it is implemented as a shorthand. We also need to
|
|
// serialize -x-system-font's token stream value, even though the
|
|
// value is set through the font shorthand. This serialization
|
|
// of -x-system-font is needed when we need to output the
|
|
// 'font' shorthand followed by a number of overriding font
|
|
// longhand components.
|
|
aResult.Append(mValue.mTokenStream->mTokenStream);
|
|
}
|
|
} else if (eCSSUnit_Pair == unit) {
|
|
if (eCSSProperty_font_variant_alternates == aProperty) {
|
|
int32_t intValue = GetPairValue().mXValue.GetIntValue();
|
|
nsAutoString out;
|
|
|
|
// simple, enumerated values
|
|
nsStyleUtil::AppendBitmaskCSSValue(aProperty,
|
|
intValue & NS_FONT_VARIANT_ALTERNATES_ENUMERATED_MASK,
|
|
NS_FONT_VARIANT_ALTERNATES_HISTORICAL,
|
|
NS_FONT_VARIANT_ALTERNATES_HISTORICAL,
|
|
out);
|
|
|
|
// functional values
|
|
const nsCSSValueList *list = GetPairValue().mYValue.GetListValue();
|
|
AutoTArray<gfxAlternateValue,8> altValues;
|
|
|
|
nsStyleUtil::ComputeFunctionalAlternates(list, altValues);
|
|
nsStyleUtil::SerializeFunctionalAlternates(altValues, out);
|
|
aResult.Append(out);
|
|
} else {
|
|
GetPairValue().AppendToString(aProperty, aResult, aSerialization);
|
|
}
|
|
} else if (eCSSUnit_Triplet == unit) {
|
|
GetTripletValue().AppendToString(aProperty, aResult, aSerialization);
|
|
} else if (eCSSUnit_Rect == unit) {
|
|
GetRectValue().AppendToString(aProperty, aResult, aSerialization);
|
|
} else if (eCSSUnit_List == unit || eCSSUnit_ListDep == unit) {
|
|
GetListValue()->AppendToString(aProperty, aResult, aSerialization);
|
|
} else if (eCSSUnit_SharedList == unit) {
|
|
GetSharedListValue()->AppendToString(aProperty, aResult, aSerialization);
|
|
} else if (eCSSUnit_PairList == unit || eCSSUnit_PairListDep == unit) {
|
|
switch (aProperty) {
|
|
case eCSSProperty_font_feature_settings:
|
|
nsStyleUtil::AppendFontFeatureSettings(*this, aResult);
|
|
break;
|
|
default:
|
|
GetPairListValue()->AppendToString(aProperty, aResult, aSerialization);
|
|
break;
|
|
}
|
|
} else if (eCSSUnit_GridTemplateAreas == unit) {
|
|
const mozilla::css::GridTemplateAreasValue* areas = GetGridTemplateAreas();
|
|
MOZ_ASSERT(!areas->mTemplates.IsEmpty(),
|
|
"Unexpected empty array in GridTemplateAreasValue");
|
|
nsStyleUtil::AppendEscapedCSSString(areas->mTemplates[0], aResult);
|
|
for (uint32_t i = 1; i < areas->mTemplates.Length(); i++) {
|
|
aResult.Append(char16_t(' '));
|
|
nsStyleUtil::AppendEscapedCSSString(areas->mTemplates[i], aResult);
|
|
}
|
|
} else if (eCSSUnit_FontFamilyList == unit) {
|
|
nsStyleUtil::AppendEscapedCSSFontFamilyList(*mValue.mFontFamilyList,
|
|
aResult);
|
|
}
|
|
|
|
switch (unit) {
|
|
case eCSSUnit_Null: break;
|
|
case eCSSUnit_Auto: aResult.AppendLiteral("auto"); break;
|
|
case eCSSUnit_Inherit: aResult.AppendLiteral("inherit"); break;
|
|
case eCSSUnit_Initial: aResult.AppendLiteral("initial"); break;
|
|
case eCSSUnit_Unset: aResult.AppendLiteral("unset"); break;
|
|
case eCSSUnit_None: aResult.AppendLiteral("none"); break;
|
|
case eCSSUnit_Normal: aResult.AppendLiteral("normal"); break;
|
|
case eCSSUnit_System_Font: aResult.AppendLiteral("-moz-use-system-font"); break;
|
|
case eCSSUnit_All: aResult.AppendLiteral("all"); break;
|
|
case eCSSUnit_Dummy:
|
|
case eCSSUnit_DummyInherit:
|
|
MOZ_ASSERT(false, "should never serialize");
|
|
break;
|
|
|
|
case eCSSUnit_FontFamilyList: break;
|
|
case eCSSUnit_String: break;
|
|
case eCSSUnit_Ident: break;
|
|
case eCSSUnit_URL: break;
|
|
case eCSSUnit_Image: break;
|
|
case eCSSUnit_Element: break;
|
|
case eCSSUnit_Array: break;
|
|
case eCSSUnit_Attr:
|
|
case eCSSUnit_Cubic_Bezier:
|
|
case eCSSUnit_Steps:
|
|
case eCSSUnit_Symbols:
|
|
case eCSSUnit_Counter:
|
|
case eCSSUnit_Counters: aResult.Append(char16_t(')')); break;
|
|
case eCSSUnit_Local_Font: break;
|
|
case eCSSUnit_Font_Format: break;
|
|
case eCSSUnit_Function: break;
|
|
case eCSSUnit_Calc: break;
|
|
case eCSSUnit_Calc_Plus: break;
|
|
case eCSSUnit_Calc_Minus: break;
|
|
case eCSSUnit_Calc_Times_L: break;
|
|
case eCSSUnit_Calc_Times_R: break;
|
|
case eCSSUnit_Calc_Divided: break;
|
|
case eCSSUnit_Integer: break;
|
|
case eCSSUnit_Enumerated: break;
|
|
case eCSSUnit_EnumColor: break;
|
|
case eCSSUnit_RGBColor: break;
|
|
case eCSSUnit_RGBAColor: break;
|
|
case eCSSUnit_HexColor: break;
|
|
case eCSSUnit_ShortHexColor: break;
|
|
case eCSSUnit_PercentageRGBColor: break;
|
|
case eCSSUnit_PercentageRGBAColor: break;
|
|
case eCSSUnit_HSLColor: break;
|
|
case eCSSUnit_HSLAColor: break;
|
|
case eCSSUnit_Percent: aResult.Append(char16_t('%')); break;
|
|
case eCSSUnit_Number: break;
|
|
case eCSSUnit_Gradient: break;
|
|
case eCSSUnit_TokenStream: break;
|
|
case eCSSUnit_Pair: break;
|
|
case eCSSUnit_Triplet: break;
|
|
case eCSSUnit_Rect: break;
|
|
case eCSSUnit_List: break;
|
|
case eCSSUnit_ListDep: break;
|
|
case eCSSUnit_SharedList: break;
|
|
case eCSSUnit_PairList: break;
|
|
case eCSSUnit_PairListDep: break;
|
|
case eCSSUnit_GridTemplateAreas: break;
|
|
|
|
case eCSSUnit_Inch: aResult.AppendLiteral("in"); break;
|
|
case eCSSUnit_Millimeter: aResult.AppendLiteral("mm"); break;
|
|
case eCSSUnit_PhysicalMillimeter: aResult.AppendLiteral("mozmm"); break;
|
|
case eCSSUnit_Centimeter: aResult.AppendLiteral("cm"); break;
|
|
case eCSSUnit_Point: aResult.AppendLiteral("pt"); break;
|
|
case eCSSUnit_Pica: aResult.AppendLiteral("pc"); break;
|
|
case eCSSUnit_Quarter: aResult.AppendLiteral("q"); break;
|
|
|
|
case eCSSUnit_ViewportWidth: aResult.AppendLiteral("vw"); break;
|
|
case eCSSUnit_ViewportHeight: aResult.AppendLiteral("vh"); break;
|
|
case eCSSUnit_ViewportMin: aResult.AppendLiteral("vmin"); break;
|
|
case eCSSUnit_ViewportMax: aResult.AppendLiteral("vmax"); break;
|
|
|
|
case eCSSUnit_EM: aResult.AppendLiteral("em"); break;
|
|
case eCSSUnit_XHeight: aResult.AppendLiteral("ex"); break;
|
|
case eCSSUnit_Char: aResult.AppendLiteral("ch"); break;
|
|
case eCSSUnit_RootEM: aResult.AppendLiteral("rem"); break;
|
|
|
|
case eCSSUnit_Pixel: aResult.AppendLiteral("px"); break;
|
|
|
|
case eCSSUnit_Degree: aResult.AppendLiteral("deg"); break;
|
|
case eCSSUnit_Grad: aResult.AppendLiteral("grad"); break;
|
|
case eCSSUnit_Radian: aResult.AppendLiteral("rad"); break;
|
|
case eCSSUnit_Turn: aResult.AppendLiteral("turn"); break;
|
|
|
|
case eCSSUnit_Hertz: aResult.AppendLiteral("Hz"); break;
|
|
case eCSSUnit_Kilohertz: aResult.AppendLiteral("kHz"); break;
|
|
|
|
case eCSSUnit_Seconds: aResult.Append(char16_t('s')); break;
|
|
case eCSSUnit_Milliseconds: aResult.AppendLiteral("ms"); break;
|
|
|
|
case eCSSUnit_FlexFraction: aResult.AppendLiteral("fr"); break;
|
|
}
|
|
}
|
|
|
|
size_t
|
|
nsCSSValue::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
|
{
|
|
size_t n = 0;
|
|
|
|
switch (GetUnit()) {
|
|
// No value: nothing extra to measure.
|
|
case eCSSUnit_Null:
|
|
case eCSSUnit_Auto:
|
|
case eCSSUnit_Inherit:
|
|
case eCSSUnit_Initial:
|
|
case eCSSUnit_Unset:
|
|
case eCSSUnit_None:
|
|
case eCSSUnit_Normal:
|
|
case eCSSUnit_System_Font:
|
|
case eCSSUnit_All:
|
|
case eCSSUnit_Dummy:
|
|
case eCSSUnit_DummyInherit:
|
|
break;
|
|
|
|
// String
|
|
case eCSSUnit_String:
|
|
case eCSSUnit_Ident:
|
|
case eCSSUnit_Attr:
|
|
case eCSSUnit_Local_Font:
|
|
case eCSSUnit_Font_Format:
|
|
case eCSSUnit_Element:
|
|
n += mValue.mString->SizeOfIncludingThisIfUnshared(aMallocSizeOf);
|
|
break;
|
|
|
|
// Array
|
|
case eCSSUnit_Array:
|
|
case eCSSUnit_Counter:
|
|
case eCSSUnit_Counters:
|
|
case eCSSUnit_Cubic_Bezier:
|
|
case eCSSUnit_Steps:
|
|
case eCSSUnit_Symbols:
|
|
case eCSSUnit_Function:
|
|
case eCSSUnit_Calc:
|
|
case eCSSUnit_Calc_Plus:
|
|
case eCSSUnit_Calc_Minus:
|
|
case eCSSUnit_Calc_Times_L:
|
|
case eCSSUnit_Calc_Times_R:
|
|
case eCSSUnit_Calc_Divided:
|
|
break;
|
|
|
|
// URL
|
|
case eCSSUnit_URL:
|
|
n += mValue.mURL->SizeOfIncludingThis(aMallocSizeOf);
|
|
break;
|
|
|
|
// Image
|
|
case eCSSUnit_Image:
|
|
// Not yet measured. Measurement may be added later if DMD finds it
|
|
// worthwhile.
|
|
break;
|
|
|
|
// Gradient
|
|
case eCSSUnit_Gradient:
|
|
n += mValue.mGradient->SizeOfIncludingThis(aMallocSizeOf);
|
|
break;
|
|
|
|
// TokenStream
|
|
case eCSSUnit_TokenStream:
|
|
n += mValue.mTokenStream->SizeOfIncludingThis(aMallocSizeOf);
|
|
break;
|
|
|
|
// Pair
|
|
case eCSSUnit_Pair:
|
|
n += mValue.mPair->SizeOfIncludingThis(aMallocSizeOf);
|
|
break;
|
|
|
|
// Triplet
|
|
case eCSSUnit_Triplet:
|
|
n += mValue.mTriplet->SizeOfIncludingThis(aMallocSizeOf);
|
|
break;
|
|
|
|
// Rect
|
|
case eCSSUnit_Rect:
|
|
n += mValue.mRect->SizeOfIncludingThis(aMallocSizeOf);
|
|
break;
|
|
|
|
// List
|
|
case eCSSUnit_List:
|
|
n += mValue.mList->SizeOfIncludingThis(aMallocSizeOf);
|
|
break;
|
|
|
|
// ListDep: not measured because it's non-owning.
|
|
case eCSSUnit_ListDep:
|
|
break;
|
|
|
|
// SharedList
|
|
case eCSSUnit_SharedList:
|
|
// Makes more sense not to measure, since it most cases the list
|
|
// will be shared.
|
|
break;
|
|
|
|
// PairList
|
|
case eCSSUnit_PairList:
|
|
n += mValue.mPairList->SizeOfIncludingThis(aMallocSizeOf);
|
|
break;
|
|
|
|
// PairListDep: not measured because it's non-owning.
|
|
case eCSSUnit_PairListDep:
|
|
break;
|
|
|
|
// GridTemplateAreas
|
|
case eCSSUnit_GridTemplateAreas:
|
|
n += mValue.mGridTemplateAreas->SizeOfIncludingThis(aMallocSizeOf);
|
|
break;
|
|
|
|
case eCSSUnit_FontFamilyList:
|
|
n += mValue.mFontFamilyList->SizeOfIncludingThis(aMallocSizeOf);
|
|
break;
|
|
|
|
// Int: nothing extra to measure.
|
|
case eCSSUnit_Integer:
|
|
case eCSSUnit_Enumerated:
|
|
case eCSSUnit_EnumColor:
|
|
break;
|
|
|
|
// Integer Color: nothing extra to measure.
|
|
case eCSSUnit_RGBColor:
|
|
case eCSSUnit_RGBAColor:
|
|
case eCSSUnit_HexColor:
|
|
case eCSSUnit_ShortHexColor:
|
|
break;
|
|
|
|
// Float Color
|
|
case eCSSUnit_PercentageRGBColor:
|
|
case eCSSUnit_PercentageRGBAColor:
|
|
case eCSSUnit_HSLColor:
|
|
case eCSSUnit_HSLAColor:
|
|
n += mValue.mFloatColor->SizeOfIncludingThis(aMallocSizeOf);
|
|
break;
|
|
|
|
// Float: nothing extra to measure.
|
|
case eCSSUnit_Percent:
|
|
case eCSSUnit_Number:
|
|
case eCSSUnit_PhysicalMillimeter:
|
|
case eCSSUnit_ViewportWidth:
|
|
case eCSSUnit_ViewportHeight:
|
|
case eCSSUnit_ViewportMin:
|
|
case eCSSUnit_ViewportMax:
|
|
case eCSSUnit_EM:
|
|
case eCSSUnit_XHeight:
|
|
case eCSSUnit_Char:
|
|
case eCSSUnit_RootEM:
|
|
case eCSSUnit_Point:
|
|
case eCSSUnit_Inch:
|
|
case eCSSUnit_Millimeter:
|
|
case eCSSUnit_Centimeter:
|
|
case eCSSUnit_Pica:
|
|
case eCSSUnit_Pixel:
|
|
case eCSSUnit_Quarter:
|
|
case eCSSUnit_Degree:
|
|
case eCSSUnit_Grad:
|
|
case eCSSUnit_Turn:
|
|
case eCSSUnit_Radian:
|
|
case eCSSUnit_Hertz:
|
|
case eCSSUnit_Kilohertz:
|
|
case eCSSUnit_Seconds:
|
|
case eCSSUnit_Milliseconds:
|
|
case eCSSUnit_FlexFraction:
|
|
break;
|
|
|
|
default:
|
|
MOZ_ASSERT(false, "bad nsCSSUnit");
|
|
break;
|
|
}
|
|
|
|
return n;
|
|
}
|
|
|
|
// --- nsCSSValueList -----------------
|
|
|
|
nsCSSValueList::~nsCSSValueList()
|
|
{
|
|
MOZ_COUNT_DTOR(nsCSSValueList);
|
|
NS_CSS_DELETE_LIST_MEMBER(nsCSSValueList, this, mNext);
|
|
}
|
|
|
|
nsCSSValueList*
|
|
nsCSSValueList::Clone() const
|
|
{
|
|
nsCSSValueList* result = new nsCSSValueList(*this);
|
|
nsCSSValueList* dest = result;
|
|
const nsCSSValueList* src = this->mNext;
|
|
while (src) {
|
|
dest->mNext = new nsCSSValueList(*src);
|
|
dest = dest->mNext;
|
|
src = src->mNext;
|
|
}
|
|
|
|
MOZ_ASSERT(result, "shouldn't return null; supposed to be infallible");
|
|
return result;
|
|
}
|
|
|
|
void
|
|
nsCSSValueList::CloneInto(nsCSSValueList* aList) const
|
|
{
|
|
NS_ASSERTION(!aList->mNext, "Must be an empty list!");
|
|
aList->mValue = mValue;
|
|
aList->mNext = mNext ? mNext->Clone() : nullptr;
|
|
}
|
|
|
|
static void
|
|
AppendValueListToString(const nsCSSValueList* val,
|
|
nsCSSProperty aProperty, nsAString& aResult,
|
|
nsCSSValue::Serialization aSerialization)
|
|
{
|
|
for (;;) {
|
|
val->mValue.AppendToString(aProperty, aResult, aSerialization);
|
|
val = val->mNext;
|
|
if (!val)
|
|
break;
|
|
|
|
if (nsCSSProps::PropHasFlags(aProperty,
|
|
CSS_PROPERTY_VALUE_LIST_USES_COMMAS))
|
|
aResult.Append(char16_t(','));
|
|
aResult.Append(char16_t(' '));
|
|
}
|
|
}
|
|
|
|
static void
|
|
AppendGridTemplateToString(const nsCSSValueList* val,
|
|
nsCSSProperty aProperty, nsAString& aResult,
|
|
nsCSSValue::Serialization aSerialization)
|
|
{
|
|
// This is called for the "list" that's the top-level value of the property.
|
|
bool isSubgrid = false;
|
|
for (;;) {
|
|
bool addSpaceSeparator = true;
|
|
nsCSSUnit unit = val->mValue.GetUnit();
|
|
|
|
if (unit == eCSSUnit_Enumerated &&
|
|
val->mValue.GetIntValue() == NS_STYLE_GRID_TEMPLATE_SUBGRID) {
|
|
MOZ_ASSERT(!isSubgrid, "saw subgrid once already");
|
|
isSubgrid = true;
|
|
aResult.AppendLiteral("subgrid");
|
|
|
|
} else if (unit == eCSSUnit_Pair) {
|
|
// This is a repeat 'auto-fill' / 'auto-fit'.
|
|
const nsCSSValuePair& pair = val->mValue.GetPairValue();
|
|
switch (pair.mXValue.GetIntValue()) {
|
|
case NS_STYLE_GRID_REPEAT_AUTO_FILL:
|
|
aResult.AppendLiteral("repeat(auto-fill, ");
|
|
break;
|
|
case NS_STYLE_GRID_REPEAT_AUTO_FIT:
|
|
aResult.AppendLiteral("repeat(auto-fit, ");
|
|
break;
|
|
default:
|
|
MOZ_ASSERT_UNREACHABLE("unexpected enum value");
|
|
}
|
|
const nsCSSValueList* repeatList = pair.mYValue.GetListValue();
|
|
if (repeatList->mValue.GetUnit() != eCSSUnit_Null) {
|
|
aResult.Append('[');
|
|
AppendValueListToString(repeatList->mValue.GetListValue(), aProperty,
|
|
aResult, aSerialization);
|
|
aResult.Append(']');
|
|
if (!isSubgrid) {
|
|
aResult.Append(' ');
|
|
}
|
|
} else if (isSubgrid) {
|
|
aResult.AppendLiteral("[]");
|
|
}
|
|
if (!isSubgrid) {
|
|
repeatList = repeatList->mNext;
|
|
repeatList->mValue.AppendToString(aProperty, aResult, aSerialization);
|
|
repeatList = repeatList->mNext;
|
|
if (repeatList->mValue.GetUnit() != eCSSUnit_Null) {
|
|
aResult.AppendLiteral(" [");
|
|
AppendValueListToString(repeatList->mValue.GetListValue(), aProperty,
|
|
aResult, aSerialization);
|
|
aResult.Append(']');
|
|
}
|
|
}
|
|
aResult.Append(')');
|
|
|
|
} else if (unit == eCSSUnit_Null) {
|
|
// Empty or omitted <line-names>.
|
|
if (isSubgrid) {
|
|
aResult.AppendLiteral("[]");
|
|
} else {
|
|
// Serializes to nothing.
|
|
addSpaceSeparator = false; // Avoid a double space.
|
|
}
|
|
|
|
} else if (unit == eCSSUnit_List || unit == eCSSUnit_ListDep) {
|
|
// Non-empty <line-names>
|
|
aResult.Append('[');
|
|
AppendValueListToString(val->mValue.GetListValue(), aProperty,
|
|
aResult, aSerialization);
|
|
aResult.Append(']');
|
|
|
|
} else {
|
|
// <track-size>
|
|
val->mValue.AppendToString(aProperty, aResult, aSerialization);
|
|
if (!isSubgrid &&
|
|
val->mNext &&
|
|
val->mNext->mValue.GetUnit() == eCSSUnit_Null &&
|
|
!val->mNext->mNext) {
|
|
// Break out of the loop early to avoid a trailing space.
|
|
break;
|
|
}
|
|
}
|
|
|
|
val = val->mNext;
|
|
if (!val) {
|
|
break;
|
|
}
|
|
|
|
if (addSpaceSeparator) {
|
|
aResult.Append(char16_t(' '));
|
|
}
|
|
}
|
|
}
|
|
|
|
void
|
|
nsCSSValueList::AppendToString(nsCSSProperty aProperty, nsAString& aResult,
|
|
nsCSSValue::Serialization aSerialization) const
|
|
{
|
|
if (aProperty == eCSSProperty_grid_template_columns ||
|
|
aProperty == eCSSProperty_grid_template_rows) {
|
|
AppendGridTemplateToString(this, aProperty, aResult, aSerialization);
|
|
} else {
|
|
AppendValueListToString(this, aProperty, aResult, aSerialization);
|
|
}
|
|
}
|
|
|
|
/* static */ bool
|
|
nsCSSValueList::Equal(const nsCSSValueList* aList1,
|
|
const nsCSSValueList* aList2)
|
|
{
|
|
if (aList1 == aList2) {
|
|
return true;
|
|
}
|
|
|
|
const nsCSSValueList *p1 = aList1, *p2 = aList2;
|
|
for ( ; p1 && p2; p1 = p1->mNext, p2 = p2->mNext) {
|
|
if (p1->mValue != p2->mValue)
|
|
return false;
|
|
}
|
|
return !p1 && !p2; // true if same length, false otherwise
|
|
}
|
|
|
|
size_t
|
|
nsCSSValueList::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
|
{
|
|
size_t n = 0;
|
|
const nsCSSValueList* v = this;
|
|
while (v) {
|
|
n += aMallocSizeOf(v);
|
|
n += v->mValue.SizeOfExcludingThis(aMallocSizeOf);
|
|
v = v->mNext;
|
|
}
|
|
return n;
|
|
}
|
|
|
|
size_t
|
|
nsCSSValueList_heap::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
|
{
|
|
size_t n = aMallocSizeOf(this);
|
|
n += mValue.SizeOfExcludingThis(aMallocSizeOf);
|
|
n += mNext ? mNext->SizeOfIncludingThis(aMallocSizeOf) : 0;
|
|
return n;
|
|
}
|
|
|
|
// --- nsCSSValueSharedList -----------------
|
|
|
|
nsCSSValueSharedList::~nsCSSValueSharedList()
|
|
{
|
|
MOZ_COUNT_DTOR(nsCSSValueSharedList);
|
|
if (mHead) {
|
|
NS_CSS_DELETE_LIST_MEMBER(nsCSSValueList, mHead, mNext);
|
|
delete mHead;
|
|
}
|
|
}
|
|
|
|
void
|
|
nsCSSValueSharedList::AppendToString(nsCSSProperty aProperty, nsAString& aResult,
|
|
nsCSSValue::Serialization aSerialization) const
|
|
{
|
|
if (mHead) {
|
|
mHead->AppendToString(aProperty, aResult, aSerialization);
|
|
}
|
|
}
|
|
|
|
bool
|
|
nsCSSValueSharedList::operator==(const nsCSSValueSharedList& aOther) const
|
|
{
|
|
return nsCSSValueList::Equal(mHead, aOther.mHead);
|
|
}
|
|
|
|
size_t
|
|
nsCSSValueSharedList::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
|
{
|
|
size_t n = 0;
|
|
n += aMallocSizeOf(this);
|
|
n += mHead->SizeOfIncludingThis(aMallocSizeOf);
|
|
return n;
|
|
}
|
|
|
|
// --- nsCSSRect -----------------
|
|
|
|
nsCSSRect::nsCSSRect(void)
|
|
{
|
|
MOZ_COUNT_CTOR(nsCSSRect);
|
|
}
|
|
|
|
nsCSSRect::nsCSSRect(const nsCSSRect& aCopy)
|
|
: mTop(aCopy.mTop),
|
|
mRight(aCopy.mRight),
|
|
mBottom(aCopy.mBottom),
|
|
mLeft(aCopy.mLeft)
|
|
{
|
|
MOZ_COUNT_CTOR(nsCSSRect);
|
|
}
|
|
|
|
nsCSSRect::~nsCSSRect()
|
|
{
|
|
MOZ_COUNT_DTOR(nsCSSRect);
|
|
}
|
|
|
|
void
|
|
nsCSSRect::AppendToString(nsCSSProperty aProperty, nsAString& aResult,
|
|
nsCSSValue::Serialization aSerialization) const
|
|
{
|
|
MOZ_ASSERT(mTop.GetUnit() != eCSSUnit_Null &&
|
|
mTop.GetUnit() != eCSSUnit_Inherit &&
|
|
mTop.GetUnit() != eCSSUnit_Initial &&
|
|
mTop.GetUnit() != eCSSUnit_Unset,
|
|
"parser should have used a bare value");
|
|
|
|
if (eCSSProperty_border_image_slice == aProperty ||
|
|
eCSSProperty_border_image_width == aProperty ||
|
|
eCSSProperty_border_image_outset == aProperty) {
|
|
NS_NAMED_LITERAL_STRING(space, " ");
|
|
|
|
mTop.AppendToString(aProperty, aResult, aSerialization);
|
|
aResult.Append(space);
|
|
mRight.AppendToString(aProperty, aResult, aSerialization);
|
|
aResult.Append(space);
|
|
mBottom.AppendToString(aProperty, aResult, aSerialization);
|
|
aResult.Append(space);
|
|
mLeft.AppendToString(aProperty, aResult, aSerialization);
|
|
} else {
|
|
NS_NAMED_LITERAL_STRING(comma, ", ");
|
|
|
|
aResult.AppendLiteral("rect(");
|
|
mTop.AppendToString(aProperty, aResult, aSerialization);
|
|
aResult.Append(comma);
|
|
mRight.AppendToString(aProperty, aResult, aSerialization);
|
|
aResult.Append(comma);
|
|
mBottom.AppendToString(aProperty, aResult, aSerialization);
|
|
aResult.Append(comma);
|
|
mLeft.AppendToString(aProperty, aResult, aSerialization);
|
|
aResult.Append(char16_t(')'));
|
|
}
|
|
}
|
|
|
|
void nsCSSRect::SetAllSidesTo(const nsCSSValue& aValue)
|
|
{
|
|
mTop = aValue;
|
|
mRight = aValue;
|
|
mBottom = aValue;
|
|
mLeft = aValue;
|
|
}
|
|
|
|
size_t
|
|
nsCSSRect_heap::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
|
{
|
|
size_t n = aMallocSizeOf(this);
|
|
n += mTop .SizeOfExcludingThis(aMallocSizeOf);
|
|
n += mRight .SizeOfExcludingThis(aMallocSizeOf);
|
|
n += mBottom.SizeOfExcludingThis(aMallocSizeOf);
|
|
n += mLeft .SizeOfExcludingThis(aMallocSizeOf);
|
|
return n;
|
|
}
|
|
|
|
static_assert(NS_SIDE_TOP == 0 && NS_SIDE_RIGHT == 1 &&
|
|
NS_SIDE_BOTTOM == 2 && NS_SIDE_LEFT == 3,
|
|
"box side constants not top/right/bottom/left == 0/1/2/3");
|
|
|
|
/* static */ const nsCSSRect::side_type nsCSSRect::sides[4] = {
|
|
&nsCSSRect::mTop,
|
|
&nsCSSRect::mRight,
|
|
&nsCSSRect::mBottom,
|
|
&nsCSSRect::mLeft,
|
|
};
|
|
|
|
// --- nsCSSValuePair -----------------
|
|
|
|
void
|
|
nsCSSValuePair::AppendToString(nsCSSProperty aProperty,
|
|
nsAString& aResult,
|
|
nsCSSValue::Serialization aSerialization) const
|
|
{
|
|
mXValue.AppendToString(aProperty, aResult, aSerialization);
|
|
if (mYValue.GetUnit() != eCSSUnit_Null) {
|
|
aResult.Append(char16_t(' '));
|
|
mYValue.AppendToString(aProperty, aResult, aSerialization);
|
|
}
|
|
}
|
|
|
|
size_t
|
|
nsCSSValuePair::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
|
{
|
|
size_t n = 0;
|
|
n += mXValue.SizeOfExcludingThis(aMallocSizeOf);
|
|
n += mYValue.SizeOfExcludingThis(aMallocSizeOf);
|
|
return n;
|
|
}
|
|
|
|
size_t
|
|
nsCSSValuePair_heap::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
|
{
|
|
size_t n = aMallocSizeOf(this);
|
|
n += mXValue.SizeOfExcludingThis(aMallocSizeOf);
|
|
n += mYValue.SizeOfExcludingThis(aMallocSizeOf);
|
|
return n;
|
|
}
|
|
|
|
// --- nsCSSValueTriplet -----------------
|
|
|
|
void
|
|
nsCSSValueTriplet::AppendToString(nsCSSProperty aProperty,
|
|
nsAString& aResult,
|
|
nsCSSValue::Serialization aSerialization) const
|
|
{
|
|
mXValue.AppendToString(aProperty, aResult, aSerialization);
|
|
if (mYValue.GetUnit() != eCSSUnit_Null) {
|
|
aResult.Append(char16_t(' '));
|
|
mYValue.AppendToString(aProperty, aResult, aSerialization);
|
|
if (mZValue.GetUnit() != eCSSUnit_Null) {
|
|
aResult.Append(char16_t(' '));
|
|
mZValue.AppendToString(aProperty, aResult, aSerialization);
|
|
}
|
|
}
|
|
}
|
|
|
|
size_t
|
|
nsCSSValueTriplet_heap::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
|
{
|
|
size_t n = aMallocSizeOf(this);
|
|
n += mXValue.SizeOfExcludingThis(aMallocSizeOf);
|
|
n += mYValue.SizeOfExcludingThis(aMallocSizeOf);
|
|
n += mZValue.SizeOfExcludingThis(aMallocSizeOf);
|
|
return n;
|
|
}
|
|
|
|
// --- nsCSSValuePairList -----------------
|
|
|
|
nsCSSValuePairList::~nsCSSValuePairList()
|
|
{
|
|
MOZ_COUNT_DTOR(nsCSSValuePairList);
|
|
NS_CSS_DELETE_LIST_MEMBER(nsCSSValuePairList, this, mNext);
|
|
}
|
|
|
|
nsCSSValuePairList*
|
|
nsCSSValuePairList::Clone() const
|
|
{
|
|
nsCSSValuePairList* result = new nsCSSValuePairList(*this);
|
|
nsCSSValuePairList* dest = result;
|
|
const nsCSSValuePairList* src = this->mNext;
|
|
while (src) {
|
|
dest->mNext = new nsCSSValuePairList(*src);
|
|
dest = dest->mNext;
|
|
src = src->mNext;
|
|
}
|
|
|
|
MOZ_ASSERT(result, "shouldn't return null; supposed to be infallible");
|
|
return result;
|
|
}
|
|
|
|
void
|
|
nsCSSValuePairList::AppendToString(nsCSSProperty aProperty,
|
|
nsAString& aResult,
|
|
nsCSSValue::Serialization aSerialization) const
|
|
{
|
|
const nsCSSValuePairList* item = this;
|
|
for (;;) {
|
|
MOZ_ASSERT(item->mXValue.GetUnit() != eCSSUnit_Null,
|
|
"unexpected null unit");
|
|
item->mXValue.AppendToString(aProperty, aResult, aSerialization);
|
|
if (item->mXValue.GetUnit() != eCSSUnit_Inherit &&
|
|
item->mXValue.GetUnit() != eCSSUnit_Initial &&
|
|
item->mXValue.GetUnit() != eCSSUnit_Unset &&
|
|
item->mYValue.GetUnit() != eCSSUnit_Null) {
|
|
aResult.Append(char16_t(' '));
|
|
item->mYValue.AppendToString(aProperty, aResult, aSerialization);
|
|
}
|
|
item = item->mNext;
|
|
if (!item)
|
|
break;
|
|
|
|
if (nsCSSProps::PropHasFlags(aProperty,
|
|
CSS_PROPERTY_VALUE_LIST_USES_COMMAS) ||
|
|
aProperty == eCSSProperty_clip_path)
|
|
aResult.Append(char16_t(','));
|
|
aResult.Append(char16_t(' '));
|
|
}
|
|
}
|
|
|
|
/* static */ bool
|
|
nsCSSValuePairList::Equal(const nsCSSValuePairList* aList1,
|
|
const nsCSSValuePairList* aList2)
|
|
{
|
|
if (aList1 == aList2) {
|
|
return true;
|
|
}
|
|
|
|
const nsCSSValuePairList *p1 = aList1, *p2 = aList2;
|
|
for ( ; p1 && p2; p1 = p1->mNext, p2 = p2->mNext) {
|
|
if (p1->mXValue != p2->mXValue ||
|
|
p1->mYValue != p2->mYValue)
|
|
return false;
|
|
}
|
|
return !p1 && !p2; // true if same length, false otherwise
|
|
}
|
|
|
|
size_t
|
|
nsCSSValuePairList::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
|
{
|
|
size_t n = 0;
|
|
const nsCSSValuePairList* v = this;
|
|
while (v) {
|
|
n += aMallocSizeOf(v);
|
|
n += v->mXValue.SizeOfExcludingThis(aMallocSizeOf);
|
|
n += v->mYValue.SizeOfExcludingThis(aMallocSizeOf);
|
|
v = v->mNext;
|
|
}
|
|
return n;
|
|
}
|
|
|
|
size_t
|
|
nsCSSValuePairList_heap::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
|
{
|
|
size_t n = aMallocSizeOf(this);
|
|
n += mXValue.SizeOfExcludingThis(aMallocSizeOf);
|
|
n += mYValue.SizeOfExcludingThis(aMallocSizeOf);
|
|
n += mNext ? mNext->SizeOfIncludingThis(aMallocSizeOf) : 0;
|
|
return n;
|
|
}
|
|
|
|
size_t
|
|
nsCSSValue::Array::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
|
{
|
|
size_t n = aMallocSizeOf(this);
|
|
for (size_t i = 0; i < mCount; i++) {
|
|
n += mArray[i].SizeOfExcludingThis(aMallocSizeOf);
|
|
}
|
|
return n;
|
|
}
|
|
|
|
css::URLValue::URLValue(nsIURI* aURI, nsStringBuffer* aString,
|
|
nsIURI* aReferrer, nsIPrincipal* aOriginPrincipal)
|
|
: mURI(aURI),
|
|
mString(aString),
|
|
mReferrer(aReferrer),
|
|
mOriginPrincipal(aOriginPrincipal),
|
|
mURIResolved(true)
|
|
{
|
|
MOZ_ASSERT(aOriginPrincipal, "Must have an origin principal");
|
|
}
|
|
|
|
css::URLValue::URLValue(nsStringBuffer* aString, nsIURI* aBaseURI,
|
|
nsIURI* aReferrer, nsIPrincipal* aOriginPrincipal)
|
|
: mURI(aBaseURI),
|
|
mString(aString),
|
|
mReferrer(aReferrer),
|
|
mOriginPrincipal(aOriginPrincipal),
|
|
mURIResolved(false)
|
|
{
|
|
MOZ_ASSERT(aOriginPrincipal, "Must have an origin principal");
|
|
}
|
|
|
|
bool
|
|
css::URLValue::operator==(const URLValue& aOther) const
|
|
{
|
|
bool eq;
|
|
return NS_strcmp(nsCSSValue::GetBufferValue(mString),
|
|
nsCSSValue::GetBufferValue(aOther.mString)) == 0 &&
|
|
(GetURI() == aOther.GetURI() || // handles null == null
|
|
(mURI && aOther.mURI &&
|
|
NS_SUCCEEDED(mURI->Equals(aOther.mURI, &eq)) &&
|
|
eq)) &&
|
|
(mOriginPrincipal == aOther.mOriginPrincipal ||
|
|
(NS_SUCCEEDED(mOriginPrincipal->Equals(aOther.mOriginPrincipal,
|
|
&eq)) && eq));
|
|
}
|
|
|
|
bool
|
|
css::URLValue::URIEquals(const URLValue& aOther) const
|
|
{
|
|
MOZ_ASSERT(mURIResolved && aOther.mURIResolved,
|
|
"How do you know the URIs aren't null?");
|
|
bool eq;
|
|
// Worth comparing GetURI() to aOther.GetURI() and mOriginPrincipal to
|
|
// aOther.mOriginPrincipal, because in the (probably common) case when this
|
|
// value was one of the ones that in fact did not change this will be our
|
|
// fast path to equality
|
|
return (mURI == aOther.mURI ||
|
|
(NS_SUCCEEDED(mURI->Equals(aOther.mURI, &eq)) && eq)) &&
|
|
(mOriginPrincipal == aOther.mOriginPrincipal ||
|
|
(NS_SUCCEEDED(mOriginPrincipal->Equals(aOther.mOriginPrincipal,
|
|
&eq)) && eq));
|
|
}
|
|
|
|
nsIURI*
|
|
css::URLValue::GetURI() const
|
|
{
|
|
if (!mURIResolved) {
|
|
mURIResolved = true;
|
|
// Be careful to not null out mURI before we've passed it as the base URI
|
|
nsCOMPtr<nsIURI> newURI;
|
|
NS_NewURI(getter_AddRefs(newURI),
|
|
NS_ConvertUTF16toUTF8(nsCSSValue::GetBufferValue(mString)),
|
|
nullptr, mURI);
|
|
newURI.swap(mURI);
|
|
}
|
|
|
|
return mURI;
|
|
}
|
|
|
|
size_t
|
|
css::URLValue::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
|
{
|
|
size_t n = aMallocSizeOf(this);
|
|
|
|
n += mString->SizeOfIncludingThisIfUnshared(aMallocSizeOf);
|
|
|
|
// Measurement of the following members may be added later if DMD finds it is
|
|
// worthwhile:
|
|
// - mURI
|
|
// - mReferrer
|
|
// - mOriginPrincipal
|
|
|
|
return n;
|
|
}
|
|
|
|
|
|
css::ImageValue::ImageValue(nsIURI* aURI, nsStringBuffer* aString,
|
|
nsIURI* aReferrer, nsIPrincipal* aOriginPrincipal,
|
|
nsIDocument* aDocument)
|
|
: URLValue(aURI, aString, aReferrer, aOriginPrincipal)
|
|
{
|
|
// NB: If aDocument is not the original document, we may not be able to load
|
|
// images from aDocument. Instead we do the image load from the original doc
|
|
// and clone it to aDocument.
|
|
nsIDocument* loadingDoc = aDocument->GetOriginalDocument();
|
|
if (!loadingDoc) {
|
|
loadingDoc = aDocument;
|
|
}
|
|
|
|
loadingDoc->StyleImageLoader()->LoadImage(aURI, aOriginPrincipal, aReferrer,
|
|
this);
|
|
|
|
if (loadingDoc != aDocument) {
|
|
aDocument->StyleImageLoader()->MaybeRegisterCSSImage(this);
|
|
}
|
|
}
|
|
|
|
css::ImageValue::~ImageValue()
|
|
{
|
|
for (auto iter = mRequests.Iter(); !iter.Done(); iter.Next()) {
|
|
nsIDocument* doc = iter.Key();
|
|
RefPtr<imgRequestProxy>& proxy = iter.Data();
|
|
|
|
if (doc) {
|
|
doc->StyleImageLoader()->DeregisterCSSImage(this);
|
|
}
|
|
|
|
if (proxy) {
|
|
proxy->CancelAndForgetObserver(NS_BINDING_ABORTED);
|
|
}
|
|
|
|
iter.Remove();
|
|
}
|
|
}
|
|
|
|
NS_IMPL_ADDREF(css::ImageValue)
|
|
NS_IMPL_RELEASE(css::ImageValue)
|
|
|
|
nsCSSValueGradientStop::nsCSSValueGradientStop()
|
|
: mLocation(eCSSUnit_None),
|
|
mColor(eCSSUnit_Null),
|
|
mIsInterpolationHint(false)
|
|
{
|
|
MOZ_COUNT_CTOR(nsCSSValueGradientStop);
|
|
}
|
|
|
|
nsCSSValueGradientStop::nsCSSValueGradientStop(const nsCSSValueGradientStop& aOther)
|
|
: mLocation(aOther.mLocation),
|
|
mColor(aOther.mColor),
|
|
mIsInterpolationHint(aOther.mIsInterpolationHint)
|
|
{
|
|
MOZ_COUNT_CTOR(nsCSSValueGradientStop);
|
|
}
|
|
|
|
nsCSSValueGradientStop::~nsCSSValueGradientStop()
|
|
{
|
|
MOZ_COUNT_DTOR(nsCSSValueGradientStop);
|
|
}
|
|
|
|
size_t
|
|
nsCSSValueGradientStop::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
|
{
|
|
size_t n = 0;
|
|
n += mLocation.SizeOfExcludingThis(aMallocSizeOf);
|
|
n += mColor .SizeOfExcludingThis(aMallocSizeOf);
|
|
return n;
|
|
}
|
|
|
|
nsCSSValueGradient::nsCSSValueGradient(bool aIsRadial,
|
|
bool aIsRepeating)
|
|
: mIsRadial(aIsRadial),
|
|
mIsRepeating(aIsRepeating),
|
|
mIsLegacySyntax(false),
|
|
mIsExplicitSize(false),
|
|
mBgPos(eCSSUnit_None),
|
|
mAngle(eCSSUnit_None)
|
|
{
|
|
mRadialValues[0].SetNoneValue();
|
|
mRadialValues[1].SetNoneValue();
|
|
}
|
|
|
|
size_t
|
|
nsCSSValueGradient::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
|
{
|
|
size_t n = aMallocSizeOf(this);
|
|
n += mBgPos.SizeOfExcludingThis(aMallocSizeOf);
|
|
n += mAngle.SizeOfExcludingThis(aMallocSizeOf);
|
|
n += mRadialValues[0].SizeOfExcludingThis(aMallocSizeOf);
|
|
n += mRadialValues[1].SizeOfExcludingThis(aMallocSizeOf);
|
|
n += mStops.ShallowSizeOfExcludingThis(aMallocSizeOf);
|
|
for (uint32_t i = 0; i < mStops.Length(); i++) {
|
|
n += mStops[i].SizeOfExcludingThis(aMallocSizeOf);
|
|
}
|
|
return n;
|
|
}
|
|
|
|
// --- nsCSSValueTokenStream ------------
|
|
|
|
nsCSSValueTokenStream::nsCSSValueTokenStream()
|
|
: mPropertyID(eCSSProperty_UNKNOWN)
|
|
, mShorthandPropertyID(eCSSProperty_UNKNOWN)
|
|
, mLevel(SheetType::Count)
|
|
{
|
|
MOZ_COUNT_CTOR(nsCSSValueTokenStream);
|
|
}
|
|
|
|
nsCSSValueTokenStream::~nsCSSValueTokenStream()
|
|
{
|
|
MOZ_COUNT_DTOR(nsCSSValueTokenStream);
|
|
}
|
|
|
|
size_t
|
|
nsCSSValueTokenStream::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
|
{
|
|
size_t n = aMallocSizeOf(this);
|
|
n += mTokenStream.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
|
|
return n;
|
|
}
|
|
|
|
// --- nsCSSValueFloatColor -------------
|
|
|
|
bool
|
|
nsCSSValueFloatColor::operator==(nsCSSValueFloatColor& aOther) const
|
|
{
|
|
return mComponent1 == aOther.mComponent1 &&
|
|
mComponent2 == aOther.mComponent2 &&
|
|
mComponent3 == aOther.mComponent3 &&
|
|
mAlpha == aOther.mAlpha;
|
|
}
|
|
|
|
nscolor
|
|
nsCSSValueFloatColor::GetColorValue(nsCSSUnit aUnit) const
|
|
{
|
|
MOZ_ASSERT(nsCSSValue::IsFloatColorUnit(aUnit), "unexpected unit");
|
|
|
|
if (aUnit == eCSSUnit_PercentageRGBColor ||
|
|
aUnit == eCSSUnit_PercentageRGBAColor) {
|
|
return NS_RGBA(NSToIntRound(mComponent1 * 255.0f),
|
|
NSToIntRound(mComponent2 * 255.0f),
|
|
NSToIntRound(mComponent3 * 255.0f),
|
|
NSToIntRound(mAlpha * 255.0f));
|
|
}
|
|
|
|
// HSL color
|
|
MOZ_ASSERT(aUnit == eCSSUnit_HSLColor ||
|
|
aUnit == eCSSUnit_HSLAColor);
|
|
nscolor hsl = NS_HSL2RGB(mComponent1, mComponent2, mComponent3);
|
|
return NS_RGBA(NS_GET_R(hsl),
|
|
NS_GET_G(hsl),
|
|
NS_GET_B(hsl),
|
|
NSToIntRound(mAlpha * 255.0f));
|
|
}
|
|
|
|
bool
|
|
nsCSSValueFloatColor::IsNonTransparentColor() const
|
|
{
|
|
return mAlpha > 0.0f;
|
|
}
|
|
|
|
void
|
|
nsCSSValueFloatColor::AppendToString(nsCSSUnit aUnit, nsAString& aResult) const
|
|
{
|
|
MOZ_ASSERT(nsCSSValue::IsFloatColorUnit(aUnit), "unexpected unit");
|
|
|
|
bool hasAlpha = aUnit == eCSSUnit_PercentageRGBAColor ||
|
|
aUnit == eCSSUnit_HSLAColor;
|
|
bool isHSL = aUnit == eCSSUnit_HSLColor ||
|
|
aUnit == eCSSUnit_HSLAColor;
|
|
|
|
if (isHSL) {
|
|
aResult.AppendLiteral("hsl");
|
|
} else {
|
|
aResult.AppendLiteral("rgb");
|
|
}
|
|
if (hasAlpha) {
|
|
aResult.AppendLiteral("a(");
|
|
} else {
|
|
aResult.Append('(');
|
|
}
|
|
if (isHSL) {
|
|
aResult.AppendFloat(mComponent1 * 360.0f);
|
|
aResult.AppendLiteral(", ");
|
|
} else {
|
|
aResult.AppendFloat(mComponent1 * 100.0f);
|
|
aResult.AppendLiteral("%, ");
|
|
}
|
|
aResult.AppendFloat(mComponent2 * 100.0f);
|
|
aResult.AppendLiteral("%, ");
|
|
aResult.AppendFloat(mComponent3 * 100.0f);
|
|
if (hasAlpha) {
|
|
aResult.AppendLiteral("%, ");
|
|
aResult.AppendFloat(mAlpha);
|
|
aResult.Append(')');
|
|
} else {
|
|
aResult.AppendLiteral("%)");
|
|
}
|
|
}
|
|
|
|
size_t
|
|
nsCSSValueFloatColor::SizeOfIncludingThis(
|
|
mozilla::MallocSizeOf aMallocSizeOf) const
|
|
{
|
|
size_t n = aMallocSizeOf(this);
|
|
return n;
|
|
}
|
|
|
|
// --- nsCSSCornerSizes -----------------
|
|
|
|
nsCSSCornerSizes::nsCSSCornerSizes(void)
|
|
{
|
|
MOZ_COUNT_CTOR(nsCSSCornerSizes);
|
|
}
|
|
|
|
nsCSSCornerSizes::nsCSSCornerSizes(const nsCSSCornerSizes& aCopy)
|
|
: mTopLeft(aCopy.mTopLeft),
|
|
mTopRight(aCopy.mTopRight),
|
|
mBottomRight(aCopy.mBottomRight),
|
|
mBottomLeft(aCopy.mBottomLeft)
|
|
{
|
|
MOZ_COUNT_CTOR(nsCSSCornerSizes);
|
|
}
|
|
|
|
nsCSSCornerSizes::~nsCSSCornerSizes()
|
|
{
|
|
MOZ_COUNT_DTOR(nsCSSCornerSizes);
|
|
}
|
|
|
|
void
|
|
nsCSSCornerSizes::Reset()
|
|
{
|
|
NS_FOR_CSS_FULL_CORNERS(corner) {
|
|
this->GetCorner(corner).Reset();
|
|
}
|
|
}
|
|
|
|
static_assert(NS_CORNER_TOP_LEFT == 0 && NS_CORNER_TOP_RIGHT == 1 &&
|
|
NS_CORNER_BOTTOM_RIGHT == 2 && NS_CORNER_BOTTOM_LEFT == 3,
|
|
"box corner constants not tl/tr/br/bl == 0/1/2/3");
|
|
|
|
/* static */ const nsCSSCornerSizes::corner_type
|
|
nsCSSCornerSizes::corners[4] = {
|
|
&nsCSSCornerSizes::mTopLeft,
|
|
&nsCSSCornerSizes::mTopRight,
|
|
&nsCSSCornerSizes::mBottomRight,
|
|
&nsCSSCornerSizes::mBottomLeft,
|
|
};
|
|
|
|
size_t
|
|
mozilla::css::GridTemplateAreasValue::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
|
{
|
|
size_t n = mNamedAreas.ShallowSizeOfExcludingThis(aMallocSizeOf);
|
|
n += mTemplates.ShallowSizeOfExcludingThis(aMallocSizeOf);
|
|
return n;
|
|
}
|