Files
palemoon27/layout/style/nsDOMCSSValueList.cpp
T
roytam1 8a77b15be5 import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1230398 - [css-align] Don't output 'unsafe' in serialization because it's the default. r=dholbert (08d36e767d)
- Bug 1234707: Make nsDOMCSSValueList::AppendCSSValue() take an already_AddRefed arg (instead of a raw pointer, usually with refcount of 0). r=heycam (739fa75d70)
- Bug 1234676 part 1: Give nsComputedDOMStyle a private typedef for mozilla::dom::CSSValue. r=heycam (6371627bf3)
- Bug 1234676 part 2: Make nsComputedDOMStyle getters return an already_AddRefed value, instead of a raw pointer with refcount of 0. r=heycam (e196aa9692)
- Bug 1234676 part 3: Remove some now-unneeded local RefPtr variables. r=heycam (b780ed3246)
- Bug 1234676 part 4: Remove now-obsolete comment. r=heycam (2d982ed55b)
- Bug 1234676 part 5: Update indentation & rewrap some nsComputedDOMStyle function-decls. rs=heycam (0b02962fac)
- Bug 1233106 part 1 - [css-align] Update align-/justify-* properties to the current CSS Align spec (adding 'normal' keyword, dropping 'auto' in some cases etc). r=dholbert (8558089c51)
- Bug 1233106 part 2 - [css-align] Updated tests due to changes to align-/justify-* properties. (c407114303)
- Bug 1118820 - Follow-up: disable the grid-repeat-auto-fill-fit-006.html reftest for now since it triggers a leak: bug 1234644. r=me (8802927b37)
- Bug 1234644 - [css-grid] Avoid calling GetROCSSValueList() when we don't need the allocated object. r=dholbert (e8b4f7295a)
- Bug 1230172. Update CSS.escape to never throw and instead replace U+0000 with U+FFFD, per recent spec change. r=dbaron (c66008388e)
- Bug 1234659: Attempt to work around randomorange in test_bug332655-2.html by using an unthemed <input> widget. rs=jfkthame (84fa36d569)
- Bug 1234535 - Avoid spurious null dereference complaint from Coverity. r=froydnj (804bdb1189)
- Bug 1235737: Soften some MOZ_CRASH statements in flexbox layout code to MOZ_ASSERT_UNREACHABLE, which they were originally intended as anyway. r=mats (0a66b12c46)
- Bug 1229932 - check that offsets to canvas fillText() are finite. r=jmuizelaar (cfa2fd240e)
- Bug 1233613 - Add crashtest. r=mt (b49c56d5df)
- Bug 1229983 - verify that paths are finite in DrawTargetSkia::Stroke/Fill to handle Canvas paths containing infs. r=jmuizelaar (79f3b8f225)
- Bug 1233632 - Moz2Dify GetBlurAndSpreadRadius(). r=dholbert. (868800f95f)
- Bug 1194856 - Load noscript.css and noframes.css from data: URLs in release builds. r=dbaron (7c009bcac2)
- Bug 1234758 - Fix errors in preference style sheet focus ring rules. r=dholbert (501f4088cc)
- Bug 1234773 - Build and parse preference style sheet as a single string. r=dholbert (82b848cb6a)
- Bug 1234773 - Followup assertion. (aa916f246b)
2023-08-23 10:40:44 +08:00

131 lines
3.0 KiB
C++

/* 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/. */
/* DOM object representing lists of values in DOM computed style */
#include "nsDOMCSSValueList.h"
#include "mozilla/dom/CSSValueListBinding.h"
#include "mozilla/Move.h"
#include "nsAutoPtr.h"
using namespace mozilla;
nsDOMCSSValueList::nsDOMCSSValueList(bool aCommaDelimited, bool aReadonly)
: CSSValue(), mCommaDelimited(aCommaDelimited), mReadonly(aReadonly)
{
}
nsDOMCSSValueList::~nsDOMCSSValueList()
{
}
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMCSSValueList)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMCSSValueList)
// QueryInterface implementation for nsDOMCSSValueList
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMCSSValueList)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSValue)
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSValueList)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, CSSValue)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(nsDOMCSSValueList, mCSSValues)
JSObject*
nsDOMCSSValueList::WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto)
{
return dom::CSSValueListBinding::Wrap(cx, this, aGivenProto);
}
void
nsDOMCSSValueList::AppendCSSValue(already_AddRefed<CSSValue> aValue)
{
RefPtr<CSSValue> val = aValue;
mCSSValues.AppendElement(Move(val));
}
// nsIDOMCSSValue
NS_IMETHODIMP
nsDOMCSSValueList::GetCssText(nsAString& aCssText)
{
aCssText.Truncate();
uint32_t count = mCSSValues.Length();
nsAutoString separator;
if (mCommaDelimited) {
separator.AssignLiteral(", ");
}
else {
separator.Assign(char16_t(' '));
}
nsAutoString tmpStr;
for (uint32_t i = 0; i < count; ++i) {
CSSValue *cssValue = mCSSValues[i];
NS_ASSERTION(cssValue, "Eek! Someone filled the value list with null CSSValues!");
ErrorResult dummy;
if (cssValue) {
cssValue->GetCssText(tmpStr, dummy);
if (tmpStr.IsEmpty()) {
#ifdef DEBUG_caillon
NS_ERROR("Eek! An empty CSSValue! Bad!");
#endif
continue;
}
// If this isn't the first item in the list, then
// it's ok to append a separator.
if (!aCssText.IsEmpty()) {
aCssText.Append(separator);
}
aCssText.Append(tmpStr);
}
}
return NS_OK;
}
void
nsDOMCSSValueList::GetCssText(nsString& aText, ErrorResult& aRv)
{
aRv = GetCssText(aText);
}
NS_IMETHODIMP
nsDOMCSSValueList::SetCssText(const nsAString& aCssText)
{
if (mReadonly) {
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
NS_NOTYETIMPLEMENTED("Can't SetCssText yet: please write me!");
return NS_OK;
}
void
nsDOMCSSValueList::SetCssText(const nsAString& aText, ErrorResult& aRv)
{
aRv = SetCssText(aText);
}
NS_IMETHODIMP
nsDOMCSSValueList::GetCssValueType(uint16_t* aValueType)
{
NS_ENSURE_ARG_POINTER(aValueType);
*aValueType = nsIDOMCSSValue::CSS_VALUE_LIST;
return NS_OK;
}
uint16_t
nsDOMCSSValueList::CssValueType() const
{
return nsIDOMCSSValue::CSS_VALUE_LIST;
}