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


C++ RenderTextControl类代码示例

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


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

示例1: visibleSelectionForRangeInputElement

VisibleSelection visibleSelectionForRangeInputElement(Element* element, int start, int end)
{
    if (DOMSupport::toTextControlElement(element)) {
        RenderTextControl* textRender = toRenderTextControl(element->renderer());
        if (!textRender)
            return VisibleSelection();

        VisiblePosition startPosition = textRender->visiblePositionForIndex(start);
        VisiblePosition endPosition;
        if (start == end)
            endPosition = startPosition;
        else
            endPosition = textRender->visiblePositionForIndex(end);

        return VisibleSelection(startPosition, endPosition);
    }

    // Must be content editable, generate the range.
    RefPtr<Range> selectionRange = TextIterator::rangeFromLocationAndLength(element, start, end - start);
    if (start == end)
        return VisibleSelection(selectionRange.get()->startPosition(), DOWNSTREAM);

    VisiblePosition visibleStart(selectionRange->startPosition(), DOWNSTREAM);
    VisiblePosition visibleEnd(selectionRange->endPosition(), SEL_DEFAULT_AFFINITY);

    return VisibleSelection(visibleStart, visibleEnd);
}
开发者ID:,项目名称:,代码行数:27,代码来源:

示例2: visibleSelectionForFocusedBlock

VisibleSelection visibleSelectionForFocusedBlock(Element* element)
{
    int textLength = inputElementText(element).length();

    if (DOMSupport::toTextControlElement(element)) {
        RenderTextControl* textRender = toRenderTextControl(element->renderer());
        if (!textRender)
            return VisibleSelection();

        VisiblePosition startPosition = textRender->visiblePositionForIndex(0);
        VisiblePosition endPosition;

        if (textLength)
            endPosition = textRender->visiblePositionForIndex(textLength);
        else
            endPosition = startPosition;
        return VisibleSelection(startPosition, endPosition);
    }

    // Must be content editable, generate the range.
    RefPtr<Range> selectionRange = TextIterator::rangeFromLocationAndLength(element, 0, textLength);

    if (!selectionRange)
        return VisibleSelection();

    if (!textLength)
        return VisibleSelection(selectionRange->startPosition(), DOWNSTREAM);

    return VisibleSelection(selectionRange->startPosition(), selectionRange->endPosition());
}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例3: toRenderTextControl

bool HTMLTextAreaElement::appendFormData(FormDataList& encoding, bool)
{
    if (name().isEmpty())
        return false;

    // FIXME: It's not acceptable to ignore the HardWrap setting when there is no renderer.
    // While we have no evidence this has ever been a practical problem, it would be best to fix it some day.
    RenderTextControl* control = toRenderTextControl(renderer());
    const String& text = (m_wrap == HardWrap && control) ? control->textWithHardLineBreaks() : value();
    encoding.appendData(name(), text);
    return true;
}
开发者ID:,项目名称:,代码行数:12,代码来源:

示例4: contentsPoint

VisiblePosition RenderTextControlInnerBlock::positionForPoint(const LayoutPoint& point)
{
    LayoutPoint contentsPoint(point);

    // Multiline text controls have the scroll on shadowAncestorNode, so we need to take that
    // into account here.
    if (m_multiLine) {
        RenderTextControl* renderer = toRenderTextControl(node()->shadowAncestorNode()->renderer());
        if (renderer->hasOverflowClip())
            contentsPoint += renderer->scrolledContentOffset();
    }

    return RenderBlock::positionForPoint(contentsPoint);
}
开发者ID:,项目名称:,代码行数:14,代码来源:

示例5: positionForPoint

VisiblePosition RenderTextControlInnerBlock::positionForPoint(const IntPoint& point)
{
    int contentsX = point.x();
    int contentsY = point.y();

    // Multiline text controls have the scroll on shadowAncestorNode, so we need to take that
    // into account here.
    if (m_multiLine) {
        RenderTextControl* renderer = static_cast<RenderTextControl*>(node()->shadowAncestorNode()->renderer());
        if (renderer->hasOverflowClip())
            renderer->layer()->addScrolledContentOffset(contentsX, contentsY);
    }

    return RenderBlock::positionForPoint(IntPoint(contentsX, contentsY));
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:15,代码来源:TextControlInnerElements.cpp

示例6: document

void HTMLTextFormControlElement::setSelectionRange(int start, int end, TextFieldSelectionDirection direction)
{
    document()->updateLayoutIgnorePendingStylesheets();

    if (!renderer() || !renderer()->isTextControl())
        return;

    end = max(end, 0);
    start = min(max(start, 0), end);

    RenderTextControl* control = toRenderTextControl(renderer());
    if (!hasVisibleTextArea(control, innerTextElement())) {
        cacheSelection(start, end, direction);
        return;
    }
    VisiblePosition startPosition = control->visiblePositionForIndex(start);
    VisiblePosition endPosition;
    if (start == end)
        endPosition = startPosition;
    else
        endPosition = control->visiblePositionForIndex(end);

    // startPosition and endPosition can be null position for example when
    // "-webkit-user-select: none" style attribute is specified.
    if (startPosition.isNotNull() && endPosition.isNotNull()) {
        ASSERT(startPosition.deepEquivalent().deprecatedNode()->shadowHost() == this
            && endPosition.deepEquivalent().deprecatedNode()->shadowHost() == this);
    }
    VisibleSelection newSelection;
    if (direction == SelectionHasBackwardDirection)
        newSelection = VisibleSelection(endPosition, startPosition);
    else
        newSelection = VisibleSelection(startPosition, endPosition);
    newSelection.setIsDirectional(direction != SelectionHasNoDirection);

    if (Frame* frame = document()->frame())
        frame->selection()->setSelection(newSelection);
}
开发者ID:awong-chromium,项目名称:webkit,代码行数:38,代码来源:HTMLTextFormControlElement.cpp

示例7: nodeAtPoint

bool RenderTextControlInnerBlock::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, int x, int y, int tx, int ty, HitTestAction hitTestAction)
{
    RenderTextControl* renderer = static_cast<RenderTextControl*>(node()->shadowAncestorNode()->renderer());
    
    return RenderBlock::nodeAtPoint(request, result, x, y, tx, ty, renderer->placeholderIsVisible() ? HitTestBlockBackground : hitTestAction);
}
开发者ID:,项目名称:,代码行数:6,代码来源:


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