void CoordinatedDrawingArea::viewStateDidChange(ViewState::Flags changed, bool, const Vector<uint64_t>&) { if (changed & ViewState::IsVisible) { if (m_webPage.isVisible()) resumePainting(); else suspendPainting(); } }
void ChunkedUpdateDrawingArea::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) { DrawingAreaID targetDrawingAreaID; if (!arguments->decode(CoreIPC::Out(targetDrawingAreaID))) return; // We can switch drawing areas on the fly, so if this message was targetted at an obsolete drawing area, ignore it. if (targetDrawingAreaID != id()) return; switch (messageID.get<DrawingAreaMessage::Kind>()) { case DrawingAreaMessage::SetSize: { IntSize size; if (!arguments->decode(CoreIPC::Out(size))) return; setSize(size); break; } case DrawingAreaMessage::SuspendPainting: suspendPainting(); break; case DrawingAreaMessage::ResumePainting: { bool forceRepaint; if (!arguments->decode(CoreIPC::Out(forceRepaint))) return; resumePainting(forceRepaint); break; } case DrawingAreaMessage::DidUpdate: didUpdate(); break; default: ASSERT_NOT_REACHED(); break; } }
void LayerBackedDrawingArea::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) { DrawingAreaInfo::Identifier targetIdentifier; if (!arguments->decode(CoreIPC::Out(targetIdentifier))) return; // We can switch drawing areas on the fly, so if this message was targetted at an obsolete drawing area, ignore it. if (targetIdentifier != info().identifier) return; switch (messageID.get<DrawingAreaLegacyMessage::Kind>()) { case DrawingAreaLegacyMessage::SetSize: { IntSize size; if (!arguments->decode(CoreIPC::Out(size))) return; setSize(size); break; } case DrawingAreaLegacyMessage::SuspendPainting: suspendPainting(); break; case DrawingAreaLegacyMessage::ResumePainting: resumePainting(); break; case DrawingAreaLegacyMessage::DidUpdate: didUpdate(); break; default: ASSERT_NOT_REACHED(); break; } }
void TiledDrawingArea::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) { switch (messageID.get<DrawingAreaLegacyMessage::Kind>()) { case DrawingAreaLegacyMessage::SetSize: { IntSize size; if (!arguments->decode(CoreIPC::Out(size))) return; setSize(size); break; } case DrawingAreaLegacyMessage::SuspendPainting: suspendPainting(); break; case DrawingAreaLegacyMessage::ResumePainting: resumePainting(); break; case DrawingAreaLegacyMessage::CancelTileUpdate: { int tileID; if (!arguments->decode(CoreIPC::Out(tileID))) return; UpdateMap::iterator it = m_pendingUpdates.find(tileID); if (it != m_pendingUpdates.end()) { m_pendingUpdates.remove(it); if (m_pendingUpdates.isEmpty()) { WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::AllTileUpdatesProcessed, m_webPage->pageID(), CoreIPC::In()); m_tileUpdateTimer.stop(); } } break; } case DrawingAreaLegacyMessage::RequestTileUpdate: { TileUpdate update; if (!arguments->decode(CoreIPC::Out(update.tileID, update.dirtyRect, update.scale))) return; UpdateMap::iterator it = m_pendingUpdates.find(update.tileID); if (it != m_pendingUpdates.end()) it->second.dirtyRect.unite(update.dirtyRect); else { m_pendingUpdates.add(update.tileID, update); if (!m_tileUpdateTimer.isActive()) m_tileUpdateTimer.startOneShot(0); } break; } case DrawingAreaLegacyMessage::TakeSnapshot: { IntSize targetSize; IntRect contentsRect; if (!arguments->decode(CoreIPC::Out(targetSize, contentsRect))) return; m_webPage->layoutIfNeeded(); contentsRect.intersect(IntRect(IntPoint::zero(), m_webPage->mainFrame()->coreFrame()->view()->contentsSize())); float targetScale = float(targetSize.width()) / contentsRect.width(); UpdateChunk updateChunk(IntRect(IntPoint(contentsRect.x() * targetScale, contentsRect.y() * targetScale), targetSize)); paintIntoUpdateChunk(&updateChunk, targetScale); WebProcess::shared().connection()->send(DrawingAreaProxyLegacyMessage::SnapshotTaken, m_webPage->pageID(), CoreIPC::In(updateChunk)); break; } default: ASSERT_NOT_REACHED(); break; } }