<link rel="import" href="chrome://resources/html/polymer.html">

<link rel="import" href="chrome://resources/cr_elements/cr_link_row/cr_link_row.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
<link rel="import" href="fonts_browser_proxy.html">
<link rel="import" href="../controls/settings_slider.html">
<link rel="import" href="../controls/settings_dropdown_menu.html">
<link rel="import" href="../i18n_setup.html">
<link rel="import" href="../settings_shared_css.html">

<dom-module id="settings-appearance-fonts-page">
  <template>
    <style include="settings-shared">
      #minimumSize {
        align-items: flex-end;
        display: flex;
        flex-direction: column;
      }

      #minimumSizeSample {
        text-align: end;
      }
    </style>
    <div class="settings-box first">
      <div class="start settings-box-text">$i18n{fontSize}</div>
      <settings-slider id="sizeSlider"
          pref="{{prefs.webkit.webprefs.default_font_size}}"
          ticks="[[fontSizeRange_]]"
          label-min="$i18n{tiny}" label-max="$i18n{huge}">
      </settings-slider>
    </div>
    <div class="settings-box">
      <div class="start settings-box-text">$i18n{minimumFont}</div>
      <div id="minimumSize">
        <settings-slider  pref="{{prefs.webkit.webprefs.minimum_font_size}}"
            ticks="[[minimumFontSizeRange_]]" label-min="$i18n{tiny}"
            label-max="$i18n{huge}"></settings-slider>
        <div id="minimumSizeSample"
            style="
                font-size:[[computeMinimumFontSize_(
                    prefs.webkit.webprefs.minimum_font_size.value)]]px;
                font-family:
                    '[[prefs.webkit.webprefs.fonts.standard.Zyyy.value]]';"
            hidden>
          [[computeMinimumFontSize_(
                  prefs.webkit.webprefs.minimum_font_size.value)]]:
          $i18n{quickBrownFox}
        </div>
      </div>
    </div>
    <div class="settings-box">
      <h2>$i18n{standardFont}</h2>
    </div>
    <div class="list-frame">
      <div class="list-item">
        <settings-dropdown-menu class="start" label="$i18n{standardFont}"
            pref="{{prefs.webkit.webprefs.fonts.standard.Zyyy}}"
            menu-options="[[fontOptions_]]">
        </settings-dropdown-menu>
      </div>
      <div class="list-item settings-box-text"
          style="
              font-size:[[prefs.webkit.webprefs.default_font_size.value]]px;
              font-family:
                  '[[prefs.webkit.webprefs.fonts.standard.Zyyy.value]]';">
        <span>
          [[prefs.webkit.webprefs.default_font_size.value]]:
          $i18n{quickBrownFox}
        </span>
      </div>
    </div>
    <div class="settings-box">
      <h2>$i18n{serifFont}</h2>
    </div>
    <div class="list-frame">
      <div class="list-item">
        <settings-dropdown-menu class="start" label="$i18n{serifFont}"
            pref="{{prefs.webkit.webprefs.fonts.serif.Zyyy}}"
            menu-options="[[fontOptions_]]">
        </settings-dropdown-menu>
      </div>
      <div class="list-item settings-box-text"
          style="
              font-size:[[prefs.webkit.webprefs.default_font_size.value]]px;
              font-family:
                  '[[prefs.webkit.webprefs.fonts.serif.Zyyy.value]]';">
        <span>
          [[prefs.webkit.webprefs.default_font_size.value]]:
          $i18n{quickBrownFox}
        </span>
      </div>
    </div>
    <div class="settings-box">
      <h2>$i18n{sansSerifFont}</h2>
    </div>
    <div class="list-frame">
      <div class="list-item">
        <settings-dropdown-menu class="start" label="$i18n{sansSerifFont}"
            pref="{{prefs.webkit.webprefs.fonts.sansserif.Zyyy}}"
            menu-options="[[fontOptions_]]">
        </settings-dropdown-menu>
      </div>
      <div class="list-item settings-box-text"
          style="
              font-size:[[prefs.webkit.webprefs.default_font_size.value]]px;
              font-family:
                  '[[prefs.webkit.webprefs.fonts.sansserif.Zyyy.value]]';">
        <span>
          [[prefs.webkit.webprefs.default_font_size.value]]:
          $i18n{quickBrownFox}
        </span>
      </div>
    </div>
    <div class="settings-box">
      <h2>$i18n{fixedWidthFont}</h2>
    </div>
    <div class="list-frame">
      <div class="list-item">
        <settings-dropdown-menu class="start" label="$i18n{fixedWidthFont}"
            pref="{{prefs.webkit.webprefs.fonts.fixed.Zyyy}}"
            menu-options="[[fontOptions_]]">
        </settings-dropdown-menu>
      </div>
      <div class="list-item settings-box-text"
          style="
              font-size:
                  [[prefs.webkit.webprefs.default_fixed_font_size.value]]px;
              font-family:
                  '[[prefs.webkit.webprefs.fonts.fixed.Zyyy.value]]';">
        [[prefs.webkit.webprefs.default_font_size.value]]:
        $i18n{quickBrownFox}
      </div>
    </div>
    <template is="dom-if" if="[[!isGuest_]]">
      <cr-link-row id="advancedButton" class="hr"
          on-click="openAdvancedExtension_" label="$i18n{advancedFontSettings}"
          sub-label="[[advancedExtensionSublabel_]]" external></cr-link-row>
    </template>
  </template>
  <script src="appearance_fonts_page.js"></script>
</dom-module>
