本文整理汇总了C++中RenderStyle::fontSize方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderStyle::fontSize方法的具体用法?C++ RenderStyle::fontSize怎么用?C++ RenderStyle::fontSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderStyle
的用法示例。
在下文中一共展示了RenderStyle::fontSize方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hostInput
PassRefPtr<RenderStyle> TextFieldDecorationElement::customStyleForRenderer()
{
RefPtr<RenderStyle> style = RenderStyle::create();
RenderStyle* inputStyle = hostInput()->renderStyle();
ASSERT(inputStyle);
style->setWidth(Length(inputStyle->fontSize(), Fixed));
style->setHeight(Length(inputStyle->fontSize(), Fixed));
updateImage();
return style.release();
}
示例2: document
PassRefPtr<RenderStyle> TextFieldDecorationElement::customStyleForRenderer()
{
RefPtr<RenderStyle> originalStyle = document()->styleResolver()->styleForElement(this);
RefPtr<RenderStyle> style = RenderStyle::clone(originalStyle.get());
RenderStyle* inputStyle = hostInput()->renderStyle();
ASSERT(inputStyle);
style->setWidth(Length(inputStyle->fontSize(), Fixed));
style->setHeight(Length(inputStyle->fontSize(), Fixed));
updateImage();
return style.release();
}
示例3: originalStyleForRenderer
PassRefPtr<RenderStyle> PasswordGeneratorButtonElement::customStyleForRenderer()
{
RefPtr<RenderStyle> originalStyle = originalStyleForRenderer();
RefPtr<RenderStyle> style = RenderStyle::clone(originalStyle.get());
RenderStyle* inputStyle = hostInput()->renderStyle();
ASSERT(inputStyle);
style->setWidth(Length(inputStyle->fontSize(), Fixed));
style->setHeight(Length(inputStyle->fontSize(), Fixed));
style->setUnique();
updateImage();
return style.release();
}
示例4: updateMarqueeStyle
void RenderMarquee::updateMarqueeStyle()
{
RenderStyle* s = m_layer->renderer()->style();
if (m_direction != s->marqueeDirection() || (m_totalLoops != s->marqueeLoopCount() && m_currentLoop >= m_totalLoops))
m_currentLoop = 0; // When direction changes or our loopCount is a smaller number than our current loop, reset our loop.
m_totalLoops = s->marqueeLoopCount();
m_direction = s->marqueeDirection();
if (m_layer->renderer()->isHTMLMarquee()) {
// Hack for WinIE. In WinIE, a value of 0 or lower for the loop count for SLIDE means to only do
// one loop.
if (m_totalLoops <= 0 && s->marqueeBehavior() == MSLIDE)
m_totalLoops = 1;
// Hack alert: Set the white-space value to nowrap for horizontal marquees with inline children, thus ensuring
// all the text ends up on one line by default. Limit this hack to the <marquee> element to emulate
// WinIE's behavior. Someone using CSS3 can use white-space: nowrap on their own to get this effect.
// Second hack alert: Set the text-align back to auto. WinIE completely ignores text-align on the
// marquee element.
// FIXME: Bring these up with the CSS WG.
if (isHorizontal() && m_layer->renderer()->childrenInline()) {
s->setWhiteSpace(NOWRAP);
s->setTextAlign(TAAUTO);
}
}
// Marquee height hack!! Make sure that, if it is a horizontal marquee, the height attribute is overridden
// if it is smaller than the font size. If it is a vertical marquee and height is not specified, we default
// to a marquee of 200px.
if (isHorizontal()) {
if (s->height().isFixed() && s->height().value() < s->fontSize())
s->setHeight(Length(s->fontSize(),Fixed));
} else if (s->height().isAuto()) //vertical marquee with no specified height
s->setHeight(Length(200, Fixed));
if (speed() != marqueeSpeed()) {
m_speed = marqueeSpeed();
if (m_timer.isActive())
m_timer.startRepeating(speed() * 0.001);
}
// Check the loop count to see if we should now stop.
bool activate = (m_totalLoops <= 0 || m_currentLoop < m_totalLoops);
if (activate && !m_timer.isActive())
m_layer->renderer()->setNeedsLayout(true);
else if (!activate && m_timer.isActive())
m_timer.stop();
}
示例5: lineHeight
int RenderBR::lineHeight(bool firstLine, bool /*isRootLineBox*/) const
{
if (firstTextBox() && !firstTextBox()->isText())
return 0;
if (firstLine) {
RenderStyle* s = style(firstLine);
Length lh = s->lineHeight();
if (lh.isNegative()) {
if (s == style()) {
if (m_lineHeight == -1)
m_lineHeight = RenderObject::lineHeight(false);
return m_lineHeight;
}
return s->font().lineSpacing();
}
if (lh.isPercent())
return lh.calcMinValue(s->fontSize());
return lh.value();
}
if (m_lineHeight == -1)
m_lineHeight = RenderObject::lineHeight(false);
return m_lineHeight;
}
示例6: visualOverflowForDecorations
GlyphOverflow visualOverflowForDecorations(const RenderStyle& lineStyle, const InlineTextBox* inlineTextBox)
{
ASSERT(!inlineTextBox || inlineTextBox->lineStyle() == lineStyle);
TextDecoration decoration = lineStyle.textDecorationsInEffect();
if (decoration == TextDecorationNone)
return GlyphOverflow();
float strokeThickness = textDecorationStrokeThickness(lineStyle.fontSize());
float controlPointDistance;
float step;
float wavyOffset;
TextDecorationStyle decorationStyle = lineStyle.textDecorationStyle();
float height = lineStyle.fontCascade().fontMetrics().floatHeight();
GlyphOverflow overflowResult;
if (decorationStyle == TextDecorationStyleWavy) {
getWavyStrokeParameters(strokeThickness, controlPointDistance, step);
wavyOffset = wavyOffsetFromDecoration();
overflowResult.left = strokeThickness;
overflowResult.right = strokeThickness;
}
// These metrics must match where underlines get drawn.
if (decoration & TextDecorationUnderline) {
// Compensate for the integral ceiling in GraphicsContext::computeLineBoundsAndAntialiasingModeForText()
int underlineOffset = 1;
underlineOffset += computeUnderlineOffset(lineStyle.textUnderlinePosition(), lineStyle.fontMetrics(), inlineTextBox, strokeThickness);
if (decorationStyle == TextDecorationStyleWavy) {
extendIntToFloat(overflowResult.bottom, underlineOffset + wavyOffset + controlPointDistance + strokeThickness - height);
extendIntToFloat(overflowResult.top, -(underlineOffset + wavyOffset - controlPointDistance - strokeThickness));
} else {
extendIntToFloat(overflowResult.bottom, underlineOffset + strokeThickness - height);
extendIntToFloat(overflowResult.top, -underlineOffset);
}
}
if (decoration & TextDecorationOverline) {
if (decorationStyle == TextDecorationStyleWavy) {
extendIntToFloat(overflowResult.bottom, -wavyOffset + controlPointDistance + strokeThickness - height);
extendIntToFloat(overflowResult.top, wavyOffset + controlPointDistance + strokeThickness);
} else {
extendIntToFloat(overflowResult.bottom, strokeThickness - height);
// top is untouched
}
}
if (decoration & TextDecorationLineThrough) {
float baseline = lineStyle.fontMetrics().floatAscent();
if (decorationStyle == TextDecorationStyleWavy) {
extendIntToFloat(overflowResult.bottom, 2 * baseline / 3 + controlPointDistance + strokeThickness - height);
extendIntToFloat(overflowResult.top, -(2 * baseline / 3 - controlPointDistance - strokeThickness));
} else {
extendIntToFloat(overflowResult.bottom, 2 * baseline / 3 + strokeThickness - height);
extendIntToFloat(overflowResult.top, -(2 * baseline / 3));
}
}
return overflowResult;
}
示例7: controlSizeForSystemFont
NSControlSize RenderThemeSafari::controlSizeForSystemFont(RenderStyle& style) const
{
int fontSize = style.fontSize();
if (fontSize >= 13)
return NSRegularControlSize;
if (fontSize >= 11)
return NSSmallControlSize;
return NSMiniControlSize;
}
示例8: convertValueFromEMSToUserUnits
float SVGLength::convertValueFromEMSToUserUnits(float value, const SVGElement* context, ExceptionCode& ec) const
{
if (!context || !context->renderer() || !context->renderer()->style()) {
ec = NOT_SUPPORTED_ERR;
return 0;
}
RenderStyle* style = context->renderer()->style();
return value * style->fontSize();
}
示例9: popupInternalPaddingRight
int RenderThemeSafari::popupInternalPaddingRight(RenderStyle& style) const
{
if (style.appearance() == MenulistPart)
return popupButtonPadding(controlSizeForFont(style))[rightPadding];
if (style.appearance() == MenulistButtonPart) {
float fontScale = style.fontSize() / baseFontSize;
float arrowWidth = baseArrowWidth * fontScale;
return static_cast<int>(ceilf(arrowWidth + arrowPaddingLeft + arrowPaddingRight + paddingBeforeSeparator));
}
return 0;
}
示例10: adjustMenuListButtonStyle
void RenderThemeSafari::adjustMenuListButtonStyle(StyleResolver&, RenderStyle& style, Element*) const
{
float fontScale = style.fontSize() / baseFontSize;
style.resetPadding();
style.setBorderRadius(IntSize(int(baseBorderRadius + fontScale - 1), int(baseBorderRadius + fontScale - 1))); // FIXME: Round up?
const int minHeight = 15;
style.setMinHeight(Length(minHeight, Fixed));
style.setLineHeight(RenderStyle::initialLineHeight());
}
示例11: value
float SVGLength::value() const
{
SVGLengthType type = extractType(m_unit);
if (type == LengthTypeUnknown)
return 0.0f;
switch (type) {
case LengthTypeNumber:
return m_valueInSpecifiedUnits;
case LengthTypePercentage:
return SVGLength::PercentageOfViewport(m_valueInSpecifiedUnits / 100.0f, m_context, extractMode(m_unit));
case LengthTypeEMS:
case LengthTypeEXS:
{
RenderStyle* style = 0;
if (m_context && m_context->renderer())
style = m_context->renderer()->style();
if (style) {
float useSize = style->fontSize();
ASSERT(useSize > 0);
if (type == LengthTypeEMS)
return m_valueInSpecifiedUnits * useSize;
else {
float xHeight = style->font().xHeight();
// Use of ceil allows a pixel match to the W3Cs expected output of coords-units-03-b.svg
// if this causes problems in real world cases maybe it would be best to remove this
return m_valueInSpecifiedUnits * ceilf(xHeight);
}
}
return 0.0f;
}
case LengthTypePX:
return m_valueInSpecifiedUnits;
case LengthTypeCM:
return m_valueInSpecifiedUnits / 2.54f * cssPixelsPerInch;
case LengthTypeMM:
return m_valueInSpecifiedUnits / 25.4f * cssPixelsPerInch;
case LengthTypeIN:
return m_valueInSpecifiedUnits * cssPixelsPerInch;
case LengthTypePT:
return m_valueInSpecifiedUnits / 72.0f * cssPixelsPerInch;
case LengthTypePC:
return m_valueInSpecifiedUnits / 6.0f * cssPixelsPerInch;
default:
break;
}
ASSERT_NOT_REACHED();
return 0.0f;
}
示例12: adjustSearchFieldIconStyle
static void adjustSearchFieldIconStyle(RenderStyle& style)
{
style.resetBorder();
style.resetPadding();
// Get the icon size based on the font size.
int fontSize = style.fontSize();
if (fontSize < gtkIconSizeMenu) {
style.setWidth(Length(fontSize, Fixed));
style.setHeight(Length(fontSize, Fixed));
return;
}
gint width = 0, height = 0;
gtk_icon_size_lookup(getIconSizeForPixelSize(fontSize), &width, &height);
style.setWidth(Length(width, Fixed));
style.setHeight(Length(height, Fixed));
}
示例13: updateValue
void SVGLength::updateValue(bool notify)
{
switch(m_unitType)
{
case SVG_LENGTHTYPE_PX:
m_value = m_valueInSpecifiedUnits;
break;
case SVG_LENGTHTYPE_CM:
m_value = (m_valueInSpecifiedUnits / 2.54) * dpi();
break;
case SVG_LENGTHTYPE_MM:
m_value = (m_valueInSpecifiedUnits / 25.4) * dpi();
break;
case SVG_LENGTHTYPE_IN:
m_value = m_valueInSpecifiedUnits * dpi();
break;
case SVG_LENGTHTYPE_PT:
m_value = (m_valueInSpecifiedUnits / 72.0) * dpi();
break;
case SVG_LENGTHTYPE_PC:
m_value = (m_valueInSpecifiedUnits / 6.0) * dpi();
break;
case SVG_LENGTHTYPE_EMS:
case SVG_LENGTHTYPE_EXS:
if (m_context && m_context->renderer()) {
RenderStyle *style = m_context->renderer()->style();
float useSize = style->fontSize();
ASSERT(useSize > 0);
if (m_unitType == SVG_LENGTHTYPE_EMS)
m_value = m_valueInSpecifiedUnits * useSize;
else {
float xHeight = style->font().xHeight();
// Use of ceil allows a pixel match to the W3Cs expected output of coords-units-03-b.svg
// if this causes problems in real world cases maybe it would be best to remove this
m_value = m_valueInSpecifiedUnits * ceil(xHeight);
}
m_requiresLayout = false;
} else {
m_requiresLayout = true;
}
break;
}
if (notify && m_context)
m_context->notifyAttributeChange();
}
示例14: getAttributeSetForAccessibilityObject
static AtkAttributeSet* getAttributeSetForAccessibilityObject(const AccessibilityObject* object)
{
if (!object->isAccessibilityRenderObject())
return 0;
RenderObject* renderer = object->renderer();
RenderStyle* style = renderer->style();
AtkAttributeSet* result = 0;
GOwnPtr<gchar> buffer(g_strdup_printf("%i", style->fontSize()));
result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_SIZE), buffer.get());
Color bgColor = style->visitedDependentColor(CSSPropertyBackgroundColor);
if (bgColor.isValid()) {
buffer.set(g_strdup_printf("%i,%i,%i",
bgColor.red(), bgColor.green(), bgColor.blue()));
result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_BG_COLOR), buffer.get());
}
Color fgColor = style->visitedDependentColor(CSSPropertyColor);
if (fgColor.isValid()) {
buffer.set(g_strdup_printf("%i,%i,%i",
fgColor.red(), fgColor.green(), fgColor.blue()));
result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_FG_COLOR), buffer.get());
}
int baselinePosition;
bool includeRise = true;
switch (style->verticalAlign()) {
case SUB:
baselinePosition = -1 * baselinePositionForRenderObject(renderer);
break;
case SUPER:
baselinePosition = baselinePositionForRenderObject(renderer);
break;
case BASELINE:
baselinePosition = 0;
break;
default:
includeRise = false;
break;
}
if (includeRise) {
buffer.set(g_strdup_printf("%i", baselinePosition));
result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_RISE), buffer.get());
}
if (!style->textIndent().isUndefined()) {
int indentation = valueForLength(style->textIndent(), object->size().width(), renderer->view());
buffer.set(g_strdup_printf("%i", indentation));
result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_INDENT), buffer.get());
}
String fontFamilyName = style->font().family().family().string();
if (fontFamilyName.left(8) == "-webkit-")
fontFamilyName = fontFamilyName.substring(8);
result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_FAMILY_NAME), fontFamilyName.utf8().data());
int fontWeight = -1;
switch (style->font().weight()) {
case FontWeight100:
fontWeight = 100;
break;
case FontWeight200:
fontWeight = 200;
break;
case FontWeight300:
fontWeight = 300;
break;
case FontWeight400:
fontWeight = 400;
break;
case FontWeight500:
fontWeight = 500;
break;
case FontWeight600:
fontWeight = 600;
break;
case FontWeight700:
fontWeight = 700;
break;
case FontWeight800:
fontWeight = 800;
break;
case FontWeight900:
fontWeight = 900;
}
if (fontWeight > 0) {
buffer.set(g_strdup_printf("%i", fontWeight));
result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_WEIGHT), buffer.get());
}
switch (style->textAlign()) {
case TAAUTO:
case TASTART:
case TAEND:
break;
case LEFT:
//.........这里部分代码省略.........