summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/RenderTextControlSingleLine.cpp
diff options
context:
space:
mode:
authorKonstantin Tokarev <annulen@yandex.ru>2016-08-25 19:20:41 +0300
committerKonstantin Tokarev <annulen@yandex.ru>2017-02-02 12:30:55 +0000
commit6882a04fb36642862b11efe514251d32070c3d65 (patch)
treeb7959826000b061fd5ccc7512035c7478742f7b0 /Source/WebCore/rendering/RenderTextControlSingleLine.cpp
parentab6df191029eeeb0b0f16f127d553265659f739e (diff)
downloadqtwebkit-6882a04fb36642862b11efe514251d32070c3d65.tar.gz
Imported QtWebKit TP3 (git b57bc6801f1876c3220d5a4bfea33d620d477443)
Change-Id: I3b1d8a2808782c9f34d50240000e20cb38d3680f Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/WebCore/rendering/RenderTextControlSingleLine.cpp')
-rw-r--r--Source/WebCore/rendering/RenderTextControlSingleLine.cpp261
1 files changed, 112 insertions, 149 deletions
diff --git a/Source/WebCore/rendering/RenderTextControlSingleLine.cpp b/Source/WebCore/rendering/RenderTextControlSingleLine.cpp
index 8ba8ea13b..e6f5b6b91 100644
--- a/Source/WebCore/rendering/RenderTextControlSingleLine.cpp
+++ b/Source/WebCore/rendering/RenderTextControlSingleLine.cpp
@@ -27,6 +27,7 @@
#include "CSSFontSelector.h"
#include "CSSValueKeywords.h"
#include "Chrome.h"
+#include "Font.h"
#include "Frame.h"
#include "FrameSelection.h"
#include "FrameView.h"
@@ -38,25 +39,24 @@
#include "RenderLayer.h"
#include "RenderScrollbar.h"
#include "RenderTheme.h"
+#include "RenderView.h"
#include "Settings.h"
-#include "SimpleFontData.h"
#include "StyleResolver.h"
#include "TextControlInnerElements.h"
#include <wtf/StackStats.h>
-using namespace std;
+#if PLATFORM(IOS)
+#include "RenderThemeIOS.h"
+#endif
namespace WebCore {
using namespace HTMLNames;
-RenderTextControlSingleLine::RenderTextControlSingleLine(Element* element)
- : RenderTextControl(element)
- , m_shouldDrawCapsLockIndicator(false)
+RenderTextControlSingleLine::RenderTextControlSingleLine(HTMLInputElement& element, Ref<RenderStyle>&& style)
+ : RenderTextControl(element, WTFMove(style))
, m_desiredInnerTextLogicalHeight(-1)
{
- ASSERT(element->isHTMLElement());
- ASSERT(element->toInputElement());
}
RenderTextControlSingleLine::~RenderTextControlSingleLine()
@@ -65,37 +65,28 @@ RenderTextControlSingleLine::~RenderTextControlSingleLine()
inline HTMLElement* RenderTextControlSingleLine::innerSpinButtonElement() const
{
- return inputElement()->innerSpinButtonElement();
+ return inputElement().innerSpinButtonElement();
}
-RenderStyle* RenderTextControlSingleLine::textBaseStyle() const
+LayoutUnit RenderTextControlSingleLine::computeLogicalHeightLimit() const
{
- HTMLElement* innerBlock = innerBlockElement();
- return innerBlock ? innerBlock->renderer()->style() : style();
+ return containerElement() ? contentLogicalHeight() : logicalHeight();
}
-void RenderTextControlSingleLine::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
+void RenderTextControlSingleLine::centerRenderer(RenderBox& renderer) const
{
- RenderTextControl::paint(paintInfo, paintOffset);
-
- if (paintInfo.phase == PaintPhaseBlockBackground && m_shouldDrawCapsLockIndicator) {
- LayoutRect contentsRect = contentBoxRect();
-
- // Center in the block progression direction.
- if (isHorizontalWritingMode())
- contentsRect.setY((height() - contentsRect.height()) / 2);
- else
- contentsRect.setX((width() - contentsRect.width()) / 2);
-
- // Convert the rect into the coords used for painting the content
- contentsRect.moveBy(paintOffset + location());
- theme()->paintCapsLockIndicator(this, paintInfo, pixelSnappedIntRect(contentsRect));
- }
+ LayoutUnit logicalHeightDiff = renderer.logicalHeight() - contentLogicalHeight();
+ float center = logicalHeightDiff / 2;
+ renderer.setLogicalTop(renderer.logicalTop() - LayoutUnit(round(center)));
}
-LayoutUnit RenderTextControlSingleLine::computeLogicalHeightLimit() const
+static void setNeedsLayoutOnAncestors(RenderObject* start, RenderObject* ancestor)
{
- return containerElement() ? contentLogicalHeight() : logicalHeight();
+ ASSERT(start != ancestor);
+ for (RenderObject* renderer = start; renderer != ancestor; renderer = renderer->parent()) {
+ ASSERT(renderer);
+ renderer->setNeedsLayout(MarkOnlyThis);
+ }
}
void RenderTextControlSingleLine::layout()
@@ -113,20 +104,20 @@ void RenderTextControlSingleLine::layout()
// and type=search if the text height is taller than the contentHeight()
// because of compability.
- RenderBox* innerTextRenderer = innerTextElement()->renderBox();
+ RenderTextControlInnerBlock* innerTextRenderer = innerTextElement()->renderer();
RenderBox* innerBlockRenderer = innerBlockElement() ? innerBlockElement()->renderBox() : 0;
// To ensure consistency between layouts, we need to reset any conditionally overriden height.
- if (innerTextRenderer && !innerTextRenderer->style()->logicalHeight().isAuto()) {
- innerTextRenderer->style()->setLogicalHeight(Length(Auto));
- innerTextRenderer->setNeedsLayout(true, MarkOnlyThis);
+ if (innerTextRenderer && !innerTextRenderer->style().logicalHeight().isAuto()) {
+ innerTextRenderer->style().setLogicalHeight(Length(Auto));
+ setNeedsLayoutOnAncestors(innerTextRenderer, this);
}
- if (innerBlockRenderer && !innerBlockRenderer->style()->logicalHeight().isAuto()) {
- innerBlockRenderer->style()->setLogicalHeight(Length(Auto));
- innerBlockRenderer->setNeedsLayout(true, MarkOnlyThis);
+ if (innerBlockRenderer && !innerBlockRenderer->style().logicalHeight().isAuto()) {
+ innerBlockRenderer->style().setLogicalHeight(Length(Auto));
+ setNeedsLayoutOnAncestors(innerBlockRenderer, this);
}
- RenderBlock::layoutBlock(false);
+ RenderBlockFlow::layoutBlock(false);
HTMLElement* container = containerElement();
RenderBox* containerRenderer = container ? container->renderBox() : 0;
@@ -136,15 +127,15 @@ void RenderTextControlSingleLine::layout()
LayoutUnit logicalHeightLimit = computeLogicalHeightLimit();
if (innerTextRenderer && innerTextRenderer->logicalHeight() > logicalHeightLimit) {
if (desiredLogicalHeight != innerTextRenderer->logicalHeight())
- setNeedsLayout(true, MarkOnlyThis);
+ setNeedsLayout(MarkOnlyThis);
m_desiredInnerTextLogicalHeight = desiredLogicalHeight;
- innerTextRenderer->style()->setLogicalHeight(Length(desiredLogicalHeight, Fixed));
- innerTextRenderer->setNeedsLayout(true, MarkOnlyThis);
+ innerTextRenderer->style().setLogicalHeight(Length(desiredLogicalHeight, Fixed));
+ innerTextRenderer->setNeedsLayout(MarkOnlyThis);
if (innerBlockRenderer) {
- innerBlockRenderer->style()->setLogicalHeight(Length(desiredLogicalHeight, Fixed));
- innerBlockRenderer->setNeedsLayout(true, MarkOnlyThis);
+ innerBlockRenderer->style().setLogicalHeight(Length(desiredLogicalHeight, Fixed));
+ innerBlockRenderer->setNeedsLayout(MarkOnlyThis);
}
}
// The container might be taller because of decoration elements.
@@ -152,43 +143,42 @@ void RenderTextControlSingleLine::layout()
containerRenderer->layoutIfNeeded();
LayoutUnit containerLogicalHeight = containerRenderer->logicalHeight();
if (containerLogicalHeight > logicalHeightLimit) {
- containerRenderer->style()->setLogicalHeight(Length(logicalHeightLimit, Fixed));
- setNeedsLayout(true, MarkOnlyThis);
+ containerRenderer->style().setLogicalHeight(Length(logicalHeightLimit, Fixed));
+ setNeedsLayout(MarkOnlyThis);
} else if (containerRenderer->logicalHeight() < contentLogicalHeight()) {
- containerRenderer->style()->setLogicalHeight(Length(contentLogicalHeight(), Fixed));
- setNeedsLayout(true, MarkOnlyThis);
+ containerRenderer->style().setLogicalHeight(Length(contentLogicalHeight(), Fixed));
+ setNeedsLayout(MarkOnlyThis);
} else
- containerRenderer->style()->setLogicalHeight(Length(containerLogicalHeight, Fixed));
+ containerRenderer->style().setLogicalHeight(Length(containerLogicalHeight, Fixed));
}
// If we need another layout pass, we have changed one of children's height so we need to relayout them.
if (needsLayout())
- RenderBlock::layoutBlock(true);
+ RenderBlockFlow::layoutBlock(true);
// Center the child block in the block progression direction (vertical centering for horizontal text fields).
- if (!container && innerTextRenderer && innerTextRenderer->height() != contentLogicalHeight()) {
- LayoutUnit logicalHeightDiff = innerTextRenderer->logicalHeight() - contentLogicalHeight();
- innerTextRenderer->setLogicalTop(innerTextRenderer->logicalTop() - (logicalHeightDiff / 2 + layoutMod(logicalHeightDiff, 2)));
- } else
+ if (!container && innerTextRenderer && innerTextRenderer->height() != contentLogicalHeight())
+ centerRenderer(*innerTextRenderer);
+ else
centerContainerIfNeeded(containerRenderer);
// Ignores the paddings for the inner spin button.
if (RenderBox* innerSpinBox = innerSpinButtonElement() ? innerSpinButtonElement()->renderBox() : 0) {
RenderBox* parentBox = innerSpinBox->parentBox();
- if (containerRenderer && !containerRenderer->style()->isLeftToRightDirection())
+ if (containerRenderer && !containerRenderer->style().isLeftToRightDirection())
innerSpinBox->setLogicalLocation(LayoutPoint(-paddingLogicalLeft(), -paddingBefore()));
else
innerSpinBox->setLogicalLocation(LayoutPoint(parentBox->logicalWidth() - innerSpinBox->logicalWidth() + paddingLogicalRight(), -paddingBefore()));
innerSpinBox->setLogicalHeight(logicalHeight() - borderBefore() - borderAfter());
}
- HTMLElement* placeholderElement = inputElement()->placeholderElement();
+ HTMLElement* placeholderElement = inputElement().placeholderElement();
if (RenderBox* placeholderBox = placeholderElement ? placeholderElement->renderBox() : 0) {
LayoutSize innerTextSize;
if (innerTextRenderer)
innerTextSize = innerTextRenderer->size();
- placeholderBox->style()->setWidth(Length(innerTextSize.width() - placeholderBox->borderAndPaddingWidth(), Fixed));
- placeholderBox->style()->setHeight(Length(innerTextSize.height() - placeholderBox->borderAndPaddingHeight(), Fixed));
+ placeholderBox->style().setWidth(Length(innerTextSize.width() - placeholderBox->horizontalBorderAndPaddingExtent(), Fixed));
+ placeholderBox->style().setHeight(Length(innerTextSize.height() - placeholderBox->verticalBorderAndPaddingExtent(), Fixed));
bool neededLayout = placeholderBox->needsLayout();
bool placeholderBoxHadLayout = placeholderBox->everHadLayout();
placeholderBox->layoutIfNeeded();
@@ -211,6 +201,12 @@ void RenderTextControlSingleLine::layout()
if (neededLayout)
computeOverflow(clientLogicalBottom());
}
+
+#if PLATFORM(IOS)
+ // FIXME: We should not be adjusting styles during layout. <rdar://problem/7675493>
+ if (inputElement().isSearchField())
+ RenderThemeIOS::adjustRoundBorderRadius(style(), *this);
+#endif
}
bool RenderTextControlSingleLine::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction)
@@ -223,7 +219,7 @@ bool RenderTextControlSingleLine::nodeAtPoint(const HitTestRequest& request, Hit
// - we hit the <input> element (e.g. we're over the border or padding), or
// - we hit regions not in any decoration buttons.
HTMLElement* container = containerElement();
- if (result.innerNode()->isDescendantOf(innerTextElement()) || result.innerNode() == node() || (container && container == result.innerNode())) {
+ if (result.innerNode()->isDescendantOf(innerTextElement()) || result.innerNode() == &inputElement() || (container && container == result.innerNode())) {
LayoutPoint pointInParent = locationInContainer.point();
if (container && innerBlockElement()) {
if (innerBlockElement()->renderBox())
@@ -245,46 +241,22 @@ void RenderTextControlSingleLine::styleDidChange(StyleDifference diff, const Ren
// Reset them now to avoid getting a spurious layout hint.
HTMLElement* innerBlock = innerBlockElement();
if (RenderObject* innerBlockRenderer = innerBlock ? innerBlock->renderer() : 0) {
- innerBlockRenderer->style()->setHeight(Length());
- innerBlockRenderer->style()->setWidth(Length());
+ innerBlockRenderer->style().setHeight(Length());
+ innerBlockRenderer->style().setWidth(Length());
}
HTMLElement* container = containerElement();
if (RenderObject* containerRenderer = container ? container->renderer() : 0) {
- containerRenderer->style()->setHeight(Length());
- containerRenderer->style()->setWidth(Length());
+ containerRenderer->style().setHeight(Length());
+ containerRenderer->style().setWidth(Length());
}
- RenderObject* innerTextRenderer = innerTextElement()->renderer();
+ RenderTextControlInnerBlock* innerTextRenderer = innerTextElement()->renderer();
if (innerTextRenderer && diff == StyleDifferenceLayout)
- innerTextRenderer->setNeedsLayout(true, MarkContainingBlockChain);
- if (HTMLElement* placeholder = inputElement()->placeholderElement())
+ innerTextRenderer->setNeedsLayout(MarkContainingBlockChain);
+ if (HTMLElement* placeholder = inputElement().placeholderElement())
placeholder->setInlineStyleProperty(CSSPropertyTextOverflow, textShouldBeTruncated() ? CSSValueEllipsis : CSSValueClip);
setHasOverflowClip(false);
}
-void RenderTextControlSingleLine::capsLockStateMayHaveChanged()
-{
- if (!node() || !document())
- return;
-
- // Only draw the caps lock indicator if these things are true:
- // 1) The field is a password field
- // 2) The frame is active
- // 3) The element is focused
- // 4) The caps lock is on
- bool shouldDrawCapsLockIndicator = false;
-
- if (Frame* frame = document()->frame())
- shouldDrawCapsLockIndicator = inputElement()->isPasswordField()
- && frame->selection()->isFocusedAndActive()
- && document()->focusedElement() == node()
- && PlatformKeyboardEvent::currentCapsLockState();
-
- if (shouldDrawCapsLockIndicator != m_shouldDrawCapsLockIndicator) {
- m_shouldDrawCapsLockIndicator = shouldDrawCapsLockIndicator;
- repaint();
- }
-}
-
bool RenderTextControlSingleLine::hasControlClip() const
{
// Apply control clip for text fields with decorations.
@@ -301,51 +273,49 @@ LayoutRect RenderTextControlSingleLine::controlClipRect(const LayoutPoint& addit
return clipRect;
}
-float RenderTextControlSingleLine::getAvgCharWidth(AtomicString family)
+float RenderTextControlSingleLine::getAverageCharWidth()
{
+#if !PLATFORM(IOS)
// Since Lucida Grande is the default font, we want this to match the width
// of MS Shell Dlg, the default font for textareas in Firefox, Safari Win and
// IE for some encodings (in IE, the default font is encoding specific).
// 901 is the avgCharWidth value in the OS/2 table for MS Shell Dlg.
- if (family == "Lucida Grande")
+ if (style().fontCascade().firstFamily() == "Lucida Grande")
return scaleEmToUnits(901);
+#endif
- return RenderTextControl::getAvgCharWidth(family);
+ return RenderTextControl::getAverageCharWidth();
}
LayoutUnit RenderTextControlSingleLine::preferredContentLogicalWidth(float charWidth) const
{
int factor;
- bool includesDecoration = inputElement()->sizeShouldIncludeDecoration(factor);
+ bool includesDecoration = inputElement().sizeShouldIncludeDecoration(factor);
if (factor <= 0)
factor = 20;
- LayoutUnit result = static_cast<LayoutUnit>(ceiledLayoutUnit(charWidth * factor));
+ LayoutUnit result = LayoutUnit::fromFloatCeil(charWidth * factor);
float maxCharWidth = 0.f;
- const AtomicString& family = style()->font().firstFamily();
+
+#if !PLATFORM(IOS)
+ const AtomicString& family = style().fontCascade().firstFamily();
// Since Lucida Grande is the default font, we want this to match the width
// of MS Shell Dlg, the default font for textareas in Firefox, Safari Win and
// IE for some encodings (in IE, the default font is encoding specific).
// 4027 is the (xMax - xMin) value in the "head" font table for MS Shell Dlg.
if (family == "Lucida Grande")
maxCharWidth = scaleEmToUnits(4027);
- else if (hasValidAvgCharWidth(family))
- maxCharWidth = roundf(style()->font().primaryFont()->maxCharWidth());
+ else if (style().fontCascade().hasValidAverageCharWidth())
+ maxCharWidth = roundf(style().fontCascade().primaryFont().maxCharWidth());
+#endif
// For text inputs, IE adds some extra width.
if (maxCharWidth > 0.f)
result += maxCharWidth - charWidth;
- if (includesDecoration) {
- HTMLElement* spinButton = innerSpinButtonElement();
- if (RenderBox* spinRenderer = spinButton ? spinButton->renderBox() : 0) {
- result += spinRenderer->borderAndPaddingLogicalWidth();
- // Since the width of spinRenderer is not calculated yet, spinRenderer->logicalWidth() returns 0.
- // So computedStyle()->logicalWidth() is used instead.
- result += spinButton->computedStyle()->logicalWidth().value();
- }
- }
+ if (includesDecoration)
+ result += inputElement().decorationWidth();
return result;
}
@@ -355,61 +325,54 @@ LayoutUnit RenderTextControlSingleLine::computeControlLogicalHeight(LayoutUnit l
return lineHeight + nonContentHeight;
}
-void RenderTextControlSingleLine::updateFromElement()
-{
- RenderTextControl::updateFromElement();
-}
-
-PassRefPtr<RenderStyle> RenderTextControlSingleLine::createInnerTextStyle(const RenderStyle* startStyle) const
+Ref<RenderStyle> RenderTextControlSingleLine::createInnerTextStyle(const RenderStyle* startStyle) const
{
- RefPtr<RenderStyle> textBlockStyle = RenderStyle::create();
- textBlockStyle->inheritFrom(startStyle);
+ auto textBlockStyle = RenderStyle::create();
+ textBlockStyle.get().inheritFrom(startStyle);
adjustInnerTextStyle(startStyle, textBlockStyle.get());
- textBlockStyle->setWhiteSpace(PRE);
- textBlockStyle->setOverflowWrap(NormalOverflowWrap);
- textBlockStyle->setOverflowX(OHIDDEN);
- textBlockStyle->setOverflowY(OHIDDEN);
- textBlockStyle->setTextOverflow(textShouldBeTruncated() ? TextOverflowEllipsis : TextOverflowClip);
+ textBlockStyle.get().setWhiteSpace(PRE);
+ textBlockStyle.get().setOverflowWrap(NormalOverflowWrap);
+ textBlockStyle.get().setOverflowX(OHIDDEN);
+ textBlockStyle.get().setOverflowY(OHIDDEN);
+ textBlockStyle.get().setTextOverflow(textShouldBeTruncated() ? TextOverflowEllipsis : TextOverflowClip);
if (m_desiredInnerTextLogicalHeight >= 0)
- textBlockStyle->setLogicalHeight(Length(m_desiredInnerTextLogicalHeight, Fixed));
+ textBlockStyle.get().setLogicalHeight(Length(m_desiredInnerTextLogicalHeight, Fixed));
// Do not allow line-height to be smaller than our default.
- if (textBlockStyle->fontMetrics().lineSpacing() > lineHeight(true, HorizontalLine, PositionOfInteriorLineBoxes))
- textBlockStyle->setLineHeight(RenderStyle::initialLineHeight());
+ if (textBlockStyle.get().fontMetrics().lineSpacing() > lineHeight(true, HorizontalLine, PositionOfInteriorLineBoxes))
+ textBlockStyle.get().setLineHeight(RenderStyle::initialLineHeight());
- textBlockStyle->setDisplay(BLOCK);
+ textBlockStyle.get().setDisplay(BLOCK);
- return textBlockStyle.release();
+ return textBlockStyle;
}
-PassRefPtr<RenderStyle> RenderTextControlSingleLine::createInnerBlockStyle(const RenderStyle* startStyle) const
+Ref<RenderStyle> RenderTextControlSingleLine::createInnerBlockStyle(const RenderStyle* startStyle) const
{
- RefPtr<RenderStyle> innerBlockStyle = RenderStyle::create();
- innerBlockStyle->inheritFrom(startStyle);
+ auto innerBlockStyle = RenderStyle::create();
+ innerBlockStyle.get().inheritFrom(startStyle);
- innerBlockStyle->setFlexGrow(1);
+ innerBlockStyle.get().setFlexGrow(1);
// min-width: 0; is needed for correct shrinking.
- // FIXME: Remove this line when https://bugs.webkit.org/show_bug.cgi?id=111790 is fixed.
- innerBlockStyle->setMinWidth(Length(0, Fixed));
- innerBlockStyle->setDisplay(BLOCK);
- innerBlockStyle->setDirection(LTR);
+ innerBlockStyle.get().setMinWidth(Length(0, Fixed));
+ innerBlockStyle.get().setDisplay(BLOCK);
+ innerBlockStyle.get().setDirection(LTR);
// We don't want the shadow dom to be editable, so we set this block to read-only in case the input itself is editable.
- innerBlockStyle->setUserModify(READ_ONLY);
+ innerBlockStyle.get().setUserModify(READ_ONLY);
- return innerBlockStyle.release();
+ return innerBlockStyle;
}
bool RenderTextControlSingleLine::textShouldBeTruncated() const
{
- return document()->focusedElement() != node()
- && style()->textOverflow() == TextOverflowEllipsis;
+ return document().focusedElement() != &inputElement() && style().textOverflow() == TextOverflowEllipsis;
}
void RenderTextControlSingleLine::autoscroll(const IntPoint& position)
{
- RenderBox* renderer = innerTextElement()->renderBox();
+ RenderTextControlInnerBlock* renderer = innerTextElement()->renderer();
if (!renderer)
return;
RenderLayer* layer = renderer->layer();
@@ -421,28 +384,28 @@ int RenderTextControlSingleLine::scrollWidth() const
{
if (innerTextElement())
return innerTextElement()->scrollWidth();
- return RenderBlock::scrollWidth();
+ return RenderBlockFlow::scrollWidth();
}
int RenderTextControlSingleLine::scrollHeight() const
{
if (innerTextElement())
return innerTextElement()->scrollHeight();
- return RenderBlock::scrollHeight();
+ return RenderBlockFlow::scrollHeight();
}
int RenderTextControlSingleLine::scrollLeft() const
{
if (innerTextElement())
return innerTextElement()->scrollLeft();
- return RenderBlock::scrollLeft();
+ return RenderBlockFlow::scrollLeft();
}
int RenderTextControlSingleLine::scrollTop() const
{
if (innerTextElement())
return innerTextElement()->scrollTop();
- return RenderBlock::scrollTop();
+ return RenderBlockFlow::scrollTop();
}
void RenderTextControlSingleLine::setScrollLeft(int newLeft)
@@ -457,28 +420,28 @@ void RenderTextControlSingleLine::setScrollTop(int newTop)
innerTextElement()->setScrollTop(newTop);
}
-bool RenderTextControlSingleLine::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier, Node** stopNode)
+bool RenderTextControlSingleLine::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier, Element** stopElement, RenderBox* startBox, const IntPoint& wheelEventAbsolutePoint)
{
- RenderBox* renderer = innerTextElement()->renderBox();
+ RenderTextControlInnerBlock* renderer = innerTextElement()->renderer();
if (!renderer)
return false;
RenderLayer* layer = renderer->layer();
if (layer && layer->scroll(direction, granularity, multiplier))
return true;
- return RenderBlock::scroll(direction, granularity, multiplier, stopNode);
+ return RenderBlockFlow::scroll(direction, granularity, multiplier, stopElement, startBox, wheelEventAbsolutePoint);
}
-bool RenderTextControlSingleLine::logicalScroll(ScrollLogicalDirection direction, ScrollGranularity granularity, float multiplier, Node** stopNode)
+bool RenderTextControlSingleLine::logicalScroll(ScrollLogicalDirection direction, ScrollGranularity granularity, float multiplier, Element** stopElement)
{
- RenderLayer* layer = innerTextElement()->renderBox()->layer();
- if (layer && layer->scroll(logicalToPhysical(direction, style()->isHorizontalWritingMode(), style()->isFlippedBlocksWritingMode()), granularity, multiplier))
+ RenderLayer* layer = innerTextElement()->renderer()->layer();
+ if (layer && layer->scroll(logicalToPhysical(direction, style().isHorizontalWritingMode(), style().isFlippedBlocksWritingMode()), granularity, multiplier))
return true;
- return RenderBlock::logicalScroll(direction, granularity, multiplier, stopNode);
+ return RenderBlockFlow::logicalScroll(direction, granularity, multiplier, stopElement);
}
-HTMLInputElement* RenderTextControlSingleLine::inputElement() const
+HTMLInputElement& RenderTextControlSingleLine::inputElement() const
{
- return node()->toInputElement();
+ return downcast<HTMLInputElement>(RenderTextControl::textFormControlElement());
}
}