2006-05-02 15:05:25 +00:00
|
|
|
/* -*- 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 IBM Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2006
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either of 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 MPL, 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 ***** */
|
|
|
|
|
|
|
|
#include "nsPresContext.h"
|
2011-05-01 19:26:20 +01:00
|
|
|
#include "nsSVGPathElement.h"
|
2006-05-02 15:05:25 +00:00
|
|
|
#include "nsSVGUtils.h"
|
|
|
|
#include "nsSVGGeometryFrame.h"
|
2006-05-16 15:55:01 +00:00
|
|
|
#include "nsSVGPaintServerFrame.h"
|
|
|
|
#include "nsContentUtils.h"
|
2006-11-27 17:30:57 +00:00
|
|
|
#include "gfxContext.h"
|
2008-10-01 13:51:05 +13:00
|
|
|
#include "nsSVGEffects.h"
|
2006-05-02 15:05:25 +00:00
|
|
|
|
2009-09-12 17:49:24 +01:00
|
|
|
NS_IMPL_FRAMEARENA_HELPERS(nsSVGGeometryFrame)
|
|
|
|
|
2006-05-02 15:05:25 +00:00
|
|
|
//----------------------------------------------------------------------
|
2007-07-17 01:40:28 -07:00
|
|
|
// nsIFrame methods
|
2006-05-02 15:05:25 +00:00
|
|
|
|
2006-08-23 18:16:15 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGGeometryFrame::Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow)
|
|
|
|
{
|
2011-04-20 10:16:01 +01:00
|
|
|
AddStateBits(aParent->GetStateBits() &
|
2012-02-04 13:58:46 +00:00
|
|
|
(NS_STATE_SVG_NONDISPLAY_CHILD | NS_STATE_SVG_CLIPPATH_CHILD |
|
|
|
|
NS_STATE_SVG_REDRAW_SUSPENDED));
|
2007-08-30 10:01:37 -07:00
|
|
|
nsresult rv = nsSVGGeometryFrameBase::Init(aContent, aParent, aPrevInFlow);
|
|
|
|
return rv;
|
2006-08-23 18:16:15 +00:00
|
|
|
}
|
|
|
|
|
2007-07-17 01:40:28 -07:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
nsSVGPaintServerFrame *
|
2008-10-01 13:51:05 +13:00
|
|
|
nsSVGGeometryFrame::GetPaintServer(const nsStyleSVGPaint *aPaint,
|
2010-03-29 14:46:55 +13:00
|
|
|
const FramePropertyDescriptor *aType)
|
2007-07-17 01:40:28 -07:00
|
|
|
{
|
|
|
|
if (aPaint->mType != eStyleSVGPaintType_Server)
|
|
|
|
return nsnull;
|
|
|
|
|
2011-04-03 13:23:40 +01:00
|
|
|
nsIFrame *frame = mContent->IsNodeOfType(nsINode::eTEXT) ?
|
|
|
|
GetParent() : this;
|
2008-10-01 13:51:05 +13:00
|
|
|
nsSVGPaintingProperty *property =
|
2011-04-03 13:23:40 +01:00
|
|
|
nsSVGEffects::GetPaintingProperty(aPaint->mPaint.mPaintServer, frame, aType);
|
2008-10-01 13:51:05 +13:00
|
|
|
if (!property)
|
2007-07-17 01:40:28 -07:00
|
|
|
return nsnull;
|
2008-10-01 13:51:05 +13:00
|
|
|
nsIFrame *result = property->GetReferencedFrame();
|
|
|
|
if (!result)
|
2007-07-17 01:40:28 -07:00
|
|
|
return nsnull;
|
|
|
|
|
|
|
|
nsIAtom *type = result->GetType();
|
|
|
|
if (type != nsGkAtoms::svgLinearGradientFrame &&
|
|
|
|
type != nsGkAtoms::svgRadialGradientFrame &&
|
|
|
|
type != nsGkAtoms::svgPatternFrame)
|
|
|
|
return nsnull;
|
|
|
|
|
2008-10-01 13:51:05 +13:00
|
|
|
return static_cast<nsSVGPaintServerFrame*>(result);
|
2007-07-17 01:40:28 -07:00
|
|
|
}
|
|
|
|
|
2006-05-02 15:05:25 +00:00
|
|
|
float
|
|
|
|
nsSVGGeometryFrame::GetStrokeWidth()
|
|
|
|
{
|
2007-07-08 00:08:04 -07:00
|
|
|
nsSVGElement *ctx = static_cast<nsSVGElement*>
|
2010-08-07 10:38:11 +01:00
|
|
|
(mContent->IsNodeOfType(nsINode::eTEXT) ?
|
2007-03-09 16:27:01 +00:00
|
|
|
mContent->GetParent() : mContent);
|
|
|
|
|
2006-07-19 14:46:50 +00:00
|
|
|
return
|
2007-03-30 14:11:41 -07:00
|
|
|
nsSVGUtils::CoordToFloat(PresContext(),
|
2007-03-09 16:27:01 +00:00
|
|
|
ctx,
|
|
|
|
GetStyleSVG()->mStrokeWidth);
|
2006-05-02 15:05:25 +00:00
|
|
|
}
|
|
|
|
|
2012-01-16 09:19:24 +00:00
|
|
|
bool
|
|
|
|
nsSVGGeometryFrame::GetStrokeDashData(FallibleTArray<gfxFloat>& dashes,
|
|
|
|
gfxFloat *dashOffset)
|
2006-05-02 15:05:25 +00:00
|
|
|
{
|
|
|
|
PRUint32 count = GetStyleSVG()->mStrokeDasharrayLength;
|
2012-01-16 09:19:24 +00:00
|
|
|
if (!count || !dashes.SetLength(count)) {
|
|
|
|
return false;
|
|
|
|
}
|
2011-05-01 19:26:20 +01:00
|
|
|
|
2012-01-16 09:19:24 +00:00
|
|
|
gfxFloat pathScale = 1.0;
|
2006-05-02 15:05:25 +00:00
|
|
|
|
2012-01-16 09:19:24 +00:00
|
|
|
if (mContent->Tag() == nsGkAtoms::path) {
|
|
|
|
pathScale = static_cast<nsSVGPathElement*>(mContent)->
|
|
|
|
GetPathLengthScale(nsSVGPathElement::eForStroking);
|
|
|
|
if (pathScale <= 0) {
|
|
|
|
return false;
|
2006-05-02 15:05:25 +00:00
|
|
|
}
|
|
|
|
}
|
2012-01-16 09:19:24 +00:00
|
|
|
|
2008-11-14 10:46:56 -08:00
|
|
|
nsSVGElement *ctx = static_cast<nsSVGElement*>
|
2010-08-07 10:38:11 +01:00
|
|
|
(mContent->IsNodeOfType(nsINode::eTEXT) ?
|
2008-11-14 10:46:56 -08:00
|
|
|
mContent->GetParent() : mContent);
|
|
|
|
|
2012-01-16 09:19:24 +00:00
|
|
|
const nsStyleCoord *dasharray = GetStyleSVG()->mStrokeDasharray;
|
|
|
|
nsPresContext *presContext = PresContext();
|
|
|
|
gfxFloat totalLength = 0.0;
|
|
|
|
|
|
|
|
for (PRUint32 i = 0; i < count; i++) {
|
|
|
|
dashes[i] =
|
|
|
|
nsSVGUtils::CoordToFloat(presContext,
|
|
|
|
ctx,
|
|
|
|
dasharray[i]) * pathScale;
|
|
|
|
if (dashes[i] < 0.0) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
totalLength += dashes[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
*dashOffset = nsSVGUtils::CoordToFloat(presContext,
|
|
|
|
ctx,
|
|
|
|
GetStyleSVG()->mStrokeDashoffset);
|
|
|
|
|
|
|
|
return (totalLength > 0.0);
|
2006-05-02 15:05:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PRUint16
|
|
|
|
nsSVGGeometryFrame::GetClipRule()
|
|
|
|
{
|
|
|
|
return GetStyleSVG()->mClipRule;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2007-01-10 17:01:20 +00:00
|
|
|
SetupCairoColor(gfxContext *aContext, nscolor aRGB, float aOpacity)
|
2006-05-02 15:05:25 +00:00
|
|
|
{
|
2007-01-10 17:01:20 +00:00
|
|
|
aContext->SetColor(gfxRGBA(NS_GET_R(aRGB)/255.0,
|
|
|
|
NS_GET_G(aRGB)/255.0,
|
|
|
|
NS_GET_B(aRGB)/255.0,
|
|
|
|
NS_GET_A(aRGB)/255.0 * aOpacity));
|
2006-05-02 15:05:25 +00:00
|
|
|
}
|
|
|
|
|
2010-04-02 18:58:26 -07:00
|
|
|
static void
|
|
|
|
SetupFallbackOrPaintColor(gfxContext *aContext, nsStyleContext *aStyleContext,
|
|
|
|
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
|
|
|
|
float aOpacity)
|
|
|
|
{
|
2012-02-04 13:11:09 +00:00
|
|
|
nscolor color;
|
|
|
|
nsSVGUtils::GetFallbackOrPaintColor(aContext, aStyleContext, aFillOrStroke,
|
|
|
|
&aOpacity, &color);
|
2010-04-02 18:58:26 -07:00
|
|
|
|
|
|
|
SetupCairoColor(aContext, color, aOpacity);
|
|
|
|
}
|
|
|
|
|
2007-01-04 15:05:39 +00:00
|
|
|
float
|
2009-10-26 18:17:49 +01:00
|
|
|
nsSVGGeometryFrame::MaybeOptimizeOpacity(float aFillOrStrokeOpacity)
|
2007-01-04 15:05:39 +00:00
|
|
|
{
|
2009-10-26 18:17:49 +01:00
|
|
|
float opacity = GetStyleDisplay()->mOpacity;
|
|
|
|
if (opacity < 1 && nsSVGUtils::CanOptimizeOpacity(this)) {
|
|
|
|
return aFillOrStrokeOpacity * opacity;
|
2007-01-04 15:05:39 +00:00
|
|
|
}
|
2009-10-26 18:17:49 +01:00
|
|
|
return aFillOrStrokeOpacity;
|
2007-01-04 15:05:39 +00:00
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool
|
2007-10-21 02:05:41 -07:00
|
|
|
nsSVGGeometryFrame::SetupCairoFill(gfxContext *aContext)
|
2006-05-02 15:05:25 +00:00
|
|
|
{
|
2008-10-06 15:44:40 +02:00
|
|
|
const nsStyleSVG* style = GetStyleSVG();
|
|
|
|
if (style->mFill.mType == eStyleSVGPaintType_None)
|
2011-10-17 10:59:28 -04:00
|
|
|
return false;
|
2008-10-06 15:44:40 +02:00
|
|
|
|
|
|
|
if (style->mFillRule == NS_STYLE_FILL_RULE_EVENODD)
|
2007-01-10 17:01:20 +00:00
|
|
|
aContext->SetFillRule(gfxContext::FILL_RULE_EVEN_ODD);
|
2006-05-02 15:05:25 +00:00
|
|
|
else
|
2007-01-10 17:01:20 +00:00
|
|
|
aContext->SetFillRule(gfxContext::FILL_RULE_WINDING);
|
2006-05-02 15:05:25 +00:00
|
|
|
|
2008-10-06 15:44:40 +02:00
|
|
|
float opacity = MaybeOptimizeOpacity(style->mFillOpacity);
|
2007-01-04 15:05:39 +00:00
|
|
|
|
2008-10-01 13:51:05 +13:00
|
|
|
nsSVGPaintServerFrame *ps =
|
2010-03-29 14:46:55 +13:00
|
|
|
GetPaintServer(&style->mFill, nsSVGEffects::FillProperty());
|
2008-10-01 13:51:05 +13:00
|
|
|
if (ps && ps->SetupPaintServer(aContext, this, opacity))
|
2011-10-17 10:59:28 -04:00
|
|
|
return true;
|
2008-02-07 03:45:21 -08:00
|
|
|
|
2008-10-01 13:51:05 +13:00
|
|
|
// On failure, use the fallback colour in case we have an
|
|
|
|
// objectBoundingBox where the width or height of the object is zero.
|
|
|
|
// See http://www.w3.org/TR/SVG11/coords.html#ObjectBoundingBox
|
2010-04-02 18:58:26 -07:00
|
|
|
SetupFallbackOrPaintColor(aContext, GetStyleContext(),
|
|
|
|
&nsStyleSVG::mFill, opacity);
|
2006-05-16 15:55:01 +00:00
|
|
|
|
2011-10-17 10:59:28 -04:00
|
|
|
return true;
|
2006-05-16 15:55:01 +00:00
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool
|
2009-10-21 13:32:57 +02:00
|
|
|
nsSVGGeometryFrame::HasStroke()
|
2009-07-12 19:50:45 +01:00
|
|
|
{
|
2009-10-26 18:17:49 +01:00
|
|
|
const nsStyleSVG *style = GetStyleSVG();
|
|
|
|
return style->mStroke.mType != eStyleSVGPaintType_None &&
|
|
|
|
style->mStrokeOpacity > 0 &&
|
2009-07-12 19:50:45 +01:00
|
|
|
GetStrokeWidth() > 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2007-01-10 17:01:20 +00:00
|
|
|
nsSVGGeometryFrame::SetupCairoStrokeGeometry(gfxContext *aContext)
|
2006-05-02 15:05:25 +00:00
|
|
|
{
|
2008-10-01 13:51:05 +13:00
|
|
|
float width = GetStrokeWidth();
|
|
|
|
if (width <= 0)
|
2009-07-12 19:50:45 +01:00
|
|
|
return;
|
2008-10-01 13:51:05 +13:00
|
|
|
aContext->SetLineWidth(width);
|
2007-01-10 17:01:20 +00:00
|
|
|
|
2009-07-12 19:50:45 +01:00
|
|
|
const nsStyleSVG* style = GetStyleSVG();
|
|
|
|
|
2008-10-01 13:51:05 +13:00
|
|
|
switch (style->mStrokeLinecap) {
|
2006-05-02 15:05:25 +00:00
|
|
|
case NS_STYLE_STROKE_LINECAP_BUTT:
|
2007-01-10 17:01:20 +00:00
|
|
|
aContext->SetLineCap(gfxContext::LINE_CAP_BUTT);
|
2006-05-02 15:05:25 +00:00
|
|
|
break;
|
|
|
|
case NS_STYLE_STROKE_LINECAP_ROUND:
|
2007-01-10 17:01:20 +00:00
|
|
|
aContext->SetLineCap(gfxContext::LINE_CAP_ROUND);
|
2006-05-02 15:05:25 +00:00
|
|
|
break;
|
|
|
|
case NS_STYLE_STROKE_LINECAP_SQUARE:
|
2007-01-10 17:01:20 +00:00
|
|
|
aContext->SetLineCap(gfxContext::LINE_CAP_SQUARE);
|
2006-05-02 15:05:25 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-01-10 17:01:20 +00:00
|
|
|
|
2008-10-01 13:51:05 +13:00
|
|
|
aContext->SetMiterLimit(style->mStrokeMiterlimit);
|
2007-01-10 17:01:20 +00:00
|
|
|
|
2008-10-01 13:51:05 +13:00
|
|
|
switch (style->mStrokeLinejoin) {
|
2006-05-02 15:05:25 +00:00
|
|
|
case NS_STYLE_STROKE_LINEJOIN_MITER:
|
2007-01-10 17:01:20 +00:00
|
|
|
aContext->SetLineJoin(gfxContext::LINE_JOIN_MITER);
|
2006-05-02 15:05:25 +00:00
|
|
|
break;
|
|
|
|
case NS_STYLE_STROKE_LINEJOIN_ROUND:
|
2007-01-10 17:01:20 +00:00
|
|
|
aContext->SetLineJoin(gfxContext::LINE_JOIN_ROUND);
|
2006-05-02 15:05:25 +00:00
|
|
|
break;
|
|
|
|
case NS_STYLE_STROKE_LINEJOIN_BEVEL:
|
2007-01-10 17:01:20 +00:00
|
|
|
aContext->SetLineJoin(gfxContext::LINE_JOIN_BEVEL);
|
2006-05-02 15:05:25 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-12 19:50:45 +01:00
|
|
|
void
|
2007-01-10 17:01:20 +00:00
|
|
|
nsSVGGeometryFrame::SetupCairoStrokeHitGeometry(gfxContext *aContext)
|
2006-05-02 15:05:25 +00:00
|
|
|
{
|
2009-07-12 19:50:45 +01:00
|
|
|
SetupCairoStrokeGeometry(aContext);
|
2006-05-02 15:05:25 +00:00
|
|
|
|
2012-01-16 09:19:24 +00:00
|
|
|
AutoFallibleTArray<gfxFloat, 10> dashes;
|
|
|
|
gfxFloat dashOffset;
|
|
|
|
if (GetStrokeDashData(dashes, &dashOffset)) {
|
|
|
|
aContext->SetDash(dashes.Elements(), dashes.Length(), dashOffset);
|
2006-05-02 15:05:25 +00:00
|
|
|
}
|
2006-08-07 16:41:58 +00:00
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool
|
2007-10-21 02:05:41 -07:00
|
|
|
nsSVGGeometryFrame::SetupCairoStroke(gfxContext *aContext)
|
2006-08-07 16:41:58 +00:00
|
|
|
{
|
2009-10-21 13:32:57 +02:00
|
|
|
if (!HasStroke()) {
|
2011-10-17 10:59:28 -04:00
|
|
|
return false;
|
2009-07-12 19:50:45 +01:00
|
|
|
}
|
|
|
|
SetupCairoStrokeHitGeometry(aContext);
|
2006-05-02 15:05:25 +00:00
|
|
|
|
2008-10-06 15:44:40 +02:00
|
|
|
const nsStyleSVG* style = GetStyleSVG();
|
|
|
|
float opacity = MaybeOptimizeOpacity(style->mStrokeOpacity);
|
2007-01-04 15:05:39 +00:00
|
|
|
|
2008-10-01 13:51:05 +13:00
|
|
|
nsSVGPaintServerFrame *ps =
|
2010-03-29 14:46:55 +13:00
|
|
|
GetPaintServer(&style->mStroke, nsSVGEffects::StrokeProperty());
|
2008-10-01 13:51:05 +13:00
|
|
|
if (ps && ps->SetupPaintServer(aContext, this, opacity))
|
2011-10-17 10:59:28 -04:00
|
|
|
return true;
|
2008-02-07 03:45:21 -08:00
|
|
|
|
2008-10-01 13:51:05 +13:00
|
|
|
// On failure, use the fallback colour in case we have an
|
|
|
|
// objectBoundingBox where the width or height of the object is zero.
|
|
|
|
// See http://www.w3.org/TR/SVG11/coords.html#ObjectBoundingBox
|
2010-04-02 18:58:26 -07:00
|
|
|
SetupFallbackOrPaintColor(aContext, GetStyleContext(),
|
|
|
|
&nsStyleSVG::mStroke, opacity);
|
2006-05-16 15:55:01 +00:00
|
|
|
|
2011-10-17 10:59:28 -04:00
|
|
|
return true;
|
2006-05-16 15:55:01 +00:00
|
|
|
}
|
2011-01-28 19:35:35 +13:00
|
|
|
|
|
|
|
PRUint16
|
2011-07-08 14:20:14 +01:00
|
|
|
nsSVGGeometryFrame::GetHitTestFlags()
|
2011-01-28 19:35:35 +13:00
|
|
|
{
|
2011-07-08 14:20:14 +01:00
|
|
|
PRUint16 flags = 0;
|
2011-01-28 19:35:35 +13:00
|
|
|
|
|
|
|
switch(GetStyleVisibility()->mPointerEvents) {
|
|
|
|
case NS_STYLE_POINTER_EVENTS_NONE:
|
|
|
|
break;
|
|
|
|
case NS_STYLE_POINTER_EVENTS_AUTO:
|
|
|
|
case NS_STYLE_POINTER_EVENTS_VISIBLEPAINTED:
|
|
|
|
if (GetStyleVisibility()->IsVisible()) {
|
|
|
|
if (GetStyleSVG()->mFill.mType != eStyleSVGPaintType_None)
|
2011-07-08 14:20:14 +01:00
|
|
|
flags |= SVG_HIT_TEST_FILL;
|
2011-01-28 19:35:35 +13:00
|
|
|
if (GetStyleSVG()->mStroke.mType != eStyleSVGPaintType_None)
|
2011-07-08 14:20:14 +01:00
|
|
|
flags |= SVG_HIT_TEST_STROKE;
|
2011-01-28 19:35:35 +13:00
|
|
|
if (GetStyleSVG()->mStrokeOpacity > 0)
|
2011-07-08 14:20:14 +01:00
|
|
|
flags |= SVG_HIT_TEST_CHECK_MRECT;
|
2011-01-28 19:35:35 +13:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NS_STYLE_POINTER_EVENTS_VISIBLEFILL:
|
|
|
|
if (GetStyleVisibility()->IsVisible()) {
|
2011-07-08 14:20:14 +01:00
|
|
|
flags |= SVG_HIT_TEST_FILL;
|
2011-01-28 19:35:35 +13:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NS_STYLE_POINTER_EVENTS_VISIBLESTROKE:
|
|
|
|
if (GetStyleVisibility()->IsVisible()) {
|
2011-07-08 14:20:14 +01:00
|
|
|
flags |= SVG_HIT_TEST_STROKE;
|
2011-01-28 19:35:35 +13:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NS_STYLE_POINTER_EVENTS_VISIBLE:
|
|
|
|
if (GetStyleVisibility()->IsVisible()) {
|
2011-07-08 14:20:14 +01:00
|
|
|
flags |= SVG_HIT_TEST_FILL | SVG_HIT_TEST_STROKE;
|
2011-01-28 19:35:35 +13:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NS_STYLE_POINTER_EVENTS_PAINTED:
|
|
|
|
if (GetStyleSVG()->mFill.mType != eStyleSVGPaintType_None)
|
2011-07-08 14:20:14 +01:00
|
|
|
flags |= SVG_HIT_TEST_FILL;
|
2011-01-28 19:35:35 +13:00
|
|
|
if (GetStyleSVG()->mStroke.mType != eStyleSVGPaintType_None)
|
2011-07-08 14:20:14 +01:00
|
|
|
flags |= SVG_HIT_TEST_STROKE;
|
2011-01-28 19:35:35 +13:00
|
|
|
if (GetStyleSVG()->mStrokeOpacity)
|
2011-07-08 14:20:14 +01:00
|
|
|
flags |= SVG_HIT_TEST_CHECK_MRECT;
|
2011-01-28 19:35:35 +13:00
|
|
|
break;
|
|
|
|
case NS_STYLE_POINTER_EVENTS_FILL:
|
2011-07-08 14:20:14 +01:00
|
|
|
flags |= SVG_HIT_TEST_FILL;
|
2011-01-28 19:35:35 +13:00
|
|
|
break;
|
|
|
|
case NS_STYLE_POINTER_EVENTS_STROKE:
|
2011-07-08 14:20:14 +01:00
|
|
|
flags |= SVG_HIT_TEST_STROKE;
|
2011-01-28 19:35:35 +13:00
|
|
|
break;
|
|
|
|
case NS_STYLE_POINTER_EVENTS_ALL:
|
2011-07-08 14:20:14 +01:00
|
|
|
flags |= SVG_HIT_TEST_FILL | SVG_HIT_TEST_STROKE;
|
2011-01-28 19:35:35 +13:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
NS_ERROR("not reached");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-07-08 14:20:14 +01:00
|
|
|
return flags;
|
2011-01-28 19:35:35 +13:00
|
|
|
}
|