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.

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

mercurial