| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2015 Google Inc. All rights reserved. | 3 * Copyright (C) 2015 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 } | 94 } |
| 95 | 95 |
| 96 return !offset_ || !offset_->IsFontRelativeLength(); | 96 return !offset_ || !offset_->IsFontRelativeLength(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 DEFINE_TRACE(CSSGradientColorStop) { | 99 DEFINE_TRACE(CSSGradientColorStop) { |
| 100 visitor->Trace(offset_); | 100 visitor->Trace(offset_); |
| 101 visitor->Trace(color_); | 101 visitor->Trace(color_); |
| 102 } | 102 } |
| 103 | 103 |
| 104 PassRefPtr<Image> CSSGradientValue::GetImage(const LayoutObject& layout_object, | 104 PassRefPtr<Image> CSSGradientValue::GetImage( |
| 105 const IntSize& size) { | 105 const ImageResourceObserver& client, |
| 106 const Document& document, |
| 107 const ComputedStyle& style, |
| 108 const IntSize& size) { |
| 106 if (size.IsEmpty()) | 109 if (size.IsEmpty()) |
| 107 return nullptr; | 110 return nullptr; |
| 108 | 111 |
| 109 if (is_cacheable_) { | 112 if (is_cacheable_) { |
| 110 if (!Clients().Contains(&layout_object)) | 113 if (!Clients().Contains(&client)) |
| 111 return nullptr; | 114 return nullptr; |
| 112 | 115 |
| 113 // Need to look up our size. Create a string of width*height to use as a | 116 // Need to look up our size. Create a string of width*height to use as a |
| 114 // hash key. | 117 // hash key. |
| 115 Image* result = | 118 Image* result = |
| 116 this->CSSImageGeneratorValue::GetImage(&layout_object, size); | 119 this->CSSImageGeneratorValue::GetImage(&client, document, style, size); |
| 117 if (result) | 120 if (result) |
| 118 return result; | 121 return result; |
| 119 } | 122 } |
| 120 | 123 |
| 121 // We need to create an image. | 124 // We need to create an image. |
| 122 RefPtr<Gradient> gradient; | 125 RefPtr<Gradient> gradient; |
| 123 | 126 |
| 124 const ComputedStyle* root_style = | 127 const ComputedStyle* root_style = |
| 125 layout_object.GetDocument().documentElement()->GetComputedStyle(); | 128 document.documentElement()->GetComputedStyle(); |
| 129 // TODO: Break dependency on LayoutObject. |
| 130 const LayoutObject& layout_object = static_cast<const LayoutObject&>(client); |
| 126 CSSToLengthConversionData conversion_data( | 131 CSSToLengthConversionData conversion_data( |
| 127 layout_object.Style(), root_style, LayoutViewItem(layout_object.View()), | 132 &style, root_style, LayoutViewItem(layout_object.View()), |
| 128 layout_object.Style()->EffectiveZoom()); | 133 style.EffectiveZoom()); |
| 129 | 134 |
| 130 switch (GetClassType()) { | 135 switch (GetClassType()) { |
| 131 case kLinearGradientClass: | 136 case kLinearGradientClass: |
| 132 gradient = ToCSSLinearGradientValue(this)->CreateGradient( | 137 gradient = ToCSSLinearGradientValue(this)->CreateGradient( |
| 133 conversion_data, size, layout_object); | 138 conversion_data, size, layout_object); |
| 134 break; | 139 break; |
| 135 case kRadialGradientClass: | 140 case kRadialGradientClass: |
| 136 gradient = ToCSSRadialGradientValue(this)->CreateGradient( | 141 gradient = ToCSSRadialGradientValue(this)->CreateGradient( |
| 137 conversion_data, size, layout_object); | 142 conversion_data, size, layout_object); |
| 138 break; | 143 break; |
| (...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1536 } | 1541 } |
| 1537 | 1542 |
| 1538 DEFINE_TRACE_AFTER_DISPATCH(CSSConicGradientValue) { | 1543 DEFINE_TRACE_AFTER_DISPATCH(CSSConicGradientValue) { |
| 1539 visitor->Trace(x_); | 1544 visitor->Trace(x_); |
| 1540 visitor->Trace(y_); | 1545 visitor->Trace(y_); |
| 1541 visitor->Trace(from_angle_); | 1546 visitor->Trace(from_angle_); |
| 1542 CSSGradientValue::TraceAfterDispatch(visitor); | 1547 CSSGradientValue::TraceAfterDispatch(visitor); |
| 1543 } | 1548 } |
| 1544 | 1549 |
| 1545 } // namespace blink | 1550 } // namespace blink |
| OLD | NEW |