Question

I am embedding geckofx v22.0.6 into a .Net 4 C# Winforms test app. Using geckofx LoadHtml() to put SVG content into gecko's document. SVG snippet (formatted for readability):

<!-- 8 -->
<g id='node3' class='node'>
    <title>8</title>

    <polygon fill='red'
             stroke='red'
             points='571,-828 517,-828 517,-792 571,-792 571,-828'/>

    <text text-anchor='middle' x='544' y='-806.3'
          font-family='Times New Roman,serif' font-size='14.00'
          fill='white'>

        8(1)

    </text>
</g>

Handling DomMouseOver event on my form:

void m_gb_DomMouseOver(object sender, Gecko.DomMouseEventArgs e)
{
    var tgt = e.Target.CastToGeckoElement();

    if (tgt.NodeName.ToLower() == "text")
    {
        var parent = tgt.ParentNode;

        foreach (var child in parent.ChildNodes)
        {
            if (child.NodeName.ToLower() != "polygon")
                continue;

            var poly = child as GeckoElement;
        }
    }
}

poly variable is always null. In debugger's watch window I tried casting child to all sorts of things (SvgElement, GeckoElement, etc), it just wants to stay GeckoNode. Why is this?

Was it helpful?

Solution

It was a bug in the GeckoFx's QueryInterface. https://bitbucket.org/geckofx/geckofx-22.0/issue/54/casting-geckonode-to-geckoelement-for-svg

Fixed in the tip of v22.0.6

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top