Exemple #1
0
bool ScreenOrientation::lockOrientation(Screen& screen, const AtomicString& orientationString)
{
    blink::WebScreenOrientations orientations = stringToOrientations(orientationString);
    if (!orientations)
        return false;
    ScreenOrientation::from(screen).lockOrientationAsync(orientations);
    return true;
}
bool ScreenOrientation::lockOrientation(Screen* screen, const AtomicString& orientationString, ExceptionState& es)
{
    blink::WebScreenOrientations orientations = stringToOrientations(orientationString);
    if (!orientations) {
        es.throwTypeError("parameter 1 ('" + orientationString + "') is not a valid enum value.");
        return false;
    }
    ScreenOrientation::from(screen)->lockOrientationAsync(orientations);
    return true;
}
Exemple #3
0
bool ScreenOrientation::lockOrientation(Screen& screen, const Vector<String>& orientationsVector)
{
    blink::WebScreenOrientations orientations = 0;
    for (size_t i = 0; i < orientationsVector.size(); ++i) {
        blink::WebScreenOrientations currentOrientation = stringToOrientations(AtomicString(orientationsVector[i]));
        if (!currentOrientation)
            return false;
        orientations |= currentOrientation;
    }
    if (!orientations)
        return false;
    ScreenOrientation::from(screen).lockOrientationAsync(orientations);
    return true;
}