void LayoutGeometryMap::mapToAncestor(TransformState& transformState, const LayoutBoxModelObject* ancestor) const { // If the mapping includes something like columns, we have to go via layoutObjects. if (hasNonUniformStep()) { m_mapping.last().m_layoutObject->mapLocalToAncestor(ancestor, transformState, ApplyContainerFlip | m_mapCoordinatesFlags); transformState.flatten(); return; } bool inFixed = false; #if ENABLE(ASSERT) bool foundAncestor = !ancestor || (m_mapping.size() && m_mapping[0].m_layoutObject == ancestor); #endif for (int i = m_mapping.size() - 1; i >= 0; --i) { const LayoutGeometryMapStep& currentStep = m_mapping[i]; // If container is the root LayoutView (step 0) we want to apply its fixed position offset. if (i > 0 && currentStep.m_layoutObject == ancestor) { #if ENABLE(ASSERT) foundAncestor = 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_flags & HasTransform && !(currentStep.m_flags & IsFixedPosition)) inFixed = false; else if (currentStep.m_flags & IsFixedPosition) inFixed = true; ASSERT(!i == isTopmostLayoutView(currentStep.m_layoutObject)); if (!i) { // A null container indicates mapping through the root LayoutView, so including its transform (the page scale). if (!ancestor && currentStep.m_transform) transformState.applyTransform(*currentStep.m_transform.get()); } else { TransformState::TransformAccumulation accumulate = currentStep.m_flags & 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_layoutObject->isLayoutView()); transformState.move(currentStep.m_offsetForFixedPosition); } } ASSERT(foundAncestor); transformState.flatten(); }
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 RenderView (step 0) we want to apply its scroll 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; if (!i) { // The root gets special treatment for fixed position if (inFixed) transformState.move(currentStep.m_offset.width(), currentStep.m_offset.height()); // A null container indicates mapping through the 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(); }
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(); }
void RenderGeometryMap::mapToAbsolute(TransformState& transformState) const { // If the mapping includes something like columns, we have to go via renderers. if (hasNonUniformStep()) { bool fixed = false; m_mapping.last()->m_renderer->mapLocalToContainer(0, fixed, true, transformState, RenderObject::ApplyContainerFlip); return; } bool inFixed = false; for (int i = m_mapping.size() - 1; i >= 0; --i) { const RenderGeometryMapStep* currStep = m_mapping[i].get(); // 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 (currStep->m_hasTransform && !currStep->m_isFixedPosition) inFixed = false; else if (currStep->m_isFixedPosition) inFixed = true; if (!i) { if (currStep->m_transform) transformState.applyTransform(*currStep->m_transform.get()); // The root gets special treatment for fixed position if (inFixed) transformState.move(currStep->m_offset.width(), currStep->m_offset.height()); } else { TransformState::TransformAccumulation accumulate = currStep->m_accumulatingTransform ? TransformState::AccumulateTransform : TransformState::FlattenTransform; if (currStep->m_transform) transformState.applyTransform(*currStep->m_transform.get(), accumulate); else transformState.move(currStep->m_offset.width(), currStep->m_offset.height(), accumulate); } } transformState.flatten(); }