Exemplo n.º 1
0
void ContentLayerDelegate::paintContents(
    WebDisplayItemList* webDisplayItemList, const WebRect& clip,
    WebContentLayerClient::PaintingControlSetting paintingControl)
{
    TRACE_EVENT1("blink,benchmark", "ContentLayerDelegate::paintContents", "clip_rect", toTracedValue(clip));

    // TODO(pdr): Remove when slimming paint v2 is further along. This is only
    // here so the browser is usable during development and does not crash due
    // to committing the new display items twice.
    if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()) {
        m_painter->displayItemList()->paintArtifact().appendToWebDisplayItemList(webDisplayItemList);
        return;
    }

    DisplayItemList* displayItemList = m_painter->displayItemList();
    ASSERT(displayItemList);
    displayItemList->setDisplayItemConstructionIsDisabled(
        paintingControl == WebContentLayerClient::DisplayListConstructionDisabled);

    // We also disable caching when Painting or Construction are disabled. In both cases we would like
    // to compare assuming the full cost of recording, not the cost of re-using cached content.
    if (paintingControl != WebContentLayerClient::PaintDefaultBehavior)
        displayItemList->invalidateAll();

    GraphicsContext::DisabledMode disabledMode = GraphicsContext::NothingDisabled;
    if (paintingControl == WebContentLayerClient::DisplayListPaintingDisabled
        || paintingControl == WebContentLayerClient::DisplayListConstructionDisabled)
        disabledMode = GraphicsContext::FullyDisabled;
    GraphicsContext context(displayItemList, disabledMode);

    m_painter->paint(context, clip);

    displayItemList->commitNewDisplayItems();
    displayItemList->paintArtifact().appendToWebDisplayItemList(webDisplayItemList);
}
Exemplo n.º 2
0
void PaintController::copyCachedSubsequence(DisplayItemList::iterator& currentIt, DisplayItemList& updatedList)
{
    ASSERT(currentIt->type() == DisplayItem::Subsequence);
    ASSERT(!currentIt->scope());
    DisplayItem::Id endSubsequenceId(currentIt->client(), DisplayItem::EndSubsequence, 0);
    do {
        // We should always find the EndSubsequence display item.
        ASSERT(currentIt != m_currentPaintArtifact.displayItemList().end());
        ASSERT(currentIt->hasValidClient());
        updatedList.appendByMoving(*currentIt);
        ++currentIt;
    } while (!endSubsequenceId.matches(updatedList.last()));
}
Exemplo n.º 3
0
WTF::String PaintController::displayItemListAsDebugString(const DisplayItemList& list) const
{
    StringBuilder stringBuilder;
    size_t i = 0;
    for (auto it = list.begin(); it != list.end(); ++it, ++i) {
        const DisplayItem& displayItem = *it;
        if (i)
            stringBuilder.append(",\n");
        stringBuilder.append(String::format("{index: %d, ", (int)i));
        displayItem.dumpPropertiesAsDebugString(stringBuilder);
        stringBuilder.append(", cacheIsValid: ");
        stringBuilder.append(clientCacheIsValid(displayItem.client()) ? "true" : "false");
        stringBuilder.append('}');
    }
    return stringBuilder.toString();
}
Exemplo n.º 4
0
void WebPopupMenuImpl::paintContents(WebCanvas* canvas, const WebRect& rect, WebContentLayerClient::PaintingControlSetting paintingControl)
{
    if (!m_widget)
        return;

    OwnPtr<GraphicsContext> context;
    GraphicsContext::DisabledMode disabledMode = GraphicsContext::NothingDisabled;
    if (paintingControl == PaintingControlSetting::DisplayListPaintingDisabled
        || paintingControl == PaintingControlSetting::DisplayListConstructionDisabled)
        disabledMode = GraphicsContext::FullyDisabled;

    DisplayItemList* itemList = displayItemList();
    if (itemList) {
        context = adoptPtr(new GraphicsContext(itemList, disabledMode));
        itemList->setDisplayItemConstructionIsDisabled(paintingControl == PaintingControlSetting::DisplayListConstructionDisabled);
    } else {
        context = GraphicsContext::deprecatedCreateWithCanvas(canvas, disabledMode);
    }
    m_widget->paint(context.get(), rect);

    if (itemList)
        itemList->commitNewDisplayItems();
}