예제 #1
0
RenderRegion* RootInlineBox::containingRegion() const
{
    ContainingRegionMap& regionMap = containingRegionMap(blockFlow());
    bool hasContainingRegion = regionMap.contains(this);
    RenderRegion* region = hasContainingRegion ? regionMap.get(this) : nullptr;

#ifndef NDEBUG
    if (hasContainingRegion) {
        RenderFlowThread* flowThread = blockFlow().flowThreadContainingBlock();
        const RenderRegionList& regionList = flowThread->renderRegionList();
        ASSERT_WITH_SECURITY_IMPLICATION(regionList.contains(region));
    }
#endif

    return region;
}
예제 #2
0
static PassRefPtr<InspectorArray> buildObjectForRendererFragments(RenderObject* renderer, const HighlightConfig& config)
{
    RefPtr<InspectorArray> fragmentsArray = InspectorArray::create();

    RenderFlowThread* containingFlowThread = renderer->flowThreadContainingBlock();
    if (!containingFlowThread) {
        Highlight highlight;
        buildRendererHighlight(renderer, nullptr, config, &highlight, InspectorOverlay::CoordinateSystem::View);
        fragmentsArray->pushObject(buildObjectForHighlight(highlight));
    } else {
        RenderRegion* startRegion = nullptr;
        RenderRegion* endRegion = nullptr;
        if (!containingFlowThread->getRegionRangeForBox(&renderer->enclosingBox(), startRegion, endRegion)) {
            // The flow has no visible regions. The renderer is not visible on screen.
            return nullptr;
        }

        const RenderRegionList& regionList = containingFlowThread->renderRegionList();
        for (RenderRegionList::const_iterator iter = regionList.find(startRegion); iter != regionList.end(); ++iter) {
            RenderRegion* region = *iter;
            if (region->isValid()) {
                // Compute the highlight of the fragment inside the current region.
                Highlight highlight;
                buildRendererHighlight(renderer, region, config, &highlight, InspectorOverlay::CoordinateSystem::View);
                RefPtr<InspectorObject> fragmentObject = buildObjectForHighlight(highlight);

                // Compute the clipping area of the region.
                fragmentObject->setObject("region", buildObjectForCSSRegionContentClip(region));
                fragmentsArray->pushObject(fragmentObject.release());
            }
            if (region == endRegion)
                break;
        }
    }

    return fragmentsArray.release();
}