15267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)/*
25267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * Copyright (C) 2012 Google Inc. All rights reserved.
35267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) *
45267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * Redistribution and use in source and binary forms, with or without
55267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * modification, are permitted provided that the following conditions
65267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * are met:
75267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * 1.  Redistributions of source code must retain the above copyright
85267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) *     notice, this list of conditions and the following disclaimer.
95267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * 2.  Redistributions in binary form must reproduce the above copyright
105267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) *     notice, this list of conditions and the following disclaimer in the
115267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) *     documentation and/or other materials provided with the distribution.
125267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) *
135267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
145267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
155267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
165267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE
175267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
185267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
195267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
205267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
215267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
225267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
235267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * SUCH DAMAGE.
245267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) */
255267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
265267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#ifndef WebDateTimeChooserParams_h
275267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#define WebDateTimeChooserParams_h
285267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
295267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#include "../platform/WebRect.h"
305267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#include "../platform/WebString.h"
315267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#include "../platform/WebVector.h"
325267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#include "WebDateTimeInputType.h"
33a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)#include "WebDateTimeSuggestion.h"
345267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3551b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)namespace blink {
365267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
375267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)// This class conveys various information to make date/time chooser UI.
385267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)// See WebViewClient::openDateTimeChooser.
395267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)struct WebDateTimeChooserParams {
405267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The type of chooser to show.
415267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    WebDateTimeInputType type;
425267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Bounding rectangle of the requester element.
435267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    WebRect anchorRectInScreen;
445267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The current value of the requester element.
4551b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    // FIXME: Remove. Deprecated in favor of doubleValue.
465267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    WebString currentValue;
4751b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    // The current value of the requester element as a double.
4851b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    // NaN means empty value. Should not be infinity.
4951b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    double doubleValue;
50a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    // <datalist> option suggestions associated to the requester element. The
51a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    // vector size might be 0.
52a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    WebVector<WebDateTimeSuggestion> suggestions;
535267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // HTMLInputElement::min attribute value parsed in the valusAsNumber rule,
545267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // that is to say, milliseconds from the epoch for non-month types and
555267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // months from the epoch for month type. If the min attribute is missing,
565267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // this field has the hard minimum limit.
575267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    double minimum;
585267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Similar to minimum.
595267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    double maximum;
605267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Step value represented in milliseconds for non-month types, and
615267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // represetnted in months for month type.
625267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    double step;
635267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Step-base value represeted in milliseconds, or months.
645267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    double stepBase;
655267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // True if the requester element has required attribute.
665267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    bool isRequired;
675267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // True if the requester element is rendered in rtl direction.
685267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    bool isAnchorElementRTL;
695267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
705267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    WebDateTimeChooserParams()
715267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        : minimum(0)
725267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        , maximum(0)
735267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        , step(0)
745267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        , stepBase(0)
755267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        , isRequired(false)
765267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        , isAnchorElementRTL(false)
775267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    {
785267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    }
795267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)};
805267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
8151b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)} // namespace blink
825267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
835267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#endif
84