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 27 matching lines...) Expand all Loading... |
38 | 38 |
39 protected: | 39 protected: |
40 RenderTextControl(HTMLTextFormControlElement*); | 40 RenderTextControl(HTMLTextFormControlElement*); |
41 | 41 |
42 // This convenience function should not be made public because innerTextElem
ent may outlive the render tree. | 42 // This convenience function should not be made public because innerTextElem
ent may outlive the render tree. |
43 HTMLElement* innerTextElement() const; | 43 HTMLElement* innerTextElement() const; |
44 | 44 |
45 int scrollbarThickness() const; | 45 int scrollbarThickness() const; |
46 void adjustInnerTextStyle(RenderStyle* textBlockStyle) const; | 46 void adjustInnerTextStyle(RenderStyle* textBlockStyle) const; |
47 | 47 |
48 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); | 48 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OV
ERRIDE; |
49 | 49 |
50 void hitInnerTextElement(HitTestResult&, const LayoutPoint& pointInContainer
, const LayoutPoint& accumulatedOffset); | 50 void hitInnerTextElement(HitTestResult&, const LayoutPoint& pointInContainer
, const LayoutPoint& accumulatedOffset); |
51 | 51 |
52 int textBlockLogicalWidth() const; | 52 int textBlockLogicalWidth() const; |
53 int textBlockLogicalHeight() const; | 53 int textBlockLogicalHeight() const; |
54 | 54 |
55 float scaleEmToUnits(int x) const; | 55 float scaleEmToUnits(int x) const; |
56 | 56 |
57 static bool hasValidAvgCharWidth(AtomicString family); | 57 static bool hasValidAvgCharWidth(AtomicString family); |
58 virtual float getAvgCharWidth(AtomicString family); | 58 virtual float getAvgCharWidth(AtomicString family); |
59 virtual LayoutUnit preferredContentLogicalWidth(float charWidth) const = 0; | 59 virtual LayoutUnit preferredContentLogicalWidth(float charWidth) const = 0; |
60 virtual LayoutUnit computeControlLogicalHeight(LayoutUnit lineHeight, Layout
Unit nonContentHeight) const = 0; | 60 virtual LayoutUnit computeControlLogicalHeight(LayoutUnit lineHeight, Layout
Unit nonContentHeight) const = 0; |
61 | 61 |
62 virtual void updateFromElement(); | 62 virtual void updateFromElement() OVERRIDE; |
63 virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logic
alTop, LogicalExtentComputedValues&) const OVERRIDE; | 63 virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logic
alTop, LogicalExtentComputedValues&) const OVERRIDE; |
64 virtual RenderObject* layoutSpecialExcludedChild(bool relayoutChildren, Subt
reeLayoutScope&); | 64 virtual RenderObject* layoutSpecialExcludedChild(bool relayoutChildren, Subt
reeLayoutScope&) OVERRIDE; |
65 | 65 |
66 // We need to override this function because we don't want overflow:hidden o
n an <input> | 66 // We need to override this function because we don't want overflow:hidden o
n an <input> |
67 // to affect the baseline calculation. This is necessary because we are an i
nline-block | 67 // to affect the baseline calculation. This is necessary because we are an i
nline-block |
68 // element as an implementation detail which would normally be affected by t
his. | 68 // element as an implementation detail which would normally be affected by t
his. |
69 virtual int inlineBlockBaseline(LineDirectionMode direction) const OVERRIDE
{ return lastLineBoxBaseline(direction); } | 69 virtual int inlineBlockBaseline(LineDirectionMode direction) const OVERRIDE
{ return lastLineBoxBaseline(direction); } |
70 | 70 |
71 private: | 71 private: |
72 virtual const char* renderName() const { return "RenderTextControl"; } | 72 virtual const char* renderName() const OVERRIDE { return "RenderTextControl"
; } |
73 virtual bool isTextControl() const { return true; } | 73 virtual bool isTextControl() const OVERRIDE FINAL { return true; } |
74 virtual bool supportsPartialLayout() const OVERRIDE { return false; } | 74 virtual bool supportsPartialLayout() const OVERRIDE FINAL { return false; } |
75 virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layo
utUnit& maxLogicalWidth) const OVERRIDE; | 75 virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layo
utUnit& maxLogicalWidth) const OVERRIDE FINAL; |
76 virtual void computePreferredLogicalWidths() OVERRIDE; | 76 virtual void computePreferredLogicalWidths() OVERRIDE FINAL; |
77 virtual void removeLeftoverAnonymousBlock(RenderBlock*) { } | 77 virtual void removeLeftoverAnonymousBlock(RenderBlock*) OVERRIDE FINAL { } |
78 virtual bool avoidsFloats() const { return true; } | 78 virtual bool avoidsFloats() const OVERRIDE FINAL { return true; } |
79 virtual bool canHaveGeneratedChildren() const OVERRIDE { return false; } | 79 virtual bool canHaveGeneratedChildren() const OVERRIDE FINAL { return false;
} |
80 | 80 |
81 virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0)
OVERRIDE FINAL; | 81 virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0)
OVERRIDE FINAL; |
82 | 82 |
83 virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& addition
alOffset, const RenderLayerModelObject* paintContainer = 0) OVERRIDE; | 83 virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& addition
alOffset, const RenderLayerModelObject* paintContainer = 0) OVERRIDE FINAL; |
84 | 84 |
85 virtual bool canBeProgramaticallyScrolled() const { return true; } | 85 virtual bool canBeProgramaticallyScrolled() const OVERRIDE FINAL { return tr
ue; } |
86 }; | 86 }; |
87 | 87 |
88 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderTextControl, isTextControl()); | 88 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderTextControl, isTextControl()); |
89 | 89 |
90 // Renderer for our inner container, for <search> and others. | 90 // Renderer for our inner container, for <search> and others. |
91 // We can't use RenderFlexibleBox directly, because flexboxes have a different | 91 // We can't use RenderFlexibleBox directly, because flexboxes have a different |
92 // baseline definition, and then inputs of different types wouldn't line up | 92 // baseline definition, and then inputs of different types wouldn't line up |
93 // anymore. | 93 // anymore. |
94 class RenderTextControlInnerContainer FINAL : public RenderFlexibleBox { | 94 class RenderTextControlInnerContainer FINAL : public RenderFlexibleBox { |
95 public: | 95 public: |
96 explicit RenderTextControlInnerContainer(Element* element) | 96 explicit RenderTextControlInnerContainer(Element* element) |
97 : RenderFlexibleBox(element) | 97 : RenderFlexibleBox(element) |
98 { } | 98 { } |
99 virtual ~RenderTextControlInnerContainer() { } | 99 virtual ~RenderTextControlInnerContainer() { } |
100 | 100 |
101 virtual int baselinePosition(FontBaseline baseline, bool firstLine, LineDire
ctionMode direction, LinePositionMode position) const OVERRIDE | 101 virtual int baselinePosition(FontBaseline baseline, bool firstLine, LineDire
ctionMode direction, LinePositionMode position) const OVERRIDE |
102 { | 102 { |
103 return RenderBlock::baselinePosition(baseline, firstLine, direction, pos
ition); | 103 return RenderBlock::baselinePosition(baseline, firstLine, direction, pos
ition); |
104 } | 104 } |
105 virtual int firstLineBoxBaseline() const OVERRIDE { return RenderBlock::firs
tLineBoxBaseline(); } | 105 virtual int firstLineBoxBaseline() const OVERRIDE { return RenderBlock::firs
tLineBoxBaseline(); } |
106 virtual int inlineBlockBaseline(LineDirectionMode direction) const OVERRIDE
{ return lastLineBoxBaseline(direction); } | 106 virtual int inlineBlockBaseline(LineDirectionMode direction) const OVERRIDE
{ return lastLineBoxBaseline(direction); } |
107 virtual bool supportsPartialLayout() const OVERRIDE { return false; } | 107 virtual bool supportsPartialLayout() const OVERRIDE { return false; } |
108 }; | 108 }; |
109 | 109 |
110 | 110 |
111 } // namespace WebCore | 111 } // namespace WebCore |
112 | 112 |
113 #endif // RenderTextControl_h | 113 #endif // RenderTextControl_h |
OLD | NEW |