| OLD | NEW |
| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 { | 55 { |
| 56 // FIXME: This is a terrible hack to get the caret over the placeholder text
since it'll | 56 // FIXME: This is a terrible hack to get the caret over the placeholder text
since it'll |
| 57 // make us paint the placeholder first. (See https://trac.webkit.org/changes
et/118733) | 57 // make us paint the placeholder first. (See https://trac.webkit.org/changes
et/118733) |
| 58 Node* node = newChild->node(); | 58 Node* node = newChild->node(); |
| 59 if (node && node->isElementNode() && toElement(node)->shadowPseudoId() == "-
webkit-input-placeholder") | 59 if (node && node->isElementNode() && toElement(node)->shadowPseudoId() == "-
webkit-input-placeholder") |
| 60 LayoutBlockFlow::addChild(newChild, firstChild()); | 60 LayoutBlockFlow::addChild(newChild, firstChild()); |
| 61 else | 61 else |
| 62 LayoutBlockFlow::addChild(newChild, beforeChild); | 62 LayoutBlockFlow::addChild(newChild, beforeChild); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void LayoutTextControl::styleDidChange(StyleDifference diff, const LayoutStyle*
oldStyle) | 65 void LayoutTextControl::styleDidChange(StyleDifference diff, const ComputedStyle
* oldStyle) |
| 66 { | 66 { |
| 67 LayoutBlockFlow::styleDidChange(diff, oldStyle); | 67 LayoutBlockFlow::styleDidChange(diff, oldStyle); |
| 68 Element* innerEditor = innerEditorElement(); | 68 Element* innerEditor = innerEditorElement(); |
| 69 if (!innerEditor) | 69 if (!innerEditor) |
| 70 return; | 70 return; |
| 71 LayoutBlock* innerEditorRenderer = toLayoutBlock(innerEditor->layoutObject()
); | 71 LayoutBlock* innerEditorRenderer = toLayoutBlock(innerEditor->layoutObject()
); |
| 72 if (innerEditorRenderer) { | 72 if (innerEditorRenderer) { |
| 73 // We may have set the width and the height in the old style in layout()
. | 73 // We may have set the width and the height in the old style in layout()
. |
| 74 // Reset them now to avoid getting a spurious layout hint. | 74 // Reset them now to avoid getting a spurious layout hint. |
| 75 innerEditorRenderer->style()->setHeight(Length()); | 75 innerEditorRenderer->style()->setHeight(Length()); |
| 76 innerEditorRenderer->style()->setWidth(Length()); | 76 innerEditorRenderer->style()->setWidth(Length()); |
| 77 innerEditorRenderer->setStyle(createInnerEditorStyle(styleRef())); | 77 innerEditorRenderer->setStyle(createInnerEditorStyle(styleRef())); |
| 78 innerEditor->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonFo
rTracing::create(StyleChangeReason::Control)); | 78 innerEditor->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonFo
rTracing::create(StyleChangeReason::Control)); |
| 79 } | 79 } |
| 80 textFormControlElement()->updatePlaceholderVisibility(false); | 80 textFormControlElement()->updatePlaceholderVisibility(false); |
| 81 } | 81 } |
| 82 | 82 |
| 83 static inline void updateUserModifyProperty(HTMLTextFormControlElement& node, La
youtStyle& style) | 83 static inline void updateUserModifyProperty(HTMLTextFormControlElement& node, Co
mputedStyle& style) |
| 84 { | 84 { |
| 85 style.setUserModify(node.isDisabledOrReadOnly() ? READ_ONLY : READ_WRITE_PLA
INTEXT_ONLY); | 85 style.setUserModify(node.isDisabledOrReadOnly() ? READ_ONLY : READ_WRITE_PLA
INTEXT_ONLY); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void LayoutTextControl::adjustInnerEditorStyle(LayoutStyle& textBlockStyle) cons
t | 88 void LayoutTextControl::adjustInnerEditorStyle(ComputedStyle& textBlockStyle) co
nst |
| 89 { | 89 { |
| 90 // The inner block, if present, always has its direction set to LTR, | 90 // The inner block, if present, always has its direction set to LTR, |
| 91 // so we need to inherit the direction and unicode-bidi style from the eleme
nt. | 91 // so we need to inherit the direction and unicode-bidi style from the eleme
nt. |
| 92 textBlockStyle.setDirection(style()->direction()); | 92 textBlockStyle.setDirection(style()->direction()); |
| 93 textBlockStyle.setUnicodeBidi(style()->unicodeBidi()); | 93 textBlockStyle.setUnicodeBidi(style()->unicodeBidi()); |
| 94 | 94 |
| 95 updateUserModifyProperty(*textFormControlElement(), textBlockStyle); | 95 updateUserModifyProperty(*textFormControlElement(), textBlockStyle); |
| 96 } | 96 } |
| 97 | 97 |
| 98 int LayoutTextControl::textBlockLogicalHeight() const | 98 int LayoutTextControl::textBlockLogicalHeight() const |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 if (!style()->logicalWidth().isPercent()) | 251 if (!style()->logicalWidth().isPercent()) |
| 252 minLogicalWidth = maxLogicalWidth; | 252 minLogicalWidth = maxLogicalWidth; |
| 253 } | 253 } |
| 254 | 254 |
| 255 void LayoutTextControl::computePreferredLogicalWidths() | 255 void LayoutTextControl::computePreferredLogicalWidths() |
| 256 { | 256 { |
| 257 ASSERT(preferredLogicalWidthsDirty()); | 257 ASSERT(preferredLogicalWidthsDirty()); |
| 258 | 258 |
| 259 m_minPreferredLogicalWidth = 0; | 259 m_minPreferredLogicalWidth = 0; |
| 260 m_maxPreferredLogicalWidth = 0; | 260 m_maxPreferredLogicalWidth = 0; |
| 261 const LayoutStyle& styleToUse = styleRef(); | 261 const ComputedStyle& styleToUse = styleRef(); |
| 262 | 262 |
| 263 if (styleToUse.logicalWidth().isFixed() && styleToUse.logicalWidth().value()
>= 0) | 263 if (styleToUse.logicalWidth().isFixed() && styleToUse.logicalWidth().value()
>= 0) |
| 264 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentB
oxLogicalWidthForBoxSizing(styleToUse.logicalWidth().value()); | 264 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentB
oxLogicalWidthForBoxSizing(styleToUse.logicalWidth().value()); |
| 265 else | 265 else |
| 266 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferred
LogicalWidth); | 266 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferred
LogicalWidth); |
| 267 | 267 |
| 268 if (styleToUse.logicalMinWidth().isFixed() && styleToUse.logicalMinWidth().v
alue() > 0) { | 268 if (styleToUse.logicalMinWidth().isFixed() && styleToUse.logicalMinWidth().v
alue() > 0) { |
| 269 m_maxPreferredLogicalWidth = std::max(m_maxPreferredLogicalWidth, adjust
ContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMinWidth().value())); | 269 m_maxPreferredLogicalWidth = std::max(m_maxPreferredLogicalWidth, adjust
ContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMinWidth().value())); |
| 270 m_minPreferredLogicalWidth = std::max(m_minPreferredLogicalWidth, adjust
ContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMinWidth().value())); | 270 m_minPreferredLogicalWidth = std::max(m_minPreferredLogicalWidth, adjust
ContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMinWidth().value())); |
| 271 } | 271 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 294 HTMLElement* placeholder = toHTMLTextFormControlElement(node())->placeholder
Element(); | 294 HTMLElement* placeholder = toHTMLTextFormControlElement(node())->placeholder
Element(); |
| 295 LayoutObject* placeholderRenderer = placeholder ? placeholder->layoutObject(
) : 0; | 295 LayoutObject* placeholderRenderer = placeholder ? placeholder->layoutObject(
) : 0; |
| 296 if (!placeholderRenderer) | 296 if (!placeholderRenderer) |
| 297 return 0; | 297 return 0; |
| 298 if (relayoutChildren) | 298 if (relayoutChildren) |
| 299 layoutScope.setChildNeedsLayout(placeholderRenderer); | 299 layoutScope.setChildNeedsLayout(placeholderRenderer); |
| 300 return placeholderRenderer; | 300 return placeholderRenderer; |
| 301 } | 301 } |
| 302 | 302 |
| 303 } // namespace blink | 303 } // namespace blink |
| OLD | NEW |