| 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, |
| 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
| 14 * | 14 * |
| 15 * You should have received a copy of the GNU Library General Public License | 15 * You should have received a copy of the GNU Library General Public License |
| 16 * along with this library; see the file COPYING.LIB. If not, write to | 16 * along with this library; see the file COPYING.LIB. If not, write to |
| 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
| 19 * | 19 * |
| 20 */ | 20 */ |
| 21 | 21 |
| 22 #ifndef RenderTextControl_h | 22 #ifndef LayoutTextControl_h |
| 23 #define RenderTextControl_h | 23 #define LayoutTextControl_h |
| 24 | 24 |
| 25 #include "core/rendering/RenderBlockFlow.h" | 25 #include "core/rendering/RenderBlockFlow.h" |
| 26 #include "core/rendering/RenderFlexibleBox.h" | 26 #include "core/rendering/RenderFlexibleBox.h" |
| 27 | 27 |
| 28 namespace blink { | 28 namespace blink { |
| 29 | 29 |
| 30 class HTMLTextFormControlElement; | 30 class HTMLTextFormControlElement; |
| 31 | 31 |
| 32 class RenderTextControl : public RenderBlockFlow { | 32 class LayoutTextControl : public RenderBlockFlow { |
| 33 public: | 33 public: |
| 34 virtual ~RenderTextControl(); | 34 virtual ~LayoutTextControl(); |
| 35 | 35 |
| 36 HTMLTextFormControlElement* textFormControlElement() const; | 36 HTMLTextFormControlElement* textFormControlElement() const; |
| 37 virtual PassRefPtr<LayoutStyle> createInnerEditorStyle(const LayoutStyle& st
artStyle) const = 0; | 37 virtual PassRefPtr<LayoutStyle> createInnerEditorStyle(const LayoutStyle& st
artStyle) const = 0; |
| 38 | 38 |
| 39 protected: | 39 protected: |
| 40 RenderTextControl(HTMLTextFormControlElement*); | 40 LayoutTextControl(HTMLTextFormControlElement*); |
| 41 | 41 |
| 42 // This convenience function should not be made public because | 42 // This convenience function should not be made public because |
| 43 // innerEditorElement may outlive the render tree. | 43 // innerEditorElement may outlive the render tree. |
| 44 HTMLElement* innerEditorElement() const; | 44 HTMLElement* innerEditorElement() const; |
| 45 | 45 |
| 46 int scrollbarThickness() const; | 46 int scrollbarThickness() const; |
| 47 void adjustInnerEditorStyle(LayoutStyle& textBlockStyle) const; | 47 void adjustInnerEditorStyle(LayoutStyle& textBlockStyle) const; |
| 48 | 48 |
| 49 virtual void styleDidChange(StyleDifference, const LayoutStyle* oldStyle) ov
erride; | 49 virtual void styleDidChange(StyleDifference, const LayoutStyle* oldStyle) ov
erride; |
| 50 | 50 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 65 virtual LayoutObject* layoutSpecialExcludedChild(bool relayoutChildren, Subt
reeLayoutScope&) override; | 65 virtual LayoutObject* layoutSpecialExcludedChild(bool relayoutChildren, Subt
reeLayoutScope&) override; |
| 66 | 66 |
| 67 // We need to override this function because we don't want overflow:hidden o
n an <input> | 67 // We need to override this function because we don't want overflow:hidden o
n an <input> |
| 68 // to affect the baseline calculation. This is necessary because we are an i
nline-block | 68 // to affect the baseline calculation. This is necessary because we are an i
nline-block |
| 69 // element as an implementation detail which would normally be affected by t
his. | 69 // element as an implementation detail which would normally be affected by t
his. |
| 70 virtual int inlineBlockBaseline(LineDirectionMode direction) const override
{ return lastLineBoxBaseline(direction); } | 70 virtual int inlineBlockBaseline(LineDirectionMode direction) const override
{ return lastLineBoxBaseline(direction); } |
| 71 | 71 |
| 72 virtual bool isOfType(LayoutObjectType type) const override { return type ==
LayoutObjectTextControl || RenderBlockFlow::isOfType(type); } | 72 virtual bool isOfType(LayoutObjectType type) const override { return type ==
LayoutObjectTextControl || RenderBlockFlow::isOfType(type); } |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 virtual const char* renderName() const override { return "RenderTextControl"
; } | 75 virtual const char* renderName() const override { return "LayoutTextControl"
; } |
| 76 virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layo
utUnit& maxLogicalWidth) const override final; | 76 virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layo
utUnit& maxLogicalWidth) const override final; |
| 77 virtual void computePreferredLogicalWidths() override final; | 77 virtual void computePreferredLogicalWidths() override final; |
| 78 virtual void removeLeftoverAnonymousBlock(RenderBlock*) override final { } | 78 virtual void removeLeftoverAnonymousBlock(RenderBlock*) override final { } |
| 79 virtual bool avoidsFloats() const override final { return true; } | 79 virtual bool avoidsFloats() const override final { return true; } |
| 80 virtual bool canHaveGeneratedChildren() const override final { return false;
} | 80 virtual bool canHaveGeneratedChildren() const override final { return false;
} |
| 81 | 81 |
| 82 virtual void addChild(LayoutObject* newChild, LayoutObject* beforeChild = 0)
override final; | 82 virtual void addChild(LayoutObject* newChild, LayoutObject* beforeChild = 0)
override final; |
| 83 | 83 |
| 84 virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& addit
ionalOffset) const override final; | 84 virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& addit
ionalOffset) const override final; |
| 85 | 85 |
| 86 virtual bool canBeProgramaticallyScrolled() const override final { return tr
ue; } | 86 virtual bool canBeProgramaticallyScrolled() const override final { return tr
ue; } |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(RenderTextControl, isTextControl()); | 89 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTextControl, isTextControl()); |
| 90 | 90 |
| 91 // Renderer for our inner container, for <search> and others. | 91 // Renderer for our inner container, for <search> and others. |
| 92 // We can't use RenderFlexibleBox directly, because flexboxes have a different | 92 // We can't use RenderFlexibleBox directly, because flexboxes have a different |
| 93 // baseline definition, and then inputs of different types wouldn't line up | 93 // baseline definition, and then inputs of different types wouldn't line up |
| 94 // anymore. | 94 // anymore. |
| 95 class RenderTextControlInnerContainer final : public RenderFlexibleBox { | 95 class LayoutTextControlInnerContainer final : public RenderFlexibleBox { |
| 96 public: | 96 public: |
| 97 explicit RenderTextControlInnerContainer(Element* element) | 97 explicit LayoutTextControlInnerContainer(Element* element) |
| 98 : RenderFlexibleBox(element) | 98 : RenderFlexibleBox(element) |
| 99 { } | 99 { } |
| 100 virtual ~RenderTextControlInnerContainer() { } | 100 virtual ~LayoutTextControlInnerContainer() { } |
| 101 | 101 |
| 102 virtual int baselinePosition(FontBaseline baseline, bool firstLine, LineDire
ctionMode direction, LinePositionMode position) const override | 102 virtual int baselinePosition(FontBaseline baseline, bool firstLine, LineDire
ctionMode direction, LinePositionMode position) const override |
| 103 { | 103 { |
| 104 return RenderBlock::baselinePosition(baseline, firstLine, direction, pos
ition); | 104 return RenderBlock::baselinePosition(baseline, firstLine, direction, pos
ition); |
| 105 } | 105 } |
| 106 virtual int firstLineBoxBaseline() const override { return RenderBlock::firs
tLineBoxBaseline(); } | 106 virtual int firstLineBoxBaseline() const override { return RenderBlock::firs
tLineBoxBaseline(); } |
| 107 virtual int inlineBlockBaseline(LineDirectionMode direction) const override
{ return lastLineBoxBaseline(direction); } | 107 virtual int inlineBlockBaseline(LineDirectionMode direction) const override
{ return lastLineBoxBaseline(direction); } |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 | 110 |
| 111 } // namespace blink | 111 } // namespace blink |
| 112 | 112 |
| 113 #endif // RenderTextControl_h | 113 #endif // LayoutTextControl_h |
| OLD | NEW |