예제 #1
0
float SVGTextContentElement::getRotationOfChar(long charnum, ExceptionCode& ec) const
{
    document()->updateLayoutIgnorePendingStylesheets();

    if (charnum < 0 || charnum > getNumberOfChars()) {
        ec = INDEX_SIZE_ERR;
        return 0.0f;
    }

    return executeTextQuery(this, SVGInlineTextBoxQueryWalker::Rotation, charnum).floatResult();
}
FloatRect SVGTextContentElement::getExtentOfChar(unsigned charnum, ExceptionCode& ec) const
{
    document()->updateLayoutIgnorePendingStylesheets();

    if (charnum > getNumberOfChars()) {
        ec = INDEX_SIZE_ERR;
        return FloatRect();
    }

    return executeTextQuery(this, SVGInlineTextBoxQueryWalker::Extent, charnum).rectResult();
}
float SVGTextContentElement::getSubStringLength(unsigned charnum, unsigned nchars, ExceptionCode& ec) const
{
    document()->updateLayoutIgnorePendingStylesheets();

    unsigned numberOfChars = getNumberOfChars();
    if (charnum >= numberOfChars) {
        ec = INDEX_SIZE_ERR;
        return 0.0f;
    }

    return executeTextQuery(this, SVGInlineTextBoxQueryWalker::SubStringLength, charnum, nchars).floatResult();
}
예제 #4
0
float SVGTextContentElement::getSubStringLength(long charnum, long nchars, ExceptionCode& ec) const
{
    document()->updateLayoutIgnorePendingStylesheets();

    // Differences to SVG 1.1 spec, as the spec is clearly wrong. TODO: Raise SVG WG issue!
    // #1: We accept a 'long nchars' parameter instead of 'unsigned long nchars' to be able
    //     to catch cases where someone called us with a negative 'nchars' value - in those
    //     cases we'll just throw a 'INDEX_SIZE_ERR' (acid3 implicitly agrees with us)
    //
    // #2: We only throw if 'charnum + nchars' is greater than the number of characters, not
    //     if it's equal, as this really doesn't make any sense (no way to measure the last character!)
    //
    // #3: If 'charnum' is greater than or equal to 'numberOfChars', we're throwing an exception here
    //     as the result is undefined for every other value of 'nchars' than '0'.

    long numberOfChars = getNumberOfChars();
    if (charnum < 0 || nchars < 0 || numberOfChars <= charnum || charnum + nchars > numberOfChars) {
        ec = INDEX_SIZE_ERR;
        return 0.0f;
    }

    return executeTextQuery(this, SVGInlineTextBoxQueryWalker::SubStringLength, charnum, nchars).floatResult();
}
예제 #5
0
long SVGTextContentElement::getCharNumAtPosition(const FloatPoint& point) const
{
    document()->updateLayoutIgnorePendingStylesheets();

    return executeTextQuery(this, SVGInlineTextBoxQueryWalker::CharacterNumberAtPosition, 0.0f, 0.0f, point).longResult();
}
예제 #6
0
float SVGTextContentElement::getComputedTextLength() const
{
    document()->updateLayoutIgnorePendingStylesheets();

    return executeTextQuery(this, SVGInlineTextBoxQueryWalker::TextLength).floatResult();
}
예제 #7
0
long SVGTextContentElement::getNumberOfChars() const
{
    document()->updateLayoutIgnorePendingStylesheets();

    return executeTextQuery(this, SVGInlineTextBoxQueryWalker::NumberOfCharacters).longResult();
}