Exemplo n.º 1
0
void InspectorPageAgent::disable(ErrorString*)
{
    m_enabled = false;
    m_state->setBoolean(PageAgentState::pageAgentEnabled, false);
    m_state->remove(PageAgentState::pageAgentScriptsToEvaluateOnLoad);
    m_overlay->hide();
    m_instrumentingAgents->setInspectorPageAgent(0);
    m_deviceMetricsOverridden = false;

    setShowPaintRects(0, false);
    setShowDebugBorders(0, false);
    setShowFPSCounter(0, false);
    setEmulatedMedia(0, String());
    setContinuousPaintingEnabled(0, false);
    setShowScrollBottleneckRects(0, false);
    setShowViewportSizeOnResize(0, false, 0);

    if (m_state->getBoolean(PageAgentState::touchEventEmulationEnabled)) {
        updateTouchEventEmulationInPage(false);
        m_state->setBoolean(PageAgentState::touchEventEmulationEnabled, false);
    }

    if (!deviceMetricsChanged(false, 0, 0, 0, false, false, 1, false))
        return;

    // When disabling the agent, reset the override values if necessary.
    updateViewMetrics(false, 0, 0, 0, false, false, m_embedderFontScaleFactor, m_embedderTextAutosizingEnabled);
    m_state->setLong(PageAgentState::pageAgentScreenWidthOverride, 0);
    m_state->setLong(PageAgentState::pageAgentScreenHeightOverride, 0);
    m_state->setDouble(PageAgentState::pageAgentDeviceScaleFactorOverride, 0);
    m_state->setBoolean(PageAgentState::pageAgentEmulateViewport, false);
    m_state->setBoolean(PageAgentState::pageAgentFitWindow, false);
    m_state->setDouble(PageAgentState::fontScaleFactor, 1);
    m_state->setBoolean(PageAgentState::pageAgentTextAutosizingOverride, false);
}
void InspectorEmulationAgent::disable(ErrorString*)
{
    ErrorString error;
    setScriptExecutionDisabled(&error, false);
    setTouchEmulationEnabled(&error, false, protocol::Maybe<String>());
    setEmulatedMedia(&error, String());
}
void InspectorEmulationAgent::disable(ErrorString*)
{
    ErrorString error;
    setScriptExecutionDisabled(&error, false);
    setTouchEmulationEnabled(&error, false, nullptr);
    setEmulatedMedia(&error, String());
}
void InspectorEmulationAgent::restore()
{
    ErrorString error;
    setScriptExecutionDisabled(&error, m_state->getBoolean(EmulationAgentState::scriptExecutionDisabled));
    setTouchEmulationEnabled(&error, m_state->getBoolean(EmulationAgentState::touchEventEmulationEnabled), nullptr);
    setEmulatedMedia(&error, m_state->getString(EmulationAgentState::emulatedMedia));
}
Exemplo n.º 5
0
Response InspectorEmulationAgent::disable() {
  setScriptExecutionDisabled(false);
  setTouchEmulationEnabled(false, Maybe<String>());
  setEmulatedMedia(String());
  setCPUThrottlingRate(1);
  resetViewport();
  return Response::OK();
}
void InspectorEmulationAgent::restore()
{
    ErrorString error;
    setScriptExecutionDisabled(&error, m_state->booleanProperty(EmulationAgentState::scriptExecutionDisabled, false));
    setTouchEmulationEnabled(&error, m_state->booleanProperty(EmulationAgentState::touchEventEmulationEnabled, false), protocol::Maybe<String>());
    String16 emulatedMedia;
    m_state->getString(EmulationAgentState::emulatedMedia, &emulatedMedia);
    setEmulatedMedia(&error, emulatedMedia);
}
Exemplo n.º 7
0
void InspectorEmulationAgent::restore() {
  setScriptExecutionDisabled(m_state->booleanProperty(
      EmulationAgentState::scriptExecutionDisabled, false));
  setTouchEmulationEnabled(
      m_state->booleanProperty(EmulationAgentState::touchEventEmulationEnabled,
                               false),
      protocol::Maybe<String>());
  String emulatedMedia;
  m_state->getString(EmulationAgentState::emulatedMedia, &emulatedMedia);
  setEmulatedMedia(emulatedMedia);
  if (m_state->booleanProperty(EmulationAgentState::forcedViewportEnabled,
                               false)) {
    forceViewport(

        m_state->doubleProperty(EmulationAgentState::forcedViewportX, 0),
        m_state->doubleProperty(EmulationAgentState::forcedViewportY, 0),
        m_state->doubleProperty(EmulationAgentState::forcedViewportScale, 1));
  }
}
Exemplo n.º 8
0
void InspectorPageAgent::restore()
{
    if (m_state->getBoolean(PageAgentState::pageAgentEnabled)) {
        ErrorString error;
        enable(&error);
        bool scriptExecutionDisabled = m_state->getBoolean(PageAgentState::pageAgentScriptExecutionDisabled);
        setScriptExecutionDisabled(0, scriptExecutionDisabled);
        bool showPaintRects = m_state->getBoolean(PageAgentState::pageAgentShowPaintRects);
        setShowPaintRects(0, showPaintRects);
        bool showDebugBorders = m_state->getBoolean(PageAgentState::pageAgentShowDebugBorders);
        setShowDebugBorders(0, showDebugBorders);
        bool showFPSCounter = m_state->getBoolean(PageAgentState::pageAgentShowFPSCounter);
        setShowFPSCounter(0, showFPSCounter);
        String emulatedMedia = m_state->getString(PageAgentState::pageAgentEmulatedMedia);
        setEmulatedMedia(0, emulatedMedia);
        bool continuousPaintingEnabled = m_state->getBoolean(PageAgentState::pageAgentContinuousPaintingEnabled);
        setContinuousPaintingEnabled(0, continuousPaintingEnabled);
        bool showScrollBottleneckRects = m_state->getBoolean(PageAgentState::pageAgentShowScrollBottleneckRects);
        setShowScrollBottleneckRects(0, showScrollBottleneckRects);

        updateViewMetricsFromState();
        updateTouchEventEmulationInPage(m_state->getBoolean(PageAgentState::touchEventEmulationEnabled));
    }
}