summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/RenderTextControl.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-09-10 19:10:20 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-09-10 19:10:20 +0200
commit284837daa07b29d6a63a748544a90b1f5842ac5c (patch)
treeecd258180bde91fe741e0cfd2638beb3c6da7e8e /Source/WebCore/rendering/RenderTextControl.cpp
parent2e2ba8ff45915f40ed3e014101269c175f2a89a0 (diff)
downloadqtwebkit-284837daa07b29d6a63a748544a90b1f5842ac5c.tar.gz
Imported WebKit commit 68645295d2e3e09af2c942f092556f06aa5f8b0d (http://svn.webkit.org/repository/webkit/trunk@128073)
New snapshot
Diffstat (limited to 'Source/WebCore/rendering/RenderTextControl.cpp')
-rw-r--r--Source/WebCore/rendering/RenderTextControl.cpp30
1 files changed, 20 insertions, 10 deletions
diff --git a/Source/WebCore/rendering/RenderTextControl.cpp b/Source/WebCore/rendering/RenderTextControl.cpp
index 3bc25b897..cb7637db3 100644
--- a/Source/WebCore/rendering/RenderTextControl.cpp
+++ b/Source/WebCore/rendering/RenderTextControl.cpp
@@ -110,13 +110,18 @@ int RenderTextControl::textBlockWidth() const
{
Element* innerText = innerTextElement();
ASSERT(innerText);
- return width() - borderAndPaddingWidth() - innerText->renderBox()->paddingLeft() - innerText->renderBox()->paddingRight();
+
+ LayoutUnit unitWidth = width() - borderAndPaddingWidth();
+ if (innerText->renderer())
+ unitWidth -= innerText->renderBox()->paddingLeft() + innerText->renderBox()->paddingRight();
+
+ return unitWidth;
}
void RenderTextControl::updateFromElement()
{
Element* innerText = innerTextElement();
- if (innerText)
+ if (innerText && innerText->renderer())
updateUserModifyProperty(node(), innerText->renderer()->style());
}
@@ -143,13 +148,14 @@ void RenderTextControl::computeLogicalHeight()
{
HTMLElement* innerText = innerTextElement();
ASSERT(innerText);
- RenderBox* innerTextBox = innerText->renderBox();
- LayoutUnit nonContentHeight = innerTextBox->borderAndPaddingHeight() + innerTextBox->marginHeight();
- setHeight(computeControlHeight(innerTextBox->lineHeight(true, HorizontalLine, PositionOfInteriorLineBoxes), nonContentHeight) + borderAndPaddingHeight());
+ if (RenderBox* innerTextBox = innerText->renderBox()) {
+ LayoutUnit nonContentHeight = innerTextBox->borderAndPaddingHeight() + innerTextBox->marginHeight();
+ setHeight(computeControlHeight(innerTextBox->lineHeight(true, HorizontalLine, PositionOfInteriorLineBoxes), nonContentHeight) + borderAndPaddingHeight());
- // We are able to have a horizontal scrollbar if the overflow style is scroll, or if its auto and there's no word wrap.
- if (style()->overflowX() == OSCROLL || (style()->overflowX() == OAUTO && innerText->renderer()->style()->wordWrap() == NormalWordWrap))
- setHeight(height() + scrollbarThickness());
+ // We are able to have a horizontal scrollbar if the overflow style is scroll, or if its auto and there's no word wrap.
+ if (style()->overflowX() == OSCROLL || (style()->overflowX() == OAUTO && innerText->renderer()->style()->overflowWrap() == NormalOverflowWrap))
+ setHeight(height() + scrollbarThickness());
+ }
RenderBlock::computeLogicalHeight();
}
@@ -157,6 +163,9 @@ void RenderTextControl::computeLogicalHeight()
void RenderTextControl::hitInnerTextElement(HitTestResult& result, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset)
{
HTMLElement* innerText = innerTextElement();
+ if (!innerText->renderer())
+ return;
+
LayoutPoint adjustedLocation = accumulatedOffset + location();
LayoutPoint localPoint = pointInContainer - toLayoutSize(adjustedLocation + innerText->renderBox()->location());
if (hasOverflowClip())
@@ -257,8 +266,9 @@ void RenderTextControl::computePreferredLogicalWidths()
else {
// Use average character width. Matches IE.
AtomicString family = style()->font().family().family();
- RenderBox* innerTextRenderBox = innerTextElement()->renderBox();
- m_maxPreferredLogicalWidth = preferredContentWidth(getAvgCharWidth(family)) + innerTextRenderBox->paddingLeft() + innerTextRenderBox->paddingRight();
+ m_maxPreferredLogicalWidth = preferredContentWidth(getAvgCharWidth(family));
+ if (RenderBox* innerTextRenderBox = innerTextElement()->renderBox())
+ m_maxPreferredLogicalWidth += innerTextRenderBox->paddingLeft() + innerTextRenderBox->paddingRight();
}
if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) {