本文整理汇总了C++中RenderRubyBase::style方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderRubyBase::style方法的具体用法?C++ RenderRubyBase::style怎么用?C++ RenderRubyBase::style使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderRubyBase
的用法示例。
在下文中一共展示了RenderRubyBase::style方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: shouldOverhang
static bool shouldOverhang(bool firstLine, const RenderObject* renderer, const RenderRubyBase& rubyBase)
{
if (!renderer || !renderer->isText())
return false;
const RenderStyle& rubyBaseStyle = firstLine ? rubyBase.firstLineStyle() : rubyBase.style();
const RenderStyle& style = firstLine ? renderer->firstLineStyle() : renderer->style();
return style.fontSize() <= rubyBaseStyle.fontSize();
}
示例2: getOverhang
void RenderRubyRun::getOverhang(bool firstLine, RenderObject* startRenderer, RenderObject* endRenderer, int& startOverhang, int& endOverhang) const
{
ASSERT(!needsLayout());
startOverhang = 0;
endOverhang = 0;
RenderRubyBase* rubyBase = this->rubyBase();
RenderRubyText* rubyText = this->rubyText();
if (!rubyBase || !rubyText)
return;
if (!rubyBase->firstRootBox())
return;
int logicalWidth = this->logicalWidth();
// No more than half a ruby is allowed to overhang.
int logicalLeftOverhang = rubyText->style(firstLine)->fontSize() / 2;
int logicalRightOverhang = logicalLeftOverhang;
for (RootInlineBox* rootInlineBox = rubyBase->firstRootBox(); rootInlineBox; rootInlineBox = rootInlineBox->nextRootBox()) {
logicalLeftOverhang = min<int>(logicalLeftOverhang, rootInlineBox->logicalLeft());
logicalRightOverhang = min<int>(logicalRightOverhang, logicalWidth - rootInlineBox->logicalRight());
}
startOverhang = style()->isLeftToRightDirection() ? logicalLeftOverhang : logicalRightOverhang;
endOverhang = style()->isLeftToRightDirection() ? logicalRightOverhang : logicalLeftOverhang;
if (!startRenderer || !startRenderer->isText() || startRenderer->style(firstLine)->fontSize() > rubyBase->style(firstLine)->fontSize())
startOverhang = 0;
if (!endRenderer || !endRenderer->isText() || endRenderer->style(firstLine)->fontSize() > rubyBase->style(firstLine)->fontSize())
endOverhang = 0;
}
示例3: getOverhang
void RenderRubyRun::getOverhang(bool firstLine, RenderObject* startRenderer, RenderObject* endRenderer, int& startOverhang, int& endOverhang) const
{
ASSERT(!needsLayout());
startOverhang = 0;
endOverhang = 0;
RenderRubyBase* rubyBase = this->rubyBase();
RenderRubyText* rubyText = this->rubyText();
if (!rubyBase || !rubyText)
return;
if (!rubyBase->firstRootBox())
return;
int logicalWidth = this->logicalWidth();
int logicalLeftOverhang = numeric_limits<int>::max();
int logicalRightOverhang = numeric_limits<int>::max();
for (RootInlineBox* rootInlineBox = rubyBase->firstRootBox(); rootInlineBox; rootInlineBox = rootInlineBox->nextRootBox()) {
logicalLeftOverhang = min<int>(logicalLeftOverhang, rootInlineBox->logicalLeft());
logicalRightOverhang = min<int>(logicalRightOverhang, logicalWidth - rootInlineBox->logicalRight());
}
startOverhang = style()->isLeftToRightDirection() ? logicalLeftOverhang : logicalRightOverhang;
endOverhang = style()->isLeftToRightDirection() ? logicalRightOverhang : logicalLeftOverhang;
if (!startRenderer || !startRenderer->isText() || startRenderer->style(firstLine)->fontSize() > rubyBase->style(firstLine)->fontSize())
startOverhang = 0;
if (!endRenderer || !endRenderer->isText() || endRenderer->style(firstLine)->fontSize() > rubyBase->style(firstLine)->fontSize())
endOverhang = 0;
// We overhang a ruby only if the neighboring render object is a text.
// We can overhang the ruby by no more than half the width of the neighboring text
// and no more than half the font size.
int halfWidthOfFontSize = rubyText->style(firstLine)->fontSize() / 2;
if (startOverhang)
startOverhang = min<int>(startOverhang, min<int>(toRenderText(startRenderer)->minLogicalWidth(), halfWidthOfFontSize));
if (endOverhang)
endOverhang = min<int>(endOverhang, min<int>(toRenderText(endRenderer)->minLogicalWidth(), halfWidthOfFontSize));
}