本文整理汇总了C++中RenderRegion类的典型用法代码示例。如果您正苦于以下问题:C++ RenderRegion类的具体用法?C++ RenderRegion怎么用?C++ RenderRegion使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RenderRegion类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getRegionRangeForBox
bool RenderFlowThread::logicalWidthChangedInRegions(const RenderBlock* block, LayoutUnit offsetFromLogicalTopOfFirstPage)
{
if (!hasRegions() || block == this) // Not necessary, since if any region changes, we do a full pagination relayout anyway.
return false;
RenderRegion* startRegion;
RenderRegion* endRegion;
getRegionRangeForBox(block, startRegion, endRegion);
for (RenderRegionList::iterator iter = m_regionList.find(startRegion); iter != m_regionList.end(); ++iter) {
RenderRegion* region = *iter;
if (!region->isValid())
continue;
ASSERT(!region->needsLayout());
OwnPtr<RenderBoxRegionInfo> oldInfo = region->takeRenderBoxRegionInfo(block);
if (!oldInfo)
continue;
LayoutUnit oldLogicalWidth = oldInfo->logicalWidth();
RenderBoxRegionInfo* newInfo = block->renderBoxRegionInfo(region, offsetFromLogicalTopOfFirstPage);
if (!newInfo || newInfo->logicalWidth() != oldLogicalWidth)
return true;
if (region == endRegion)
break;
}
return false;
}
示例2: ASSERT
RenderRegion* RenderFlowThread::regionAtBlockOffset(LayoutUnit offset, bool extendLastRegion) const
{
ASSERT(!m_regionsInvalidated);
// If no region matches the position and extendLastRegion is true, it will return
// the last valid region. It is similar to auto extending the size of the last region.
RenderRegion* lastValidRegion = 0;
LayoutUnit accumulatedLogicalHeight = 0;
// FIXME: The regions are always in order, optimize this search.
for (RenderRegionList::const_iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) {
RenderRegion* region = *iter;
if (offset <= 0)
return region;
if (extendLastRegion || region->isRenderRegionSet())
lastValidRegion = region;
if (region->hasOverrideHeight() && view()->normalLayoutPhase()) {
accumulatedLogicalHeight += region->overrideLogicalContentHeight();
if (offset < accumulatedLogicalHeight)
return region;
continue;
}
LayoutRect regionRect = region->flowThreadPortionRect();
accumulatedLogicalHeight += isHorizontalWritingMode() ? regionRect.height() : regionRect.width();
if (offset < accumulatedLogicalHeight)
return region;
}
return lastValidRegion;
}
示例3: getRegionRangeForBox
bool RenderFlowThread::logicalWidthChangedInRegions(const RenderBlock* block, LayoutUnit offsetFromLogicalTopOfFirstPage)
{
if (!hasRegions() || block == this) // Not necessary, since if any region changes, we do a full pagination relayout anyway.
return false;
RenderRegion* startRegion;
RenderRegion* endRegion;
getRegionRangeForBox(block, startRegion, endRegion);
// If the block doesn't have a startRegion (and implicitly a region range) it's safe to assume the width in regions has changed (e.g. the region chain was invalidated).
if (!startRegion)
return true;
for (RenderRegionList::iterator iter = m_regionList.find(startRegion); iter != m_regionList.end(); ++iter) {
RenderRegion* region = *iter;
ASSERT(!region->needsLayout());
OwnPtr<RenderBoxRegionInfo> oldInfo = region->takeRenderBoxRegionInfo(block);
if (!oldInfo)
continue;
LayoutUnit oldLogicalWidth = oldInfo->logicalWidth();
RenderBoxRegionInfo* newInfo = block->renderBoxRegionInfo(region, offsetFromLogicalTopOfFirstPage);
if (!newInfo || newInfo->logicalWidth() != oldLogicalWidth)
return true;
if (region == endRegion)
break;
}
return false;
}
示例4: ASSERT
RenderRegion* RenderFlowThread::regionAtBlockOffset(LayoutUnit offset, bool extendLastRegion) const
{
ASSERT(!m_regionsInvalidated);
// If no region matches the position and extendLastRegion is true, it will return
// the last valid region. It is similar to auto extending the size of the last region.
RenderRegion* lastValidRegion = 0;
// FIXME: The regions are always in order, optimize this search.
bool useHorizontalWritingMode = isHorizontalWritingMode();
for (RenderRegionList::const_iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) {
RenderRegion* region = *iter;
if (!region->isValid())
continue;
if (offset <= 0)
return region;
LayoutRect regionRect = region->flowThreadPortionRect();
if ((useHorizontalWritingMode && offset < regionRect.maxY()) || (!useHorizontalWritingMode && offset < regionRect.maxX()))
return region;
if (extendLastRegion || region->isRenderRegionSet())
lastValidRegion = region;
}
return lastValidRegion;
}
示例5: firstRegion
LayoutUnit RenderFlowThread::contentLogicalLeftOfFirstRegion() const
{
RenderRegion* firstValidRegionInFlow = firstRegion();
if (!firstValidRegionInFlow)
return 0;
return isHorizontalWritingMode() ? firstValidRegionInFlow->flowThreadPortionRect().x() : firstValidRegionInFlow->flowThreadPortionRect().y();
}
示例6: clearRenderObjectCustomStyle
void RenderFlowThread::clearRenderObjectCustomStyle(const RenderObject* object,
const RenderRegion* oldStartRegion, const RenderRegion* oldEndRegion,
const RenderRegion* newStartRegion, const RenderRegion* newEndRegion)
{
// Clear the styles for the object in the regions.
// The styles are not cleared for the regions that are contained in both ranges.
bool insideOldRegionRange = false;
bool insideNewRegionRange = false;
for (RenderRegionList::iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) {
RenderRegion* region = *iter;
if (oldStartRegion == region)
insideOldRegionRange = true;
if (newStartRegion == region)
insideNewRegionRange = true;
if (!(insideOldRegionRange && insideNewRegionRange))
region->clearObjectStyleInRegion(object);
if (oldEndRegion == region)
insideOldRegionRange = false;
if (newEndRegion == region)
insideNewRegionRange = false;
}
}
示例7: renderRegionForLine
LayoutUnit RenderFlowThread::regionLogicalHeightForLine(LayoutUnit position) const
{
RenderRegion* region = renderRegionForLine(position);
if (!region)
return 0;
return isHorizontalWritingMode() ? region->regionRect().height() : region->regionRect().width();
}
示例8: ASSERT
void RenderFlowThread::removeRenderBoxRegionInfo(RenderBox* box)
{
if (!hasRegions())
return;
// If the region chain was invalidated the next layout will clear the box information from all the regions.
if (m_regionsInvalidated) {
ASSERT(selfNeedsLayout());
return;
}
RenderRegion* startRegion;
RenderRegion* endRegion;
getRegionRangeForBox(box, startRegion, endRegion);
for (RenderRegionList::iterator iter = m_regionList.find(startRegion); iter != m_regionList.end(); ++iter) {
RenderRegion* region = *iter;
region->removeRenderBoxRegionInfo(box);
if (region == endRegion)
break;
}
#ifndef NDEBUG
// We have to make sure we did not leave any RenderBoxRegionInfo attached.
for (RenderRegionList::iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) {
RenderRegion* region = *iter;
ASSERT(!region->renderBoxRegionInfo(box));
}
#endif
m_regionRangeMap.remove(box);
}
示例9: regionAtBlockOffset
LayoutUnit RenderFlowThread::pageLogicalHeightForOffset(LayoutUnit offset) const
{
RenderRegion* region = regionAtBlockOffset(offset);
if (!region)
return 0;
return region->pageLogicalHeight();
}
示例10: ASSERT
void RenderFlowThread::computeLogicalWidth()
{
LayoutUnit logicalWidth = 0;
for (RenderRegionList::iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) {
RenderRegion* region = *iter;
if (!region->isValid())
continue;
ASSERT(!region->needsLayout());
logicalWidth = max(isHorizontalWritingMode() ? region->contentWidth() : region->contentHeight(), logicalWidth);
}
setLogicalWidth(logicalWidth);
// If the regions have non-uniform logical widths, then insert inset information for the RenderFlowThread.
for (RenderRegionList::iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) {
RenderRegion* region = *iter;
if (!region->isValid())
continue;
LayoutUnit regionLogicalWidth = isHorizontalWritingMode() ? region->contentWidth() : region->contentHeight();
if (regionLogicalWidth != logicalWidth) {
LayoutUnit logicalLeft = style()->direction() == LTR ? zeroLayoutUnit : logicalWidth - regionLogicalWidth;
region->setRenderBoxRegionInfo(this, logicalLeft, regionLogicalWidth, false);
}
}
}
示例11: lastRegion
RenderRegion* RenderFlowThread::lastRegion() const
{
if (!hasValidRegionInfo())
return 0;
for (RenderRegionList::const_reverse_iterator iter = m_regionList.rbegin(); iter != m_regionList.rend(); ++iter) {
RenderRegion* region = *iter;
if (!region->isValid())
continue;
return region;
}
return 0;
}
示例12: computeLogicalHeight
void RenderFlowThread::computeLogicalHeight(LayoutUnit, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const
{
computedValues.m_position = logicalTop;
computedValues.m_extent = 0;
for (RenderRegionList::const_iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) {
RenderRegion* region = *iter;
ASSERT(!region->needsLayout());
computedValues.m_extent += region->logicalHeightOfAllFlowThreadContent();
}
}
示例13: checkRegionsWithStyling
// Check if the content is flown into at least a region with region styling rules.
void RenderFlowThread::checkRegionsWithStyling()
{
bool hasRegionsWithStyling = false;
for (RenderRegionList::iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) {
RenderRegion* region = *iter;
if (region->hasCustomRegionStyle()) {
hasRegionsWithStyling = true;
break;
}
}
m_hasRegionsWithStyling = hasRegionsWithStyling;
}
示例14: addForcedRegionBreak
void RenderFlowThread::computeOverflowStateForRegions(LayoutUnit oldClientAfterEdge)
{
LayoutUnit height = oldClientAfterEdge;
LayoutUnit offsetBreakAdjustment = 0;
// Simulate a region break at height. If it points inside an auto logical height region,
// then it may determine the region override logical content height.
addForcedRegionBreak(height, this, false, &offsetBreakAdjustment);
// During the normal layout phase of the flow thread all the auto-height regions have the overrideLogicalContentHeight set to max height.
// We need to clear the overrideLogicalContentHeight for all the regions that didn't receive any content, starting with firstEmptyRegion.
RenderRegion* firstEmptyRegion = 0;
if (view()->normalLayoutPhase())
firstEmptyRegion = regionAtBlockOffset(height + offsetBreakAdjustment);
// FIXME: the visual overflow of middle region (if it is the last one to contain any content in a render flow thread)
// might not be taken into account because the render flow thread height is greater that that regions height + its visual overflow
// because of how computeLogicalHeight is implemented for RenderFlowThread (as a sum of all regions height).
// This means that the middle region will be marked as fit (even if it has visual overflow flowing into the next region)
if (hasRenderOverflow()
&& ( (isHorizontalWritingMode() && visualOverflowRect().maxY() > clientBoxRect().maxY())
|| (!isHorizontalWritingMode() && visualOverflowRect().maxX() > clientBoxRect().maxX())))
height = isHorizontalWritingMode() ? visualOverflowRect().maxY() : visualOverflowRect().maxX();
bool inEmptyRegionsSection = false;
RenderRegion* lastReg = lastRegion();
for (RenderRegionList::iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) {
RenderRegion* region = *iter;
LayoutUnit flowMin = height - (isHorizontalWritingMode() ? region->flowThreadPortionRect().y() : region->flowThreadPortionRect().x());
LayoutUnit flowMax = height - (isHorizontalWritingMode() ? region->flowThreadPortionRect().maxY() : region->flowThreadPortionRect().maxX());
RenderRegion::RegionState previousState = region->regionState();
RenderRegion::RegionState state = RenderRegion::RegionFit;
if (flowMin <= 0)
state = RenderRegion::RegionEmpty;
if (flowMax > 0 && region == lastReg)
state = RenderRegion::RegionOverset;
region->setRegionState(state);
// determine whether the NamedFlow object should dispatch a regionLayoutUpdate event
// FIXME: currently it cannot determine whether a region whose regionOverset state remained either "fit" or "overset" has actually
// changed, so it just assumes that the NamedFlow should dispatch the event
if (previousState != state
|| state == RenderRegion::RegionFit
|| state == RenderRegion::RegionOverset)
setDispatchRegionLayoutUpdateEvent(true);
if (region == firstEmptyRegion)
inEmptyRegionsSection = true;
// Clear the overrideLogicalContentHeight value for autoheight regions that didn't receive any content.
if (inEmptyRegionsSection && region->hasAutoLogicalHeight())
region->clearOverrideLogicalContentHeight();
}
// With the regions overflow state computed we can also set the overset flag for the named flow.
// If there are no valid regions in the chain, overset is true.
m_overset = lastReg ? lastReg->regionState() == RenderRegion::RegionOverset : true;
}
示例15: updateWritingMode
void RenderNamedFlowThread::updateWritingMode()
{
RenderRegion* firstRegion = m_regionList.first();
if (!firstRegion)
return;
if (style()->writingMode() == firstRegion->style()->writingMode())
return;
// The first region defines the principal writing mode for the entire flow.
RefPtr<RenderStyle> newStyle = RenderStyle::clone(style());
newStyle->setWritingMode(firstRegion->style()->writingMode());
setStyle(newStyle.release());
}