示例#1
0
void RenderGeometryMap::mapToContainer(TransformState& transformState, const RenderLayerModelObject* container) const
{
    // If the mapping includes something like columns, we have to go via renderers.
    if (hasNonUniformStep()) {
        m_mapping.last().m_renderer->mapLocalToContainer(container, transformState, ApplyContainerFlip | m_mapCoordinatesFlags);
        transformState.flatten();
        return;
    }

    bool inFixed = false;
#if !ASSERT_DISABLED
    bool foundContainer = !container || (m_mapping.size() && m_mapping[0].m_renderer == container);
#endif

    for (int i = m_mapping.size() - 1; i >= 0; --i) {
        const RenderGeometryMapStep& currentStep = m_mapping[i];

        // If container is the root RenderView (step 0) we want to apply its fixed position offset.
        if (i > 0 && currentStep.m_renderer == container) {
#if !ASSERT_DISABLED
            foundContainer = true;
#endif
            break;
        }

        // If this box has a transform, it acts as a fixed position container
        // for fixed descendants, which prevents the propagation of 'fixed'
        // unless the layer itself is also fixed position.
        if (i && currentStep.m_hasTransform && !currentStep.m_isFixedPosition)
            inFixed = false;
        else if (currentStep.m_isFixedPosition)
            inFixed = true;

        ASSERT(!i == isTopmostRenderView(currentStep.m_renderer));

        if (!i) {
            // A null container indicates mapping through the root RenderView, so including its transform (the page scale).
            if (!container && currentStep.m_transform)
                transformState.applyTransform(*currentStep.m_transform.get());
        } else {
            TransformState::TransformAccumulation accumulate = currentStep.m_accumulatingTransform ? TransformState::AccumulateTransform : TransformState::FlattenTransform;
            if (currentStep.m_transform)
                transformState.applyTransform(*currentStep.m_transform.get(), accumulate);
            else
                transformState.move(currentStep.m_offset.width(), currentStep.m_offset.height(), accumulate);
        }

        if (inFixed && !currentStep.m_offsetForFixedPosition.isZero()) {
            ASSERT(currentStep.m_renderer->isRenderView());
            transformState.move(currentStep.m_offsetForFixedPosition);
        }
    }

    ASSERT(foundContainer);
    transformState.flatten();
}
示例#2
0
void RenderGeometryMap::pushMappingsToAncestor(const RenderObject* renderer, const RenderLayerModelObject* ancestorRenderer)
{
    // We need to push mappings in reverse order here, so do insertions rather than appends.
    TemporaryChange<size_t> positionChange(m_insertionPosition, m_mapping.size());
    do {
        renderer = renderer->pushMappingToContainer(ancestorRenderer, *this);
    } while (renderer && renderer != ancestorRenderer);

    ASSERT(m_mapping.isEmpty() || isTopmostRenderView(m_mapping[0].m_renderer));
}
示例#3
0
void RenderGeometryMap::mapToContainer(TransformState& transformState,
                                       const RenderBox* container) const {
  // If the mapping includes something like columns, we have to go via
  // renderers.
  if (hasNonUniformStep()) {
    m_mapping.last().m_renderer->mapLocalToContainer(
        container, transformState, ApplyContainerFlip | m_mapCoordinatesFlags);
    transformState.flatten();
    return;
  }

#if ENABLE(ASSERT)
  bool foundContainer =
      !container || (m_mapping.size() && m_mapping[0].m_renderer == container);
#endif

  for (int i = m_mapping.size() - 1; i >= 0; --i) {
    const RenderGeometryMapStep& currentStep = m_mapping[i];

    // If container is the root RenderView (step 0) we want to apply its fixed
    // position offset.
    if (i > 0 && currentStep.m_renderer == container) {
#if ENABLE(ASSERT)
      foundContainer = true;
#endif
      break;
    }

    ASSERT(!i == isTopmostRenderView(currentStep.m_renderer));

    if (!i) {
      // A null container indicates mapping through the root RenderView, so
      // including its transform (the page scale).
      if (!container && currentStep.m_transform)
        transformState.applyTransform(*currentStep.m_transform.get());
    } else {
      TransformState::TransformAccumulation accumulate =
          currentStep.m_accumulatingTransform
              ? TransformState::AccumulateTransform
              : TransformState::FlattenTransform;
      if (currentStep.m_transform)
        transformState.applyTransform(*currentStep.m_transform.get(),
                                      accumulate);
      else
        transformState.move(currentStep.m_offset.width(),
                            currentStep.m_offset.height(), accumulate);
    }
  }

  ASSERT(foundContainer);
  transformState.flatten();
}