void VisualViewport::initializeScrollbars()
{
    if (visualViewportSuppliesScrollbars()) {
        if (!m_overlayScrollbarHorizontal->parent())
            m_innerViewportContainerLayer->addChild(m_overlayScrollbarHorizontal.get());
        if (!m_overlayScrollbarVertical->parent())
            m_innerViewportContainerLayer->addChild(m_overlayScrollbarVertical.get());
    } else {
        m_overlayScrollbarHorizontal->removeFromParent();
        m_overlayScrollbarVertical->removeFromParent();
    }

    setupScrollbar(WebScrollbar::Horizontal);
    setupScrollbar(WebScrollbar::Vertical);
}
Example #2
0
void VisualViewport::initializeScrollbars() {
  // Do nothing if not attached to layer tree yet - will initialize upon attach.
  if (!m_innerViewportContainerLayer)
    return;

  if (visualViewportSuppliesScrollbars() &&
      !frameHost().settings().hideScrollbars()) {
    if (!m_overlayScrollbarHorizontal->parent())
      m_innerViewportContainerLayer->addChild(
          m_overlayScrollbarHorizontal.get());
    if (!m_overlayScrollbarVertical->parent())
      m_innerViewportContainerLayer->addChild(m_overlayScrollbarVertical.get());
  } else {
    m_overlayScrollbarHorizontal->removeFromParent();
    m_overlayScrollbarVertical->removeFromParent();
  }

  setupScrollbar(WebScrollbar::Horizontal);
  setupScrollbar(WebScrollbar::Vertical);
}