| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 Color color; | 97 Color color; |
| 98 float offset; | 98 float offset; |
| 99 bool specified; | 99 bool specified; |
| 100 | 100 |
| 101 GradientStop() | 101 GradientStop() |
| 102 : offset(0) | 102 : offset(0) |
| 103 , specified(false) | 103 , specified(false) |
| 104 { } | 104 { } |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 static void replaceColorHintsWithColorStops(Vector<GradientStop>& stops, const W
illBeHeapVector<CSSGradientColorStop, 2>& cssGradientStops) | 107 static void replaceColorHintsWithColorStops(Vector<GradientStop>& stops, const H
eapVector<CSSGradientColorStop, 2>& cssGradientStops) |
| 108 { | 108 { |
| 109 // This algorithm will replace each color interpolation hint with 9 regular | 109 // This algorithm will replace each color interpolation hint with 9 regular |
| 110 // color stops. The color values for the new color stops will be calculated | 110 // color stops. The color values for the new color stops will be calculated |
| 111 // using the color weighting formula defined in the spec. The new color | 111 // using the color weighting formula defined in the spec. The new color |
| 112 // stops will be positioned in such a way that all the pixels between the tw
o | 112 // stops will be positioned in such a way that all the pixels between the tw
o |
| 113 // user defined color stops have color values close to the interpolation cur
ve. | 113 // user defined color stops have color values close to the interpolation cur
ve. |
| 114 // If the hint is closer to the left color stop, add 2 stops to the left and | 114 // If the hint is closer to the left color stop, add 2 stops to the left and |
| 115 // 6 to the right, else add 6 stops to the left and 2 to the right. | 115 // 6 to the right, else add 6 stops to the left and 2 to the right. |
| 116 // The color stops on the side with more space start midway because | 116 // The color stops on the side with more space start midway because |
| 117 // the curve approximates a line in that region. | 117 // the curve approximates a line in that region. |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 bool CSSGradientValue::knownToBeOpaque(const LayoutObject* object) const | 565 bool CSSGradientValue::knownToBeOpaque(const LayoutObject* object) const |
| 566 { | 566 { |
| 567 ASSERT(object); | 567 ASSERT(object); |
| 568 for (auto& stop : m_stops) { | 568 for (auto& stop : m_stops) { |
| 569 if (!stop.isHint() && resolveStopColor(*stop.m_color, *object).hasAlpha(
)) | 569 if (!stop.isHint() && resolveStopColor(*stop.m_color, *object).hasAlpha(
)) |
| 570 return false; | 570 return false; |
| 571 } | 571 } |
| 572 return true; | 572 return true; |
| 573 } | 573 } |
| 574 | 574 |
| 575 void CSSGradientValue::getStopColors(WillBeHeapVector<Color>& stopColors, const
LayoutObject* object) const | 575 void CSSGradientValue::getStopColors(HeapVector<Color>& stopColors, const Layout
Object* object) const |
| 576 { | 576 { |
| 577 ASSERT(object); | 577 ASSERT(object); |
| 578 for (auto& stop : m_stops) { | 578 for (auto& stop : m_stops) { |
| 579 if (!stop.isHint()) | 579 if (!stop.isHint()) |
| 580 stopColors.append(resolveStopColor(*stop.m_color, *object)); | 580 stopColors.append(resolveStopColor(*stop.m_color, *object)); |
| 581 } | 581 } |
| 582 | 582 |
| 583 } | 583 } |
| 584 | 584 |
| 585 DEFINE_TRACE_AFTER_DISPATCH(CSSGradientValue) | 585 DEFINE_TRACE_AFTER_DISPATCH(CSSGradientValue) |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1218 visitor->trace(m_firstRadius); | 1218 visitor->trace(m_firstRadius); |
| 1219 visitor->trace(m_secondRadius); | 1219 visitor->trace(m_secondRadius); |
| 1220 visitor->trace(m_shape); | 1220 visitor->trace(m_shape); |
| 1221 visitor->trace(m_sizingBehavior); | 1221 visitor->trace(m_sizingBehavior); |
| 1222 visitor->trace(m_endHorizontalSize); | 1222 visitor->trace(m_endHorizontalSize); |
| 1223 visitor->trace(m_endVerticalSize); | 1223 visitor->trace(m_endVerticalSize); |
| 1224 CSSGradientValue::traceAfterDispatch(visitor); | 1224 CSSGradientValue::traceAfterDispatch(visitor); |
| 1225 } | 1225 } |
| 1226 | 1226 |
| 1227 } // namespace blink | 1227 } // namespace blink |
| OLD | NEW |