本文整理汇总了C++中RenderObject::container方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderObject::container方法的具体用法?C++ RenderObject::container怎么用?C++ RenderObject::container使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderObject
的用法示例。
在下文中一共展示了RenderObject::container方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: verticallyAlignBoxes
int RootInlineBox::verticallyAlignBoxes(int heightOfBlock)
{
int maxPositionTop = 0;
int maxPositionBottom = 0;
int maxAscent = 0;
int maxDescent = 0;
// Figure out if we're in strict mode. Note that we can't simply use !style()->htmlHacks(),
// because that would match almost strict mode as well.
RenderObject* curr = renderer();
while (curr && !curr->node())
curr = curr->container();
bool strictMode = (curr && curr->document()->inStrictMode());
computeLogicalBoxHeights(maxPositionTop, maxPositionBottom, maxAscent, maxDescent, strictMode);
if (maxAscent + maxDescent < max(maxPositionTop, maxPositionBottom))
adjustMaxAscentAndDescent(maxAscent, maxDescent, maxPositionTop, maxPositionBottom);
int maxHeight = maxAscent + maxDescent;
int lineTop = heightOfBlock;
int lineBottom = heightOfBlock;
placeBoxesVertically(heightOfBlock, maxHeight, maxAscent, strictMode, lineTop, lineBottom);
computeVerticalOverflow(lineTop, lineBottom, strictMode);
setLineTopBottomPositions(lineTop, lineBottom);
heightOfBlock += maxHeight;
return heightOfBlock;
}
示例2: ENABLE
LayoutState::LayoutState(RenderObject& root)
: m_clipped(false)
, m_isPaginated(false)
, m_pageLogicalHeightChanged(false)
#if !ASSERT_DISABLED && ENABLE(SATURATED_LAYOUT_ARITHMETIC)
, m_layoutDeltaXSaturated(false)
, m_layoutDeltaYSaturated(false)
#endif
, m_columnInfo(0)
, m_lineGrid(0)
#if ENABLE(CSS_SHAPES)
, m_shapeInsideInfo(0)
#endif
, m_pageLogicalHeight(0)
#ifndef NDEBUG
, m_renderer(&root)
#endif
{
RenderElement* container = root.container();
FloatPoint absContentPoint = container->localToAbsolute(FloatPoint(), UseTransforms);
m_paintOffset = LayoutSize(absContentPoint.x(), absContentPoint.y());
if (container->hasOverflowClip()) {
m_clipped = true;
RenderBox* containerBox = toRenderBox(container);
m_clipRect = LayoutRect(toPoint(m_paintOffset), containerBox->cachedSizeForOverflowClip());
m_paintOffset -= containerBox->scrolledContentOffset();
}
}
示例3: verticallyAlignBoxes
void InlineFlowBox::verticallyAlignBoxes(int& heightOfBlock)
{
int maxPositionTop = 0;
int maxPositionBottom = 0;
int maxAscent = 0;
int maxDescent = 0;
// Figure out if we're in strict mode.
RenderObject* curr = object();
while (curr && !curr->element())
curr = curr->container();
bool strictMode = (curr && curr->element()->getDocument()->inStrictMode());
computeLogicalBoxHeights(maxPositionTop, maxPositionBottom, maxAscent, maxDescent, strictMode);
if (maxAscent + maxDescent < kMax(maxPositionTop, maxPositionBottom))
adjustMaxAscentAndDescent(maxAscent, maxDescent, maxPositionTop, maxPositionBottom);
int maxHeight = maxAscent + maxDescent;
int topPosition = heightOfBlock;
int bottomPosition = heightOfBlock;
placeBoxesVertically(heightOfBlock, maxHeight, maxAscent, strictMode, topPosition, bottomPosition);
setOverflowPositions(topPosition, bottomPosition);
// Shrink boxes with no text children in quirks and almost strict mode.
if (!strictMode)
shrinkBoxesWithNoTextChildren(topPosition, bottomPosition);
heightOfBlock += maxHeight;
}
示例4: isObjectAncestorContainerOf
static bool isObjectAncestorContainerOf(RenderObject* ancestor, RenderObject* descendant)
{
for (RenderObject* r = descendant; r; r = r->container()) {
if (r == ancestor)
return true;
}
return false;
}
示例5: shouldDisableLayoutStateForSubtree
bool RenderView::shouldDisableLayoutStateForSubtree(RenderObject* renderer) const
{
RenderObject* o = renderer;
while (o) {
if (o->hasColumns() || o->hasTransform() || o->hasReflection())
return true;
o = o->container();
}
return false;
}
示例6: getLowerRightCorner
bool ContainerNode::getLowerRightCorner(FloatPoint& point) const
{
if (!renderer())
return false;
RenderObject* o = renderer();
if (!o->isInline() || o->isReplaced()) {
RenderBox* box = toRenderBox(o);
point = o->localToAbsolute(LayoutPoint(box->size()), UseTransforms);
return true;
}
// find the last text/image child, to get a position
while (o) {
if (o->lastChild())
o = o->lastChild();
else if (o->previousSibling())
o = o->previousSibling();
else {
RenderObject* prev = 0;
while (!prev) {
o = o->parent();
if (!o)
return false;
prev = o->previousSibling();
}
o = prev;
}
ASSERT(o);
if (o->isText() || o->isReplaced()) {
point = FloatPoint();
if (o->isText()) {
RenderText* text = toRenderText(o);
IntRect linesBox = text->linesBoundingBox();
if (!linesBox.maxX() && !linesBox.maxY())
continue;
point.moveBy(linesBox.maxXMaxYCorner());
} else {
RenderBox* box = toRenderBox(o);
point.moveBy(box->frameRect().maxXMaxYCorner());
}
point = o->container()->localToAbsolute(point, UseTransforms);
return true;
}
}
return true;
}
示例7: ASSERT
LayoutState::LayoutState(RenderObject& root)
: m_isPaginated(false)
, m_pageLogicalHeightChanged(false)
, m_containingBlockLogicalWidthChanged(false)
, m_flowThread(0)
, m_columnInfo(0)
, m_next(root.view()->layoutState())
, m_pageLogicalHeight(0)
, m_renderer(root)
{
ASSERT(!m_next);
// We'll end up pushing in RenderView itself, so don't bother adding it.
if (root.isRenderView())
return;
root.view()->pushLayoutState(*this);
RenderObject* container = root.container();
FloatPoint absContentPoint = container->localToAbsolute(FloatPoint(), UseTransforms);
m_layoutOffset = LayoutSize(absContentPoint.x(), absContentPoint.y());
}
示例8: updateCaretRect
bool CaretBase::updateCaretRect(Document* document, const PositionWithAffinity& caretPosition)
{
m_caretLocalRect = LayoutRect();
m_caretRectNeedsUpdate = false;
if (caretPosition.position().isNull())
return false;
ASSERT(caretPosition.position().deprecatedNode()->renderer());
// First compute a rect local to the renderer at the selection start.
RenderObject* renderer;
LayoutRect localRect = localCaretRectOfPosition(caretPosition, renderer);
// Get the renderer that will be responsible for painting the caret
// (which is either the renderer we just found, or one of its containers).
RenderBlock* caretPainter = caretRenderer(caretPosition.position().deprecatedNode());
// Compute an offset between the renderer and the caretPainter.
bool unrooted = false;
while (renderer != caretPainter) {
RenderObject* containerObject = renderer->container();
if (!containerObject) {
unrooted = true;
break;
}
localRect.move(renderer->offsetFromContainer(containerObject, localRect.location()));
renderer = containerObject;
}
if (!unrooted)
m_caretLocalRect = localRect;
return true;
}
示例9: LayoutSize
LayoutState::LayoutState(RenderObject& root)
: m_clipped(false)
, m_isPaginated(false)
, m_pageLogicalHeightChanged(false)
#if !ASSERT_DISABLED
, m_layoutDeltaXSaturated(false)
, m_layoutDeltaYSaturated(false)
#endif
#ifndef NDEBUG
, m_renderer(&root)
#endif
{
if (RenderElement* container = root.container()) {
FloatPoint absContentPoint = container->localToAbsolute(FloatPoint(), UseTransforms);
m_paintOffset = LayoutSize(absContentPoint.x(), absContentPoint.y());
if (container->hasOverflowClip()) {
m_clipped = true;
auto& containerBox = downcast<RenderBox>(*container);
m_clipRect = LayoutRect(toLayoutPoint(m_paintOffset), containerBox.cachedSizeForOverflowClip());
m_paintOffset -= containerBox.scrolledContentOffset();
}
}
}
示例10: getUpperLeftCorner
bool ContainerNode::getUpperLeftCorner(FloatPoint& point) const
{
if (!renderer())
return false;
// What is this code really trying to do?
RenderObject* o = renderer();
RenderObject* p = o;
if (!o->isInline() || o->isReplaced()) {
point = o->localToAbsolute(FloatPoint(), UseTransforms);
return true;
}
// find the next text/image child, to get a position
while (o) {
p = o;
if (o->firstChild())
o = o->firstChild();
else if (o->nextSibling())
o = o->nextSibling();
else {
RenderObject* next = 0;
while (!next && o->parent()) {
o = o->parent();
next = o->nextSibling();
}
o = next;
if (!o)
break;
}
ASSERT(o);
if (!o->isInline() || o->isReplaced()) {
point = o->localToAbsolute(FloatPoint(), UseTransforms);
return true;
}
if (p->node() && p->node() == this && o->isText() && !o->isBR() && !toRenderText(o)->firstTextBox()) {
// do nothing - skip unrendered whitespace that is a child or next sibling of the anchor
} else if ((o->isText() && !o->isBR()) || o->isReplaced()) {
point = FloatPoint();
if (o->isText() && toRenderText(o)->firstTextBox()) {
point.move(toRenderText(o)->linesBoundingBox().x(), toRenderText(o)->firstTextBox()->root()->lineTop());
} else if (o->isBox()) {
RenderBox* box = toRenderBox(o);
point.moveBy(box->location());
}
point = o->container()->localToAbsolute(point, UseTransforms);
return true;
}
}
// If the target doesn't have any children or siblings that could be used to calculate the scroll position, we must be
// at the end of the document. Scroll to the bottom. FIXME: who said anything about scrolling?
if (!o && document().view()) {
point = FloatPoint(0, document().view()->contentsHeight());
return true;
}
return false;
}