本文整理汇总了C++中RenderStyle::direction方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderStyle::direction方法的具体用法?C++ RenderStyle::direction怎么用?C++ RenderStyle::direction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderStyle
的用法示例。
在下文中一共展示了RenderStyle::direction方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: adjustInnerStyle
void RenderMenuList::adjustInnerStyle()
{
RenderStyle* innerStyle = m_innerBlock->style();
innerStyle->setFlexGrow(1);
innerStyle->setFlexShrink(1);
// min-width: 0; is needed for correct shrinking.
// FIXME: Remove this line when https://bugs.webkit.org/show_bug.cgi?id=111790 is fixed.
innerStyle->setMinWidth(Length(0, Fixed));
// Use margin:auto instead of align-items:center to get safe centering, i.e.
// when the content overflows, treat it the same as align-items: flex-start.
// But we only do that for the cases where html.css would otherwise use center.
if (style()->alignItems() == AlignCenter) {
innerStyle->setMarginTop(Length());
innerStyle->setMarginBottom(Length());
innerStyle->setAlignSelf(AlignFlexStart);
}
innerStyle->setPaddingLeft(Length(RenderTheme::theme().popupInternalPaddingLeft(style()), Fixed));
innerStyle->setPaddingRight(Length(RenderTheme::theme().popupInternalPaddingRight(style()), Fixed));
innerStyle->setPaddingTop(Length(RenderTheme::theme().popupInternalPaddingTop(style()), Fixed));
innerStyle->setPaddingBottom(Length(RenderTheme::theme().popupInternalPaddingBottom(style()), Fixed));
if (m_optionStyle) {
if ((m_optionStyle->direction() != innerStyle->direction() || m_optionStyle->unicodeBidi() != innerStyle->unicodeBidi()))
m_innerBlock->setNeedsLayoutAndPrefWidthsRecalc();
innerStyle->setTextAlign(style()->isLeftToRightDirection() ? LEFT : RIGHT);
innerStyle->setDirection(m_optionStyle->direction());
innerStyle->setUnicodeBidi(m_optionStyle->unicodeBidi());
}
}
示例2: initializeCommonQStyleOptions
ControlPart RenderThemeQStyle::initializeCommonQStyleOptions(QStyleFacadeOption &option, RenderObject* o) const
{
// Default bits: no focus, no mouse over, enabled
option.state &= ~(QStyleFacade::State_HasFocus | QStyleFacade::State_MouseOver);
option.state |= QStyleFacade::State_Enabled;
if (isReadOnlyControl(o))
// Readonly is supported on textfields.
option.state |= QStyleFacade::State_ReadOnly;
option.direction = Qt::LeftToRight;
if (isHovered(o))
option.state |= QStyleFacade::State_MouseOver;
setPaletteFromPageClientIfExists(option.palette);
if (!isEnabled(o)) {
option.palette.setCurrentColorGroup(QPalette::Disabled);
option.state &= ~QStyleFacade::State_Enabled;
}
RenderStyle* style = o->style();
if (!style)
return NoControlPart;
ControlPart result = style->appearance();
if (supportsFocus(result) && isFocused(o)) {
option.state |= QStyleFacade::State_HasFocus;
option.state |= QStyleFacade::State_KeyboardFocusChange;
}
if (style->direction() == WebCore::RTL)
option.direction = Qt::RightToLeft;
switch (result) {
case PushButtonPart:
case SquareButtonPart:
case ButtonPart:
case ButtonBevelPart:
case ListItemPart:
case MenulistButtonPart:
case InnerSpinButtonPart:
case SearchFieldResultsButtonPart:
case SearchFieldCancelButtonPart: {
if (isPressed(o))
option.state |= QStyleFacade::State_Sunken;
else if (result == PushButtonPart || result == ButtonPart)
option.state |= QStyleFacade::State_Raised;
break;
}
case RadioPart:
case CheckboxPart:
option.state |= (isChecked(o) ? QStyleFacade::State_On : QStyleFacade::State_Off);
}
return result;
}
示例3: paintItemForeground
void RenderListBox::paintItemForeground(PaintInfo& paintInfo, int tx, int ty, int listIndex)
{
SelectElement* select = toSelectElement(static_cast<Element*>(node()));
const Vector<Element*>& listItems = select->listItems();
Element* element = listItems[listIndex];
OptionElement* optionElement = toOptionElement(element);
String itemText;
if (optionElement)
itemText = optionElement->textIndentedToRespectGroupLabel();
else if (OptionGroupElement* optionGroupElement = toOptionGroupElement(element))
itemText = optionGroupElement->groupLabelText();
// Determine where the item text should be placed
IntRect r = itemBoundingBoxRect(tx, ty, listIndex);
r.move(optionsSpacingHorizontal, style()->font().ascent());
RenderStyle* itemStyle = element->renderStyle();
if (!itemStyle)
itemStyle = style();
Color textColor = element->renderStyle() ? element->renderStyle()->color() : style()->color();
if (optionElement && optionElement->selected()) {
if (document()->frame()->selection()->isFocusedAndActive() && document()->focusedNode() == node())
textColor = theme()->activeListBoxSelectionForegroundColor();
// Honor the foreground color for disabled items
else if (!element->disabled())
textColor = theme()->inactiveListBoxSelectionForegroundColor();
}
ColorSpace colorSpace = itemStyle->colorSpace();
paintInfo.context->setFillColor(textColor, colorSpace);
Font itemFont = style()->font();
if (isOptionGroupElement(element)) {
FontDescription d = itemFont.fontDescription();
d.setWeight(d.bolderWeight());
itemFont = Font(d, itemFont.letterSpacing(), itemFont.wordSpacing());
itemFont.update(document()->styleSelector()->fontSelector());
}
unsigned length = itemText.length();
const UChar* string = itemText.characters();
TextRun textRun(string, length, 0, 0, 0, itemStyle->direction() == RTL, itemStyle->unicodeBidi() == Override, false, false);
// Draw the item text
if (itemStyle->visibility() != HIDDEN)
paintInfo.context->drawBidiText(itemFont, textRun, r.location());
}
示例4: setupBidiRuns
void SVGTextMetricsCalculator::setupBidiRuns()
{
RenderStyle* style = m_text->style();
m_textDirection = style->direction();
if (isOverride(style->unicodeBidi()))
return;
BidiStatus status(LTR, false);
status.last = status.lastStrong = WTF::Unicode::OtherNeutral;
m_bidiResolver.setStatus(status);
m_bidiResolver.setPositionIgnoringNestedIsolates(TextRunIterator(&m_run, 0));
const bool hardLineBreak = false;
const bool reorderRuns = false;
m_bidiResolver.createBidiRunsForLine(TextRunIterator(&m_run, m_run.length()), NoVisualOverride, hardLineBreak, reorderRuns);
BidiRunList<BidiCharacterRun>& bidiRuns = m_bidiResolver.runs();
m_bidiRun = bidiRuns.firstRun();
}
示例5: computePosition
int RenderMarquee::computePosition(EMarqueeDirection dir, bool stopAtContentEdge)
{
RenderBox* box = m_layer->renderBox();
ASSERT(box);
RenderStyle* s = box->style();
if (isHorizontal()) {
bool ltr = s->direction() == LTR;
int clientWidth = box->clientWidth();
int contentWidth = ltr ? box->rightmostPosition(true, false) : box->leftmostPosition(true, false);
if (ltr)
contentWidth += (box->paddingRight() - box->borderLeft());
else {
contentWidth = box->width() - contentWidth;
contentWidth += (box->paddingLeft() - box->borderRight());
}
if (dir == MRIGHT) {
if (stopAtContentEdge)
return max(0, ltr ? (contentWidth - clientWidth) : (clientWidth - contentWidth));
else
return ltr ? contentWidth : clientWidth;
}
else {
if (stopAtContentEdge)
return min(0, ltr ? (contentWidth - clientWidth) : (clientWidth - contentWidth));
else
return ltr ? -clientWidth : -contentWidth;
}
}
else {
int contentHeight = box->lowestPosition(true, false) -
box->borderTop() + box->paddingBottom();
int clientHeight = box->clientHeight();
if (dir == MUP) {
if (stopAtContentEdge)
return min(contentHeight - clientHeight, 0);
else
return -clientHeight;
}
else {
if (stopAtContentEdge)
return max(contentHeight - clientHeight, 0);
else
return contentHeight;
}
}
}
示例6: itemStyle
PopupMenuStyle RenderMenuList::itemStyle(unsigned listIndex) const
{
const Vector<HTMLElement*>& listItems = toHTMLSelectElement(node())->listItems();
if (listIndex >= listItems.size()) {
// If we are making an out of bounds access, then we want to use the style
// of a different option element (index 0). However, if there isn't an option element
// before at index 0, we fall back to the menu's style.
if (!listIndex)
return menuStyle();
// Try to retrieve the style of an option element we know exists (index 0).
listIndex = 0;
}
HTMLElement* element = listItems[listIndex];
RenderStyle* style = element->renderStyle() ? element->renderStyle() : element->computedStyle();
return style ? PopupMenuStyle(style->visitedDependentColor(CSSPropertyColor), itemBackgroundColor(listIndex), style->font(), style->visibility() == VISIBLE,
style->display() == NONE, style->textIndent(), style->direction(), isOverride(style->unicodeBidi())) : menuStyle();
}
示例7: adjustInnerStyle
void RenderMenuList::adjustInnerStyle()
{
RenderStyle* innerStyle = m_innerBlock->style();
innerStyle->setFlexGrow(1);
innerStyle->setFlexShrink(1);
// min-width: 0; is needed for correct shrinking.
// FIXME: Remove this line when https://bugs.webkit.org/show_bug.cgi?id=111790 is fixed.
innerStyle->setMinWidth(Length(0, Fixed));
// Use margin:auto instead of align-items:center to get safe centering, i.e.
// when the content overflows, treat it the same as align-items: flex-start.
// But we only do that for the cases where html.css would otherwise use center.
if (style()->alignItems() == AlignCenter) {
innerStyle->setMarginTop(Length());
innerStyle->setMarginBottom(Length());
innerStyle->setAlignSelf(AlignFlexStart);
}
innerStyle->setPaddingLeft(Length(theme()->popupInternalPaddingLeft(style()), Fixed));
innerStyle->setPaddingRight(Length(theme()->popupInternalPaddingRight(style()), Fixed));
innerStyle->setPaddingTop(Length(theme()->popupInternalPaddingTop(style()), Fixed));
innerStyle->setPaddingBottom(Length(theme()->popupInternalPaddingBottom(style()), Fixed));
if (document()->page()->chrome().selectItemWritingDirectionIsNatural()) {
// Items in the popup will not respect the CSS text-align and direction properties,
// so we must adjust our own style to match.
innerStyle->setTextAlign(LEFT);
TextDirection direction = (m_buttonText && m_buttonText->text()->defaultWritingDirection() == WTF::Unicode::RightToLeft) ? RTL : LTR;
innerStyle->setDirection(direction);
} else if (m_optionStyle && document()->page()->chrome().selectItemAlignmentFollowsMenuWritingDirection()) {
if ((m_optionStyle->direction() != innerStyle->direction() || m_optionStyle->unicodeBidi() != innerStyle->unicodeBidi()))
m_innerBlock->setNeedsLayoutAndPrefWidthsRecalc();
innerStyle->setTextAlign(style()->isLeftToRightDirection() ? LEFT : RIGHT);
innerStyle->setDirection(m_optionStyle->direction());
innerStyle->setUnicodeBidi(m_optionStyle->unicodeBidi());
}
}
示例8: CSSPrimitiveValueImpl
//.........这里部分代码省略.........
return new CSSPrimitiveValueImpl(CSS_VAL_CROSSHAIR);
case khtml::CURSOR_DEFAULT:
return new CSSPrimitiveValueImpl(CSS_VAL_DEFAULT);
case khtml::CURSOR_POINTER:
return new CSSPrimitiveValueImpl(CSS_VAL_POINTER);
case khtml::CURSOR_MOVE:
return new CSSPrimitiveValueImpl(CSS_VAL_MOVE);
case khtml::CURSOR_E_RESIZE:
return new CSSPrimitiveValueImpl(CSS_VAL_E_RESIZE);
case khtml::CURSOR_NE_RESIZE:
return new CSSPrimitiveValueImpl(CSS_VAL_NE_RESIZE);
case khtml::CURSOR_NW_RESIZE:
return new CSSPrimitiveValueImpl(CSS_VAL_NW_RESIZE);
case khtml::CURSOR_N_RESIZE:
return new CSSPrimitiveValueImpl(CSS_VAL_N_RESIZE);
case khtml::CURSOR_SE_RESIZE:
return new CSSPrimitiveValueImpl(CSS_VAL_SE_RESIZE);
case khtml::CURSOR_SW_RESIZE:
return new CSSPrimitiveValueImpl(CSS_VAL_SW_RESIZE);
case khtml::CURSOR_S_RESIZE:
return new CSSPrimitiveValueImpl(CSS_VAL_S_RESIZE);
case khtml::CURSOR_W_RESIZE:
return new CSSPrimitiveValueImpl(CSS_VAL_W_RESIZE);
case khtml::CURSOR_TEXT:
return new CSSPrimitiveValueImpl(CSS_VAL_TEXT);
case khtml::CURSOR_WAIT:
return new CSSPrimitiveValueImpl(CSS_VAL_WAIT);
case khtml::CURSOR_HELP:
return new CSSPrimitiveValueImpl(CSS_VAL_HELP);
}
ASSERT_NOT_REACHED();
return 0;
case CSS_PROP_DIRECTION:
switch (style->direction()) {
case khtml::LTR:
return new CSSPrimitiveValueImpl(CSS_VAL_LTR);
case khtml::RTL:
return new CSSPrimitiveValueImpl(CSS_VAL_RTL);
}
ASSERT_NOT_REACHED();
return 0;
case CSS_PROP_DISPLAY:
switch (style->display()) {
case khtml::INLINE:
return new CSSPrimitiveValueImpl(CSS_VAL_INLINE);
case khtml::BLOCK:
return new CSSPrimitiveValueImpl(CSS_VAL_BLOCK);
case khtml::LIST_ITEM:
return new CSSPrimitiveValueImpl(CSS_VAL_LIST_ITEM);
case khtml::RUN_IN:
return new CSSPrimitiveValueImpl(CSS_VAL_RUN_IN);
case khtml::COMPACT:
return new CSSPrimitiveValueImpl(CSS_VAL_COMPACT);
case khtml::INLINE_BLOCK:
return new CSSPrimitiveValueImpl(CSS_VAL_INLINE_BLOCK);
case khtml::TABLE:
return new CSSPrimitiveValueImpl(CSS_VAL_TABLE);
case khtml::INLINE_TABLE:
return new CSSPrimitiveValueImpl(CSS_VAL_INLINE_TABLE);
case khtml::TABLE_ROW_GROUP:
return new CSSPrimitiveValueImpl(CSS_VAL_TABLE_ROW_GROUP);
case khtml::TABLE_HEADER_GROUP:
return new CSSPrimitiveValueImpl(CSS_VAL_TABLE_HEADER_GROUP);
case khtml::TABLE_FOOTER_GROUP:
return new CSSPrimitiveValueImpl(CSS_VAL_TABLE_FOOTER_GROUP);
case khtml::TABLE_ROW: