summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/RenderTextControlMultiLine.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2016-05-24 08:28:08 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2016-05-24 08:28:08 +0000
commita4e969f4965059196ca948db781e52f7cfebf19e (patch)
tree6ca352808c8fdc52006a0f33f6ae3c593b23867d /Source/WebCore/rendering/RenderTextControlMultiLine.cpp
parent41386e9cb918eed93b3f13648cbef387e371e451 (diff)
downloadWebKitGtk-tarball-a4e969f4965059196ca948db781e52f7cfebf19e.tar.gz
webkitgtk-2.12.3webkitgtk-2.12.3
Diffstat (limited to 'Source/WebCore/rendering/RenderTextControlMultiLine.cpp')
-rw-r--r--Source/WebCore/rendering/RenderTextControlMultiLine.cpp34
1 files changed, 16 insertions, 18 deletions
diff --git a/Source/WebCore/rendering/RenderTextControlMultiLine.cpp b/Source/WebCore/rendering/RenderTextControlMultiLine.cpp
index fa8d8a801..8cefbf86b 100644
--- a/Source/WebCore/rendering/RenderTextControlMultiLine.cpp
+++ b/Source/WebCore/rendering/RenderTextControlMultiLine.cpp
@@ -32,8 +32,8 @@
namespace WebCore {
-RenderTextControlMultiLine::RenderTextControlMultiLine(HTMLTextAreaElement& element, PassRef<RenderStyle> style)
- : RenderTextControl(element, std::move(style))
+RenderTextControlMultiLine::RenderTextControlMultiLine(HTMLTextAreaElement& element, Ref<RenderStyle>&& style)
+ : RenderTextControl(element, WTFMove(style))
{
}
@@ -45,7 +45,7 @@ RenderTextControlMultiLine::~RenderTextControlMultiLine()
HTMLTextAreaElement& RenderTextControlMultiLine::textAreaElement() const
{
- return toHTMLTextAreaElement(RenderTextControl::textFormControlElement());
+ return downcast<HTMLTextAreaElement>(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::getAvgCharWidth(AtomicString family)
+float RenderTextControlMultiLine::getAverageCharWidth()
{
#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 (family == "Lucida Grande")
+ if (style().fontCascade().firstFamily() == "Lucida Grande")
return scaleEmToUnits(1229);
#endif
- return RenderTextControl::getAvgCharWidth(family);
+ return RenderTextControl::getAverageCharWidth();
}
LayoutUnit RenderTextControlMultiLine::preferredContentLogicalWidth(float charWidth) const
{
- return static_cast<LayoutUnit>(ceilf(charWidth * textAreaElement().cols())) + scrollbarThickness();
+ return 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);
}
-PassRef<RenderStyle> RenderTextControlMultiLine::createInnerTextStyle(const RenderStyle* startStyle) const
+Ref<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,15 +106,13 @@ PassRef<RenderStyle> RenderTextControlMultiLine::createInnerTextStyle(const Rend
RenderObject* RenderTextControlMultiLine::layoutSpecialExcludedChild(bool relayoutChildren)
{
RenderObject* placeholderRenderer = RenderTextControl::layoutSpecialExcludedChild(relayoutChildren);
- 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());
+ 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());
+ }
return placeholderRenderer;
}