Home | History | Annotate | Download | only in WebCoreSupport
      1 /*
      2  * Copyright 2009, The Android Open Source Project
      3  *
      4  * Redistribution and use in source and binary forms, with or without
      5  * modification, are permitted provided that the following conditions
      6  * are met:
      7  *  * Redistributions of source code must retain the above copyright
      8  *    notice, this list of conditions and the following disclaimer.
      9  *  * Redistributions in binary form must reproduce the above copyright
     10  *    notice, this list of conditions and the following disclaimer in the
     11  *    documentation and/or other materials provided with the distribution.
     12  *
     13  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
     14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
     21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     24  */
     25 
     26 #include "config.h"
     27 
     28 #include "CachedFramePlatformDataAndroid.h"
     29 #include "Settings.h"
     30 
     31 namespace android {
     32 
     33 CachedFramePlatformDataAndroid::CachedFramePlatformDataAndroid(WebCore::Settings* settings)
     34 {
     35 #ifdef ANDROID_META_SUPPORT
     36     m_viewport_width = settings->viewportWidth();
     37     m_viewport_height = settings->viewportHeight();
     38     m_viewport_initial_scale = settings->viewportInitialScale();
     39     m_viewport_minimum_scale = settings->viewportMinimumScale();
     40     m_viewport_maximum_scale = settings->viewportMaximumScale();
     41     m_viewport_target_densitydpi = settings->viewportTargetDensityDpi();
     42     m_viewport_user_scalable = settings->viewportUserScalable();
     43     m_format_detection_address = settings->formatDetectionAddress();
     44     m_format_detection_email = settings->formatDetectionEmail();
     45     m_format_detection_telephone = settings->formatDetectionTelephone();
     46 #endif
     47 
     48 }
     49 
     50 #ifdef ANDROID_META_SUPPORT
     51 void CachedFramePlatformDataAndroid::restoreMetadata(WebCore::Settings* settings)
     52 {
     53     settings->setViewportWidth(m_viewport_width);
     54     settings->setViewportHeight(m_viewport_height);
     55     settings->setViewportInitialScale(m_viewport_initial_scale);
     56     settings->setViewportMinimumScale(m_viewport_minimum_scale);
     57     settings->setViewportMaximumScale(m_viewport_maximum_scale);
     58     settings->setViewportTargetDensityDpi(m_viewport_target_densitydpi);
     59     settings->setViewportUserScalable(m_viewport_user_scalable);
     60     settings->setFormatDetectionAddress(m_format_detection_address);
     61     settings->setFormatDetectionEmail(m_format_detection_email);
     62     settings->setFormatDetectionTelephone(m_format_detection_telephone);
     63 }
     64 #endif
     65 
     66 }
     67