| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 int shadowRight = 0; | 71 int shadowRight = 0; |
| 72 int shadowTop = 0; | 72 int shadowTop = 0; |
| 73 int shadowBottom = 0; | 73 int shadowBottom = 0; |
| 74 calculateShadowExtent(this, additionalOutlineSize, shadowLeft, shadowRight,
shadowTop, shadowBottom); | 74 calculateShadowExtent(this, additionalOutlineSize, shadowLeft, shadowRight,
shadowTop, shadowBottom); |
| 75 | 75 |
| 76 rect.move(shadowLeft, shadowTop); | 76 rect.move(shadowLeft, shadowTop); |
| 77 rect.setWidth(rect.width() - shadowLeft + shadowRight); | 77 rect.setWidth(rect.width() - shadowLeft + shadowRight); |
| 78 rect.setHeight(rect.height() - shadowTop + shadowBottom); | 78 rect.setHeight(rect.height() - shadowTop + shadowBottom); |
| 79 } | 79 } |
| 80 | 80 |
| 81 PassRefPtr<ShadowList> ShadowList::blend(const ShadowList* from, const ShadowLis
t* to, double progress) |
| 82 { |
| 83 size_t fromLength = from ? from->shadows().size() : 0; |
| 84 size_t toLength = to ? to->shadows().size() : 0; |
| 85 if (!fromLength && !toLength) |
| 86 return 0; |
| 87 |
| 88 ShadowDataVector shadows; |
| 89 |
| 90 DEFINE_STATIC_LOCAL(ShadowData, defaultShadowData, (IntPoint(), 0, 0, Normal
, Color::transparent)); |
| 91 DEFINE_STATIC_LOCAL(ShadowData, defaultInsetShadowData, (IntPoint(), 0, 0, I
nset, Color::transparent)); |
| 92 |
| 93 size_t maxLength = std::max(fromLength, toLength); |
| 94 for (size_t i = 0; i < maxLength; ++i) { |
| 95 const ShadowData* fromShadow = i < fromLength ? &from->shadows()[i] : 0; |
| 96 const ShadowData* toShadow = i < toLength ? &to->shadows()[i] : 0; |
| 97 if (!fromShadow) |
| 98 fromShadow = toShadow->style() == Inset ? &defaultInsetShadowData :
&defaultShadowData; |
| 99 else if (!toShadow) |
| 100 toShadow = fromShadow->style() == Inset ? &defaultInsetShadowData :
&defaultShadowData; |
| 101 shadows.append(toShadow->blend(*fromShadow, progress)); |
| 102 } |
| 103 |
| 104 return ShadowList::adopt(shadows); |
| 105 } |
| 106 |
| 81 } // namespace WebCore | 107 } // namespace WebCore |
| OLD | NEW |