void RenderTextControlSingleLine::forwardEvent(Event* event)
{
    RenderBox* innerTextRenderer = innerTextElement()->renderBox();

    if (event->type() == eventNames().blurEvent) {
        if (innerTextRenderer) {
            if (RenderLayer* innerLayer = innerTextRenderer->layer())
                innerLayer->scrollToOffset(style()->direction() == RTL ? innerLayer->scrollWidth() : 0, 0);
        }

        capsLockStateMayHaveChanged();
    } else if (event->type() == eventNames().focusEvent)
        capsLockStateMayHaveChanged();

    if (!event->isMouseEvent()) {
        RenderTextControl::forwardEvent(event);
        return;
    }

    FloatPoint localPoint = innerTextRenderer->absoluteToLocal(FloatPoint(static_cast<MouseEvent*>(event)->pageX(), static_cast<MouseEvent*>(event)->pageY()), false, true);
    if (m_resultsButton && localPoint.x() < innerTextRenderer->borderBoxRect().x())
        m_resultsButton->defaultEventHandler(event);
    else if (m_cancelButton && localPoint.x() > innerTextRenderer->borderBoxRect().right())
        m_cancelButton->defaultEventHandler(event);
    else
        RenderTextControl::forwardEvent(event);
}
void RenderTextControlSingleLine::autoscroll(const IntPoint& position)
{
    RenderBox* renderer = innerTextElement()->renderBox();
    if (!renderer)
        return;
    RenderLayer* layer = renderer->layer();
    if (layer)
        layer->autoscroll(position);
}
bool RenderTextControlSingleLine::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier, Node** stopNode)
{
    RenderBox* renderer = innerTextElement()->renderBox();
    if (!renderer)
        return false;
    RenderLayer* layer = renderer->layer();
    if (layer && layer->scroll(direction, granularity, multiplier))
        return true;
    return RenderBlock::scroll(direction, granularity, multiplier, stopNode);
}
Example #4
0
void RenderTextControlSingleLine::forwardEvent(Event* event)
{
    RenderBox* innerTextRenderer = innerTextElement()->renderBox();

    if (event->type() == eventNames().blurEvent) {
        if (innerTextRenderer) {
            if (RenderLayer* innerLayer = innerTextRenderer->layer())
                innerLayer->scrollToOffset(!style()->isLeftToRightDirection() ? innerLayer->scrollWidth() : 0, 0);
        }

        capsLockStateMayHaveChanged();
    } else if (event->type() == eventNames().focusEvent)
        capsLockStateMayHaveChanged();

    if (!event->isMouseEvent()) {
        RenderTextControl::forwardEvent(event);
        return;
    }

#if ENABLE(INPUT_SPEECH)
    if (RenderBox* speechBox = speechButtonElement() ? speechButtonElement()->renderBox() : 0) {
        RenderBox* parent = innerTextRenderer ? innerTextRenderer : this;
        FloatPoint pointInTextControlCoords = parent->absoluteToLocal(static_cast<MouseEvent*>(event)->absoluteLocation(), false, true);
        if (speechBox->frameRect().contains(roundedIntPoint(pointInTextControlCoords))) {
            speechButtonElement()->defaultEventHandler(event);
            return;
        }
    }
#endif

    FloatPoint localPoint = innerTextRenderer->absoluteToLocal(static_cast<MouseEvent*>(event)->absoluteLocation(), false, true);
    int textRight = innerTextRenderer->borderBoxRect().maxX();

    HTMLElement* resultsButton = resultsButtonElement();
    HTMLElement* cancelButton = cancelButtonElement();
    if (resultsButton && localPoint.x() < innerTextRenderer->borderBoxRect().x())
        resultsButton->defaultEventHandler(event);
    else if (cancelButton && localPoint.x() > textRight)
        cancelButton->defaultEventHandler(event);
    else
        RenderTextControl::forwardEvent(event);
}
// Collect the fixed positioned layers that have the named flows as containing block
// These layers are painted and hit-tested starting from RenderView not from regions.
void FlowThreadController::collectFixedPositionedLayers(Vector<RenderLayer*>& fixedPosLayers) const
{
    for (auto iter = m_renderNamedFlowThreadList->begin(), end = m_renderNamedFlowThreadList->end(); iter != end; ++iter) {
        RenderNamedFlowThread* flowRenderer = *iter;

        // If the named flow does not have any regions attached, a fixed element should not be
        // displayed even if the fixed element is positioned/sized by the viewport.
        if (!flowRenderer->hasRegions())
            continue;

        // Iterate over the fixed positioned elements in the flow thread
        TrackedRendererListHashSet* positionedDescendants = flowRenderer->positionedObjects();
        if (positionedDescendants) {
            for (auto it = positionedDescendants->begin(), end = positionedDescendants->end(); it != end; ++it) {
                RenderBox* box = *it;
                if (!box->fixedPositionedWithNamedFlowContainingBlock())
                    continue;
                fixedPosLayers.append(box->layer());
            }
        }
    }
}