gfx/skia/trunk/src/animator/SkAnimateSet.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 "SkAnimateSet.h"
    11 #include "SkAnimateMaker.h"
    12 #include "SkAnimateProperties.h"
    13 #include "SkParse.h"
    15 #if SK_USE_CONDENSED_INFO == 0
    17 const SkMemberInfo SkSet::fInfo[] = {
    18     SK_MEMBER(begin, MSec),
    19     SK_MEMBER(dur, MSec),
    20     SK_MEMBER_PROPERTY(dynamic, Boolean),
    21     SK_MEMBER(field, String),
    22 //  SK_MEMBER(formula, DynamicString),
    23     SK_MEMBER(lval, DynamicString),
    24 //  SK_MEMBER_PROPERTY(reset, Boolean),
    25     SK_MEMBER_PROPERTY(step, Int),
    26     SK_MEMBER(target, DynamicString),
    27     SK_MEMBER(to, DynamicString)
    28 };
    30 #endif
    32 DEFINE_GET_MEMBER(SkSet);
    34 SkSet::SkSet() {
    35     dur = 1;
    36 }
    38 #ifdef SK_DUMP_ENABLED
    39 void SkSet::dump(SkAnimateMaker* maker) {
    40     INHERITED::dump(maker);
    41     if (dur != 1) {
    42         SkDebugf("dur=\"%g\" ", SkScalarToFloat(SkScalarDiv(dur,1000)));
    43     }
    44     //don't want double />\n's
    45     SkDebugf("/>\n");
    47 }
    48 #endif
    50 void SkSet::refresh(SkAnimateMaker& maker) {
    51     fFieldInfo->setValue(maker, &fValues, 0, fFieldInfo->fCount, NULL,
    52         fFieldInfo->getType(), to);
    53 }
    55 void SkSet::onEndElement(SkAnimateMaker& maker) {
    56     if (resolveCommon(maker) == false)
    57         return;
    58     if (fFieldInfo == NULL) {
    59         maker.setErrorCode(SkDisplayXMLParserError::kFieldNotInTarget);
    60         return;
    61     }
    62     fReset = dur != 1;
    63     SkDisplayTypes outType = fFieldInfo->getType();
    64     int comps = outType == SkType_String || outType == SkType_DynamicString ? 1 :
    65         fFieldInfo->getSize((const SkDisplayable*) fTarget) / sizeof(int);
    66     if (fValues.getType() == SkType_Unknown) {
    67         fValues.setType(outType);
    68         fValues.setCount(comps);
    69         if (outType == SkType_String || outType == SkType_DynamicString)
    70             fValues[0].fString = SkNEW(SkString);
    71         else
    72             memset(fValues.begin(), 0, fValues.count() * sizeof(fValues.begin()[0]));
    73     } else {
    74         SkASSERT(fValues.getType() == outType);
    75         if (fFieldInfo->fType == SkType_Array)
    76             comps = fValues.count();
    77         else {
    78             SkASSERT(fValues.count() == comps);
    79         }
    80     }
    81     if (formula.size() > 0) {
    82         comps = 1;
    83         outType = SkType_MSec;
    84     }
    85     fFieldInfo->setValue(maker, &fValues, fFieldOffset, comps, this, outType, formula.size() > 0 ? formula : to);
    86     fComponents = fValues.count();
    87 }

mercurial