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

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

Issue 33983003: Introduce DEFINE_RENDER_OBJECT_TYPE_CASTS to replace manual toRenderFoo, and use it (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 2 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
« no previous file with comments | « Source/core/rendering/RenderText.h ('k') | Source/core/rendering/RenderTextControlMultiLine.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0) OVERRIDE FINAL; 83 virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0) OVERRIDE FINAL;
84 84
85 virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& addition alOffset, const RenderLayerModelObject* paintContainer = 0) OVERRIDE; 85 virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& addition alOffset, const RenderLayerModelObject* paintContainer = 0) OVERRIDE;
86 86
87 virtual bool canBeProgramaticallyScrolled() const { return true; } 87 virtual bool canBeProgramaticallyScrolled() const { return true; }
88 88
89 virtual bool requiresForcedStyleRecalcPropagation() const { return true; } 89 virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
90 }; 90 };
91 91
92 inline RenderTextControl* toRenderTextControl(RenderObject* object) 92 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderTextControl, isTextControl());
93 {
94 ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isTextControl());
95 return static_cast<RenderTextControl*>(object);
96 }
97
98 inline const RenderTextControl* toRenderTextControl(const RenderObject* object)
99 {
100 ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isTextControl());
101 return static_cast<const RenderTextControl*>(object);
102 }
103
104 // This will catch anyone doing an unnecessary cast.
105 void toRenderTextControl(const RenderTextControl*);
106 93
107 // Renderer for our inner container, for <search> and others. 94 // Renderer for our inner container, for <search> and others.
108 // We can't use RenderFlexibleBox directly, because flexboxes have a different 95 // We can't use RenderFlexibleBox directly, because flexboxes have a different
109 // baseline definition, and then inputs of different types wouldn't line up 96 // baseline definition, and then inputs of different types wouldn't line up
110 // anymore. 97 // anymore.
111 class RenderTextControlInnerContainer FINAL : public RenderFlexibleBox { 98 class RenderTextControlInnerContainer FINAL : public RenderFlexibleBox {
112 public: 99 public:
113 explicit RenderTextControlInnerContainer(Element* element) 100 explicit RenderTextControlInnerContainer(Element* element)
114 : RenderFlexibleBox(element) 101 : RenderFlexibleBox(element)
115 { } 102 { }
116 virtual ~RenderTextControlInnerContainer() { } 103 virtual ~RenderTextControlInnerContainer() { }
117 104
118 virtual int baselinePosition(FontBaseline baseline, bool firstLine, LineDire ctionMode direction, LinePositionMode position) const OVERRIDE 105 virtual int baselinePosition(FontBaseline baseline, bool firstLine, LineDire ctionMode direction, LinePositionMode position) const OVERRIDE
119 { 106 {
120 return RenderBlock::baselinePosition(baseline, firstLine, direction, pos ition); 107 return RenderBlock::baselinePosition(baseline, firstLine, direction, pos ition);
121 } 108 }
122 virtual int firstLineBoxBaseline() const OVERRIDE { return RenderBlock::firs tLineBoxBaseline(); } 109 virtual int firstLineBoxBaseline() const OVERRIDE { return RenderBlock::firs tLineBoxBaseline(); }
123 virtual int inlineBlockBaseline(LineDirectionMode direction) const OVERRIDE { return lastLineBoxBaseline(direction); } 110 virtual int inlineBlockBaseline(LineDirectionMode direction) const OVERRIDE { return lastLineBoxBaseline(direction); }
124 virtual bool supportsPartialLayout() const OVERRIDE { return false; } 111 virtual bool supportsPartialLayout() const OVERRIDE { return false; }
125 }; 112 };
126 113
127 114
128 } // namespace WebCore 115 } // namespace WebCore
129 116
130 #endif // RenderTextControl_h 117 #endif // RenderTextControl_h
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderText.h ('k') | Source/core/rendering/RenderTextControlMultiLine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698