Backed out 12 changesets (bug 1383650) for landing in the soft-freeze period

Backed out changeset 4316d55f87be (bug 1383650)
Backed out changeset 0118148f1534 (bug 1383650)
Backed out changeset 447c9248342b (bug 1383650)
Backed out changeset 6730776560c0 (bug 1383650)
Backed out changeset a7b8e6460fb8 (bug 1383650)
Backed out changeset e864696f6cf8 (bug 1383650)
Backed out changeset 2b003d678c58 (bug 1383650)
Backed out changeset 7bc3bff991c4 (bug 1383650)
Backed out changeset f1f7b4ad9547 (bug 1383650)
Backed out changeset 18b030b31660 (bug 1383650)
Backed out changeset 70e74dd6b45d (bug 1383650)
Backed out changeset 55a283e793df (bug 1383650)
This commit is contained in:
Coroiu Cristina 2019-05-16 04:47:58 +03:00
Родитель f62f4b6026
Коммит b4731ed54d
71 изменённых файлов: 354 добавлений и 1128 удалений

Просмотреть файл

@ -293,8 +293,6 @@ exports.ANIMATION_TYPE_FOR_LONGHANDS = [
"bottom",
"column-gap",
"column-width",
"cx",
"cy",
"flex-basis",
"height",
"left",
@ -317,9 +315,6 @@ exports.ANIMATION_TYPE_FOR_LONGHANDS = [
"padding-right",
"padding-top",
"perspective",
"r",
"rx",
"ry",
"right",
"row-gap",
"scroll-padding-block-start",
@ -347,8 +342,6 @@ exports.ANIMATION_TYPE_FOR_LONGHANDS = [
"vertical-align",
"width",
"word-spacing",
"x",
"y",
"z-index",
])],
["float", new Set([

Просмотреть файл

@ -3315,13 +3315,6 @@ exports.CSS_PROPERTIES = {
"mask-size",
"mask-composite",
"mask-image",
"x",
"y",
"cx",
"cy",
"rx",
"ry",
"r",
"-moz-box-align",
"-moz-box-direction",
"-moz-box-flex",
@ -5839,32 +5832,6 @@ exports.CSS_PROPERTIES = {
"zoom-out"
]
},
"cx": {
"isInherited": false,
"subproperties": [
"cx"
],
"supports": [],
"values": [
"inherit",
"initial",
"revert",
"unset"
]
},
"cy": {
"isInherited": false,
"subproperties": [
"cy"
],
"supports": [],
"values": [
"inherit",
"initial",
"revert",
"unset"
]
},
"direction": {
"isInherited": true,
"subproperties": [
@ -8948,19 +8915,6 @@ exports.CSS_PROPERTIES = {
"unset"
]
},
"r": {
"isInherited": false,
"subproperties": [
"r"
],
"supports": [],
"values": [
"inherit",
"initial",
"revert",
"unset"
]
},
"resize": {
"isInherited": false,
"subproperties": [
@ -9040,34 +8994,6 @@ exports.CSS_PROPERTIES = {
"unset"
]
},
"rx": {
"isInherited": false,
"subproperties": [
"rx"
],
"supports": [],
"values": [
"auto",
"inherit",
"initial",
"revert",
"unset"
]
},
"ry": {
"isInherited": false,
"subproperties": [
"ry"
],
"supports": [],
"values": [
"auto",
"inherit",
"initial",
"revert",
"unset"
]
},
"scroll-behavior": {
"isInherited": false,
"subproperties": [
@ -10518,32 +10444,6 @@ exports.CSS_PROPERTIES = {
"vertical-rl"
]
},
"x": {
"isInherited": false,
"subproperties": [
"x"
],
"supports": [],
"values": [
"inherit",
"initial",
"revert",
"unset"
]
},
"y": {
"isInherited": false,
"subproperties": [
"y"
],
"supports": [],
"values": [
"inherit",
"initial",
"revert",
"unset"
]
},
"z-index": {
"isInherited": false,
"subproperties": [
@ -10696,38 +10596,6 @@ exports.PREFERENCES = [
"-moz-binding",
"layout.css.moz-binding.content.enabled"
],
[
"scroll-margin-block-end",
"layout.css.scroll-snap-v1.enabled"
],
[
"scroll-margin-block-start",
"layout.css.scroll-snap-v1.enabled"
],
[
"scroll-margin-bottom",
"layout.css.scroll-snap-v1.enabled"
],
[
"scroll-margin-inline-end",
"layout.css.scroll-snap-v1.enabled"
],
[
"scroll-margin-inline-start",
"layout.css.scroll-snap-v1.enabled"
],
[
"scroll-margin-left",
"layout.css.scroll-snap-v1.enabled"
],
[
"scroll-margin-right",
"layout.css.scroll-snap-v1.enabled"
],
[
"scroll-margin-top",
"layout.css.scroll-snap-v1.enabled"
],
[
"scroll-padding-block-end",
"layout.css.scroll-snap-v1.enabled"
@ -10760,6 +10628,38 @@ exports.PREFERENCES = [
"scroll-padding-top",
"layout.css.scroll-snap-v1.enabled"
],
[
"scroll-margin-block-end",
"layout.css.scroll-snap-v1.enabled"
],
[
"scroll-margin-block-start",
"layout.css.scroll-snap-v1.enabled"
],
[
"scroll-margin-bottom",
"layout.css.scroll-snap-v1.enabled"
],
[
"scroll-margin-inline-end",
"layout.css.scroll-snap-v1.enabled"
],
[
"scroll-margin-inline-start",
"layout.css.scroll-snap-v1.enabled"
],
[
"scroll-margin-left",
"layout.css.scroll-snap-v1.enabled"
],
[
"scroll-margin-right",
"layout.css.scroll-snap-v1.enabled"
],
[
"scroll-margin-top",
"layout.css.scroll-snap-v1.enabled"
],
[
"-webkit-text-stroke-width",
"layout.css.prefixes.webkit"

Просмотреть файл

@ -6,7 +6,6 @@
#include "SMILCompositor.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "nsComputedDOMStyle.h"
#include "nsCSSProps.h"
#include "nsHashKeys.h"
@ -148,21 +147,19 @@ nsCSSPropertyID SMILCompositor::GetCSSPropertyToAnimate() const {
// If we are animating the 'width' or 'height' of an outer SVG
// element we should animate it as a CSS property, but for other elements
// in SVG namespace (e.g. <rect>) we should animate it as a length attribute.
// (e.g. <rect>) we should animate it as a length attribute.
// The easiest way to test for an outer SVG element, is to see if it is an
// SVG-namespace element mapping its width/height attribute to style.
//
// If we have animation of 'width' or 'height' on an SVG element that is
// NOT mapping that attributes to style then it must not be an outermost SVG
// element so we should return eCSSProperty_UNKNOWN to indicate that we
// should animate as an attribute instead.
if ((mKey.mAttributeName == nsGkAtoms::width ||
mKey.mAttributeName == nsGkAtoms::height) &&
mKey.mElement->GetNameSpaceID() == kNameSpaceID_SVG) {
// Not an <svg> element.
if (!mKey.mElement->IsSVGElement(nsGkAtoms::svg)) {
return eCSSProperty_UNKNOWN;
}
// An inner <svg> element
if (static_cast<dom::SVGSVGElement const&>(*mKey.mElement).IsInner()) {
return eCSSProperty_UNKNOWN;
}
// Indeed an outer <svg> element, fall through.
mKey.mElement->GetNameSpaceID() == kNameSpaceID_SVG &&
!mKey.mElement->IsAttributeMapped(mKey.mAttributeName)) {
return eCSSProperty_UNKNOWN;
}
return propID;

Просмотреть файл

@ -4,13 +4,11 @@
* 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 "ComputedStyle.h"
#include "mozilla/dom/SVGCircleElement.h"
#include "mozilla/gfx/2D.h"
#include "nsGkAtoms.h"
#include "mozilla/dom/SVGCircleElementBinding.h"
#include "mozilla/dom/SVGLengthBinding.h"
#include "SVGGeometryProperty.h"
NS_IMPL_NS_NEW_SVG_ELEMENT(Circle)
@ -39,13 +37,6 @@ SVGCircleElement::SVGCircleElement(
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
: SVGCircleElementBase(std::move(aNodeInfo)) {}
bool SVGCircleElement::IsAttributeMapped(const nsAtom* aAttribute) const {
return IsInLengthInfo(aAttribute, sLengthInfo) ||
SVGCircleElementBase::IsAttributeMapped(aAttribute);
}
namespace SVGT = SVGGeometryProperty::Tags;
//----------------------------------------------------------------------
// nsINode methods
@ -70,11 +61,8 @@ already_AddRefed<DOMSVGAnimatedLength> SVGCircleElement::R() {
/* virtual */
bool SVGCircleElement::HasValidDimensions() const {
float r;
MOZ_ASSERT(GetPrimaryFrame());
SVGGeometryProperty::ResolveAll<SVGT::R>(this, &r);
return r > 0;
return mLengthAttributes[ATTR_R].IsExplicitlySet() &&
mLengthAttributes[ATTR_R].GetAnimValInSpecifiedUnits() > 0;
}
SVGElement::LengthAttributesInfo SVGCircleElement::GetLengthInfo() {
@ -89,10 +77,7 @@ bool SVGCircleElement::GetGeometryBounds(
Rect* aBounds, const StrokeOptions& aStrokeOptions,
const Matrix& aToBoundsSpace, const Matrix* aToNonScalingStrokeSpace) {
float x, y, r;
MOZ_ASSERT(GetPrimaryFrame());
SVGGeometryProperty::ResolveAll<SVGT::Cx, SVGT::Cy, SVGT::R>(this, &x, &y,
&r);
GetAnimatedLengthValues(&x, &y, &r, nullptr);
if (r <= 0.f) {
// Rendering of the element is disabled
@ -127,9 +112,7 @@ bool SVGCircleElement::GetGeometryBounds(
already_AddRefed<Path> SVGCircleElement::BuildPath(PathBuilder* aBuilder) {
float x, y, r;
MOZ_ASSERT(GetPrimaryFrame());
SVGGeometryProperty::ResolveAll<SVGT::Cx, SVGT::Cy, SVGT::R>(this, &x, &y,
&r);
GetAnimatedLengthValues(&x, &y, &r, nullptr);
if (r <= 0.0f) {
return nullptr;
@ -140,30 +123,5 @@ already_AddRefed<Path> SVGCircleElement::BuildPath(PathBuilder* aBuilder) {
return aBuilder->Finish();
}
bool SVGCircleElement::IsLengthChangedViaCSS(const ComputedStyle& aNewStyle,
const ComputedStyle& aOldStyle) {
auto *newSVGReset = aNewStyle.StyleSVGReset(),
*oldSVGReset = aOldStyle.StyleSVGReset();
return newSVGReset->mCx != oldSVGReset->mCx ||
newSVGReset->mCy != oldSVGReset->mCy ||
newSVGReset->mR != oldSVGReset->mR;
}
nsCSSPropertyID SVGCircleElement::GetCSSPropertyIdForAttrEnum(
uint8_t aAttrEnum) {
switch (aAttrEnum) {
case ATTR_CX:
return eCSSProperty_cx;
case ATTR_CY:
return eCSSProperty_cy;
case ATTR_R:
return eCSSProperty_r;
default:
MOZ_ASSERT_UNREACHABLE("Unknown attr enum");
return eCSSProperty_UNKNOWN;
}
}
} // namespace dom
} // namespace mozilla

Просмотреть файл

@ -7,7 +7,6 @@
#ifndef mozilla_dom_SVGCircleElement_h
#define mozilla_dom_SVGCircleElement_h
#include "nsCSSPropertyID.h"
#include "SVGGeometryElement.h"
#include "SVGAnimatedLength.h"
@ -15,8 +14,6 @@ nsresult NS_NewSVGCircleElement(
nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
namespace mozilla {
class ComputedStyle;
namespace dom {
typedef SVGGeometryElement SVGCircleElementBase;
@ -32,8 +29,6 @@ class SVGCircleElement final : public SVGCircleElementBase {
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
public:
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
// nsSVGSVGElement methods:
virtual bool HasValidDimensions() const override;
@ -46,10 +41,6 @@ class SVGCircleElement final : public SVGCircleElementBase {
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
static bool IsLengthChangedViaCSS(const ComputedStyle& aNewStyle,
const ComputedStyle& aOldStyle);
static nsCSSPropertyID GetCSSPropertyIdForAttrEnum(uint8_t aAttrEnum);
// WebIDL
already_AddRefed<DOMSVGAnimatedLength> Cx();
already_AddRefed<DOMSVGAnimatedLength> Cy();

Просмотреть файл

@ -30,7 +30,6 @@
#include "nsAttrValueOrString.h"
#include "nsCSSProps.h"
#include "nsContentUtils.h"
#include "nsDOMCSSAttrDeclaration.h"
#include "nsICSSDeclaration.h"
#include "nsIContentInlines.h"
#include "mozilla/dom/Document.h"
@ -54,7 +53,6 @@
#include "SVGAnimatedOrient.h"
#include "SVGAnimatedString.h"
#include "SVGAnimatedViewBox.h"
#include "SVGGeometryProperty.h"
#include "SVGMotionSMILAttr.h"
#include <stdarg.h>
@ -1022,41 +1020,6 @@ already_AddRefed<DOMSVGAnimatedString> SVGElement::ClassName() {
return mClassAttribute.ToDOMAnimatedString(this);
}
/* static */
bool SVGElement::UpdateDeclarationBlockFromLength(
DeclarationBlock& aBlock, nsCSSPropertyID aPropId,
const SVGAnimatedLength& aLength, ValToUse aValToUse) {
aBlock.AssertMutable();
float value;
if (aValToUse == ValToUse::Anim) {
value = aLength.GetAnimValInSpecifiedUnits();
} else {
MOZ_ASSERT(aValToUse == ValToUse::Base);
value = aLength.GetBaseValInSpecifiedUnits();
}
// SVG parser doesn't check non-negativity of some parsed value,
// we should not pass those to CSS side.
if (value < 0 &&
SVGGeometryProperty::IsNonNegativeGeometryProperty(aPropId)) {
return false;
}
nsCSSUnit cssUnit = SVGGeometryProperty::SpecifiedUnitTypeToCSSUnit(
aLength.GetSpecifiedUnitType());
if (cssUnit == eCSSUnit_Percent) {
Servo_DeclarationBlock_SetPercentValue(aBlock.Raw(), aPropId,
value / 100.f);
} else {
Servo_DeclarationBlock_SetLengthValue(aBlock.Raw(), aPropId, value,
cssUnit);
}
return true;
}
//------------------------------------------------------------------------
// Helper class: MappedAttrParser, for parsing values of mapped attributes
@ -1072,9 +1035,6 @@ class MOZ_STACK_CLASS MappedAttrParser {
void ParseMappedAttrValue(nsAtom* aMappedAttrName,
const nsAString& aMappedAttrValue);
void TellStyleAlreadyParsedResult(nsAtom const* aAtom,
SVGAnimatedLength const& aLength);
// If we've parsed any values for mapped attributes, this method returns the
// already_AddRefed css::Declaration that incorporates the parsed
// values. Otherwise, this method returns null.
@ -1162,18 +1122,6 @@ void MappedAttrParser::ParseMappedAttrValue(nsAtom* aMappedAttrName,
}
}
void MappedAttrParser::TellStyleAlreadyParsedResult(
nsAtom const* aAtom, SVGAnimatedLength const& aLength) {
if (!mDecl) {
mDecl = new DeclarationBlock();
}
nsCSSPropertyID propertyID =
nsCSSProps::LookupProperty(nsDependentAtomString(aAtom));
SVGElement::UpdateDeclarationBlockFromLength(*mDecl, propertyID, aLength,
SVGElement::ValToUse::Base);
}
already_AddRefed<DeclarationBlock> MappedAttrParser::GetDeclarationBlock() {
return mDecl.forget();
}
@ -1197,9 +1145,6 @@ void SVGElement::UpdateContentDeclarationBlock() {
MappedAttrParser mappedAttrParser(doc->CSSLoader(), doc->GetDocumentURI(),
GetBaseURI(), this);
bool lengthAffectsStyle =
SVGGeometryProperty::ElementMapsLengthsToStyle(this);
for (uint32_t i = 0; i < attrCount; ++i) {
const nsAttrName* attrName = mAttrs.AttrNameAt(i);
if (!attrName->IsAtom() || !IsAttributeMapped(attrName->Atom())) continue;
@ -1232,20 +1177,6 @@ void SVGElement::UpdateContentDeclarationBlock() {
}
}
if (lengthAffectsStyle) {
auto const* length = GetAnimatedLength(attrName->Atom());
if (length && length->HasBaseVal()) {
// This is an element with geometry property set via SVG attribute,
// and the attribute is already successfully parsed. We want to go
// through the optimized path to tell the style system the result
// directly, rather than let it parse the same thing again.
mappedAttrParser.TellStyleAlreadyParsedResult(attrName->Atom(),
*length);
continue;
}
}
nsAutoString value;
mAttrs.AttrAt(i)->ToString(value);
mappedAttrParser.ParseMappedAttrValue(attrName->Atom(), value);
@ -1460,15 +1391,6 @@ void SVGElement::DidChangeLength(uint8_t aAttrEnum,
}
void SVGElement::DidAnimateLength(uint8_t aAttrEnum) {
if (SVGGeometryProperty::ElementMapsLengthsToStyle(this)) {
nsCSSPropertyID propId =
SVGGeometryProperty::AttrEnumToCSSPropId(this, aAttrEnum);
SMILOverrideStyle()->SetSMILValue(propId,
GetLengthInfo().mLengths[aAttrEnum]);
return;
}
ClearAnyCachedPath();
nsIFrame* frame = GetPrimaryFrame();
@ -1489,6 +1411,7 @@ SVGAnimatedLength* SVGElement::GetAnimatedLength(const nsAtom* aAttrName) {
return &lengthInfo.mLengths[i];
}
}
MOZ_ASSERT(false, "no matching length found");
return nullptr;
}

Просмотреть файл

@ -165,12 +165,6 @@ class SVGElement : public SVGElementBase // nsIContent
virtual bool HasValidDimensions() const { return true; }
void SetLength(nsAtom* aName, const SVGAnimatedLength& aLength);
enum class ValToUse { Base, Anim };
static bool UpdateDeclarationBlockFromLength(DeclarationBlock& aBlock,
nsCSSPropertyID aPropId,
const SVGAnimatedLength& aLength,
ValToUse aValToUse);
nsAttrValue WillChangeLength(uint8_t aAttrEnum);
nsAttrValue WillChangeNumberPair(uint8_t aAttrEnum);
nsAttrValue WillChangeIntegerPair(uint8_t aAttrEnum);

Просмотреть файл

@ -4,14 +4,12 @@
* 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 "ComputedStyle.h"
#include "mozilla/dom/SVGEllipseElement.h"
#include "mozilla/dom/SVGEllipseElementBinding.h"
#include "mozilla/dom/SVGLengthBinding.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/PathHelpers.h"
#include "mozilla/RefPtr.h"
#include "SVGGeometryProperty.h"
NS_IMPL_NS_NEW_SVG_ELEMENT(Ellipse)
@ -43,13 +41,6 @@ SVGEllipseElement::SVGEllipseElement(
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
: SVGEllipseElementBase(std::move(aNodeInfo)) {}
bool SVGEllipseElement::IsAttributeMapped(const nsAtom* aAttribute) const {
return IsInLengthInfo(aAttribute, sLengthInfo) ||
SVGEllipseElementBase::IsAttributeMapped(aAttribute);
}
namespace SVGT = SVGGeometryProperty::Tags;
//----------------------------------------------------------------------
// nsINode methods
@ -79,12 +70,10 @@ already_AddRefed<DOMSVGAnimatedLength> SVGEllipseElement::Ry() {
/* virtual */
bool SVGEllipseElement::HasValidDimensions() const {
float rx, ry;
MOZ_ASSERT(GetPrimaryFrame());
SVGGeometryProperty::ResolveAll<SVGT::Rx, SVGT::Ry>(this, &rx, &ry);
return rx > 0 && ry > 0;
return mLengthAttributes[RX].IsExplicitlySet() &&
mLengthAttributes[RX].GetAnimValInSpecifiedUnits() > 0 &&
mLengthAttributes[RY].IsExplicitlySet() &&
mLengthAttributes[RY].GetAnimValInSpecifiedUnits() > 0;
}
SVGElement::LengthAttributesInfo SVGEllipseElement::GetLengthInfo() {
@ -99,10 +88,7 @@ bool SVGEllipseElement::GetGeometryBounds(
Rect* aBounds, const StrokeOptions& aStrokeOptions,
const Matrix& aToBoundsSpace, const Matrix* aToNonScalingStrokeSpace) {
float x, y, rx, ry;
MOZ_ASSERT(GetPrimaryFrame());
SVGGeometryProperty::ResolveAll<SVGT::Cx, SVGT::Cy, SVGT::Rx, SVGT::Ry>(
this, &x, &y, &rx, &ry);
GetAnimatedLengthValues(&x, &y, &rx, &ry, nullptr);
if (rx <= 0.f || ry <= 0.f) {
// Rendering of the element is disabled
@ -138,10 +124,7 @@ bool SVGEllipseElement::GetGeometryBounds(
already_AddRefed<Path> SVGEllipseElement::BuildPath(PathBuilder* aBuilder) {
float x, y, rx, ry;
MOZ_ASSERT(GetPrimaryFrame());
SVGGeometryProperty::ResolveAll<SVGT::Cx, SVGT::Cy, SVGT::Rx, SVGT::Ry>(
this, &x, &y, &rx, &ry);
GetAnimatedLengthValues(&x, &y, &rx, &ry, nullptr);
if (rx <= 0.0f || ry <= 0.0f) {
return nullptr;
@ -152,33 +135,5 @@ already_AddRefed<Path> SVGEllipseElement::BuildPath(PathBuilder* aBuilder) {
return aBuilder->Finish();
}
bool SVGEllipseElement::IsLengthChangedViaCSS(const ComputedStyle& aNewStyle,
const ComputedStyle& aOldStyle) {
auto *newSVGReset = aNewStyle.StyleSVGReset(),
*oldSVGReset = aOldStyle.StyleSVGReset();
return newSVGReset->mCx != oldSVGReset->mCx ||
newSVGReset->mCy != oldSVGReset->mCy ||
newSVGReset->mRx != oldSVGReset->mRx ||
newSVGReset->mRy != oldSVGReset->mRy;
}
nsCSSPropertyID SVGEllipseElement::GetCSSPropertyIdForAttrEnum(
uint8_t aAttrEnum) {
switch (aAttrEnum) {
case CX:
return eCSSProperty_cx;
case CY:
return eCSSProperty_cy;
case RX:
return eCSSProperty_rx;
case RY:
return eCSSProperty_ry;
default:
MOZ_ASSERT_UNREACHABLE("Unknown attr enum");
return eCSSProperty_UNKNOWN;
}
}
} // namespace dom
} // namespace mozilla

Просмотреть файл

@ -7,7 +7,6 @@
#ifndef mozilla_dom_SVGEllipseElement_h
#define mozilla_dom_SVGEllipseElement_h
#include "nsCSSPropertyID.h"
#include "SVGAnimatedLength.h"
#include "SVGGeometryElement.h"
@ -15,8 +14,6 @@ nsresult NS_NewSVGEllipseElement(
nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
namespace mozilla {
class ComputedStyle;
namespace dom {
typedef SVGGeometryElement SVGEllipseElementBase;
@ -32,8 +29,6 @@ class SVGEllipseElement final : public SVGEllipseElementBase {
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
public:
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
// nsSVGSVGElement methods:
virtual bool HasValidDimensions() const override;
@ -46,10 +41,6 @@ class SVGEllipseElement final : public SVGEllipseElementBase {
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
static bool IsLengthChangedViaCSS(const ComputedStyle& aNewStyle,
const ComputedStyle& aOldStyle);
static nsCSSPropertyID GetCSSPropertyIdForAttrEnum(uint8_t aAttrEnum);
// WebIDL
already_AddRefed<DOMSVGAnimatedLength> Cx();
already_AddRefed<DOMSVGAnimatedLength> Cy();

Просмотреть файл

@ -11,7 +11,6 @@
#include "mozilla/dom/SVGDocument.h"
#include "mozilla/dom/SVGForeignObjectElementBinding.h"
#include "mozilla/dom/SVGLengthBinding.h"
#include "SVGGeometryProperty.h"
NS_IMPL_NS_NEW_SVG_ELEMENT(ForeignObject)
@ -41,8 +40,6 @@ SVGForeignObjectElement::SVGForeignObjectElement(
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
: SVGGraphicsElement(std::move(aNodeInfo)) {}
namespace SVGT = SVGGeometryProperty::Tags;
//----------------------------------------------------------------------
// nsINode methods
@ -80,16 +77,8 @@ gfxMatrix SVGForeignObjectElement::PrependLocalTransformsTo(
}
// our 'x' and 'y' attributes:
float x, y;
if (GetPrimaryFrame()) {
SVGGeometryProperty::ResolveAll<SVGT::X, SVGT::Y>(this, &x, &y);
} else {
// This function might be called for element in display:none subtree
// (e.g. getScreenCTM), we fall back to use SVG attributes.
const_cast<SVGForeignObjectElement*>(this)->GetAnimatedLengthValues(
&x, &y, nullptr);
}
const_cast<SVGForeignObjectElement*>(this)->GetAnimatedLengthValues(&x, &y,
nullptr);
gfxMatrix toUserSpace = gfxMatrix::Translation(x, y);
if (aWhich == eChildToUserSpace) {
return toUserSpace * aMatrix;
@ -100,12 +89,10 @@ gfxMatrix SVGForeignObjectElement::PrependLocalTransformsTo(
/* virtual */
bool SVGForeignObjectElement::HasValidDimensions() const {
float width, height;
MOZ_ASSERT(GetPrimaryFrame());
SVGGeometryProperty::ResolveAll<SVGT::Width, SVGT::Height>(
const_cast<SVGForeignObjectElement*>(this), &width, &height);
return width > 0 && height > 0;
return mLengthAttributes[ATTR_WIDTH].IsExplicitlySet() &&
mLengthAttributes[ATTR_WIDTH].GetAnimValInSpecifiedUnits() > 0 &&
mLengthAttributes[ATTR_HEIGHT].IsExplicitlySet() &&
mLengthAttributes[ATTR_HEIGHT].GetAnimValInSpecifiedUnits() > 0;
}
//----------------------------------------------------------------------
@ -122,8 +109,7 @@ SVGForeignObjectElement::IsAttributeMapped(const nsAtom* name) const {
sTextContentElementsMap,
sViewportsMap};
return IsInLengthInfo(name, sLengthInfo) ||
FindAttributeDependence(name, map) ||
return FindAttributeDependence(name, map) ||
SVGGraphicsElement::IsAttributeMapped(name);
}
@ -135,22 +121,5 @@ SVGElement::LengthAttributesInfo SVGForeignObjectElement::GetLengthInfo() {
ArrayLength(sLengthInfo));
}
nsCSSPropertyID SVGForeignObjectElement::GetCSSPropertyIdForAttrEnum(
uint8_t aAttrEnum) {
switch (aAttrEnum) {
case ATTR_X:
return eCSSProperty_x;
case ATTR_Y:
return eCSSProperty_y;
case ATTR_WIDTH:
return eCSSProperty_width;
case ATTR_HEIGHT:
return eCSSProperty_height;
default:
MOZ_ASSERT_UNREACHABLE("Unknown attr enum");
return eCSSProperty_UNKNOWN;
}
}
} // namespace dom
} // namespace mozilla

Просмотреть файл

@ -8,7 +8,6 @@
#define mozilla_dom_SVGForeignObjectElement_h
#include "mozilla/dom/SVGGraphicsElement.h"
#include "nsCSSPropertyID.h"
#include "SVGAnimatedLength.h"
nsresult NS_NewSVGForeignObjectElement(
@ -43,8 +42,6 @@ class SVGForeignObjectElement final : public SVGGraphicsElement {
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
static nsCSSPropertyID GetCSSPropertyIdForAttrEnum(uint8_t aAttrEnum);
// WebIDL
already_AddRefed<DOMSVGAnimatedLength> X();
already_AddRefed<DOMSVGAnimatedLength> Y();

Просмотреть файл

@ -10,11 +10,8 @@
#include "gfxPlatform.h"
#include "nsCOMPtr.h"
#include "nsComputedDOMStyle.h"
#include "nsSVGUtils.h"
#include "SVGAnimatedLength.h"
#include "SVGCircleElement.h"
#include "SVGEllipseElement.h"
#include "SVGRectElement.h"
#include "nsSVGUtils.h"
#include "mozilla/dom/SVGLengthBinding.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/RefPtr.h"
@ -114,22 +111,6 @@ already_AddRefed<Path> SVGGeometryElement::GetOrBuildPathForMeasuring() {
return GetOrBuildPath(drawTarget, fillRule);
}
bool SVGGeometryElement::IsGeometryChangedViaCSS(
ComputedStyle const& aNewStyle, ComputedStyle const& aOldStyle) const {
if (IsSVGElement(nsGkAtoms::rect)) {
return SVGRectElement::IsLengthChangedViaCSS(aNewStyle, aOldStyle);
}
if (IsSVGElement(nsGkAtoms::circle)) {
return SVGCircleElement::IsLengthChangedViaCSS(aNewStyle, aOldStyle);
}
if (IsSVGElement(nsGkAtoms::ellipse)) {
return SVGEllipseElement::IsLengthChangedViaCSS(aNewStyle, aOldStyle);
}
return false;
}
FillRule SVGGeometryElement::GetFillRule() {
FillRule fillRule =
FillRule::FILL_WINDING; // Equivalent to StyleFillRule::Nonzero

Просмотреть файл

@ -191,13 +191,6 @@ class SVGGeometryElement : public SVGGeometryElementBase {
*/
virtual already_AddRefed<Path> GetOrBuildPathForMeasuring();
/**
* Return |true| if some geometry properties (|x|, |y|, etc) are changed
* because of CSS change.
*/
bool IsGeometryChangedViaCSS(ComputedStyle const& aNewStyle,
ComputedStyle const& aOldStyle) const;
/**
* Returns the current computed value of the CSS property 'fill-rule' for
* this element.

Просмотреть файл

@ -1,87 +0,0 @@
/* -*- 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 "SVGGeometryProperty.h"
#include "SVGCircleElement.h"
#include "SVGEllipseElement.h"
#include "SVGForeignObjectElement.h"
#include "SVGRectElement.h"
namespace mozilla {
namespace dom {
namespace SVGGeometryProperty {
nsCSSUnit SpecifiedUnitTypeToCSSUnit(uint8_t aSpecifiedUnit) {
switch (aSpecifiedUnit) {
case SVGLength_Binding::SVG_LENGTHTYPE_NUMBER:
case SVGLength_Binding::SVG_LENGTHTYPE_PX:
return nsCSSUnit::eCSSUnit_Pixel;
case SVGLength_Binding::SVG_LENGTHTYPE_MM:
return nsCSSUnit::eCSSUnit_Millimeter;
case SVGLength_Binding::SVG_LENGTHTYPE_CM:
return nsCSSUnit::eCSSUnit_Centimeter;
case SVGLength_Binding::SVG_LENGTHTYPE_IN:
return nsCSSUnit::eCSSUnit_Inch;
case SVGLength_Binding::SVG_LENGTHTYPE_PT:
return nsCSSUnit::eCSSUnit_Point;
case SVGLength_Binding::SVG_LENGTHTYPE_PC:
return nsCSSUnit::eCSSUnit_Pica;
case SVGLength_Binding::SVG_LENGTHTYPE_PERCENTAGE:
return nsCSSUnit::eCSSUnit_Percent;
case SVGLength_Binding::SVG_LENGTHTYPE_EMS:
return nsCSSUnit::eCSSUnit_EM;
case SVGLength_Binding::SVG_LENGTHTYPE_EXS:
return nsCSSUnit::eCSSUnit_XHeight;
default:
MOZ_ASSERT_UNREACHABLE("Unknown unit type");
return nsCSSUnit::eCSSUnit_Pixel;
}
}
nsCSSPropertyID AttrEnumToCSSPropId(const SVGElement* aElement,
uint8_t aAttrEnum) {
// This is a very trivial function only applied to a few elements,
// so we want to avoid making it virtual.
if (aElement->IsSVGElement(nsGkAtoms::rect)) {
return SVGRectElement::GetCSSPropertyIdForAttrEnum(aAttrEnum);
}
if (aElement->IsSVGElement(nsGkAtoms::circle)) {
return SVGCircleElement::GetCSSPropertyIdForAttrEnum(aAttrEnum);
}
if (aElement->IsSVGElement(nsGkAtoms::ellipse)) {
return SVGEllipseElement::GetCSSPropertyIdForAttrEnum(aAttrEnum);
}
if (aElement->IsSVGElement(nsGkAtoms::foreignObject)) {
return SVGForeignObjectElement::GetCSSPropertyIdForAttrEnum(aAttrEnum);
}
return eCSSProperty_UNKNOWN;
}
bool IsNonNegativeGeometryProperty(nsCSSPropertyID aProp) {
return aProp == eCSSProperty_r || aProp == eCSSProperty_rx ||
aProp == eCSSProperty_ry || aProp == eCSSProperty_width ||
aProp == eCSSProperty_height;
}
bool ElementMapsLengthsToStyle(SVGElement const* aElement) {
return aElement->IsSVGElement(nsGkAtoms::rect) ||
aElement->IsSVGElement(nsGkAtoms::circle) ||
aElement->IsSVGElement(nsGkAtoms::ellipse) ||
aElement->IsSVGElement(nsGkAtoms::foreignObject);
}
} // namespace SVGGeometryProperty
} // namespace dom
} // namespace mozilla

Просмотреть файл

@ -1,162 +0,0 @@
/* -*- 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/. */
#ifndef mozilla_dom_SVGGeometryProperty_SVGGeometryProperty_h
#define mozilla_dom_SVGGeometryProperty_SVGGeometryProperty_h
#include "mozilla/dom/SVGElement.h"
#include "SVGAnimatedLength.h"
#include "ComputedStyle.h"
#include "nsIFrame.h"
#include <type_traits>
namespace mozilla {
namespace dom {
namespace SVGGeometryProperty {
namespace ResolverTypes {
struct LengthPercentNoAuto {};
struct LengthPercentRXY {};
struct LengthPercentWidthHeight {};
} // namespace ResolverTypes
namespace Tags {
#define SVGGEOMETRYPROPERTY_GENERATETAG(tagName, resolver, direction, \
styleStruct) \
struct tagName { \
using ResolverType = ResolverTypes::resolver; \
constexpr static auto CtxDirection = SVGContentUtils::direction; \
constexpr static auto Getter = &styleStruct::m##tagName; \
}
SVGGEOMETRYPROPERTY_GENERATETAG(X, LengthPercentNoAuto, X, nsStyleSVGReset);
SVGGEOMETRYPROPERTY_GENERATETAG(Y, LengthPercentNoAuto, Y, nsStyleSVGReset);
SVGGEOMETRYPROPERTY_GENERATETAG(Cx, LengthPercentNoAuto, X, nsStyleSVGReset);
SVGGEOMETRYPROPERTY_GENERATETAG(Cy, LengthPercentNoAuto, Y, nsStyleSVGReset);
SVGGEOMETRYPROPERTY_GENERATETAG(R, LengthPercentNoAuto, XY, nsStyleSVGReset);
SVGGEOMETRYPROPERTY_GENERATETAG(Width, LengthPercentWidthHeight, X,
nsStylePosition);
SVGGEOMETRYPROPERTY_GENERATETAG(Height, LengthPercentWidthHeight, Y,
nsStylePosition);
#undef SVGGEOMETRYPROPERTY_GENERATETAG
struct Ry;
struct Rx {
using ResolverType = ResolverTypes::LengthPercentRXY;
constexpr static auto CtxDirection = SVGContentUtils::X;
constexpr static auto Getter = &nsStyleSVGReset::mRx;
using CounterPart = Ry;
};
struct Ry {
using ResolverType = ResolverTypes::LengthPercentRXY;
constexpr static auto CtxDirection = SVGContentUtils::Y;
constexpr static auto Getter = &nsStyleSVGReset::mRy;
using CounterPart = Rx;
};
} // namespace Tags
namespace details {
template <class T>
using AlwaysFloat = float;
using CtxDirectionType = decltype(SVGContentUtils::X);
template <CtxDirectionType CTD>
float ResolvePureLengthPercentage(SVGElement* aElement,
const LengthPercentage& aLP) {
return aLP.ResolveToCSSPixelsWith(
[&] { return CSSCoord{SVGElementMetrics(aElement).GetAxisLength(CTD)}; });
}
template <class Tag>
float ResolveImpl(ComputedStyle const& aStyle, SVGElement* aElement,
ResolverTypes::LengthPercentNoAuto) {
auto const& value = aStyle.StyleSVGReset()->*Tag::Getter;
return ResolvePureLengthPercentage<Tag::CtxDirection>(aElement, value);
}
template <class Tag>
float ResolveImpl(ComputedStyle const& aStyle, SVGElement* aElement,
ResolverTypes::LengthPercentWidthHeight) {
static_assert(
std::is_same<Tag, Tags::Width>{} || std::is_same<Tag, Tags::Height>{},
"Wrong tag");
auto const& value = aStyle.StylePosition()->*Tag::Getter;
if (value.IsLengthPercentage()) {
return ResolvePureLengthPercentage<Tag::CtxDirection>(
aElement, value.AsLengthPercentage());
}
// |auto| and |max-content| etc. are treated as 0.
return 0.f;
}
template <class Tag>
float ResolveImpl(ComputedStyle const& aStyle, SVGElement* aElement,
ResolverTypes::LengthPercentRXY) {
static_assert(std::is_same<Tag, Tags::Rx>{} || std::is_same<Tag, Tags::Ry>{},
"Wrong tag");
auto const& value = aStyle.StyleSVGReset()->*Tag::Getter;
if (value.IsLengthPercentage()) {
return ResolvePureLengthPercentage<Tag::CtxDirection>(
aElement, value.AsLengthPercentage());
}
MOZ_ASSERT(value.IsAuto());
using Rother = typename Tag::CounterPart;
auto const& valueOther = aStyle.StyleSVGReset()->*Rother::Getter;
if (valueOther.IsAuto()) {
// Per SVG2, |Rx|, |Ry| resolve to 0 if both are |auto|
return 0.f;
}
// If |Rx| is auto while |Ry| not, |Rx| gets the value of |Ry|.
return ResolvePureLengthPercentage<Rother::CtxDirection>(
aElement, valueOther.AsLengthPercentage());
}
} // namespace details
template <class Tag>
float ResolveWith(const ComputedStyle& aStyle, const SVGElement* aElement) {
// TODO: There are a lot of utilities lacking const-ness in dom/svg.
// We should fix that problem and remove this `const_cast`.
return details::ResolveImpl<Tag>(aStyle, const_cast<SVGElement*>(aElement),
typename Tag::ResolverType{});
}
// To add support for new properties, or to handle special cases for
// existing properties, you can add a new tag in |Tags| and |ResolverTypes|
// namespace, then implement the behavior in |details::ResolveImpl|.
template <class... Tags>
bool ResolveAll(const SVGElement* aElement,
details::AlwaysFloat<Tags>*... aRes) {
if (nsIFrame const* f = aElement->GetPrimaryFrame()) {
using dummy = int[];
(void)dummy{0, (*aRes = ResolveWith<Tags>(*f->Style(), aElement), 0)...};
return true;
}
return false;
}
nsCSSUnit SpecifiedUnitTypeToCSSUnit(uint8_t aSpecifiedUnit);
nsCSSPropertyID AttrEnumToCSSPropId(const SVGElement* aElement,
uint8_t aAttrEnum);
bool IsNonNegativeGeometryProperty(nsCSSPropertyID aProp);
bool ElementMapsLengthsToStyle(SVGElement const* aElement);
} // namespace SVGGeometryProperty
} // namespace dom
} // namespace mozilla
#endif

Просмотреть файл

@ -32,16 +32,6 @@ class SVGGraphicsElement : public SVGGraphicsElementBase, public SVGTests {
// returns true if focusability has been definitively determined otherwise
// false
bool IsSVGFocusable(bool* aIsFocusable, int32_t* aTabIndex);
template <typename T>
bool IsInLengthInfo(const nsAtom* aAttribute, const T& aLengthInfos) const {
for (auto const& e : aLengthInfos) {
if (e.mName == aAttribute) {
return true;
}
}
return false;
}
};
} // namespace dom

Просмотреть файл

@ -218,8 +218,7 @@ SVGImageElement::IsAttributeMapped(const nsAtom* name) const {
sViewportsMap,
};
return IsInLengthInfo(name, sLengthInfo) ||
FindAttributeDependence(name, map) ||
return FindAttributeDependence(name, map) ||
SVGImageElementBase::IsAttributeMapped(name);
}

Просмотреть файл

@ -5,14 +5,13 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/SVGRectElement.h"
#include "nsGkAtoms.h"
#include "mozilla/dom/SVGLengthBinding.h"
#include "mozilla/dom/SVGRectElementBinding.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/Matrix.h"
#include "mozilla/gfx/Rect.h"
#include "mozilla/gfx/PathHelpers.h"
#include "nsGkAtoms.h"
#include "SVGGeometryProperty.h"
#include <algorithm>
NS_IMPL_NS_NEW_SVG_ELEMENT(Rect)
@ -50,13 +49,6 @@ SVGRectElement::SVGRectElement(
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
: SVGRectElementBase(std::move(aNodeInfo)) {}
bool SVGRectElement::IsAttributeMapped(const nsAtom* aAttribute) const {
return IsInLengthInfo(aAttribute, sLengthInfo) ||
SVGRectElementBase::IsAttributeMapped(aAttribute);
}
namespace SVGT = SVGGeometryProperty::Tags;
//----------------------------------------------------------------------
// nsINode methods
@ -93,13 +85,10 @@ already_AddRefed<DOMSVGAnimatedLength> SVGRectElement::Ry() {
/* virtual */
bool SVGRectElement::HasValidDimensions() const {
float width, height;
MOZ_ASSERT(GetPrimaryFrame());
SVGGeometryProperty::ResolveAll<SVGT::Width, SVGT::Height>(this, &width,
&height);
return width > 0 && height > 0;
return mLengthAttributes[ATTR_WIDTH].IsExplicitlySet() &&
mLengthAttributes[ATTR_WIDTH].GetAnimValInSpecifiedUnits() > 0 &&
mLengthAttributes[ATTR_HEIGHT].IsExplicitlySet() &&
mLengthAttributes[ATTR_HEIGHT].GetAnimValInSpecifiedUnits() > 0;
}
SVGElement::LengthAttributesInfo SVGRectElement::GetLengthInfo() {
@ -116,11 +105,8 @@ bool SVGRectElement::GetGeometryBounds(Rect* aBounds,
const Matrix* aToNonScalingStrokeSpace) {
Rect rect;
Float rx, ry;
MOZ_ASSERT(GetPrimaryFrame());
SVGGeometryProperty::ResolveAll<SVGT::X, SVGT::Y, SVGT::Width, SVGT::Height,
SVGT::Rx, SVGT::Ry>(
this, &rect.x, &rect.y, &rect.width, &rect.height, &rx, &ry);
GetAnimatedLengthValues(&rect.x, &rect.y, &rect.width, &rect.height, &rx, &ry,
nullptr);
if (rect.IsEmpty()) {
// Rendering of the element disabled
@ -169,11 +155,7 @@ bool SVGRectElement::GetGeometryBounds(Rect* aBounds,
void SVGRectElement::GetAsSimplePath(SimplePath* aSimplePath) {
float x, y, width, height, rx, ry;
MOZ_ASSERT(GetPrimaryFrame());
SVGGeometryProperty::ResolveAll<SVGT::X, SVGT::Y, SVGT::Width, SVGT::Height,
SVGT::Rx, SVGT::Ry>(this, &x, &y, &width,
&height, &rx, &ry);
GetAnimatedLengthValues(&x, &y, &width, &height, &rx, &ry, nullptr);
if (width <= 0 || height <= 0) {
aSimplePath->Reset();
@ -193,11 +175,7 @@ void SVGRectElement::GetAsSimplePath(SimplePath* aSimplePath) {
already_AddRefed<Path> SVGRectElement::BuildPath(PathBuilder* aBuilder) {
float x, y, width, height, rx, ry;
MOZ_ASSERT(GetPrimaryFrame());
SVGGeometryProperty::ResolveAll<SVGT::X, SVGT::Y, SVGT::Width, SVGT::Height,
SVGT::Rx, SVGT::Ry>(this, &x, &y, &width,
&height, &rx, &ry);
GetAnimatedLengthValues(&x, &y, &width, &height, &rx, &ry, nullptr);
if (width <= 0 || height <= 0) {
return nullptr;
@ -215,6 +193,18 @@ already_AddRefed<Path> SVGRectElement::BuildPath(PathBuilder* aBuilder) {
aBuilder->LineTo(r.BottomLeft());
aBuilder->Close();
} else {
// If either the 'rx' or the 'ry' attribute isn't set, then we have to
// set it to the value of the other:
bool hasRx = mLengthAttributes[ATTR_RX].IsExplicitlySet();
bool hasRy = mLengthAttributes[ATTR_RY].IsExplicitlySet();
MOZ_ASSERT(hasRx || hasRy);
if (hasRx && !hasRy) {
ry = rx;
} else if (hasRy && !hasRx) {
rx = ry;
}
// Clamp rx and ry to half the rect's width and height respectively:
rx = std::min(rx, width / 2);
ry = std::min(ry, height / 2);
@ -226,40 +216,5 @@ already_AddRefed<Path> SVGRectElement::BuildPath(PathBuilder* aBuilder) {
return aBuilder->Finish();
}
bool SVGRectElement::IsLengthChangedViaCSS(const ComputedStyle& aNewStyle,
const ComputedStyle& aOldStyle) {
auto *newSVGReset = aNewStyle.StyleSVGReset(),
*oldSVGReset = aOldStyle.StyleSVGReset();
auto *newPosition = aNewStyle.StylePosition(),
*oldPosition = aOldStyle.StylePosition();
return newSVGReset->mX != oldSVGReset->mX ||
newSVGReset->mY != oldSVGReset->mY ||
newPosition->mWidth != oldPosition->mWidth ||
newPosition->mHeight != oldPosition->mHeight ||
newSVGReset->mRx != oldSVGReset->mRx ||
newSVGReset->mRy != oldSVGReset->mRy;
}
nsCSSPropertyID SVGRectElement::GetCSSPropertyIdForAttrEnum(uint8_t aAttrEnum) {
switch (aAttrEnum) {
case ATTR_X:
return eCSSProperty_x;
case ATTR_Y:
return eCSSProperty_y;
case ATTR_WIDTH:
return eCSSProperty_width;
case ATTR_HEIGHT:
return eCSSProperty_height;
case ATTR_RX:
return eCSSProperty_rx;
case ATTR_RY:
return eCSSProperty_ry;
default:
MOZ_ASSERT_UNREACHABLE("Unknown attr enum");
return eCSSProperty_UNKNOWN;
}
}
} // namespace dom
} // namespace mozilla

Просмотреть файл

@ -7,7 +7,6 @@
#ifndef mozilla_dom_SVGRectElement_h
#define mozilla_dom_SVGRectElement_h
#include "nsCSSPropertyID.h"
#include "SVGAnimatedLength.h"
#include "SVGGeometryElement.h"
@ -15,8 +14,6 @@ nsresult NS_NewSVGRectElement(
nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
namespace mozilla {
class ComputedStyle;
namespace dom {
typedef SVGGeometryElement SVGRectElementBase;
@ -31,8 +28,6 @@ class SVGRectElement final : public SVGRectElementBase {
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
public:
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
// nsSVGSVGElement methods:
virtual bool HasValidDimensions() const override;
@ -47,10 +42,6 @@ class SVGRectElement final : public SVGRectElementBase {
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
static bool IsLengthChangedViaCSS(const ComputedStyle& aNewStyle,
const ComputedStyle& aOldStyle);
static nsCSSPropertyID GetCSSPropertyIdForAttrEnum(uint8_t aAttrEnum);
// WebIDL
already_AddRefed<DOMSVGAnimatedLength> X();
already_AddRefed<DOMSVGAnimatedLength> Y();

Просмотреть файл

@ -124,17 +124,6 @@ class SVGViewportElement : public SVGGraphicsElement {
mViewportHeight = aSize.height;
}
/**
* Returns true if either this is an SVG <svg> element that is the child of
* another non-foreignObject SVG element, or this is a SVG <symbol> element
* this is the root of a use-element shadow tree.
*/
bool IsInner() const {
const nsIContent* parent = GetFlattenedTreeParent();
return parent && parent->IsSVGElement() &&
!parent->IsSVGElement(nsGkAtoms::foreignObject);
}
// WebIDL
already_AddRefed<SVGAnimatedRect> ViewBox();
already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio();
@ -150,6 +139,17 @@ class SVGViewportElement : public SVGGraphicsElement {
return IsInUncomposedDoc() && !GetParent();
}
/**
* Returns true if either this is an SVG <svg> element that is the child of
* another non-foreignObject SVG element, or this is a SVG <symbol> element
* this is the root of a use-element shadow tree.
*/
bool IsInner() const {
const nsIContent* parent = GetFlattenedTreeParent();
return parent && parent->IsSVGElement() &&
!parent->IsSVGElement(nsGkAtoms::foreignObject);
}
/**
* Returns the explicit or default preserveAspectRatio, unless we're
* synthesizing a viewBox, in which case it returns the "none" value.

Просмотреть файл

@ -181,7 +181,6 @@ UNIFIED_SOURCES += [
'SVGFragmentIdentifier.cpp',
'SVGGElement.cpp',
'SVGGeometryElement.cpp',
'SVGGeometryProperty.cpp',
'SVGGradientElement.cpp',
'SVGGraphicsElement.cpp',
'SVGImageElement.cpp',

Просмотреть файл

@ -1,20 +0,0 @@
<!doctype html>
<svg width="800" height="600">
<g>
<rect x="40" y="40" width="100" height="100" rx="30" ry="30" fill="purple" />
<rect x="40" y="150" width="30" height="200" rx="20" ry="20" fill="magenta" />
</g>
<circle cx="170" cy="340" r="70px" fill="pink" />
<g>
<circle cx="230" cy="130" r="70px" fill="skyblue" />
</g>
<svg x="300" width="200" height="200" viewBox="0 0 100 100">
<ellipse cx="30" cy="100" rx="20" ry="40" fill="cyan" />
<ellipse cx="80" cy="50" rx="20" ry="40" fill="navy" />
</svg>
<foreignObject x="450" y="200" width="80" height="130">
<svg>
<rect width="50" height="50" rx="4" ry="4" fill="brown" />
</svg>
</foreignObject>
</svg>

Просмотреть файл

@ -1,75 +0,0 @@
<!doctype html>
<style>
svg {
width: 800px;
height: 600px;
font-size: 10px;
}
svg svg {
width: 80px;
height: 80px;
}
rect:first-child {
x: 40px;
y: calc(5% + 10px);
width: calc(80px + 2em);
height: 10em;
rx: auto;
ry: 5%;
cx: 100px;
cy: 200px;
}
circle {
r: calc(70px);
}
g > #c2 {
cx: 80px;
cy: calc(20% + 10px);
x: 40px;
y: calc(5% + 10px);
}
svg > svg > ellipse {
cx: 30%;
cy: 100px;
rx: 20px;
ry: 40px;
}
svg > svg > ellipse:nth-child(2) {
transform: translate(50px, -50px);
}
svg ellipse {
cx: 10px;
cy: 10px;
rx: 10px;
ry: 10px;
}
foreignObject {
transform: translate(450px,0);
y: 200px;
width: 80px;
height: 130px;
}
#r2 {
width: 50px;
height:50px;
}
</style>
<svg>
<g>
<rect x="0" y="-10" width="30px" height="10px" rx="-5px" ry="auto" fill="purple" />
<rect x=" 40px /* some nonsense */ " y="150" width="30" height="20em" rx="20px" ry="20px" fill="magenta" />
</g>
<circle cx="/* more nonsense */ 170" cy="340" r="-5px" fill="pink" />
<g transform="translate(150,0)">
<circle id="c2" cx="20" cy="40" fill="skyblue" />
</g>
<svg x="300" width="200px" height="200px" viewBox="0 0 100 100">
<ellipse fill="cyan" />
<ellipse fill="navy" />
</svg>
<foreignObject>
<svg>
<rect id="r2" style="x:0;y:0" fill="brown" />
</svg>
</foreignObject>
</svg>

Просмотреть файл

@ -244,7 +244,6 @@ fuzzy-if(Android,0-18,0-600) == foreignObject-fixedpos-01.html foreignObject-dyn
== g-transform-01.svg pass.svg
== getElementById-a-element-01.svg pass.svg
== geometry-properties-in-css.html geometry-properties-in-css-ref.html
fuzzy-if(Android,0-9,0-980) fuzzy-if(skiaContent,0-3,0-32000) == gradient-live-01a.svg gradient-live-01-ref.svg
fuzzy-if(Android,0-9,0-980) fuzzy-if(skiaContent,0-3,0-32000) == gradient-live-01b.svg gradient-live-01-ref.svg

Просмотреть файл

@ -10,12 +10,10 @@
#include "mozilla/dom/Document.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/SVGElement.h"
#include "mozilla/dom/MutationEventBinding.h"
#include "mozilla/DeclarationBlock.h"
#include "mozilla/InternalMutationEvent.h"
#include "mozilla/SMILCSSValueType.h"
#include "mozilla/SMILValue.h"
#include "mozAutoDocUpdate.h"
#include "nsIURI.h"
#include "nsNodeUtils.h"
@ -135,10 +133,9 @@ nsDOMCSSAttributeDeclaration::GetParsingEnvironment(
};
}
template <typename SetterFunc>
nsresult nsDOMCSSAttributeDeclaration::SetSMILValueHelper(SetterFunc aFunc) {
nsresult nsDOMCSSAttributeDeclaration::SetSMILValue(
const nsCSSPropertyID aPropID, const SMILValue& aValue) {
MOZ_ASSERT(mIsSMILOverride);
// No need to do the ActiveLayerTracker / ScrollLinkedEffectDetector bits,
// since we're in a SMIL animation anyway, no need to try to detect we're a
// scripted animation.
@ -150,9 +147,7 @@ nsresult nsDOMCSSAttributeDeclaration::SetSMILValueHelper(SetterFunc aFunc) {
}
mozAutoDocUpdate autoUpdate(DocToUpdate(), true);
RefPtr<DeclarationBlock> decl = olddecl->EnsureMutable();
bool changed = aFunc(*decl);
bool changed = SMILCSSValueType::SetPropertyValues(aValue, *decl);
if (changed) {
// We can pass nullptr as the latter param, since this is
// mIsSMILOverride == true case.
@ -161,23 +156,6 @@ nsresult nsDOMCSSAttributeDeclaration::SetSMILValueHelper(SetterFunc aFunc) {
return NS_OK;
}
nsresult nsDOMCSSAttributeDeclaration::SetSMILValue(
const nsCSSPropertyID /*aPropID*/, const SMILValue& aValue) {
MOZ_ASSERT(aValue.mType == &SMILCSSValueType::sSingleton,
"We should only try setting a CSS value type");
return SetSMILValueHelper([&aValue](DeclarationBlock& aDecl) {
return SMILCSSValueType::SetPropertyValues(aValue, aDecl);
});
}
nsresult nsDOMCSSAttributeDeclaration::SetSMILValue(
const nsCSSPropertyID aPropID, const SVGAnimatedLength& aLength) {
return SetSMILValueHelper([aPropID, &aLength](DeclarationBlock& aDecl) {
return SVGElement::UpdateDeclarationBlockFromLength(
aDecl, aPropID, aLength, SVGElement::ValToUse::Anim);
});
}
nsresult nsDOMCSSAttributeDeclaration::SetPropertyValue(
const nsCSSPropertyID aPropID, const nsAString& aValue,
nsIPrincipal* aSubjectPrincipal) {

Просмотреть файл

@ -18,7 +18,6 @@ struct RawServoUnlockedDeclarationBlock;
namespace mozilla {
class SMILValue;
class SVGAnimatedLength;
namespace dom {
class DomGroup;
@ -30,7 +29,6 @@ class nsDOMCSSAttributeDeclaration final : public nsDOMCSSDeclaration {
public:
typedef mozilla::dom::Element Element;
typedef mozilla::SMILValue SMILValue;
typedef mozilla::SVGAnimatedLength SVGAnimatedLength;
nsDOMCSSAttributeDeclaration(Element* aContent, bool aIsSMILOverride);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
@ -47,9 +45,7 @@ class nsDOMCSSAttributeDeclaration final : public nsDOMCSSDeclaration {
nsINode* GetParentObject() override { return mElement; }
nsresult SetSMILValue(const nsCSSPropertyID aPropID, const SMILValue& aValue);
nsresult SetSMILValue(const nsCSSPropertyID aPropID,
const SVGAnimatedLength& aLength);
nsresult SetSMILValue(const nsCSSPropertyID aPropID, const SMILValue&);
nsresult SetPropertyValue(const nsCSSPropertyID aPropID,
const nsAString& aValue,
@ -83,10 +79,6 @@ class nsDOMCSSAttributeDeclaration final : public nsDOMCSSDeclaration {
* than the inline style rule).
*/
const bool mIsSMILOverride;
private:
template <typename SetterFunc>
nsresult SetSMILValueHelper(SetterFunc aFunc);
};
#endif /* nsDOMCSSAttributeDeclaration_h */

Просмотреть файл

@ -1069,14 +1069,7 @@ void nsStyleFilter::SetDropShadow(nsCSSShadowArray* aDropShadow) {
// nsStyleSVGReset
//
nsStyleSVGReset::nsStyleSVGReset(const Document& aDocument)
: mX(LengthPercentage::Zero()),
mY(LengthPercentage::Zero()),
mCx(LengthPercentage::Zero()),
mCy(LengthPercentage::Zero()),
mRx(NonNegativeLengthPercentageOrAuto::Auto()),
mRy(NonNegativeLengthPercentageOrAuto::Auto()),
mR(NonNegativeLengthPercentage::Zero()),
mMask(nsStyleImageLayers::LayerType::Mask),
: mMask(nsStyleImageLayers::LayerType::Mask),
mStopColor(StyleColor::Black()),
mFloodColor(StyleColor::Black()),
mLightingColor(StyleColor::White()),
@ -1091,14 +1084,7 @@ nsStyleSVGReset::nsStyleSVGReset(const Document& aDocument)
nsStyleSVGReset::~nsStyleSVGReset() { MOZ_COUNT_DTOR(nsStyleSVGReset); }
nsStyleSVGReset::nsStyleSVGReset(const nsStyleSVGReset& aSource)
: mX(aSource.mX),
mY(aSource.mY),
mCx(aSource.mCx),
mCy(aSource.mCy),
mRx(aSource.mRx),
mRy(aSource.mRy),
mR(aSource.mR),
mMask(aSource.mMask),
: mMask(aSource.mMask),
mClipPath(aSource.mClipPath),
mStopColor(aSource.mStopColor),
mFloodColor(aSource.mFloodColor),
@ -1150,12 +1136,6 @@ nsChangeHint nsStyleSVGReset::CalcDifference(
const nsStyleSVGReset& aNewData) const {
nsChangeHint hint = nsChangeHint(0);
if (mX != aNewData.mX || mY != aNewData.mY || mCx != aNewData.mCx ||
mCy != aNewData.mCy || mR != aNewData.mR || mRx != aNewData.mRx ||
mRy != aNewData.mRy) {
hint |= nsChangeHint_InvalidateRenderingObservers | nsChangeHint_NeedReflow;
}
if (mClipPath != aNewData.mClipPath) {
hint |= nsChangeHint_UpdateEffects | nsChangeHint_RepaintFrame;
}

Просмотреть файл

@ -2859,15 +2859,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleSVGReset {
return mVectorEffect == NS_STYLE_VECTOR_EFFECT_NON_SCALING_STROKE;
}
// geometry properties
mozilla::LengthPercentage mX;
mozilla::LengthPercentage mY;
mozilla::LengthPercentage mCx;
mozilla::LengthPercentage mCy;
mozilla::NonNegativeLengthPercentageOrAuto mRx;
mozilla::NonNegativeLengthPercentageOrAuto mRy;
mozilla::NonNegativeLengthPercentage mR;
nsStyleImageLayers mMask;
mozilla::StyleShapeSource mClipPath;
mozilla::StyleColor mStopColor;

Просмотреть файл

@ -5632,62 +5632,6 @@ var gCSSProperties = {
other_values: [ "0", "0px", "-0em", "17px", "0.2em", "0.0002", "context-value" ],
invalid_values: [ "-0.1px", "-3px" ]
},
"x": {
domProp: "x",
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: [ "0px" ],
other_values: [ "-1em", "17px", "0.2em", "23.4%" ],
invalid_values: [ "auto", "context-value", "0.0002" ]
},
"y": {
domProp: "y",
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: [ "0px" ],
other_values: [ "-1em", "17px", "0.2em", "23.4%" ],
invalid_values: [ "auto", "context-value", "0.0002" ]
},
"cx": {
domProp: "cx",
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: [ "0px" ],
other_values: [ "-1em", "17px", "0.2em", "23.4%" ],
invalid_values: [ "auto", "context-value", "0.0002" ]
},
"cy": {
domProp: "cy",
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: [ "0px" ],
other_values: [ "-1em", "17px", "0.2em", "23.4%" ],
invalid_values: [ "auto", "context-value", "0.0002" ]
},
"r": {
domProp: "r",
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: [ "0px" ],
other_values: [ "17px", "0.2em", "23.4%" ],
invalid_values: [ "auto", "-1", "-1.5px", "0.0002" ]
},
"rx": {
domProp: "rx",
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: [ "auto" ],
other_values: [ "17px", "0.2em", "23.4%" ],
invalid_values: [ "hello", "-12px", "0.0002" ]
},
"ry": {
domProp: "ry",
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: [ "auto" ],
other_values: [ "17px", "0.2em", "23.4%" ],
invalid_values: [ "hello", "-1.3px", "0.0002" ]
},
"text-anchor": {
domProp: "textAnchor",
inherited: true,

Просмотреть файл

@ -80,10 +80,6 @@ var supported_properties = {
test_length_clamped ],
"column-width": [ test_length_transition,
test_length_clamped ],
"cx": [ test_length_transition, test_percent_transition,
test_length_unclamped, test_percent_unclamped ],
"cy": [ test_length_transition, test_percent_transition,
test_length_unclamped, test_percent_unclamped ],
"-moz-image-region": [ test_rect_transition ],
"-moz-outline-radius-bottomleft": [ test_radius_transition ],
"-moz-outline-radius-bottomright": [ test_radius_transition ],
@ -248,12 +244,6 @@ var supported_properties = {
"right": [ test_length_transition, test_percent_transition,
test_length_percent_calc_transition,
test_length_unclamped, test_percent_unclamped ],
"r": [ test_length_transition, test_percent_transition,
test_length_clamped, test_percent_clamped ],
"rx": [ test_length_transition, test_percent_transition,
test_length_clamped, test_percent_clamped ],
"ry": [ test_length_transition, test_percent_transition,
test_length_clamped, test_percent_clamped ],
"shape-image-threshold": [ test_float_zeroToOne_transition,
// shape-image-threshold (like opacity) is
// clamped in computed style
@ -307,10 +297,6 @@ var supported_properties = {
test_length_percent_calc_transition,
test_length_clamped, test_percent_clamped ],
"word-spacing": [ test_length_transition, test_length_unclamped ],
"x": [ test_length_transition, test_percent_transition,
test_length_unclamped, test_percent_unclamped ],
"y": [ test_length_transition, test_percent_transition,
test_length_unclamped, test_percent_unclamped ],
"z-index": [ test_integer_transition, test_pos_integer_or_auto_transition ],
"-webkit-line-clamp": [ test_pos_integer_or_none_transition ],
"-webkit-text-fill-color": [ test_color_transition,

Просмотреть файл

@ -197,10 +197,6 @@ void SVGGeometryFrame::DidSetComputedStyle(ComputedStyle* aOldComputedStyle) {
}
}
}
if (element->IsGeometryChangedViaCSS(*Style(), *aOldComputedStyle)) {
element->ClearAnyCachedPath();
}
}
}

Просмотреть файл

@ -19,7 +19,6 @@
#include "nsLayoutUtils.h"
#include "nsRegion.h"
#include "nsSVGContainerFrame.h"
#include "SVGGeometryProperty.h"
#include "SVGObserverUtils.h"
#include "nsSVGIntegrationUtils.h"
#include "nsSVGOuterSVGFrame.h"
@ -28,7 +27,6 @@
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::image;
namespace SVGT = SVGGeometryProperty::Tags;
//----------------------------------------------------------------------
// Implementation
@ -244,9 +242,8 @@ void nsSVGForeignObjectFrame::PaintSVG(gfxContext& aContext,
if (StyleDisplay()->IsScrollableOverflow()) {
float x, y, width, height;
SVGGeometryProperty::ResolveAll<SVGT::X, SVGT::Y, SVGT::Width,
SVGT::Height>(
static_cast<SVGElement*>(GetContent()), &x, &y, &width, &height);
static_cast<SVGElement*>(GetContent())
->GetAnimatedLengthValues(&x, &y, &width, &height, nullptr);
gfxRect clipRect =
nsSVGUtils::GetClipRectForFrame(this, 0.0f, 0.0f, width, height);
@ -294,8 +291,8 @@ nsIFrame* nsSVGForeignObjectFrame::GetFrameForPoint(const gfxPoint& aPoint) {
}
float x, y, width, height;
SVGGeometryProperty::ResolveAll<SVGT::X, SVGT::Y, SVGT::Width, SVGT::Height>(
static_cast<SVGElement*>(GetContent()), &x, &y, &width, &height);
static_cast<SVGElement*>(GetContent())
->GetAnimatedLengthValues(&x, &y, &width, &height, nullptr);
if (!gfxRect(x, y, width, height).Contains(aPoint) ||
!nsSVGUtils::HitTestClip(this, aPoint)) {
@ -326,8 +323,8 @@ void nsSVGForeignObjectFrame::ReflowSVG() {
// correct dimensions:
float x, y, w, h;
SVGGeometryProperty::ResolveAll<SVGT::X, SVGT::Y, SVGT::Width, SVGT::Height>(
static_cast<SVGElement*>(GetContent()), &x, &y, &w, &h);
static_cast<SVGForeignObjectElement*>(GetContent())
->GetAnimatedLengthValues(&x, &y, &w, &h, nullptr);
// If mRect's width or height are negative, reflow blows up! We must clamp!
if (w < 0.0f) w = 0.0f;
@ -379,17 +376,21 @@ void nsSVGForeignObjectFrame::NotifySVGChanged(uint32_t aFlags) {
bool needNewCanvasTM = false;
if (aFlags & COORD_CONTEXT_CHANGED) {
SVGForeignObjectElement* fO =
static_cast<SVGForeignObjectElement*>(GetContent());
// Coordinate context changes affect mCanvasTM if we have a
// percentage 'x' or 'y'
if (StyleSVGReset()->mX.HasPercent() || StyleSVGReset()->mY.HasPercent()) {
if (fO->mLengthAttributes[SVGForeignObjectElement::ATTR_X].IsPercentage() ||
fO->mLengthAttributes[SVGForeignObjectElement::ATTR_Y].IsPercentage()) {
needNewBounds = true;
needNewCanvasTM = true;
}
// Our coordinate context's width/height has changed. If we have a
// percentage width/height our dimensions will change so we must reflow.
if (StylePosition()->mWidth.HasPercent() ||
StylePosition()->mHeight.HasPercent()) {
if (fO->mLengthAttributes[SVGForeignObjectElement::ATTR_WIDTH]
.IsPercentage() ||
fO->mLengthAttributes[SVGForeignObjectElement::ATTR_HEIGHT]
.IsPercentage()) {
needNewBounds = true;
needReflow = true;
}
@ -442,8 +443,7 @@ SVGBBox nsSVGForeignObjectFrame::GetBBoxContribution(
static_cast<SVGForeignObjectElement*>(GetContent());
float x, y, w, h;
SVGGeometryProperty::ResolveAll<SVGT::X, SVGT::Y, SVGT::Width, SVGT::Height>(
content, &x, &y, &w, &h);
content->GetAnimatedLengthValues(&x, &y, &w, &h, nullptr);
if (w < 0.0f) w = 0.0f;
if (h < 0.0f) h = 0.0f;

Просмотреть файл

@ -172,7 +172,7 @@ class Longhand(object):
gecko_ffi_name=None,
allowed_in_keyframe_block=True, cast_type='u8',
logical=False, logical_group=None, alias=None, extra_prefixes=None, boxed=False,
flags=None, allowed_in_page_rule=False, allow_quirks="No",
flags=None, allowed_in_page_rule=False, allow_quirks=False,
ignored_when_colors_disabled=False,
vector=False, servo_restyle_damage="repaint"):
self.name = name

Просмотреть файл

@ -10,7 +10,7 @@
<%def name="predefined_type(name, type, initial_value, parse_method='parse',
needs_context=True, vector=False,
computed_type=None, initial_specified_value=None,
allow_quirks='No', allow_empty=False, **kwargs)">
allow_quirks=False, allow_empty=False, **kwargs)">
<%def name="predefined_type_inner(name, type, initial_value, parse_method)">
#[allow(unused_imports)]
use app_units::Au;
@ -42,8 +42,8 @@
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<SpecifiedValue, ParseError<'i>> {
% if allow_quirks != "No":
specified::${type}::${parse_method}_quirky(context, input, AllowQuirks::${allow_quirks})
% if allow_quirks:
specified::${type}::${parse_method}_quirky(context, input, AllowQuirks::Yes)
% elif needs_context:
specified::${type}::${parse_method}(context, input)
% else:
@ -405,8 +405,8 @@
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<PropertyDeclaration, ParseError<'i>> {
% if property.allow_quirks != "No":
parse_quirky(context, input, specified::AllowQuirks::${property.allow_quirks})
% if property.allow_quirks:
parse_quirky(context, input, specified::AllowQuirks::Yes)
% else:
parse(context, input)
% endif
@ -868,7 +868,7 @@
</%def>
<%def name="four_sides_shorthand(name, sub_property_pattern, parser_function,
needs_context=True, allow_quirks='No', **kwargs)">
needs_context=True, allow_quirks=False, **kwargs)">
<% sub_properties=' '.join(sub_property_pattern % side for side in PHYSICAL_SIDES) %>
<%call expr="self.shorthand(name, sub_properties=sub_properties, **kwargs)">
#[allow(unused_imports)]
@ -881,8 +881,8 @@
input: &mut Parser<'i, 't>,
) -> Result<Longhands, ParseError<'i>> {
let rect = Rect::parse_with(context, input, |_c, i| {
% if allow_quirks != "No":
${parser_function}_quirky(_c, i, specified::AllowQuirks::${allow_quirks})
% if allow_quirks:
${parser_function}_quirky(_c, i, specified::AllowQuirks::Yes)
% elif needs_context:
${parser_function}(_c, i)
% else:

Просмотреть файл

@ -14,7 +14,7 @@ ${helpers.predefined_type(
spec="https://drafts.csswg.org/css-backgrounds/#background-color",
animation_value_type="AnimatedColor",
ignored_when_colors_disabled=True,
allow_quirks="Yes",
allow_quirks=True,
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER \
CAN_ANIMATE_ON_COMPOSITOR",
)}

Просмотреть файл

@ -28,7 +28,7 @@
animation_value_type="AnimatedColor",
logical=is_logical,
logical_group="border-color",
allow_quirks="No" if is_logical else "Yes",
allow_quirks=not is_logical,
flags="APPLIES_TO_FIRST_LETTER",
ignored_when_colors_disabled=True,
)}
@ -56,7 +56,7 @@
logical=is_logical,
logical_group="border-width",
flags="APPLIES_TO_FIRST_LETTER GETCS_NEEDS_LAYOUT_FLUSH",
allow_quirks="No" if is_logical else "Yes",
allow_quirks=not is_logical,
servo_restyle_damage="reflow rebuild_and_reflow_inline"
)}
% endfor

Просмотреть файл

@ -37,7 +37,7 @@ ${helpers.predefined_type(
"computed::ClipRectOrAuto::auto()",
animation_value_type="ComputedValue",
boxed=True,
allow_quirks="Yes",
allow_quirks=True,
spec="https://drafts.fxtf.org/css-masking/#clip-property",
)}

Просмотреть файл

@ -64,7 +64,7 @@ ${helpers.predefined_type(
initial_value="computed::FontSize::medium()",
initial_specified_value="specified::FontSize::medium()",
animation_value_type="NonNegativeLength",
allow_quirks="Yes",
allow_quirks=True,
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-fonts/#propdef-font-size",
servo_restyle_damage="rebuild_and_reflow",

Просмотреть файл

@ -56,7 +56,7 @@ ${helpers.predefined_type(
"computed::LengthPercentage::zero()",
animation_value_type="ComputedValue",
spec="https://drafts.csswg.org/css-text/#propdef-text-indent",
allow_quirks="Yes",
allow_quirks=True,
servo_restyle_damage = "reflow",
)}

Просмотреть файл

@ -17,7 +17,7 @@
"LengthPercentageOrAuto",
"computed::LengthPercentageOrAuto::zero()",
alias=maybe_moz_logical_alias(product, side, "-moz-margin-%s"),
allow_quirks="No" if side[1] else "Yes",
allow_quirks=not side[1],
animation_value_type="ComputedValue",
logical=side[1],
logical_group="margin",

Просмотреть файл

@ -24,7 +24,7 @@
logical_group="padding",
spec=spec,
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_PLACEHOLDER GETCS_NEEDS_LAYOUT_FLUSH",
allow_quirks="No" if side[1] else "Yes",
allow_quirks=not side[1],
servo_restyle_damage="reflow rebuild_and_reflow_inline"
)}
% endfor

Просмотреть файл

@ -17,7 +17,7 @@
spec="https://www.w3.org/TR/CSS2/visuren.html#propdef-%s" % side,
flags="GETCS_NEEDS_LAYOUT_FLUSH",
animation_value_type="ComputedValue",
allow_quirks="Yes",
allow_quirks=True,
servo_restyle_damage="reflow_out_of_flow",
logical_group="inset",
)}
@ -253,7 +253,7 @@ ${helpers.predefined_type(
"computed::Size::auto()",
logical=logical,
logical_group="size",
allow_quirks="No" if logical else "Yes",
allow_quirks=not logical,
spec=spec % size,
animation_value_type="Size",
flags="GETCS_NEEDS_LAYOUT_FLUSH",
@ -266,7 +266,7 @@ ${helpers.predefined_type(
"computed::Size::auto()",
logical=logical,
logical_group="min-size",
allow_quirks="No" if logical else "Yes",
allow_quirks=not logical,
spec=spec % size,
animation_value_type="Size",
servo_restyle_damage="reflow",
@ -277,7 +277,7 @@ ${helpers.predefined_type(
"computed::MaxSize::none()",
logical=logical,
logical_group="max-size",
allow_quirks="No" if logical else "Yes",
allow_quirks=not logical,
spec=spec % size,
animation_value_type="MaxSize",
servo_restyle_damage="reflow",

Просмотреть файл

@ -191,66 +191,3 @@ ${helpers.predefined_type(
animation_value_type="discrete",
flags="CREATES_STACKING_CONTEXT",
)}
${helpers.predefined_type(
"x",
"LengthPercentage",
"computed::LengthPercentage::zero()",
products="gecko",
animation_value_type="ComputedValue",
spec="https://svgwg.org/svg2-draft/geometry.html#X",
)}
${helpers.predefined_type(
"y",
"LengthPercentage",
"computed::LengthPercentage::zero()",
products="gecko",
animation_value_type="ComputedValue",
spec="https://svgwg.org/svg2-draft/geometry.html#Y",
)}
${helpers.predefined_type(
"cx",
"LengthPercentage",
"computed::LengthPercentage::zero()",
products="gecko",
animation_value_type="ComputedValue",
spec="https://svgwg.org/svg2-draft/geometry.html#CX",
)}
${helpers.predefined_type(
"cy",
"LengthPercentage",
"computed::LengthPercentage::zero()",
products="gecko",
animation_value_type="ComputedValue",
spec="https://svgwg.org/svg2-draft/geometry.html#CY",
)}
${helpers.predefined_type(
"rx",
"NonNegativeLengthPercentageOrAuto",
"computed::NonNegativeLengthPercentageOrAuto::auto()",
products="gecko",
animation_value_type="LengthPercentageOrAuto",
spec="https://svgwg.org/svg2-draft/geometry.html#RX",
)}
${helpers.predefined_type(
"ry",
"NonNegativeLengthPercentageOrAuto",
"computed::NonNegativeLengthPercentageOrAuto::auto()",
products="gecko",
animation_value_type="LengthPercentageOrAuto",
spec="https://svgwg.org/svg2-draft/geometry.html#RY",
)}
${helpers.predefined_type(
"r",
"NonNegativeLengthPercentage",
"computed::NonNegativeLengthPercentage::zero()",
products="gecko",
animation_value_type="LengthPercentage",
spec="https://svgwg.org/svg2-draft/geometry.html#R",
)}

Просмотреть файл

@ -7,7 +7,7 @@
${helpers.four_sides_shorthand("border-color", "border-%s-color", "specified::Color::parse",
spec="https://drafts.csswg.org/css-backgrounds/#border-color",
allow_quirks="Yes")}
allow_quirks=True)}
${helpers.four_sides_shorthand(
"border-style",

Просмотреть файл

@ -10,7 +10,7 @@ ${helpers.four_sides_shorthand(
"specified::LengthPercentageOrAuto::parse",
spec="https://drafts.csswg.org/css-box/#propdef-margin",
allowed_in_page_rule=True,
allow_quirks="Yes",
allow_quirks=True,
)}
${helpers.two_properties_shorthand(

Просмотреть файл

@ -9,7 +9,7 @@ ${helpers.four_sides_shorthand(
"padding-%s",
"specified::NonNegativeLengthPercentage::parse",
spec="https://drafts.csswg.org/css-box-3/#propdef-padding",
allow_quirks="Yes",
allow_quirks=True,
)}
${helpers.two_properties_shorthand(

Просмотреть файл

@ -768,7 +768,7 @@ ${helpers.four_sides_shorthand(
"%s",
"specified::LengthPercentageOrAuto::parse",
spec="https://drafts.csswg.org/css-logical/#propdef-inset",
allow_quirks="No",
allow_quirks=False,
)}
${helpers.two_properties_shorthand(

Просмотреть файл

@ -4513,7 +4513,7 @@ pub extern "C" fn Servo_DeclarationBlock_SetLengthValue(
use style::properties::longhands::_moz_script_min_size::SpecifiedValue as MozScriptMinSize;
use style::properties::PropertyDeclaration;
use style::values::generics::NonNegative;
use style::values::generics::length::{Size, LengthPercentageOrAuto};
use style::values::generics::length::Size;
use style::values::specified::length::NoCalcLength;
use style::values::specified::length::{AbsoluteLength, FontRelativeLength};
use style::values::specified::length::LengthPercentage;
@ -4542,14 +4542,6 @@ pub extern "C" fn Servo_DeclarationBlock_SetLengthValue(
let prop = match_wrap_declared! { long,
Width => Size::LengthPercentage(NonNegative(LengthPercentage::Length(nocalc))),
Height => Size::LengthPercentage(NonNegative(LengthPercentage::Length(nocalc))),
X => LengthPercentage::Length(nocalc),
Y => LengthPercentage::Length(nocalc),
Cx => LengthPercentage::Length(nocalc),
Cy => LengthPercentage::Length(nocalc),
R => NonNegative(LengthPercentage::Length(nocalc)),
Rx => LengthPercentageOrAuto::LengthPercentage(NonNegative(LengthPercentage::Length(nocalc))),
Ry => LengthPercentageOrAuto::LengthPercentage(NonNegative(LengthPercentage::Length(nocalc))),
FontSize => LengthPercentage::from(nocalc).into(),
MozScriptMinSize => MozScriptMinSize(nocalc),
};
@ -4600,13 +4592,6 @@ pub extern "C" fn Servo_DeclarationBlock_SetPercentValue(
let prop = match_wrap_declared! { long,
Height => Size::LengthPercentage(NonNegative(lp)),
Width => Size::LengthPercentage(NonNegative(lp)),
X => lp,
Y => lp,
Cx => lp,
Cy => lp,
R => NonNegative(lp),
Rx => LengthPercentageOrAuto::LengthPercentage(NonNegative(lp)),
Ry => LengthPercentageOrAuto::LengthPercentage(NonNegative(lp)),
MarginTop => lp_or_auto,
MarginRight => lp_or_auto,
MarginBottom => lp_or_auto,

Просмотреть файл

@ -0,0 +1,2 @@
[image-embedding-svg-with-viewport-units-inline-style.svg]
expected: FAIL

Просмотреть файл

@ -0,0 +1,2 @@
[image-embedding-svg-with-viewport-units.svg]
expected: FAIL

Просмотреть файл

@ -1,6 +1,19 @@
[properties.svg]
[Untitled]
expected: FAIL
[width and height default to auto]
expected: FAIL
[style rules are applied]
expected: FAIL
[attributes set properties]
expected: FAIL
[style rules override attributes]
expected: FAIL
[width and height default to auto (which computes to "0px")]
expected: FAIL

Просмотреть файл

@ -0,0 +1,16 @@
[cx-valid.svg]
[e.style['cx'\] = "4%" should set the property value]
expected: FAIL
[e.style['cx'\] = "-1px" should set the property value]
expected: FAIL
[e.style['cx'\] = "calc(2em + 3ex)" should set the property value]
expected: FAIL
[e.style['cx'\] = "0" should set the property value]
expected: FAIL
[e.style['cx'\] = "5ch" should set the property value]
expected: FAIL

Просмотреть файл

@ -0,0 +1,16 @@
[cy-valid.svg]
[e.style['cy'\] = "0" should set the property value]
expected: FAIL
[e.style['cy'\] = "calc(2em + 3ex)" should set the property value]
expected: FAIL
[e.style['cy'\] = "4%" should set the property value]
expected: FAIL
[e.style['cy'\] = "-1px" should set the property value]
expected: FAIL
[e.style['cy'\] = "5rem" should set the property value]
expected: FAIL

Просмотреть файл

@ -5,9 +5,15 @@
[SVG Geometry Properties: getComputedStyle().height, <rect> initial]
expected: FAIL
[SVG Geometry Properties: getComputedStyle().height, <rect> presentation attribute]
expected: FAIL
[SVG Geometry Properties: getComputedStyle().height, <rect> inline style (auto)]
expected: FAIL
[SVG Geometry Properties: getComputedStyle().height, <foreignObject> presentation attribute]
expected: FAIL
[SVG Geometry Properties: getComputedStyle().height, <image> initial]
expected: FAIL
@ -38,3 +44,6 @@
[SVG Geometry Properties: getComputedStyle().height, <image> inline style (percentage)]
expected: FAIL
[SVG Geometry Properties: getComputedStyle().height, <image> presentation attribute]
expected: FAIL

Просмотреть файл

@ -0,0 +1,16 @@
[r-valid.svg]
[e.style['r'\] = "1px" should set the property value]
expected: FAIL
[e.style['r'\] = "0" should set the property value]
expected: FAIL
[e.style['r'\] = "calc(2em + 3ex)" should set the property value]
expected: FAIL
[e.style['r'\] = "4%" should set the property value]
expected: FAIL
[e.style['r'\] = "5vmin" should set the property value]
expected: FAIL

Просмотреть файл

@ -0,0 +1,19 @@
[rx-valid.svg]
[e.style['rx'\] = "auto" should set the property value]
expected: FAIL
[e.style['rx'\] = "4%" should set the property value]
expected: FAIL
[e.style['rx'\] = "calc(2em + 3ex)" should set the property value]
expected: FAIL
[e.style['rx'\] = "0" should set the property value]
expected: FAIL
[e.style['rx'\] = "1px" should set the property value]
expected: FAIL
[e.style['rx'\] = "5vw" should set the property value]
expected: FAIL

Просмотреть файл

@ -0,0 +1,37 @@
[ry-valid.svg]
[e.style['rx'\] = "auto" should set the property value]
expected: FAIL
[e.style['rx'\] = "4%" should set the property value]
expected: FAIL
[e.style['rx'\] = "calc(2em + 3ex)" should set the property value]
expected: FAIL
[e.style['rx'\] = "0" should set the property value]
expected: FAIL
[e.style['rx'\] = "1px" should set the property value]
expected: FAIL
[e.style['rx'\] = "5vh" should set the property value]
expected: FAIL
[e.style['ry'\] = "auto" should set the property value]
expected: FAIL
[e.style['ry'\] = "0" should set the property value]
expected: FAIL
[e.style['ry'\] = "calc(2em + 3ex)" should set the property value]
expected: FAIL
[e.style['ry'\] = "4%" should set the property value]
expected: FAIL
[e.style['ry'\] = "1px" should set the property value]
expected: FAIL
[e.style['ry'\] = "5vh" should set the property value]
expected: FAIL

Просмотреть файл

@ -14,12 +14,18 @@
[SVG Geometry Properties: getComputedStyle().width, <rect> initial]
expected: FAIL
[SVG Geometry Properties: getComputedStyle().width, <rect> presentation attribute]
expected: FAIL
[SVG Geometry Properties: getComputedStyle().width, <image> inline style (percentage)]
expected: FAIL
[SVG Geometry Properties: getComputedStyle().width, <svg> presentation attribute]
expected: FAIL
[SVG Geometry Properties: getComputedStyle().width, <foreignObject> presentation attribute]
expected: FAIL
[SVG Geometry Properties: getComputedStyle().width, <foreignObject> inline style (percentage)]
expected: FAIL
@ -38,3 +44,6 @@
[SVG Geometry Properties: getComputedStyle().width, <image> inline style (auto)]
expected: FAIL
[SVG Geometry Properties: getComputedStyle().width, <image> presentation attribute]
expected: FAIL

Просмотреть файл

@ -0,0 +1,16 @@
[x-valid.svg]
[e.style['x'\] = "-1px" should set the property value]
expected: FAIL
[e.style['x'\] = "0" should set the property value]
expected: FAIL
[e.style['x'\] = "calc(2em + 3ex)" should set the property value]
expected: FAIL
[e.style['x'\] = "4%" should set the property value]
expected: FAIL
[e.style['x'\] = "5cm" should set the property value]
expected: FAIL

Просмотреть файл

@ -0,0 +1,16 @@
[y-valid.svg]
[e.style['y'\] = "-1px" should set the property value]
expected: FAIL
[e.style['y'\] = "4%" should set the property value]
expected: FAIL
[e.style['y'\] = "0" should set the property value]
expected: FAIL
[e.style['y'\] = "calc(2em + 3ex)" should set the property value]
expected: FAIL
[e.style['y'\] = "5mm" should set the property value]
expected: FAIL

Просмотреть файл

@ -0,0 +1,2 @@
[percentage.svg]
expected: FAIL

Просмотреть файл

@ -0,0 +1,4 @@
[ellipse-01.svg]
expected:
if (not (os == "win")): FAIL
if (os == "win"): FAIL

Просмотреть файл

@ -0,0 +1,4 @@
[ellipse-02.svg]
expected:
if (not (os == "win")): FAIL
if (os == "win"): FAIL

Просмотреть файл

@ -0,0 +1,4 @@
[ellipse-03.svg]
expected:
if (not (os == "win")): FAIL
if (os == "win"): FAIL

Просмотреть файл

@ -0,0 +1,4 @@
[ellipse-05.svg]
expected:
if (not (os == "win")): FAIL
if (os == "win"): FAIL

Просмотреть файл

@ -0,0 +1,4 @@
[ellipse-06.svg]
expected:
if (not (os == "win")): FAIL
if (os == "win"): FAIL

Просмотреть файл

@ -0,0 +1,4 @@
[ellipse-07.svg]
expected:
if (not (os == "win")): FAIL
if (os == "win"): FAIL

Просмотреть файл

@ -0,0 +1,4 @@
[ellipse-08.svg]
expected:
if (not (os == "win")): FAIL
if (os == "win"): FAIL

Просмотреть файл

@ -0,0 +1,7 @@
[rx-ry-not-inherited.svg]
[Untitled]
expected: FAIL
[rx-ry-not-inherited]
expected: FAIL

Просмотреть файл

@ -21,7 +21,6 @@
<rect style="height: 0" width="10"/>
<rect style="height: -10px"/>
<rect style="height: -10px" width="10"/>
<rect style="width: calc(-10px); height: calc(-10px)"/>
</g>
<g transform="translate(150, 50)">
@ -30,22 +29,22 @@
<circle r="-10"/>
<circle style="r: 0"/>
<circle style="r: -10px"/>
<circle style="r: calc(-10px)"/>
</g>
<g transform="translate(250, 50)">
<ellipse/>
<ellipse rx="0"/>
<ellipse rx="0" ry="10"/>
<ellipse rx="-10" ry="10"/>
<ellipse ry="0"/>
<ellipse ry="0" rx="10"/>
<ellipse ry="-10" rx="10"/>
<ellipse style="rx: 0"/>
<ellipse style="rx: -10px"/>
<ellipse style="rx: 0" ry="10"/>
<ellipse style="ry: 0"/>
<ellipse style="ry: -10px"/>
<ellipse style="ry: 0" rx="10"/>
<ellipse style="rx: calc(-10px); ry: calc(-10px)"/>
</g>
</g>
</svg>

До

Ширина:  |  Высота:  |  Размер: 1.7 KiB

После

Ширина:  |  Высота:  |  Размер: 1.6 KiB

Просмотреть файл

@ -22,7 +22,6 @@
<rect style="height: 0" width="10"/>
<rect style="height: -10px"/>
<rect style="height: -10px" width="10"/>
<rect style="width: calc(-10px); height: calc(-10px)"/>
</g>
<g transform="translate(150, 50)">
@ -31,22 +30,22 @@
<circle r="-10"/>
<circle style="r: 0"/>
<circle style="r: -10px"/>
<circle style="r: calc(-10px)"/>
</g>
<g transform="translate(250, 50)">
<ellipse/>
<ellipse rx="0"/>
<ellipse rx="0" ry="10"/>
<ellipse rx="-10" ry="10"/>
<ellipse ry="0"/>
<ellipse ry="0" rx="10"/>
<ellipse ry="-10" rx="10"/>
<ellipse style="rx: 0"/>
<ellipse style="rx: -10px"/>
<ellipse style="rx: 0" ry="10"/>
<ellipse style="ry: 0"/>
<ellipse style="ry: -10px"/>
<ellipse style="ry: 0" rx="10"/>
<ellipse style="rx: calc(-10px); ry: calc(-10px)"/>
</g>
</g>
<script><![CDATA[

До

Ширина:  |  Высота:  |  Размер: 2.4 KiB

После

Ширина:  |  Высота:  |  Размер: 2.3 KiB