#491: M1443891 M1444231 M1443092 M1448774 M1452416

This commit is contained in:
Cameron Kaiser 2018-04-11 22:02:03 -07:00
parent cf565fc150
commit 01881b1b07
9 changed files with 41 additions and 9 deletions

View File

@ -178,6 +178,12 @@ nsIContent::DoGetClasses() const
NS_IMETHODIMP
Element::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (aIID.Equals(NS_GET_IID(Element))) {
NS_ADDREF_THIS();
*aInstancePtr = this;
return NS_OK;
}
NS_ASSERTION(aInstancePtr,
"QueryInterface requires a non-NULL destination!");
nsresult rv = FragmentOrElement::QueryInterface(aIID, aInstancePtr);

View File

@ -1935,7 +1935,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_INTERFACE_MAP_BEGIN(FragmentOrElement)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(FragmentOrElement)
NS_INTERFACE_MAP_ENTRY(Element)
NS_INTERFACE_MAP_ENTRY(nsIContent)
NS_INTERFACE_MAP_ENTRY(nsINode)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)

View File

@ -1497,6 +1497,10 @@ MediaStreamGraphImpl::RunInStableState(bool aSourceIsMSG)
RefPtr<GraphDriver> driver = CurrentDriver();
MonitorAutoUnlock unlock(mMonitor);
driver->Start();
// It's not safe to Shutdown() a thread from StableState, and
// releasing this may shutdown a SystemClockDriver thread.
// Proxy the release to outside of StableState.
NS_ReleaseOnMainThread(driver.forget(), true); // always proxy
}
}

View File

@ -50,6 +50,13 @@ SVGClipPathElement::GetEnumInfo()
ArrayLength(sEnumInfo));
}
bool
SVGClipPathElement::IsUnitsObjectBoundingBox() const
{
return mEnumAttributes[CLIPPATHUNITS].GetAnimValue() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
}
//----------------------------------------------------------------------
// nsIDOMNode methods

View File

@ -36,6 +36,10 @@ public:
// WebIDL
already_AddRefed<SVGAnimatedEnumeration> ClipPathUnits();
// This is an internal method that does not flush style, and thus
// the answer may be out of date if there's a pending style flush.
bool IsUnitsObjectBoundingBox() const;
protected:
enum { CLIPPATHUNITS };

View File

@ -29,6 +29,7 @@ typedef SVGGraphicsElement SVGTextContentElementBase;
class SVGTextContentElement : public SVGTextContentElementBase
{
friend class ::SVGTextFrame;
public:
using FragmentOrElement::TextLength;

View File

@ -11,6 +11,7 @@
#include "nsIUnicodeDecoder.h"
#include "nsIUnicodeEncoder.h"
#include "mozilla/dom/EncodingUtils.h"
#include "mozilla/CheckedInt.h"
using mozilla::dom::EncodingUtils;
@ -39,8 +40,13 @@ nsScriptableUnicodeConverter::ConvertFromUnicodeWithLength(const nsAString& aSrc
const nsAFlatString& flatSrc = PromiseFlatString(aSrc);
rv = mEncoder->GetMaxLength(flatSrc.get(), inLength, aOutLen);
if (NS_SUCCEEDED(rv)) {
*_retval = (char*)malloc(*aOutLen+1);
if (!*_retval)
mozilla::CheckedInt<int32_t> needed(*aOutLen);
needed += 1;
if (MOZ_UNLIKELY(!needed.isValid())) {
return NS_ERROR_OUT_OF_MEMORY;
}
*_retval = (char*)malloc(needed.value());
if (MOZ_UNLIKELY(!*_retval))
return NS_ERROR_OUT_OF_MEMORY;
rv = mEncoder->Convert(flatSrc.get(), &inLength, *_retval, aOutLen);
@ -145,8 +151,14 @@ nsScriptableUnicodeConverter::ConvertFromByteArray(const uint8_t* aData,
inLength, &outLength);
if (NS_SUCCEEDED(rv))
{
char16_t* buf = (char16_t*)malloc((outLength+1) * sizeof(char16_t));
if (!buf)
mozilla::CheckedInt<nsACString::size_type> needed(outLength);
needed += 1;
needed *= sizeof(char16_t);
if (MOZ_UNLIKELY(!needed.isValid())) {
return NS_ERROR_OUT_OF_MEMORY;
}
char16_t* buf = (char16_t*)malloc(needed.value());
if (MOZ_UNLIKELY(!buf))
return NS_ERROR_OUT_OF_MEMORY;
rv = mDecoder->Convert(reinterpret_cast<const char*>(aData),

View File

@ -5202,8 +5202,8 @@ SVGTextFrame::DoGlyphPositioning()
float actualTextLength =
static_cast<float>(presContext->AppUnitsToGfxUnits(frameLength) * factor);
RefPtr<SVGAnimatedEnumeration> lengthAdjustEnum = element->LengthAdjust();
uint16_t lengthAdjust = lengthAdjustEnum->AnimVal();
uint16_t lengthAdjust =
element->EnumAttributes()[SVGTextContentElement::LENGTHADJUST].GetAnimValue();
switch (lengthAdjust) {
case SVG_LENGTHADJUST_SPACINGANDGLYPHS:
// Scale the glyphs and their positions.

View File

@ -1003,8 +1003,7 @@ nsSVGUtils::GetBBox(nsIFrame *aFrame, uint32_t aFlags)
if (clipPathFrame && isOK) {
SVGClipPathElement *clipContent =
static_cast<SVGClipPathElement*>(clipPathFrame->GetContent());
RefPtr<SVGAnimatedEnumeration> units = clipContent->ClipPathUnits();
if (units->AnimVal() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
if (clipContent->IsUnitsObjectBoundingBox()) {
matrix.Translate(gfxPoint(x, y));
matrix.Scale(width, height);
} else if (aFrame->GetType() == nsGkAtoms::svgForeignObjectFrame) {