summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/RenderTextControlMultiLine.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2016-04-10 09:28:39 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2016-04-10 09:28:39 +0000
commit32761a6cee1d0dee366b885b7b9c777e67885688 (patch)
treed6bec92bebfb216f4126356e55518842c2f476a1 /Source/WebCore/rendering/RenderTextControlMultiLine.cpp
parenta4e969f4965059196ca948db781e52f7cfebf19e (diff)
downloadWebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/WebCore/rendering/RenderTextControlMultiLine.cpp')
-rw-r--r--Source/WebCore/rendering/RenderTextControlMultiLine.cpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/Source/WebCore/rendering/RenderTextControlMultiLine.cpp b/Source/WebCore/rendering/RenderTextControlMultiLine.cpp
index 8cefbf86b..fa8d8a801 100644
--- a/Source/WebCore/rendering/RenderTextControlMultiLine.cpp
+++ b/Source/WebCore/rendering/RenderTextControlMultiLine.cpp
@@ -32,8 +32,8 @@
namespace WebCore {
-RenderTextControlMultiLine::RenderTextControlMultiLine(HTMLTextAreaElement& element, Ref<RenderStyle>&& style)
- : RenderTextControl(element, WTFMove(style))
+RenderTextControlMultiLine::RenderTextControlMultiLine(HTMLTextAreaElement& element, PassRef<RenderStyle> style)
+ : RenderTextControl(element, std::move(style))
{
}
@@ -45,7 +45,7 @@ RenderTextControlMultiLine::~RenderTextControlMultiLine()
HTMLTextAreaElement& RenderTextControlMultiLine::textAreaElement() const
{
- return downcast<HTMLTextAreaElement>(RenderTextControl::textFormControlElement());
+ return toHTMLTextAreaElement(RenderTextControl::textFormControlElement());
}
bool RenderTextControlMultiLine::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction)
@@ -59,22 +59,22 @@ bool RenderTextControlMultiLine::nodeAtPoint(const HitTestRequest& request, HitT
return true;
}
-float RenderTextControlMultiLine::getAverageCharWidth()
+float RenderTextControlMultiLine::getAvgCharWidth(AtomicString family)
{
#if !PLATFORM(IOS)
// Since Lucida Grande is the default font, we want this to match the width
// of Courier New, the default font for textareas in IE, Firefox and Safari Win.
// 1229 is the avgCharWidth value in the OS/2 table for Courier New.
- if (style().fontCascade().firstFamily() == "Lucida Grande")
+ if (family == "Lucida Grande")
return scaleEmToUnits(1229);
#endif
- return RenderTextControl::getAverageCharWidth();
+ return RenderTextControl::getAvgCharWidth(family);
}
LayoutUnit RenderTextControlMultiLine::preferredContentLogicalWidth(float charWidth) const
{
- return ceilf(charWidth * textAreaElement().cols()) + scrollbarThickness();
+ return static_cast<LayoutUnit>(ceilf(charWidth * textAreaElement().cols())) + scrollbarThickness();
}
LayoutUnit RenderTextControlMultiLine::computeControlLogicalHeight(LayoutUnit lineHeight, LayoutUnit nonContentHeight) const
@@ -87,11 +87,11 @@ int RenderTextControlMultiLine::baselinePosition(FontBaseline baselineType, bool
return RenderBox::baselinePosition(baselineType, firstLine, direction, linePositionMode);
}
-Ref<RenderStyle> RenderTextControlMultiLine::createInnerTextStyle(const RenderStyle* startStyle) const
+PassRef<RenderStyle> RenderTextControlMultiLine::createInnerTextStyle(const RenderStyle* startStyle) const
{
auto textBlockStyle = RenderStyle::create();
textBlockStyle.get().inheritFrom(startStyle);
- adjustInnerTextStyle(startStyle, textBlockStyle.get());
+ adjustInnerTextStyle(startStyle, &textBlockStyle.get());
textBlockStyle.get().setDisplay(BLOCK);
#if PLATFORM(IOS)
@@ -106,13 +106,15 @@ Ref<RenderStyle> RenderTextControlMultiLine::createInnerTextStyle(const RenderSt
RenderObject* RenderTextControlMultiLine::layoutSpecialExcludedChild(bool relayoutChildren)
{
RenderObject* placeholderRenderer = RenderTextControl::layoutSpecialExcludedChild(relayoutChildren);
- if (is<RenderBox>(placeholderRenderer)) {
- auto& placeholderBox = downcast<RenderBox>(*placeholderRenderer);
- placeholderBox.style().setLogicalWidth(Length(contentLogicalWidth() - placeholderBox.borderAndPaddingLogicalWidth(), Fixed));
- placeholderBox.layoutIfNeeded();
- placeholderBox.setX(borderLeft() + paddingLeft());
- placeholderBox.setY(borderTop() + paddingTop());
- }
+ if (!placeholderRenderer)
+ return 0;
+ if (!placeholderRenderer->isBox())
+ return placeholderRenderer;
+ RenderBox* placeholderBox = toRenderBox(placeholderRenderer);
+ placeholderBox->style().setLogicalWidth(Length(contentLogicalWidth() - placeholderBox->borderAndPaddingLogicalWidth(), Fixed));
+ placeholderBox->layoutIfNeeded();
+ placeholderBox->setX(borderLeft() + paddingLeft());
+ placeholderBox->setY(borderTop() + paddingTop());
return placeholderRenderer;
}