macro(TextZoomEnabled, textZoomEnabled, Bool, bool, false) \
macro(StyleScopedEnabled, styleScopedEnabled, Bool, bool, true) \
macro(LinkMagnifierEnabled, linkMagnifierEnabled, Bool, bool, false) \
+ macro(AutoFittingEnabled, autoFittingEnabled, Bool, bool, true) \
\
#else
macro(TextZoomEnabled, textZoomEnabled, Bool, bool, false) \
macro(StyleScopedEnabled, styleScopedEnabled, Bool, bool, true) \
macro(LinkMagnifierEnabled, linkMagnifierEnabled, Bool, bool, false) \
+ macro(AutoFittingEnabled, autoFittingEnabled, Bool, bool, true) \
\
#endif
, m_viewportFitsToContent(false)
#if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
, m_visibleContentRect(IntRect())
- , m_scaleFactor(1.0f)
+ , m_scaleFactor(0)
, m_hasSuspendedContent(false)
#endif
#if ENABLE(TIZEN_WEBKIT2_HISTORICAL_RESTORE_VISIBLE_CONTENT_RECT)
constraints.layoutSize = attributes.layoutSize;
constraints.contentsDefinedInitialScale = (ViewportArguments::ValueAuto != attributes.initialScale);
- double defaultViewLevel = m_viewImpl->page()->pageGroup()->preferences()->defaultViewLevel();
- // If defaultViewLevel is 1, "Default View" is set as "Readable"
- // if not, "Default View" is set as "Fit to width"
- if (defaultViewLevel) {
+ bool autoFittingEnabled = m_viewImpl->page()->pageGroup()->preferences()->autoFittingEnabled();
+ if (autoFittingEnabled)
+ constraints.initialScale = attributes.minimumScale * attributes.devicePixelRatio;
+ else {
// if content doesn't set initial scale value, set readable scale factor
// if not, set initial scale factor of viewport attribute
if (attributes.initialScale == ViewportArguments::ValueAuto)
constraints.initialScale = m_viewImpl->page()->deviceScaleFactor();
else
constraints.initialScale = attributes.initialScale * attributes.devicePixelRatio;
- } else {
- // Minimize initial scale factor
- constraints.initialScale = attributes.minimumScale * attributes.devicePixelRatio;
}
// adjust scale with both minimum and maximum scale factor
- constraints.initialScale = clampTo(constraints.initialScale, constraints.minimumScale, constraints.maximumScale);
+ constraints.initialScale = adjustScaleWithViewport(constraints.initialScale);
return constraints;
}
double scaleRatioBeforeRotation = m_scaleFactor / m_viewportConstraints.minimumScale;
m_viewportConstraints = computeViewportConstraints(attributes);
+ // Initially, m_scaleFactor is not decided yet.
+ // So, we should update visible content rect at here.
+ if (!m_scaleFactor) {
+ setVisibleContentRect(m_visibleContentRect, m_viewportConstraints.initialScale);
+ return;
+ }
+
// if content is reloaded, contents size will not be changed
// so, we need to calculate minimum scale here.
// if content size is changed later, minimum scale will be re-calculated on didChangeContentsSize()
{
EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
- if (enable)
- settings->preferences()->setDefaultViewLevel(0);
- else
- settings->preferences()->setDefaultViewLevel(1);
+ settings->preferences()->setAutoFittingEnabled(enable);
return true;
}
{
EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
- double level = settings->preferences()->defaultViewLevel();
- if (level == 0)
- return true;
- else
- return false;
+ return settings->preferences()->autoFittingEnabled();
}
Eina_Bool ewk_settings_font_default_size_set(Ewk_Settings* settings, int size)