本文整理汇总了C++中InlineFlowBox类的典型用法代码示例。如果您正苦于以下问题:C++ InlineFlowBox类的具体用法?C++ InlineFlowBox怎么用?C++ InlineFlowBox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了InlineFlowBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ASSERT
void LineBoxListPainter::paint(const LayoutBoxModelObject& layoutObject, const PaintInfo& paintInfo, const LayoutPoint& paintOffset) const
{
ASSERT(!shouldPaintSelfOutline(paintInfo.phase) && !shouldPaintDescendantOutlines(paintInfo.phase));
// Only paint during the foreground/selection phases.
if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection && paintInfo.phase != PaintPhaseTextClip && paintInfo.phase != PaintPhaseMask)
return;
ASSERT(layoutObject.isLayoutBlock() || (layoutObject.isLayoutInline() && layoutObject.hasLayer())); // The only way an inline could paint like this is if it has a layer.
if (paintInfo.phase == PaintPhaseForeground && paintInfo.isPrinting())
addPDFURLRectsForInlineChildrenRecursively(layoutObject, paintInfo, paintOffset);
// If we have no lines then we have no work to do.
if (!m_lineBoxList.firstLineBox())
return;
if (!m_lineBoxList.anyLineIntersectsRect(LineLayoutBoxModel(const_cast<LayoutBoxModelObject*>(&layoutObject)), paintInfo.cullRect(), paintOffset))
return;
PaintInfo info(paintInfo);
// See if our root lines intersect with the dirty rect. If so, then we paint
// them. Note that boxes can easily overlap, so we can't make any assumptions
// based off positions of our first line box or our last line box.
for (InlineFlowBox* curr = m_lineBoxList.firstLineBox(); curr; curr = curr->nextLineBox()) {
if (m_lineBoxList.lineIntersectsDirtyRect(LineLayoutBoxModel(const_cast<LayoutBoxModelObject*>(&layoutObject)), curr, info.cullRect(), paintOffset)) {
RootInlineBox& root = curr->root();
curr->paint(info, paintOffset, root.lineTop(), root.lineBottom());
}
}
}
示例2: ASSERT
FloatRect RenderSVGText::relativeBBox(bool includeStroke) const
{
FloatRect repaintRect;
for (InlineRunBox* runBox = firstLineBox(); runBox; runBox = runBox->nextLineBox()) {
ASSERT(runBox->isInlineFlowBox());
InlineFlowBox* flowBox = static_cast<InlineFlowBox*>(runBox);
for (InlineBox* box = flowBox->firstChild(); box; box = box->nextOnLine())
repaintRect.unite(FloatRect(box->xPos(), box->yPos(), box->width(), box->height()));
}
// SVG needs to include the strokeWidth(), not the textStrokeWidth().
if (includeStroke && style()->svgStyle()->hasStroke()) {
float strokeWidth = SVGRenderStyle::cssPrimitiveToLength(this, style()->svgStyle()->strokeWidth(), 0.0f);
#if ENABLE(SVG_FONTS)
const Font& font = style()->font();
if (font.primaryFont()->isSVGFont()) {
float scale = font.unitsPerEm() > 0 ? font.size() / font.unitsPerEm() : 0.0f;
if (scale != 0.0f)
strokeWidth /= scale;
}
#endif
repaintRect.inflate(strokeWidth);
}
repaintRect.move(xPos(), yPos());
return repaintRect;
}
示例3: ASSERT
bool LineBoxList::hitTest(LayoutBoxModelObject* renderer, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction) const
{
if (hitTestAction != HitTestForeground)
return false;
ASSERT(renderer->isLayoutBlock() || (renderer->isLayoutInline() && renderer->hasLayer())); // The only way an inline could hit test like this is if it has a layer.
// If we have no lines then we have no work to do.
if (!firstLineBox())
return false;
LayoutPoint point = locationInContainer.point();
LayoutRect rect(firstLineBox()->isHorizontal() ?
IntRect(point.x(), point.y() - locationInContainer.topPadding(), 1, locationInContainer.topPadding() + locationInContainer.bottomPadding() + 1) :
IntRect(point.x() - locationInContainer.leftPadding(), point.y(), locationInContainer.rightPadding() + locationInContainer.leftPadding() + 1, 1));
if (!anyLineIntersectsRect(renderer, rect, accumulatedOffset))
return false;
// See if our root lines contain the point. If so, then we hit test
// them further. Note that boxes can easily overlap, so we can't make any assumptions
// based off positions of our first line box or our last line box.
for (InlineFlowBox* curr = lastLineBox(); curr; curr = curr->prevLineBox()) {
RootInlineBox& root = curr->root();
if (rangeIntersectsRect(renderer, curr->logicalTopVisualOverflow(root.lineTop()), curr->logicalBottomVisualOverflow(root.lineBottom()), rect, accumulatedOffset)) {
bool inside = curr->nodeAtPoint(result, locationInContainer, accumulatedOffset, root.lineTop(), root.lineBottom());
if (inside) {
renderer->updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset));
return true;
}
}
}
return false;
}
示例4: ASSERT
bool RenderLineBoxList::hitTest(RenderBoxModelObject* renderer, const HitTestRequest& request, HitTestResult& result, int x, int y, int tx, int ty, HitTestAction hitTestAction) const
{
if (hitTestAction != HitTestForeground)
return false;
ASSERT(renderer->isRenderBlock() || (renderer->isRenderInline() && renderer->hasLayer())); // The only way an inline could hit test like this is if it has a layer.
// If we have no lines then we have no work to do.
if (!firstLineBox())
return false;
// We can check the first box and last box and avoid hit testing if we don't
// contain the point. This is a quick short-circuit that we can take to avoid walking any lines.
// FIXME: This check is flawed in the following extremely obscure way:
// if some line in the middle has a huge overflow, it might actually extend below the last line.
if ((y >= ty + lastLineBox()->root()->bottomVisibleOverflow()) || (y < ty + firstLineBox()->root()->topVisibleOverflow()))
return false;
// See if our root lines contain the point. If so, then we hit test
// them further. Note that boxes can easily overlap, so we can't make any assumptions
// based off positions of our first line box or our last line box.
for (InlineFlowBox* curr = lastLineBox(); curr; curr = curr->prevLineBox()) {
if (y >= ty + curr->root()->topVisibleOverflow() && y < ty + curr->root()->bottomVisibleOverflow()) {
bool inside = curr->nodeAtPoint(request, result, x, y, tx, ty);
if (inside) {
renderer->updateHitTestResult(result, IntPoint(x - tx, y - ty));
return true;
}
}
}
return false;
}
示例5: hitTestLines
bool RenderFlow::hitTestLines(NodeInfo& i, int x, int y, int tx, int ty, HitTestAction hitTestAction)
{
(void) hitTestAction;
/*
if (hitTestAction != HitTestForeground) // ### port hitTest
return false;
*/
if (!firstLineBox())
return false;
// We can check the first box and last box and avoid hit testing if we don't
// contain the point. This is a quick short-circuit that we can take to avoid walking any lines.
// FIXME: This check is flawed in two extremely obscure ways.
// (1) If some line in the middle has a huge overflow, it might actually extend below the last line.
// (2) The overflow from an inline block on a line is not reported to the line.
if ((y >= ty + lastLineBox()->root()->bottomOverflow()) || (y < ty + firstLineBox()->root()->topOverflow()))
return false;
// See if our root lines contain the point. If so, then we hit test
// them further. Note that boxes can easily overlap, so we can't make any assumptions
// based off positions of our first line box or our last line box.
for (InlineFlowBox* curr = lastLineBox(); curr; curr = curr->prevFlowBox()) {
if (y >= ty + curr->root()->topOverflow() && y < ty + curr->root()->bottomOverflow()) {
bool inside = curr->nodeAtPoint(i, x, y, tx, ty);
if (inside) {
setInnerNode(i);
return true;
}
}
}
return false;
}
示例6: ASSERT
void LineBoxListPainter::paint(LayoutBoxModelObject* layoutObject, const PaintInfo& paintInfo, const LayoutPoint& paintOffset) const
{
ASSERT(paintInfo.phase != PaintPhaseOutline && paintInfo.phase != PaintPhaseSelfOutline && paintInfo.phase != PaintPhaseChildOutlines);
// Only paint during the foreground/selection phases.
if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection && paintInfo.phase != PaintPhaseTextClip && paintInfo.phase != PaintPhaseMask)
return;
ASSERT(layoutObject->isLayoutBlock() || (layoutObject->isLayoutInline() && layoutObject->hasLayer())); // The only way an inline could paint like this is if it has a layer.
// FIXME: When Skia supports annotation rect covering (https://code.google.com/p/skia/issues/detail?id=3872),
// these rects may be covered line box drawings. Then we may need a dedicated paint phase.
if (paintInfo.phase == PaintPhaseForeground && paintInfo.isPrinting())
addPDFURLRectsForInlineChildrenRecursively(layoutObject, paintInfo, paintOffset);
// If we have no lines then we have no work to do.
if (!m_lineBoxList.firstLineBox())
return;
if (!m_lineBoxList.anyLineIntersectsRect(LineLayoutBoxModel(layoutObject), LayoutRect(paintInfo.rect), paintOffset))
return;
PaintInfo info(paintInfo);
// See if our root lines intersect with the dirty rect. If so, then we paint
// them. Note that boxes can easily overlap, so we can't make any assumptions
// based off positions of our first line box or our last line box.
for (InlineFlowBox* curr = m_lineBoxList.firstLineBox(); curr; curr = curr->nextLineBox()) {
if (m_lineBoxList.lineIntersectsDirtyRect(LineLayoutBoxModel(layoutObject), curr, info, paintOffset)) {
RootInlineBox& root = curr->root();
curr->paint(info, paintOffset, root.lineTop(), root.lineBottom());
}
}
}
示例7: collectHorizontalBoxCoordinates
/**
* Traverses the horizontal inline boxes and appends the point coordinates to
* the given array.
* @param box inline box
* @param pointArray array collecting coordinates
* @param bottom \c true, collect bottom coordinates, \c false, collect top
* coordinates.
* @param limit lower limit that an y-coordinate must at least reach. Note
* that limit designates the highest y-coordinate for \c bottom, and
* the lowest for !\c bottom.
*/
static void collectHorizontalBoxCoordinates(InlineBox *box, QValueVector< QPoint > &pointArray, bool bottom, int offset, int limit = -500000)
{
// kdDebug(6000) << "collectHorizontalBoxCoordinates: " << endl;
offset = bottom ? offset : -offset;
int y = box->yPos() + bottom * box->height() + offset;
if(limit != -500000 && (bottom ? y < limit : y > limit))
y = limit;
int x = box->xPos() + bottom * box->width() + offset;
QPoint newPnt(x, y);
// Add intersection point if point-array not empty.
if(!pointArray.isEmpty())
{
QPoint lastPnt = pointArray.back();
QPoint insPnt(newPnt.x(), lastPnt.y());
if(offset && ((bottom && lastPnt.y() > y) || (!bottom && lastPnt.y() < y)))
{
insPnt.rx() = lastPnt.x();
insPnt.ry() = y;
}
// kdDebug(6040) << "left: " << lastPnt << " == " << insPnt << ": " << (insPnt == lastPnt) << endl;
appendPoint(pointArray, insPnt);
}
// Insert starting point of box
appendPoint(pointArray, newPnt);
newPnt.rx() += (bottom ? -box->width() : box->width()) - 2 * offset;
if(box->isInlineFlowBox())
{
InlineFlowBox *flowBox = static_cast< InlineFlowBox * >(box);
for(InlineBox *b = bottom ? flowBox->lastChild() : flowBox->firstChild(); b; b = bottom ? b->prevOnLine() : b->nextOnLine())
{
// Don't let boxes smaller than this flow box' height influence
// the vertical position of the outline if they have a different
// x-coordinate
int l2;
if(b->xPos() != box->xPos() && b->xPos() + b->width() != box->xPos() + box->width())
l2 = y;
else
l2 = limit;
collectHorizontalBoxCoordinates(b, pointArray, bottom, kAbs(offset), l2);
}
// Add intersection point if flow box contained any children
if(flowBox->firstChild())
{
QPoint lastPnt = pointArray.back();
QPoint insPnt(lastPnt.x(), newPnt.y());
// kdDebug(6040) << "right: " << lastPnt << " == " << insPnt << ": " << (insPnt == lastPnt) << endl;
appendPoint(pointArray, insPnt);
}
}
// Insert ending point of box
appendPoint(pointArray, newPnt);
// kdDebug(6000) << "collectHorizontalBoxCoordinates: " << "ende" << endl;
}
示例8: if
void InlineFlowBox::determineSpacingForFlowBoxes(bool lastLine, RenderObject* endObject)
{
// All boxes start off open. They will not apply any margins/border/padding on
// any side.
bool includeLeftEdge = false;
bool includeRightEdge = false;
RenderFlow* flow = static_cast<RenderFlow*>(object());
if (!flow->firstChild())
includeLeftEdge = includeRightEdge = true; // Empty inlines never split across lines.
else if (parent()) { // The root inline box never has borders/margins/padding.
bool ltr = flow->style()->direction() == LTR;
// Check to see if all initial lines are unconstructed. If so, then
// we know the inline began on this line.
if (!flow->firstLineBox()->isConstructed()) {
if (ltr && flow->firstLineBox() == this)
includeLeftEdge = true;
else if (!ltr && flow->lastLineBox() == this)
includeRightEdge = true;
}
// In order to determine if the inline ends on this line, we check three things:
// (1) If we are the last line and we don't have a continuation(), then we can
// close up.
// (2) If the last line box for the flow has an object following it on the line (ltr,
// reverse for rtl), then the inline has closed.
// (3) The line may end on the inline. If we are the last child (climbing up
// the end object's chain), then we just closed as well.
if (!flow->lastLineBox()->isConstructed()) {
if (ltr) {
if (!nextLineBox() &&
((lastLine && !object()->continuation()) || nextOnLineExists()
|| onEndChain(endObject)))
includeRightEdge = true;
}
else {
if ((!prevLineBox() || !prevLineBox()->isConstructed()) &&
((lastLine && !object()->continuation()) ||
prevOnLineExists() || onEndChain(endObject)))
includeLeftEdge = true;
}
}
}
setEdges(includeLeftEdge, includeRightEdge);
// Recur into our children.
for (InlineBox* currChild = firstChild(); currChild; currChild = currChild->nextOnLine()) {
if (currChild->isInlineFlowBox()) {
InlineFlowBox* currFlow = static_cast<InlineFlowBox*>(currChild);
currFlow->determineSpacingForFlowBoxes(lastLine, endObject);
}
}
}
示例9: absoluteQuads
void RenderSVGInline::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const
{
auto* textAncestor = RenderSVGText::locateRenderSVGTextAncestor(*this);
if (!textAncestor)
return;
FloatRect textBoundingBox = textAncestor->strokeBoundingBox();
for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox())
quads.append(localToAbsoluteQuad(FloatRect(textBoundingBox.x() + box->x(), textBoundingBox.y() + box->y(), box->logicalWidth(), box->logicalHeight()), UseTransforms, wasFixed));
}
示例10: absoluteQuads
void RenderSVGInline::absoluteQuads(Vector<FloatQuad>& quads)
{
const RenderObject* object = SVGRenderSupport::findTextRootObject(this);
if (!object)
return;
FloatRect textBoundingBox = object->strokeBoundingBox();
for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox())
quads.append(localToAbsoluteQuad(FloatRect(textBoundingBox.x() + box->x(), textBoundingBox.y() + box->y(), box->width(), box->height())));
}
示例11: absoluteQuads
void RenderSVGInline::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed)
{
RenderObject* object = RenderSVGText::locateRenderSVGTextAncestor(this);
if (!object)
return;
FloatRect textBoundingBox = object->strokeBoundingBox();
for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox())
quads.append(localToAbsoluteQuad(FloatRect(textBoundingBox.x() + box->x(), textBoundingBox.y() + box->y(), box->logicalWidth(), box->logicalHeight()), false, wasFixed));
}
示例12: deleteLineBoxTree
void RenderLineBoxList::deleteLineBoxTree(RenderArena* arena)
{
InlineFlowBox* line = m_firstLineBox;
InlineFlowBox* nextLine;
while (line) {
nextLine = line->nextLineBox();
line->deleteLine(arena);
line = nextLine;
}
m_firstLineBox = m_lastLineBox = 0;
}
示例13: deleteLineBoxTree
void LineBoxList::deleteLineBoxTree()
{
InlineFlowBox* line = m_firstLineBox;
InlineFlowBox* nextLine;
while (line) {
nextLine = line->nextLineBox();
line->deleteLine();
line = nextLine;
}
m_firstLineBox = m_lastLineBox = 0;
}
示例14: deleteLineBoxes
void RenderLineBoxList::deleteLineBoxes()
{
if (m_firstLineBox) {
InlineFlowBox* next;
for (InlineFlowBox* curr = m_firstLineBox; curr; curr = next) {
next = curr->nextLineBox();
delete curr;
}
m_firstLineBox = nullptr;
m_lastLineBox = nullptr;
}
}
示例15: deleteLineBoxes
void RenderLineBoxList::deleteLineBoxes(RenderArena* arena)
{
if (m_firstLineBox) {
InlineFlowBox* next;
for (InlineFlowBox* curr = m_firstLineBox; curr; curr = next) {
next = curr->nextLineBox();
curr->destroy(arena);
}
m_firstLineBox = 0;
m_lastLineBox = 0;
}
}