当前位置: 首页>>代码示例>>C++>>正文


C++ HTMLAreaElement::computePath方法代码示例

本文整理汇总了C++中HTMLAreaElement::computePath方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLAreaElement::computePath方法的具体用法?C++ HTMLAreaElement::computePath怎么用?C++ HTMLAreaElement::computePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTMLAreaElement的用法示例。


在下文中一共展示了HTMLAreaElement::computePath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: paintAreaElementFocusRing

void RenderImage::paintAreaElementFocusRing(PaintInfo& paintInfo)
{
    Document* document = this->document();

    if (document->printing() || !document->frame()->selection()->isFocusedAndActive())
        return;

    if (paintInfo.context->paintingDisabled() && !paintInfo.context->updatingControlTints())
        return;

    Element* focusedElement = document->focusedElement();
    if (!focusedElement || !isHTMLAreaElement(focusedElement))
        return;

    HTMLAreaElement* areaElement = toHTMLAreaElement(focusedElement);
    if (areaElement->imageElement() != node())
        return;

    // Even if the theme handles focus ring drawing for entire elements, it won't do it for
    // an area within an image, so we don't call RenderTheme::supportsFocusRing here.

    Path path = areaElement->computePath(this);
    if (path.isEmpty())
        return;

    RenderStyle* areaElementStyle = areaElement->computedStyle();
    unsigned short outlineWidth = areaElementStyle->outlineWidth();
    if (!outlineWidth)
        return;

    // FIXME: Clip path instead of context when Skia pathops is ready.
    // https://crbug.com/251206
    GraphicsContextStateSaver savedContext(*paintInfo.context);
    paintInfo.context->clip(absoluteContentBox());
    paintInfo.context->drawFocusRing(path, outlineWidth,
        areaElementStyle->outlineOffset(),
        resolveColor(areaElementStyle, CSSPropertyOutlineColor));
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:38,代码来源:RenderImage.cpp

示例2: paintAreaElementFocusRing

void RenderImage::paintAreaElementFocusRing(PaintInfo& paintInfo)
{
    Document* document = this->document();
    
    if (document->printing() || !document->frame()->selection()->isFocusedAndActive())
        return;
    
    if (paintInfo.context->paintingDisabled() && !paintInfo.context->updatingControlTints())
        return;

    Node* focusedNode = document->focusedNode();
    if (!focusedNode || !focusedNode->hasTagName(areaTag))
        return;

    HTMLAreaElement* areaElement = static_cast<HTMLAreaElement*>(focusedNode);
    if (areaElement->imageElement() != node())
        return;

    // Even if the theme handles focus ring drawing for entire elements, it won't do it for
    // an area within an image, so we don't call RenderTheme::supportsFocusRing here.

    Path path = areaElement->computePath(this);
    if (path.isEmpty())
        return;

    // FIXME: Do we need additional code to clip the path to the image's bounding box?

    RenderStyle* areaElementStyle = areaElement->computedStyle();
    unsigned short outlineWidth = areaElementStyle->outlineWidth();
    if (!outlineWidth)
        return;

    paintInfo.context->drawFocusRing(path, outlineWidth,
        areaElementStyle->outlineOffset(),
        areaElementStyle->visitedDependentColor(CSSPropertyOutlineColor));
}
开发者ID:,项目名称:,代码行数:36,代码来源:

示例3: readyWRATHWidgetAreaElementFocusRing

void RenderImage::readyWRATHWidgetAreaElementFocusRing(PaintedWidgetsOfWRATHHandle& handle, PaintInfoOfWRATH& paintInfo)
{
    RenderImage_ReadyWRATHWidgetAreaElementFocusRing *d(RenderImage_ReadyWRATHWidgetAreaElementFocusRing::object(this, handle));
    ContextOfWRATH::AutoPushNode autoPushRoot(paintInfo.wrath_context, d->m_root_node);

    if (d->m_focus_ring.widget())
        d->m_focus_ring.widget()->visible(false);

    Document* document = this->document();

    if (document->printing() || !document->frame()->selection()->isFocusedAndActive())
        return;

    /*
    if (paintInfo.context->paintingDisabled() && !paintInfo.context->updatingControlTints())
        return;
    */

    Node* focusedNode = document->focusedNode();
    if (!focusedNode || !focusedNode->hasTagName(areaTag))
        return;

    HTMLAreaElement* areaElement = static_cast<HTMLAreaElement*>(focusedNode);
    if (areaElement->imageElement() != node())
        return;

    // Even if the theme handles focus ring drawing for entire elements, it won't do it for
    // an area within an image, so we don't call RenderTheme::supportsFocusRing here.

    Path path = areaElement->computePath(this);
    if (path.isEmpty())
        return;

    // FIXME: Do we need additional code to clip the path to the image's bounding box?

    RenderStyle* areaElementStyle = areaElement->computedStyle();
    unsigned short outlineWidth = areaElementStyle->outlineWidth();
    if (!outlineWidth)
        return;

    if (!d->m_focus_ring_shape || d->m_focus_ring_dirty) {
        if (!d->m_focus_ring_shape) {
            d->m_focus_ring_shape = WRATHNew WRATHShapeF;
        }

        d->m_focus_ring_shape->clear();
        d->m_focus_ring_shape->new_outline();

        QPainterPath qpath = path.platformPath();

        // Skip the first element, it is not needed because it's the same as the last
        for (int i = 1; i < qpath.elementCount(); ++i) {
            const QPainterPath::Element & cur = qpath.elementAt(i);

            switch (cur.type) {
            case QPainterPath::MoveToElement: {
                ASSERT_NOT_REACHED();
                break;
            }
            case QPainterPath::LineToElement: {
                QPointF p(cur);
                d->m_focus_ring_shape->current_outline() << vec2(p.x(), p.y());
                break;
            }
            case QPainterPath::CurveToElement: {
                QPainterPath::Element c1 = qpath.elementAt(i+1);
                QPainterPath::Element c2 = qpath.elementAt(i+2);

                ASSERT(c1.type == QPainterPath::CurveToDataElement);
                ASSERT(c2.type == QPainterPath::CurveToDataElement);

                QPointF p1(cur);
                QPointF p2(c1);
                QPointF p3(c2);

                d->m_focus_ring_shape->current_outline() <<
                        WRATHOutlineF::control_point(vec2(p1.x(), p1.y())) <<
                        WRATHOutlineF::control_point(vec2(p2.x(), p2.y())) <<
                        vec2(p3.x(), p3.y());

                i += 2;

                break;
            }
            case QPainterPath::CurveToDataElement: {
                ASSERT_NOT_REACHED();
                break;
            }
            }
        }
    }

    vec4 c;
    Color wc = areaElementStyle->visitedDependentColor(CSSPropertyOutlineColor);
    wc.getRGBA(c.x(), c.y(), c.z(), c.w());

    paintInfo.wrath_context->add_stroked_shape(d->m_focus_ring,
            WRATHWidgetGenerator::ColorProperties(c),
            WRATHWidgetGenerator::shape_value(*d->m_focus_ring_shape),
            WRATHWidgetGenerator::StrokingParameters()
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


注:本文中的HTMLAreaElement::computePath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。