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

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

Issue 197283025: Use new is*Element() helper functions more in rendering code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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
« no previous file with comments | « Source/core/rendering/RenderButton.h ('k') | Source/core/rendering/RenderCounter.cpp » ('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) 2005 Apple Computer, Inc. 2 * Copyright (C) 2005 Apple Computer, Inc.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 innerStyle->setMarginTop(Length()); 97 innerStyle->setMarginTop(Length());
98 innerStyle->setMarginBottom(Length()); 98 innerStyle->setMarginBottom(Length());
99 innerStyle->setFlexDirection(style()->flexDirection()); 99 innerStyle->setFlexDirection(style()->flexDirection());
100 } 100 }
101 101
102 bool RenderButton::canHaveGeneratedChildren() const 102 bool RenderButton::canHaveGeneratedChildren() const
103 { 103 {
104 // Input elements can't have generated children, but button elements can. We 'll 104 // Input elements can't have generated children, but button elements can. We 'll
105 // write the code assuming any other button types that might emerge in the f uture 105 // write the code assuming any other button types that might emerge in the f uture
106 // can also have children. 106 // can also have children.
107 return !node()->hasTagName(inputTag); 107 return !isHTMLInputElement(*node());
108 } 108 }
109 109
110 LayoutRect RenderButton::controlClipRect(const LayoutPoint& additionalOffset) co nst 110 LayoutRect RenderButton::controlClipRect(const LayoutPoint& additionalOffset) co nst
111 { 111 {
112 // Clip to the padding box to at least give content the extra padding space. 112 // Clip to the padding box to at least give content the extra padding space.
113 return LayoutRect(additionalOffset.x() + borderLeft(), additionalOffset.y() + borderTop(), width() - borderLeft() - borderRight(), height() - borderTop() - borderBottom()); 113 return LayoutRect(additionalOffset.x() + borderLeft(), additionalOffset.y() + borderTop(), width() - borderLeft() - borderRight(), height() - borderTop() - borderBottom());
114 } 114 }
115 115
116 int RenderButton::baselinePosition(FontBaseline baseline, bool firstLine, LineDi rectionMode direction, LinePositionMode linePositionMode) const 116 int RenderButton::baselinePosition(FontBaseline baseline, bool firstLine, LineDi rectionMode direction, LinePositionMode linePositionMode) const
117 { 117 {
118 ASSERT(linePositionMode == PositionOnContainingLine); 118 ASSERT(linePositionMode == PositionOnContainingLine);
119 // We want to call the RenderBlock version of firstLineBoxBaseline to 119 // We want to call the RenderBlock version of firstLineBoxBaseline to
120 // avoid RenderFlexibleBox synthesizing a baseline that we don't want. 120 // avoid RenderFlexibleBox synthesizing a baseline that we don't want.
121 // We use this check as a proxy for "are there any line boxes in this button " 121 // We use this check as a proxy for "are there any line boxes in this button "
122 if (!hasLineIfEmpty() && RenderBlock::firstLineBoxBaseline() == -1) { 122 if (!hasLineIfEmpty() && RenderBlock::firstLineBoxBaseline() == -1) {
123 // To ensure that we have a consistent baseline when we have no children , 123 // To ensure that we have a consistent baseline when we have no children ,
124 // even when we have the anonymous RenderBlock child, we calculate the 124 // even when we have the anonymous RenderBlock child, we calculate the
125 // baseline for the empty case manually here. 125 // baseline for the empty case manually here.
126 if (direction == HorizontalLine) 126 if (direction == HorizontalLine)
127 return marginTop() + borderTop() + paddingTop() + contentHeight(); 127 return marginTop() + borderTop() + paddingTop() + contentHeight();
128 128
129 return marginRight() + borderRight() + paddingRight() + contentWidth(); 129 return marginRight() + borderRight() + paddingRight() + contentWidth();
130 } 130 }
131 return RenderFlexibleBox::baselinePosition(baseline, firstLine, direction, l inePositionMode); 131 return RenderFlexibleBox::baselinePosition(baseline, firstLine, direction, l inePositionMode);
132 } 132 }
133 133
134 } // namespace WebCore 134 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderButton.h ('k') | Source/core/rendering/RenderCounter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698