Example #1
0
String RenderQuote::computeText() const
{
    if (m_depth < 0)
        return emptyString();
    bool isOpenQuote = false;
    switch (m_type) {
    case NO_OPEN_QUOTE:
    case NO_CLOSE_QUOTE:
        return emptyString();
    case OPEN_QUOTE:
        isOpenQuote = true;
        FALLTHROUGH;
    case CLOSE_QUOTE:
        if (const QuotesData* quotes = style().quotes())
            return isOpenQuote ? quotes->openQuote(m_depth).impl() : quotes->closeQuote(m_depth).impl();
        if (const QuotesForLanguage* quotes = quotesForLanguage(style().locale()))
            return stringForQuoteCharacter(isOpenQuote ? (m_depth ? quotes->open2 : quotes->open1) : (m_depth ? quotes->close2 : quotes->close1));
        // FIXME: Should the default be the quotes for "en" rather than straight quotes?
        return m_depth ? apostropheString() : quotationMarkString();
    }
    ASSERT_NOT_REACHED();
    return emptyString();
}
Example #2
0
PassRefPtr<StringImpl> RenderQuote::originalText() const
{
    if (m_depth < 0)
        return StringImpl::empty();
    bool isOpenQuote = false;
    switch (m_type) {
    case NO_OPEN_QUOTE:
    case NO_CLOSE_QUOTE:
        return StringImpl::empty();
    case OPEN_QUOTE:
        isOpenQuote = true;
        // fall through
    case CLOSE_QUOTE:
        if (const QuotesData* quotes = style()->quotes())
            return isOpenQuote ? quotes->openQuote(m_depth).impl() : quotes->closeQuote(m_depth).impl();
        if (const QuotesForLanguage* quotes = quotesForLanguage(style()->locale()))
            return stringForQuoteCharacter(isOpenQuote ? (m_depth ? quotes->open2 : quotes->open1) : (m_depth ? quotes->close2 : quotes->close1));
        // FIXME: Should the default be the quotes for "en" rather than straight quotes?
        return m_depth ? apostropheString() : quotationMarkString();
    }
    ASSERT_NOT_REACHED();
    return StringImpl::empty();
}