mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 20:35:50 +00:00
Make SVG use the normal attribute mapping codepath (via HasAttributeDependence)
by pushing the relevant helpers up to nsGenericElement.. Remove referrer code in nsSVGDocument, since nsDocument handles that. Bug 233370, r=alex@croczilla.com, sr=jst
This commit is contained in:
parent
51aea1c159
commit
7077fb69a1
@ -2078,6 +2078,23 @@ nsGenericElement::GetClassAttributeName() const
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsGenericElement::FindAttributeDependence(const nsIAtom* aAttribute,
|
||||
const AttributeDependenceEntry* const aMaps[],
|
||||
PRUint32 aMapCount)
|
||||
{
|
||||
for (PRUint32 mapindex = 0; mapindex < aMapCount; ++mapindex) {
|
||||
for (const AttributeDependenceEntry* map = aMaps[mapindex];
|
||||
map->attribute; ++map) {
|
||||
if (aAttribute == *map->attribute) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
already_AddRefed<nsINodeInfo>
|
||||
nsGenericElement::GetExistingAttrNameFromQName(const nsAString& aStr) const
|
||||
{
|
||||
|
@ -414,6 +414,23 @@ public:
|
||||
NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute,
|
||||
PRInt32 aModType,
|
||||
nsChangeHint& aHint) const;
|
||||
/*
|
||||
* Attribute Mapping Helpers
|
||||
*/
|
||||
struct AttributeDependenceEntry {
|
||||
nsIAtom** attribute;
|
||||
};
|
||||
|
||||
/**
|
||||
* A common method where you can just pass in a list of maps to check
|
||||
* for attribute dependence. Most implementations of
|
||||
* HasAttributeDependentStyle should use this function as a default
|
||||
* handler.
|
||||
*/
|
||||
static PRBool
|
||||
FindAttributeDependence(const nsIAtom* aAttribute,
|
||||
const AttributeDependenceEntry* const aMaps[],
|
||||
PRUint32 aMapCount);
|
||||
|
||||
// nsIXMLContent interface methods
|
||||
NS_IMETHOD MaybeTriggerAutoLink(nsIDocShell *aShell);
|
||||
|
@ -3077,7 +3077,7 @@ nsGenericHTMLElement::sCommonAttributeMap[] = {
|
||||
{ nsnull }
|
||||
};
|
||||
|
||||
/* static */ const nsGenericHTMLElement::AttributeDependenceEntry
|
||||
/* static */ const nsGenericElement::AttributeDependenceEntry
|
||||
nsGenericHTMLElement::sImageMarginSizeAttributeMap[] = {
|
||||
{ &nsHTMLAtoms::width },
|
||||
{ &nsHTMLAtoms::height },
|
||||
@ -3086,55 +3086,37 @@ nsGenericHTMLElement::sImageMarginSizeAttributeMap[] = {
|
||||
{ nsnull }
|
||||
};
|
||||
|
||||
/* static */ const nsGenericHTMLElement::AttributeDependenceEntry
|
||||
/* static */ const nsGenericElement::AttributeDependenceEntry
|
||||
nsGenericHTMLElement::sImageAlignAttributeMap[] = {
|
||||
{ &nsHTMLAtoms::align },
|
||||
{ nsnull }
|
||||
};
|
||||
|
||||
/* static */ const nsGenericHTMLElement::AttributeDependenceEntry
|
||||
/* static */ const nsGenericElement::AttributeDependenceEntry
|
||||
nsGenericHTMLElement::sDivAlignAttributeMap[] = {
|
||||
{ &nsHTMLAtoms::align },
|
||||
{ nsnull }
|
||||
};
|
||||
|
||||
/* static */ const nsGenericHTMLElement::AttributeDependenceEntry
|
||||
/* static */ const nsGenericElement::AttributeDependenceEntry
|
||||
nsGenericHTMLElement::sImageBorderAttributeMap[] = {
|
||||
{ &nsHTMLAtoms::border },
|
||||
{ nsnull }
|
||||
};
|
||||
|
||||
/* static */ const nsGenericHTMLElement::AttributeDependenceEntry
|
||||
/* static */ const nsGenericElement::AttributeDependenceEntry
|
||||
nsGenericHTMLElement::sBackgroundAttributeMap[] = {
|
||||
{ &nsHTMLAtoms::background },
|
||||
{ &nsHTMLAtoms::bgcolor },
|
||||
{ nsnull }
|
||||
};
|
||||
|
||||
/* static */ const nsGenericHTMLElement::AttributeDependenceEntry
|
||||
/* static */ const nsGenericElement::AttributeDependenceEntry
|
||||
nsGenericHTMLElement::sScrollingAttributeMap[] = {
|
||||
{ &nsHTMLAtoms::scrolling },
|
||||
{ nsnull }
|
||||
};
|
||||
|
||||
PRBool
|
||||
nsGenericHTMLElement::FindAttributeDependence(const nsIAtom* aAttribute,
|
||||
const AttributeDependenceEntry* const aMaps[],
|
||||
PRUint32 aMapCount)
|
||||
{
|
||||
for (PRUint32 mapindex = 0; mapindex < aMapCount; ++mapindex) {
|
||||
for (const AttributeDependenceEntry* map = aMaps[mapindex];
|
||||
map->attribute; ++map) {
|
||||
if (aAttribute == *map->attribute) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsGenericHTMLElement::MapImageAlignAttributeInto(const nsMappedAttributes* aAttributes,
|
||||
nsRuleData* aRuleData)
|
||||
|
@ -500,9 +500,6 @@ public:
|
||||
|
||||
/*
|
||||
* Attribute Mapping Helpers
|
||||
*
|
||||
* All attributes that are mapped into style contexts must have a
|
||||
* matched set of mapping function and impact getter
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -516,10 +513,6 @@ public:
|
||||
*/
|
||||
static void MapCommonAttributesInto(const nsMappedAttributes* aAttributes,
|
||||
nsRuleData* aRuleData);
|
||||
struct AttributeDependenceEntry {
|
||||
nsIAtom** attribute;
|
||||
};
|
||||
|
||||
static const AttributeDependenceEntry sCommonAttributeMap[];
|
||||
static const AttributeDependenceEntry sImageMarginSizeAttributeMap[];
|
||||
static const AttributeDependenceEntry sImageBorderAttributeMap[];
|
||||
@ -528,16 +521,6 @@ public:
|
||||
static const AttributeDependenceEntry sBackgroundAttributeMap[];
|
||||
static const AttributeDependenceEntry sScrollingAttributeMap[];
|
||||
|
||||
/**
|
||||
* A common method where you can just pass in a list of maps to check
|
||||
* for attribute dependence. Most implementations of
|
||||
* HasAttributeDependentStyle should use this function as a default
|
||||
* handler.
|
||||
*/
|
||||
static PRBool
|
||||
FindAttributeDependence(const nsIAtom* aAttribute,
|
||||
const AttributeDependenceEntry* const aMaps[],
|
||||
PRUint32 aMapCount);
|
||||
/**
|
||||
* Helper to map the align attribute into a style struct.
|
||||
*
|
||||
|
@ -96,7 +96,6 @@ EXPORTS = \
|
||||
nsISVGValueObserver.h \
|
||||
nsISVGValueUtils.h \
|
||||
nsSVGTypeCIDs.h \
|
||||
nsISVGContent.h \
|
||||
$(NULL)
|
||||
|
||||
|
||||
|
@ -1,59 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ----- BEGIN LICENSE BLOCK -----
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Mozilla SVG project.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Crocodile Clips Ltd..
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ----- END LICENSE BLOCK ----- */
|
||||
|
||||
#ifndef __NS_ISVGCONTENT__
|
||||
#define __NS_ISVGCONTENT__
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// nsISVGContent
|
||||
|
||||
// {4473C9A8-4376-48A5-BF99-D5820A1FF14E}
|
||||
#define NS_ISVGCONTENT_IID \
|
||||
{ 0x4473c9a8, 0x4376, 0x48a5, { 0xbf, 0x99, 0xd5, 0x82, 0x0a, 0x1f, 0xf1, 0x4e } }
|
||||
|
||||
class nsISVGContent : public nsISupports
|
||||
{
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_ISVGCONTENT_IID; return iid; }
|
||||
|
||||
NS_IMETHOD IsPresentationAttribute(const nsIAtom* attribute, PRBool* retval)=0;
|
||||
};
|
||||
|
||||
#endif // __NS_ISVGCONTENT__
|
@ -53,7 +53,6 @@
|
||||
#include "nsCSSDeclaration.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsSVGAtoms.h"
|
||||
#include "nsISVGContent.h"
|
||||
#include "nsDOMError.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@ -568,12 +567,10 @@ nsSVGAttributes::AffectsContentStyleRule(const nsIAtom* aAttribute)
|
||||
{
|
||||
NS_ASSERTION(mContent, "null owner");
|
||||
|
||||
nsCOMPtr<nsISVGContent> svgcontent = do_QueryInterface(mContent);
|
||||
NS_ASSERTION(svgcontent, "could not get nsISVGContent interface");
|
||||
nsCOMPtr<nsIStyledContent> styledContent = do_QueryInterface(mContent);
|
||||
NS_ASSERTION(styledContent, "could not get nsIStyledContent interface");
|
||||
|
||||
PRBool retval;
|
||||
svgcontent->IsPresentationAttribute(aAttribute, &retval);
|
||||
return retval;
|
||||
return styledContent->HasAttributeDependentStyle(aAttribute);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -89,7 +89,6 @@ NS_INTERFACE_MAP_BEGIN(nsSVGElement)
|
||||
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOM3Node, new nsNode3Tearoff(this))
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISVGContent)
|
||||
// provided by nsGenericElement:
|
||||
// NS_INTERFACE_MAP_ENTRY(nsIStyledContent)
|
||||
// NS_INTERFACE_MAP_ENTRY(nsIContent)
|
||||
@ -278,6 +277,72 @@ nsSVGElement::GetInlineStyleRule(nsICSSStyleRule** aStyleRule)
|
||||
return mStyle->GetStyleRule(this, aStyleRule);
|
||||
}
|
||||
|
||||
// PresentationAttributes-FillStroke
|
||||
/* static */ const nsGenericElement::AttributeDependenceEntry
|
||||
nsSVGElement::sFillStrokeMap[] = {
|
||||
{ &nsSVGAtoms::fill },
|
||||
{ &nsSVGAtoms::fill_opacity },
|
||||
{ &nsSVGAtoms::fill_rule },
|
||||
{ &nsSVGAtoms::stroke },
|
||||
{ &nsSVGAtoms::stroke_dasharray },
|
||||
{ &nsSVGAtoms::stroke_dashoffset },
|
||||
{ &nsSVGAtoms::stroke_linecap },
|
||||
{ &nsSVGAtoms::stroke_linejoin },
|
||||
{ &nsSVGAtoms::stroke_miterlimit },
|
||||
{ &nsSVGAtoms::stroke_opacity },
|
||||
{ &nsSVGAtoms::stroke_width },
|
||||
{ nsnull }
|
||||
};
|
||||
|
||||
// PresentationAttributes-Graphics
|
||||
/* static */ const nsGenericElement::AttributeDependenceEntry
|
||||
nsSVGElement::sGraphicsMap[] = {
|
||||
{ &nsSVGAtoms::clip_path },
|
||||
{ &nsSVGAtoms::clip_rule },
|
||||
{ &nsSVGAtoms::cursor },
|
||||
{ &nsSVGAtoms::display },
|
||||
{ &nsSVGAtoms::filter },
|
||||
{ &nsSVGAtoms::image_rendering },
|
||||
{ &nsSVGAtoms::mask },
|
||||
{ &nsSVGAtoms::opacity },
|
||||
{ &nsSVGAtoms::pointer_events },
|
||||
{ &nsSVGAtoms::shape_rendering },
|
||||
{ &nsSVGAtoms::text_rendering },
|
||||
{ &nsSVGAtoms::visibility },
|
||||
{ nsnull }
|
||||
};
|
||||
|
||||
// PresentationAttributes-TextContentElements
|
||||
/* static */ const nsGenericElement::AttributeDependenceEntry
|
||||
nsSVGElement::sTextContentElementsMap[] = {
|
||||
{ &nsSVGAtoms::alignment_baseline },
|
||||
{ &nsSVGAtoms::baseline_shift },
|
||||
{ &nsSVGAtoms::direction },
|
||||
{ &nsSVGAtoms::dominant_baseline },
|
||||
{ &nsSVGAtoms::glyph_orientation_horizontal },
|
||||
{ &nsSVGAtoms::glyph_orientation_vertical },
|
||||
{ &nsSVGAtoms::kerning },
|
||||
{ &nsSVGAtoms::letter_spacing },
|
||||
{ &nsSVGAtoms::text_anchor },
|
||||
{ &nsSVGAtoms::text_decoration },
|
||||
{ &nsSVGAtoms::unicode_bidi },
|
||||
{ &nsSVGAtoms::word_spacing },
|
||||
{ nsnull }
|
||||
};
|
||||
|
||||
// PresentationAttributes-FontSpecification
|
||||
/* static */ const nsGenericElement::AttributeDependenceEntry
|
||||
nsSVGElement::sFontSpecificationMap[] = {
|
||||
{ &nsSVGAtoms::font_family },
|
||||
{ &nsSVGAtoms::font_size },
|
||||
{ &nsSVGAtoms::font_size_adjust },
|
||||
{ &nsSVGAtoms::font_stretch },
|
||||
{ &nsSVGAtoms::font_style },
|
||||
{ &nsSVGAtoms::font_variant },
|
||||
{ &nsSVGAtoms::font_weight },
|
||||
{ nsnull }
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMNode methods
|
||||
|
||||
|
@ -53,13 +53,11 @@
|
||||
#include "nsISVGValueObserver.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsISVGStyleValue.h"
|
||||
#include "nsISVGContent.h"
|
||||
|
||||
class nsSVGElement : public nsGenericElement, // :nsIHTMLContent:nsIXMLContent:nsIStyledContent:nsIContent
|
||||
public nsIDOMSVGElement, // :nsIDOMElement:nsIDOMNode
|
||||
public nsISVGValueObserver,
|
||||
public nsSupportsWeakReference, // :nsISupportsWeakReference
|
||||
public nsISVGContent
|
||||
public nsSupportsWeakReference // :nsISupportsWeakReference
|
||||
{
|
||||
protected:
|
||||
nsSVGElement();
|
||||
@ -126,6 +124,11 @@ public:
|
||||
|
||||
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
|
||||
NS_IMETHOD GetInlineStyleRule(nsICSSStyleRule** aStyleRule);
|
||||
|
||||
static const AttributeDependenceEntry sFillStrokeMap[];
|
||||
static const AttributeDependenceEntry sGraphicsMap[];
|
||||
static const AttributeDependenceEntry sTextContentElementsMap[];
|
||||
static const AttributeDependenceEntry sFontSpecificationMap[];
|
||||
|
||||
// nsIDOMNode
|
||||
NS_DECL_NSIDOMNODE
|
||||
@ -143,10 +146,6 @@ public:
|
||||
|
||||
// nsISupportsWeakReference
|
||||
// implementation inherited from nsSupportsWeakReference
|
||||
|
||||
// nsISVGContent interface
|
||||
NS_IMETHOD IsPresentationAttribute(const nsIAtom* attribute, PRBool* retval){*retval=PR_FALSE; return NS_OK;}
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -63,9 +63,8 @@ public:
|
||||
NS_FORWARD_NSIDOMELEMENT(nsSVGGElementBase::)
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGGElementBase::)
|
||||
|
||||
// nsISVGContent interface
|
||||
NS_IMETHOD IsPresentationAttribute(const nsIAtom* attribute, PRBool* retval);
|
||||
|
||||
// nsIStyledContent
|
||||
NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
|
||||
protected:
|
||||
};
|
||||
|
||||
@ -173,37 +172,16 @@ nsSVGGElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISVGContent methods
|
||||
// nsIStyledContent methods
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGGElement::IsPresentationAttribute(const nsIAtom* name, PRBool *retval)
|
||||
NS_IMETHODIMP_(PRBool)
|
||||
nsSVGGElement::HasAttributeDependentStyle(const nsIAtom* name) const
|
||||
{
|
||||
if (
|
||||
// PresentationAttributes-TextContentElements
|
||||
name==nsSVGAtoms::alignment_baseline ||
|
||||
name==nsSVGAtoms::baseline_shift ||
|
||||
name==nsSVGAtoms::direction ||
|
||||
name==nsSVGAtoms::dominant_baseline ||
|
||||
name==nsSVGAtoms::glyph_orientation_horizontal ||
|
||||
name==nsSVGAtoms::glyph_orientation_vertical ||
|
||||
name==nsSVGAtoms::kerning ||
|
||||
name==nsSVGAtoms::letter_spacing ||
|
||||
name==nsSVGAtoms::text_anchor ||
|
||||
name==nsSVGAtoms::text_decoration ||
|
||||
name==nsSVGAtoms::unicode_bidi ||
|
||||
name==nsSVGAtoms::word_spacing ||
|
||||
// PresentationAttributes-FontSpecification
|
||||
name==nsSVGAtoms::font_family ||
|
||||
name==nsSVGAtoms::font_size ||
|
||||
name==nsSVGAtoms::font_size_adjust ||
|
||||
name==nsSVGAtoms::font_stretch ||
|
||||
name==nsSVGAtoms::font_style ||
|
||||
name==nsSVGAtoms::font_variant ||
|
||||
name==nsSVGAtoms::font_weight
|
||||
) {
|
||||
*retval = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
else
|
||||
return nsSVGGElementBase::IsPresentationAttribute(name, retval);
|
||||
static const AttributeDependenceEntry* const map[] = {
|
||||
sTextContentElementsMap,
|
||||
sFontSpecificationMap
|
||||
};
|
||||
|
||||
return FindAttributeDependence(name, map, NS_ARRAY_LENGTH(map)) ||
|
||||
nsSVGGElementBase::HasAttributeDependentStyle(name);
|
||||
}
|
||||
|
@ -304,42 +304,17 @@ NS_IMETHODIMP nsSVGGraphicElement::GetTransform(nsIDOMSVGAnimatedTransformList *
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISVGContent methods
|
||||
// nsIStyledContent methods
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGGraphicElement::IsPresentationAttribute(const nsIAtom* name, PRBool *retval)
|
||||
NS_IMETHODIMP_(PRBool)
|
||||
nsSVGGraphicElement::HasAttributeDependentStyle(const nsIAtom* name) const
|
||||
{
|
||||
if (
|
||||
// PresentationAttributes-FillStroke
|
||||
name==nsSVGAtoms::fill ||
|
||||
name==nsSVGAtoms::fill_opacity ||
|
||||
name==nsSVGAtoms::fill_rule ||
|
||||
name==nsSVGAtoms::stroke ||
|
||||
name==nsSVGAtoms::stroke_dasharray ||
|
||||
name==nsSVGAtoms::stroke_dashoffset ||
|
||||
name==nsSVGAtoms::stroke_linecap ||
|
||||
name==nsSVGAtoms::stroke_linejoin ||
|
||||
name==nsSVGAtoms::stroke_miterlimit ||
|
||||
name==nsSVGAtoms::stroke_opacity ||
|
||||
name==nsSVGAtoms::stroke_width ||
|
||||
// PresentationAttributes-Graphics
|
||||
name==nsSVGAtoms::clip_path ||
|
||||
name==nsSVGAtoms::clip_rule ||
|
||||
name==nsSVGAtoms::cursor ||
|
||||
name==nsSVGAtoms::display ||
|
||||
name==nsSVGAtoms::filter ||
|
||||
name==nsSVGAtoms::image_rendering ||
|
||||
name==nsSVGAtoms::mask ||
|
||||
name==nsSVGAtoms::opacity ||
|
||||
name==nsSVGAtoms::pointer_events ||
|
||||
name==nsSVGAtoms::shape_rendering ||
|
||||
name==nsSVGAtoms::text_rendering ||
|
||||
name==nsSVGAtoms::visibility
|
||||
) {
|
||||
*retval = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
else
|
||||
return nsSVGGraphicElementBase::IsPresentationAttribute(name, retval);
|
||||
static const AttributeDependenceEntry* const map[] = {
|
||||
sFillStrokeMap,
|
||||
sGraphicsMap,
|
||||
};
|
||||
|
||||
return FindAttributeDependence(name, map, NS_ARRAY_LENGTH(map)) ||
|
||||
nsSVGGraphicElementBase::HasAttributeDependentStyle(name);
|
||||
}
|
||||
|
||||
|
@ -58,8 +58,8 @@ public:
|
||||
NS_DECL_NSIDOMSVGLOCATABLE
|
||||
NS_DECL_NSIDOMSVGTRANSFORMABLE
|
||||
|
||||
// nsISVGContent interface
|
||||
NS_IMETHOD IsPresentationAttribute(const nsIAtom* attribute, PRBool* retval);
|
||||
// nsIStyledContent interface
|
||||
NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -92,8 +92,8 @@ public:
|
||||
// nsISVGSVGElement interface:
|
||||
NS_IMETHOD GetParentViewportRect(nsISVGViewportRect **parentViewport);
|
||||
|
||||
// nsISVGContent interface
|
||||
NS_IMETHOD IsPresentationAttribute(const nsIAtom* attribute, PRBool* retval);
|
||||
// nsIStyledContent interface
|
||||
NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
|
||||
|
||||
// nsISVGValueObserver
|
||||
NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable);
|
||||
@ -1083,64 +1083,20 @@ nsSVGSVGElement::GetParentViewportRect(nsISVGViewportRect **parentViewport)
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISVGContent methods
|
||||
// nsIStyledContent methods
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGSVGElement::IsPresentationAttribute(const nsIAtom* name, PRBool *retval)
|
||||
NS_IMETHODIMP_(PRBool)
|
||||
nsSVGSVGElement::HasAttributeDependentStyle(const nsIAtom* name) const
|
||||
{
|
||||
if (
|
||||
// PresentationAttributes-FillStroke
|
||||
name==nsSVGAtoms::fill ||
|
||||
name==nsSVGAtoms::fill_opacity ||
|
||||
name==nsSVGAtoms::fill_rule ||
|
||||
name==nsSVGAtoms::stroke ||
|
||||
name==nsSVGAtoms::stroke_dasharray ||
|
||||
name==nsSVGAtoms::stroke_dashoffset ||
|
||||
name==nsSVGAtoms::stroke_linecap ||
|
||||
name==nsSVGAtoms::stroke_linejoin ||
|
||||
name==nsSVGAtoms::stroke_miterlimit ||
|
||||
name==nsSVGAtoms::stroke_opacity ||
|
||||
name==nsSVGAtoms::stroke_width ||
|
||||
// PresentationAttributes-Graphics
|
||||
name==nsSVGAtoms::clip_path ||
|
||||
name==nsSVGAtoms::clip_rule ||
|
||||
name==nsSVGAtoms::cursor ||
|
||||
name==nsSVGAtoms::display ||
|
||||
name==nsSVGAtoms::filter ||
|
||||
name==nsSVGAtoms::image_rendering ||
|
||||
name==nsSVGAtoms::mask ||
|
||||
name==nsSVGAtoms::opacity ||
|
||||
name==nsSVGAtoms::pointer_events ||
|
||||
name==nsSVGAtoms::shape_rendering ||
|
||||
name==nsSVGAtoms::text_rendering ||
|
||||
name==nsSVGAtoms::visibility ||
|
||||
// PresentationAttributes-TextContentElements
|
||||
name==nsSVGAtoms::alignment_baseline ||
|
||||
name==nsSVGAtoms::baseline_shift ||
|
||||
name==nsSVGAtoms::direction ||
|
||||
name==nsSVGAtoms::dominant_baseline ||
|
||||
name==nsSVGAtoms::glyph_orientation_horizontal ||
|
||||
name==nsSVGAtoms::glyph_orientation_vertical ||
|
||||
name==nsSVGAtoms::kerning ||
|
||||
name==nsSVGAtoms::letter_spacing ||
|
||||
name==nsSVGAtoms::text_anchor ||
|
||||
name==nsSVGAtoms::text_decoration ||
|
||||
name==nsSVGAtoms::unicode_bidi ||
|
||||
name==nsSVGAtoms::word_spacing ||
|
||||
// PresentationAttributes-FontSpecification
|
||||
name==nsSVGAtoms::font_family ||
|
||||
name==nsSVGAtoms::font_size ||
|
||||
name==nsSVGAtoms::font_size_adjust ||
|
||||
name==nsSVGAtoms::font_stretch ||
|
||||
name==nsSVGAtoms::font_style ||
|
||||
name==nsSVGAtoms::font_variant ||
|
||||
name==nsSVGAtoms::font_weight
|
||||
) {
|
||||
*retval = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
else
|
||||
return nsSVGElement::IsPresentationAttribute(name, retval);
|
||||
static const AttributeDependenceEntry* const map[] = {
|
||||
sFillStrokeMap,
|
||||
sGraphicsMap,
|
||||
sTextContentElementsMap,
|
||||
sFontSpecificationMap
|
||||
};
|
||||
|
||||
return FindAttributeDependence(name, map, NS_ARRAY_LENGTH(map)) ||
|
||||
nsSVGElement::HasAttributeDependentStyle(name);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -73,9 +73,9 @@ public:
|
||||
NS_FORWARD_NSIDOMELEMENT(nsSVGTSpanElementBase::)
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGTSpanElementBase::)
|
||||
|
||||
// nsISVGContent interface
|
||||
NS_IMETHOD IsPresentationAttribute(const nsIAtom* attribute, PRBool* retval);
|
||||
|
||||
// nsIStyledContent interface
|
||||
NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
|
||||
|
||||
protected:
|
||||
|
||||
virtual void ParentChainChanged();
|
||||
@ -341,64 +341,20 @@ NS_IMETHODIMP nsSVGTSpanElement::SelectSubString(PRUint32 charnum, PRUint32 ncha
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISVGContent methods
|
||||
// nsIStyledContent methods
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGTSpanElement::IsPresentationAttribute(const nsIAtom* name, PRBool *retval)
|
||||
NS_IMETHODIMP_(PRBool)
|
||||
nsSVGTSpanElement::HasAttributeDependentStyle(const nsIAtom* name) const
|
||||
{
|
||||
if (
|
||||
// PresentationAttributes-FillStroke
|
||||
name==nsSVGAtoms::fill ||
|
||||
name==nsSVGAtoms::fill_opacity ||
|
||||
name==nsSVGAtoms::fill_rule ||
|
||||
name==nsSVGAtoms::stroke ||
|
||||
name==nsSVGAtoms::stroke_dasharray ||
|
||||
name==nsSVGAtoms::stroke_dashoffset ||
|
||||
name==nsSVGAtoms::stroke_linecap ||
|
||||
name==nsSVGAtoms::stroke_linejoin ||
|
||||
name==nsSVGAtoms::stroke_miterlimit ||
|
||||
name==nsSVGAtoms::stroke_opacity ||
|
||||
name==nsSVGAtoms::stroke_width ||
|
||||
// PresentationAttributes-Graphics
|
||||
name==nsSVGAtoms::clip_path ||
|
||||
name==nsSVGAtoms::clip_rule ||
|
||||
name==nsSVGAtoms::cursor ||
|
||||
name==nsSVGAtoms::display ||
|
||||
name==nsSVGAtoms::filter ||
|
||||
name==nsSVGAtoms::image_rendering ||
|
||||
name==nsSVGAtoms::mask ||
|
||||
name==nsSVGAtoms::opacity ||
|
||||
name==nsSVGAtoms::pointer_events ||
|
||||
name==nsSVGAtoms::shape_rendering ||
|
||||
name==nsSVGAtoms::text_rendering ||
|
||||
name==nsSVGAtoms::visibility ||
|
||||
// PresentationAttributes-TextContentElements
|
||||
name==nsSVGAtoms::alignment_baseline ||
|
||||
name==nsSVGAtoms::baseline_shift ||
|
||||
name==nsSVGAtoms::direction ||
|
||||
name==nsSVGAtoms::dominant_baseline ||
|
||||
name==nsSVGAtoms::glyph_orientation_horizontal ||
|
||||
name==nsSVGAtoms::glyph_orientation_vertical ||
|
||||
name==nsSVGAtoms::kerning ||
|
||||
name==nsSVGAtoms::letter_spacing ||
|
||||
name==nsSVGAtoms::text_anchor ||
|
||||
name==nsSVGAtoms::text_decoration ||
|
||||
name==nsSVGAtoms::unicode_bidi ||
|
||||
name==nsSVGAtoms::word_spacing ||
|
||||
// PresentationAttributes-FontSpecification
|
||||
name==nsSVGAtoms::font_family ||
|
||||
name==nsSVGAtoms::font_size ||
|
||||
name==nsSVGAtoms::font_size_adjust ||
|
||||
name==nsSVGAtoms::font_stretch ||
|
||||
name==nsSVGAtoms::font_style ||
|
||||
name==nsSVGAtoms::font_variant ||
|
||||
name==nsSVGAtoms::font_weight
|
||||
) {
|
||||
*retval = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
else
|
||||
return nsSVGTSpanElementBase::IsPresentationAttribute(name, retval);
|
||||
static const AttributeDependenceEntry* const map[] = {
|
||||
sFillStrokeMap,
|
||||
sGraphicsMap,
|
||||
sTextContentElementsMap,
|
||||
sFontSpecificationMap
|
||||
};
|
||||
|
||||
return FindAttributeDependence(name, map, NS_ARRAY_LENGTH(map)) ||
|
||||
nsSVGTSpanElementBase::HasAttributeDependentStyle(name);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -77,8 +77,8 @@ public:
|
||||
NS_FORWARD_NSIDOMELEMENT(nsSVGTextElementBase::)
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGTextElementBase::)
|
||||
|
||||
// nsISVGContent interface
|
||||
NS_IMETHOD IsPresentationAttribute(const nsIAtom* attribute, PRBool* retval);
|
||||
// nsIStyledContent interface
|
||||
NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
|
||||
|
||||
protected:
|
||||
virtual void ParentChainChanged();
|
||||
@ -350,39 +350,18 @@ NS_IMETHODIMP nsSVGTextElement::SelectSubString(PRUint32 charnum, PRUint32 nchar
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISVGContent methods
|
||||
// nsIStyledContent methods
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGTextElement::IsPresentationAttribute(const nsIAtom* name, PRBool *retval)
|
||||
NS_IMETHODIMP_(PRBool)
|
||||
nsSVGTextElement::HasAttributeDependentStyle(const nsIAtom* name) const
|
||||
{
|
||||
if (
|
||||
// PresentationAttributes-TextContentElements
|
||||
name==nsSVGAtoms::alignment_baseline ||
|
||||
name==nsSVGAtoms::baseline_shift ||
|
||||
name==nsSVGAtoms::direction ||
|
||||
name==nsSVGAtoms::dominant_baseline ||
|
||||
name==nsSVGAtoms::glyph_orientation_horizontal ||
|
||||
name==nsSVGAtoms::glyph_orientation_vertical ||
|
||||
name==nsSVGAtoms::kerning ||
|
||||
name==nsSVGAtoms::letter_spacing ||
|
||||
name==nsSVGAtoms::text_anchor ||
|
||||
name==nsSVGAtoms::text_decoration ||
|
||||
name==nsSVGAtoms::unicode_bidi ||
|
||||
name==nsSVGAtoms::word_spacing ||
|
||||
// PresentationAttributes-FontSpecification
|
||||
name==nsSVGAtoms::font_family ||
|
||||
name==nsSVGAtoms::font_size ||
|
||||
name==nsSVGAtoms::font_size_adjust ||
|
||||
name==nsSVGAtoms::font_stretch ||
|
||||
name==nsSVGAtoms::font_style ||
|
||||
name==nsSVGAtoms::font_variant ||
|
||||
name==nsSVGAtoms::font_weight
|
||||
) {
|
||||
*retval = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
else
|
||||
return nsSVGTextElementBase::IsPresentationAttribute(name, retval);
|
||||
static const AttributeDependenceEntry* const map[] = {
|
||||
sTextContentElementsMap,
|
||||
sFontSpecificationMap
|
||||
};
|
||||
|
||||
return FindAttributeDependence(name, map, NS_ARRAY_LENGTH(map)) ||
|
||||
nsSVGTextElementBase::HasAttributeDependentStyle(name);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -61,35 +61,6 @@ nsSVGDocument::~nsSVGDocument() {
|
||||
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSVGDocument::StartDocumentLoad(const char* aCommand,
|
||||
nsIChannel* aChannel,
|
||||
nsILoadGroup* aLoadGroup,
|
||||
nsISupports* aContainer,
|
||||
nsIStreamListener **aDocListener,
|
||||
PRBool aReset,
|
||||
nsIContentSink* aSink) {
|
||||
nsresult rv = nsXMLDocument::StartDocumentLoad(aCommand,
|
||||
aChannel,
|
||||
aLoadGroup,
|
||||
aContainer,
|
||||
aDocListener,
|
||||
aReset,
|
||||
aSink);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aChannel);
|
||||
if (httpChannel) {
|
||||
nsCAutoString referrer;
|
||||
rv = httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("referrer"), referrer);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
CopyUTF8toUTF16(referrer, mReferrer);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIDOMSVGDocument
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -99,8 +70,7 @@ nsSVGDocument::GetTitle(nsAString& aTitle) {
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGDocument::GetReferrer(nsAString& aReferrer) {
|
||||
aReferrer.Assign(mReferrer);
|
||||
return NS_OK;
|
||||
return nsDocument::GetReferrer(aReferrer);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -51,24 +51,12 @@ class nsSVGDocument : public nsXMLDocument,
|
||||
nsSVGDocument();
|
||||
virtual ~nsSVGDocument();
|
||||
|
||||
// Most methods will just fall through to the XMLDocument
|
||||
|
||||
virtual nsresult StartDocumentLoad(const char* aCommand,
|
||||
nsIChannel* aChannel,
|
||||
nsILoadGroup* aLoadGroup,
|
||||
nsISupports* aContainer,
|
||||
nsIStreamListener **aDocListener,
|
||||
PRBool aReset = PR_TRUE,
|
||||
nsIContentSink* aSink = nsnull);
|
||||
|
||||
NS_DECL_NSIDOMSVGDOCUMENT
|
||||
NS_FORWARD_NSIDOMDOCUMENT(nsXMLDocument::)
|
||||
NS_FORWARD_NSIDOMNODE(nsXMLDocument::)
|
||||
NS_FORWARD_NSIDOMDOCUMENTEVENT(nsXMLDocument::)
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
protected:
|
||||
nsString mReferrer;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -79,9 +79,6 @@
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
#ifdef MOZ_SVG
|
||||
#include "nsISVGContent.h"
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
//#define NOISY_DEBUG
|
||||
@ -1933,16 +1930,6 @@ FrameManager::HasAttributeDependentStyle(nsIContent *aContent,
|
||||
*aResult = nsReStyleHint(*aResult | eReStyle_Self);
|
||||
}
|
||||
|
||||
#ifdef MOZ_SVG
|
||||
nsCOMPtr<nsISVGContent> svg(do_QueryInterface(aContent));
|
||||
if (svg) {
|
||||
PRBool isPresAttr;
|
||||
svg->IsPresentationAttribute(aAttribute, &isPresAttr);
|
||||
if (isPresAttr)
|
||||
*aResult = nsReStyleHint(*aResult | eReStyle_Self);
|
||||
}
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -79,9 +79,6 @@
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
#ifdef MOZ_SVG
|
||||
#include "nsISVGContent.h"
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
//#define NOISY_DEBUG
|
||||
@ -1933,16 +1930,6 @@ FrameManager::HasAttributeDependentStyle(nsIContent *aContent,
|
||||
*aResult = nsReStyleHint(*aResult | eReStyle_Self);
|
||||
}
|
||||
|
||||
#ifdef MOZ_SVG
|
||||
nsCOMPtr<nsISVGContent> svg(do_QueryInterface(aContent));
|
||||
if (svg) {
|
||||
PRBool isPresAttr;
|
||||
svg->IsPresentationAttribute(aAttribute, &isPresAttr);
|
||||
if (isPresAttr)
|
||||
*aResult = nsReStyleHint(*aResult | eReStyle_Self);
|
||||
}
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user