Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
| 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
| 6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> | 6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> |
| 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
| 8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. | 8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. |
| 9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
| 10 * | 10 * |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 , m_lineDashOffset(0) | 145 , m_lineDashOffset(0) |
| 146 , m_imageSmoothingEnabled(true) | 146 , m_imageSmoothingEnabled(true) |
| 147 , m_textAlign(StartTextAlign) | 147 , m_textAlign(StartTextAlign) |
| 148 , m_textBaseline(AlphabeticTextBaseline) | 148 , m_textBaseline(AlphabeticTextBaseline) |
| 149 , m_unparsedFont(defaultFont) | 149 , m_unparsedFont(defaultFont) |
| 150 , m_realizedFont(false) | 150 , m_realizedFont(false) |
| 151 { | 151 { |
| 152 } | 152 } |
| 153 | 153 |
| 154 CanvasRenderingContext2D::State::State(const State& other) | 154 CanvasRenderingContext2D::State::State(const State& other) |
| 155 : FontSelectorClient() | 155 : CSSFontSelectorClient() |
| 156 , m_unparsedStrokeColor(other.m_unparsedStrokeColor) | 156 , m_unparsedStrokeColor(other.m_unparsedStrokeColor) |
| 157 , m_unparsedFillColor(other.m_unparsedFillColor) | 157 , m_unparsedFillColor(other.m_unparsedFillColor) |
| 158 , m_strokeStyle(other.m_strokeStyle) | 158 , m_strokeStyle(other.m_strokeStyle) |
| 159 , m_fillStyle(other.m_fillStyle) | 159 , m_fillStyle(other.m_fillStyle) |
| 160 , m_lineWidth(other.m_lineWidth) | 160 , m_lineWidth(other.m_lineWidth) |
| 161 , m_lineCap(other.m_lineCap) | 161 , m_lineCap(other.m_lineCap) |
| 162 , m_lineJoin(other.m_lineJoin) | 162 , m_lineJoin(other.m_lineJoin) |
| 163 , m_miterLimit(other.m_miterLimit) | 163 , m_miterLimit(other.m_miterLimit) |
| 164 , m_shadowOffset(other.m_shadowOffset) | 164 , m_shadowOffset(other.m_shadowOffset) |
| 165 , m_shadowBlur(other.m_shadowBlur) | 165 , m_shadowBlur(other.m_shadowBlur) |
| 166 , m_shadowColor(other.m_shadowColor) | 166 , m_shadowColor(other.m_shadowColor) |
| 167 , m_globalAlpha(other.m_globalAlpha) | 167 , m_globalAlpha(other.m_globalAlpha) |
| 168 , m_globalComposite(other.m_globalComposite) | 168 , m_globalComposite(other.m_globalComposite) |
| 169 , m_globalBlend(other.m_globalBlend) | 169 , m_globalBlend(other.m_globalBlend) |
| 170 , m_transform(other.m_transform) | 170 , m_transform(other.m_transform) |
| 171 , m_invertibleCTM(other.m_invertibleCTM) | 171 , m_invertibleCTM(other.m_invertibleCTM) |
| 172 , m_lineDashOffset(other.m_lineDashOffset) | 172 , m_lineDashOffset(other.m_lineDashOffset) |
| 173 , m_imageSmoothingEnabled(other.m_imageSmoothingEnabled) | 173 , m_imageSmoothingEnabled(other.m_imageSmoothingEnabled) |
| 174 , m_textAlign(other.m_textAlign) | 174 , m_textAlign(other.m_textAlign) |
| 175 , m_textBaseline(other.m_textBaseline) | 175 , m_textBaseline(other.m_textBaseline) |
| 176 , m_unparsedFont(other.m_unparsedFont) | 176 , m_unparsedFont(other.m_unparsedFont) |
| 177 , m_font(other.m_font) | 177 , m_font(other.m_font) |
| 178 , m_realizedFont(other.m_realizedFont) | 178 , m_realizedFont(other.m_realizedFont) |
| 179 { | 179 { |
| 180 if (m_realizedFont) | 180 if (m_realizedFont) |
| 181 m_font.fontSelector()->registerForInvalidationCallbacks(this); | 181 static_cast<CSSFontSelector*>(m_font.fontSelector())->registerForInvalid ationCallbacks(this); |
|
eae
2014/01/17 23:13:26
I'm not thrilled about all these casts, I assume t
| |
| 182 } | 182 } |
| 183 | 183 |
| 184 CanvasRenderingContext2D::State& CanvasRenderingContext2D::State::operator=(cons t State& other) | 184 CanvasRenderingContext2D::State& CanvasRenderingContext2D::State::operator=(cons t State& other) |
| 185 { | 185 { |
| 186 if (this == &other) | 186 if (this == &other) |
| 187 return *this; | 187 return *this; |
| 188 | 188 |
| 189 if (m_realizedFont) | 189 if (m_realizedFont) |
| 190 m_font.fontSelector()->unregisterForInvalidationCallbacks(this); | 190 static_cast<CSSFontSelector*>(m_font.fontSelector())->unregisterForInval idationCallbacks(this); |
| 191 | 191 |
| 192 m_unparsedStrokeColor = other.m_unparsedStrokeColor; | 192 m_unparsedStrokeColor = other.m_unparsedStrokeColor; |
| 193 m_unparsedFillColor = other.m_unparsedFillColor; | 193 m_unparsedFillColor = other.m_unparsedFillColor; |
| 194 m_strokeStyle = other.m_strokeStyle; | 194 m_strokeStyle = other.m_strokeStyle; |
| 195 m_fillStyle = other.m_fillStyle; | 195 m_fillStyle = other.m_fillStyle; |
| 196 m_lineWidth = other.m_lineWidth; | 196 m_lineWidth = other.m_lineWidth; |
| 197 m_lineCap = other.m_lineCap; | 197 m_lineCap = other.m_lineCap; |
| 198 m_lineJoin = other.m_lineJoin; | 198 m_lineJoin = other.m_lineJoin; |
| 199 m_miterLimit = other.m_miterLimit; | 199 m_miterLimit = other.m_miterLimit; |
| 200 m_shadowOffset = other.m_shadowOffset; | 200 m_shadowOffset = other.m_shadowOffset; |
| 201 m_shadowBlur = other.m_shadowBlur; | 201 m_shadowBlur = other.m_shadowBlur; |
| 202 m_shadowColor = other.m_shadowColor; | 202 m_shadowColor = other.m_shadowColor; |
| 203 m_globalAlpha = other.m_globalAlpha; | 203 m_globalAlpha = other.m_globalAlpha; |
| 204 m_globalComposite = other.m_globalComposite; | 204 m_globalComposite = other.m_globalComposite; |
| 205 m_globalBlend = other.m_globalBlend; | 205 m_globalBlend = other.m_globalBlend; |
| 206 m_transform = other.m_transform; | 206 m_transform = other.m_transform; |
| 207 m_invertibleCTM = other.m_invertibleCTM; | 207 m_invertibleCTM = other.m_invertibleCTM; |
| 208 m_imageSmoothingEnabled = other.m_imageSmoothingEnabled; | 208 m_imageSmoothingEnabled = other.m_imageSmoothingEnabled; |
| 209 m_textAlign = other.m_textAlign; | 209 m_textAlign = other.m_textAlign; |
| 210 m_textBaseline = other.m_textBaseline; | 210 m_textBaseline = other.m_textBaseline; |
| 211 m_unparsedFont = other.m_unparsedFont; | 211 m_unparsedFont = other.m_unparsedFont; |
| 212 m_font = other.m_font; | 212 m_font = other.m_font; |
| 213 m_realizedFont = other.m_realizedFont; | 213 m_realizedFont = other.m_realizedFont; |
| 214 | 214 |
| 215 if (m_realizedFont) | 215 if (m_realizedFont) |
| 216 m_font.fontSelector()->registerForInvalidationCallbacks(this); | 216 static_cast<CSSFontSelector*>(m_font.fontSelector())->registerForInvalid ationCallbacks(this); |
| 217 | 217 |
| 218 return *this; | 218 return *this; |
| 219 } | 219 } |
| 220 | 220 |
| 221 CanvasRenderingContext2D::State::~State() | 221 CanvasRenderingContext2D::State::~State() |
| 222 { | 222 { |
| 223 if (m_realizedFont) | 223 if (m_realizedFont) |
| 224 m_font.fontSelector()->unregisterForInvalidationCallbacks(this); | 224 static_cast<CSSFontSelector*>(m_font.fontSelector())->unregisterForInval idationCallbacks(this); |
| 225 } | 225 } |
| 226 | 226 |
| 227 void CanvasRenderingContext2D::State::fontsNeedUpdate(FontSelector* fontSelector ) | 227 void CanvasRenderingContext2D::State::fontsNeedUpdate(CSSFontSelector* fontSelec tor) |
| 228 { | 228 { |
| 229 ASSERT_ARG(fontSelector, fontSelector == m_font.fontSelector()); | 229 ASSERT_ARG(fontSelector, fontSelector == m_font.fontSelector()); |
| 230 ASSERT(m_realizedFont); | 230 ASSERT(m_realizedFont); |
| 231 | 231 |
| 232 m_font.update(fontSelector); | 232 m_font.update(fontSelector); |
| 233 } | 233 } |
| 234 | 234 |
| 235 void CanvasRenderingContext2D::realizeSavesLoop() | 235 void CanvasRenderingContext2D::realizeSavesLoop() |
| 236 { | 236 { |
| 237 ASSERT(m_unrealizedSaveCount); | 237 ASSERT(m_unrealizedSaveCount); |
| (...skipping 1851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2089 CSSPropertyValue(CSSPropertyFontVariant, *parsedStyle), | 2089 CSSPropertyValue(CSSPropertyFontVariant, *parsedStyle), |
| 2090 CSSPropertyValue(CSSPropertyFontWeight, *parsedStyle), | 2090 CSSPropertyValue(CSSPropertyFontWeight, *parsedStyle), |
| 2091 CSSPropertyValue(CSSPropertyFontSize, *parsedStyle), | 2091 CSSPropertyValue(CSSPropertyFontSize, *parsedStyle), |
| 2092 CSSPropertyValue(CSSPropertyLineHeight, *parsedStyle), | 2092 CSSPropertyValue(CSSPropertyLineHeight, *parsedStyle), |
| 2093 }; | 2093 }; |
| 2094 | 2094 |
| 2095 StyleResolver& styleResolver = canvas()->document().ensureStyleResolver(); | 2095 StyleResolver& styleResolver = canvas()->document().ensureStyleResolver(); |
| 2096 styleResolver.applyPropertiesToStyle(properties, WTF_ARRAY_LENGTH(properties ), newStyle.get()); | 2096 styleResolver.applyPropertiesToStyle(properties, WTF_ARRAY_LENGTH(properties ), newStyle.get()); |
| 2097 | 2097 |
| 2098 if (state().m_realizedFont) | 2098 if (state().m_realizedFont) |
| 2099 state().m_font.fontSelector()->unregisterForInvalidationCallbacks(&modif iableState()); | 2099 static_cast<CSSFontSelector*>(state().m_font.fontSelector())->unregister ForInvalidationCallbacks(&modifiableState()); |
| 2100 modifiableState().m_font = newStyle->font(); | 2100 modifiableState().m_font = newStyle->font(); |
| 2101 modifiableState().m_font.update(canvas()->document().styleEngine()->fontSele ctor()); | 2101 modifiableState().m_font.update(canvas()->document().styleEngine()->fontSele ctor()); |
| 2102 modifiableState().m_realizedFont = true; | 2102 modifiableState().m_realizedFont = true; |
| 2103 canvas()->document().styleEngine()->fontSelector()->registerForInvalidationC allbacks(&modifiableState()); | 2103 canvas()->document().styleEngine()->fontSelector()->registerForInvalidationC allbacks(&modifiableState()); |
| 2104 } | 2104 } |
| 2105 | 2105 |
| 2106 String CanvasRenderingContext2D::textAlign() const | 2106 String CanvasRenderingContext2D::textAlign() const |
| 2107 { | 2107 { |
| 2108 return textAlignName(state().m_textAlign); | 2108 return textAlignName(state().m_textAlign); |
| 2109 } | 2109 } |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2427 const int focusRingWidth = 5; | 2427 const int focusRingWidth = 5; |
| 2428 const int focusRingOutline = 0; | 2428 const int focusRingOutline = 0; |
| 2429 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor); | 2429 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor); |
| 2430 | 2430 |
| 2431 c->restore(); | 2431 c->restore(); |
| 2432 | 2432 |
| 2433 didDraw(dirtyRect); | 2433 didDraw(dirtyRect); |
| 2434 } | 2434 } |
| 2435 | 2435 |
| 2436 } // namespace WebCore | 2436 } // namespace WebCore |
| OLD | NEW |