本文整理汇总了C++中LayoutBlock::flipForWritingMode方法的典型用法代码示例。如果您正苦于以下问题:C++ LayoutBlock::flipForWritingMode方法的具体用法?C++ LayoutBlock::flipForWritingMode怎么用?C++ LayoutBlock::flipForWritingMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayoutBlock
的用法示例。
在下文中一共展示了LayoutBlock::flipForWritingMode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setBodyInnerHTML
TEST_F(VisualRectMappingTest, SelfFlippedWritingMode) {
setBodyInnerHTML(
"<div id='target' style='writing-mode: vertical-rl; box-shadow: 40px "
"20px black;"
" width: 100px; height: 50px; position: absolute; top: 111px; left: "
"222px'>"
"</div>");
LayoutBlock* target = toLayoutBlock(getLayoutObjectByElementId("target"));
LayoutRect visualRect = target->localVisualRect();
// -40 = -box_shadow_offset_x(40) (with target's top-right corner as the
// origin)
// 140 = width(100) + box_shadow_offset_x(40)
// 70 = height(50) + box_shadow_offset_y(20)
EXPECT_EQ(LayoutRect(-40, 0, 140, 70), visualRect);
LayoutRect rect = visualRect;
// TODO(wkorman): The calls to flipForWritingMode() here and in other test
// cases below are necessary because mapToVisualRectInAncestorSpace()
// currently expects the input rect to be in "physical coordinates" (*not*
// "physical coordinates with flipped block-flow direction"), see
// LayoutBoxModelObject.h.
target->flipForWritingMode(rect);
EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(target, rect));
// This rect is in physical coordinates of target.
EXPECT_EQ(LayoutRect(0, 0, 140, 70), rect);
rect = visualRect;
target->flipForWritingMode(rect);
EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect));
EXPECT_EQ(LayoutRect(222, 111, 140, 70), rect);
checkPaintInvalidationStateRectMapping(rect, visualRect, *target,
layoutView(), layoutView());
}
示例2: absoluteBoundsForLocalRect
IntRect CaretBase::absoluteBoundsForLocalRect(Node* node, const LayoutRect& rect) const
{
LayoutBlock* caretPainter = caretLayoutObject(node);
if (!caretPainter)
return IntRect();
LayoutRect localRect(rect);
caretPainter->flipForWritingMode(localRect);
return caretPainter->localToAbsoluteQuad(FloatRect(localRect)).enclosingBoundingBox();
}