Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: Source/core/rendering/RenderTextControl.cpp

Issue 237823002: Properly shrink stretched flexbox children on relayout (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /** 1 /**
2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
3 * (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 3 * (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // FIXME: We should get the size of the scrollbar from the RenderTheme inste ad. 125 // FIXME: We should get the size of the scrollbar from the RenderTheme inste ad.
126 return ScrollbarTheme::theme()->scrollbarThickness(); 126 return ScrollbarTheme::theme()->scrollbarThickness();
127 } 127 }
128 128
129 void RenderTextControl::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUni t logicalTop, LogicalExtentComputedValues& computedValues) const 129 void RenderTextControl::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUni t logicalTop, LogicalExtentComputedValues& computedValues) const
130 { 130 {
131 HTMLElement* innerText = innerTextElement(); 131 HTMLElement* innerText = innerTextElement();
132 ASSERT(innerText); 132 ASSERT(innerText);
133 if (RenderBox* innerTextBox = innerText->renderBox()) { 133 if (RenderBox* innerTextBox = innerText->renderBox()) {
134 LayoutUnit nonContentHeight = innerTextBox->borderAndPaddingHeight() + i nnerTextBox->marginHeight(); 134 LayoutUnit nonContentHeight = innerTextBox->borderAndPaddingHeight() + i nnerTextBox->marginHeight();
135 logicalHeight = computeControlLogicalHeight(innerTextBox->lineHeight(tru e, HorizontalLine, PositionOfInteriorLineBoxes), nonContentHeight) + borderAndPa ddingHeight(); 135 logicalHeight = computeControlLogicalHeight(innerTextBox->lineHeight(tru e, HorizontalLine, PositionOfInteriorLineBoxes), nonContentHeight);
136 136
137 // We are able to have a horizontal scrollbar if the overflow style is s croll, or if its auto and there's no word wrap. 137 // We are able to have a horizontal scrollbar if the overflow style is s croll, or if its auto and there's no word wrap.
138 if ((isHorizontalWritingMode() && (style()->overflowX() == OSCROLL || ( style()->overflowX() == OAUTO && innerText->renderer()->style()->overflowWrap() == NormalOverflowWrap))) 138 if ((isHorizontalWritingMode() && (style()->overflowX() == OSCROLL || ( style()->overflowX() == OAUTO && innerText->renderer()->style()->overflowWrap() == NormalOverflowWrap)))
139 || (!isHorizontalWritingMode() && (style()->overflowY() == OSCROLL | | (style()->overflowY() == OAUTO && innerText->renderer()->style()->overflowWra p() == NormalOverflowWrap)))) 139 || (!isHorizontalWritingMode() && (style()->overflowY() == OSCROLL | | (style()->overflowY() == OAUTO && innerText->renderer()->style()->overflowWra p() == NormalOverflowWrap))))
140 logicalHeight += scrollbarThickness(); 140 logicalHeight += scrollbarThickness();
141
142 // FIXME: The logical height of the inner text box should have been adde d before calling computeLogicalHeight to
143 // avoid this hack.
144 updateIntrinsicContentLogicalHeight(logicalHeight);
145
146 logicalHeight += borderAndPaddingHeight();
ojan 2014/04/15 01:07:30 extra space
leviw_travelin_and_unemployed 2014/04/15 06:53:38 Thanks!
141 } 147 }
142 148
143 RenderBox::computeLogicalHeight(logicalHeight, logicalTop, computedValues); 149 RenderBox::computeLogicalHeight(logicalHeight, logicalTop, computedValues);
144 } 150 }
145 151
146 void RenderTextControl::hitInnerTextElement(HitTestResult& result, const LayoutP oint& pointInContainer, const LayoutPoint& accumulatedOffset) 152 void RenderTextControl::hitInnerTextElement(HitTestResult& result, const LayoutP oint& pointInContainer, const LayoutPoint& accumulatedOffset)
147 { 153 {
148 HTMLElement* innerText = innerTextElement(); 154 HTMLElement* innerText = innerTextElement();
149 if (!innerText->renderer()) 155 if (!innerText->renderer())
150 return; 156 return;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 HTMLElement* placeholder = toHTMLTextFormControlElement(node())->placeholder Element(); 295 HTMLElement* placeholder = toHTMLTextFormControlElement(node())->placeholder Element();
290 RenderObject* placeholderRenderer = placeholder ? placeholder->renderer() : 0; 296 RenderObject* placeholderRenderer = placeholder ? placeholder->renderer() : 0;
291 if (!placeholderRenderer) 297 if (!placeholderRenderer)
292 return 0; 298 return 0;
293 if (relayoutChildren) 299 if (relayoutChildren)
294 layoutScope.setChildNeedsLayout(placeholderRenderer); 300 layoutScope.setChildNeedsLayout(placeholderRenderer);
295 return placeholderRenderer; 301 return placeholderRenderer;
296 } 302 }
297 303
298 } // namespace WebCore 304 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698