gfx/skia/trunk/src/animator/SkDisplayNumber.cpp

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     2 /*
     3  * Copyright 2006 The Android Open Source Project
     4  *
     5  * Use of this source code is governed by a BSD-style license that can be
     6  * found in the LICENSE file.
     7  */
    10 #include "SkDisplayNumber.h"
    12 enum SkDisplayNumber_Properties {
    13     SK_PROPERTY(MAX_VALUE),
    14     SK_PROPERTY(MIN_VALUE),
    15     SK_PROPERTY(NEGATIVE_INFINITY),
    16     SK_PROPERTY(NaN),
    17     SK_PROPERTY(POSITIVE_INFINITY)
    18 };
    20 #if SK_USE_CONDENSED_INFO == 0
    22 const SkMemberInfo SkDisplayNumber::fInfo[] = {
    23     SK_MEMBER_PROPERTY(MAX_VALUE, Float),
    24     SK_MEMBER_PROPERTY(MIN_VALUE, Float),
    25     SK_MEMBER_PROPERTY(NEGATIVE_INFINITY, Float),
    26     SK_MEMBER_PROPERTY(NaN, Float),
    27     SK_MEMBER_PROPERTY(POSITIVE_INFINITY, Float)
    28 };
    30 #endif
    32 DEFINE_GET_MEMBER(SkDisplayNumber);
    34 #if defined _WIN32
    35 #pragma warning ( push )
    36 // we are intentionally causing an overflow here
    37 //      (warning C4756: overflow in constant arithmetic)
    38 #pragma warning ( disable : 4756 )
    39 #endif
    41 bool SkDisplayNumber::getProperty(int index, SkScriptValue* value) const {
    42     SkScalar constant;
    43     switch (index) {
    44         case SK_PROPERTY(MAX_VALUE):
    45             constant = SK_ScalarMax;
    46         break;
    47         case SK_PROPERTY(MIN_VALUE):
    48             constant = SK_ScalarMin;
    49         break;
    50         case SK_PROPERTY(NEGATIVE_INFINITY):
    51             constant = -SK_ScalarInfinity;
    52         break;
    53         case SK_PROPERTY(NaN):
    54             constant = SK_ScalarNaN;
    55         break;
    56         case SK_PROPERTY(POSITIVE_INFINITY):
    57             constant = SK_ScalarInfinity;
    58         break;
    59         default:
    60             SkASSERT(0);
    61             return false;
    62     }
    63     value->fOperand.fScalar = constant;
    64     value->fType = SkType_Float;
    65     return true;
    66 }
    68 #if defined _WIN32
    69 #pragma warning ( pop )
    70 #endif

mercurial