mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:30:27 +00:00
1d6a3196e2
- Bug 1121855 - Fix camera crash. r=aosmond (6ad4335ae)
- Bug 1139721 - Fix camera memory leaks for onfacedetected events, failed initializations and capabilities. r=mikeh (663bbde8c)
- Bug 1165729 - Check SetCapacity return value in nsSMILAnimationFunction::GetValues. r=dholbert (100ecf2f7)
- Bug 968520 - Add mozilla::fallible to Fallible{Auto,}TArray::SetCapacity calls. r=froydnj (2c120f71a)
- Scrollbar thumbs can overlap scrollbar arrows during APZ scrolling. (bug 1152469, r=botond,mstange) (a2e9ac1bf)
- Bug 1148889 - Treat subclasses of scrollframes as animated geometry roots. r=mstange (434719455)
- Bug 1155025. Make the root layer on fennec have null scroll id with containerless scrolling. r=mstange (eb1bb3acd)
- remove test (63f014d13)
- Bug 1151306 - Add a reftest. r=roc (56c4137ae)
- Bug 1151145 - Add a reftest. r=jrmuizel (9684c3f0a)
- Bug 1150021. Make sure that boxes inside vertical RTL boxes are placed on the right. r=roc (c4b3e7e06)
- Bug 1156129 - Take border radius into account when calculating the bounds of border display items. r=roc (35b70f9a8)
- Bug 1152902 part 2. Add a fast path for the case when a Promise is resolved with another Promise. r=nsm (33a210977)
72 lines
2.0 KiB
C++
72 lines
2.0 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "mozilla/ArrayUtils.h"
|
|
|
|
#include "SVGNumberList.h"
|
|
#include "nsCharSeparatedTokenizer.h"
|
|
#include "nsString.h"
|
|
#include "nsTextFormatter.h"
|
|
#include "SVGContentUtils.h"
|
|
|
|
namespace mozilla {
|
|
|
|
nsresult
|
|
SVGNumberList::CopyFrom(const SVGNumberList& rhs)
|
|
{
|
|
if (!mNumbers.SetCapacity(rhs.Length(), fallible)) {
|
|
// Yes, we do want fallible alloc here
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
}
|
|
mNumbers = rhs.mNumbers;
|
|
return NS_OK;
|
|
}
|
|
|
|
void
|
|
SVGNumberList::GetValueAsString(nsAString& aValue) const
|
|
{
|
|
aValue.Truncate();
|
|
char16_t buf[24];
|
|
uint32_t last = mNumbers.Length() - 1;
|
|
for (uint32_t i = 0; i < mNumbers.Length(); ++i) {
|
|
// Would like to use aValue.AppendPrintf("%f", mNumbers[i]), but it's not
|
|
// possible to always avoid trailing zeros.
|
|
nsTextFormatter::snprintf(buf, ArrayLength(buf),
|
|
MOZ_UTF16("%g"),
|
|
double(mNumbers[i]));
|
|
// We ignore OOM, since it's not useful for us to return an error.
|
|
aValue.Append(buf);
|
|
if (i != last) {
|
|
aValue.Append(' ');
|
|
}
|
|
}
|
|
}
|
|
|
|
nsresult
|
|
SVGNumberList::SetValueFromString(const nsAString& aValue)
|
|
{
|
|
SVGNumberList temp;
|
|
|
|
nsCharSeparatedTokenizerTemplate<IsSVGWhitespace>
|
|
tokenizer(aValue, ',', nsCharSeparatedTokenizer::SEPARATOR_OPTIONAL);
|
|
|
|
while (tokenizer.hasMoreTokens()) {
|
|
float num;
|
|
if (!SVGContentUtils::ParseNumber(tokenizer.nextToken(), num)) {
|
|
return NS_ERROR_DOM_SYNTAX_ERR;
|
|
}
|
|
if (!temp.AppendItem(num)) {
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
}
|
|
}
|
|
if (tokenizer.separatorAfterCurrentToken()) {
|
|
return NS_ERROR_DOM_SYNTAX_ERR; // trailing comma
|
|
}
|
|
return CopyFrom(temp);
|
|
}
|
|
|
|
} // namespace mozilla
|