Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Side by Side Diff: Source/core/html/canvas/CanvasRenderingContext2D.cpp

Issue 352793006: context.addHitRegion() is not working when using transform operation. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: state stack Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 , m_globalAlpha(1) 251 , m_globalAlpha(1)
252 , m_globalComposite(CompositeSourceOver) 252 , m_globalComposite(CompositeSourceOver)
253 , m_globalBlend(blink::WebBlendModeNormal) 253 , m_globalBlend(blink::WebBlendModeNormal)
254 , m_invertibleCTM(true) 254 , m_invertibleCTM(true)
255 , m_lineDashOffset(0) 255 , m_lineDashOffset(0)
256 , m_imageSmoothingEnabled(true) 256 , m_imageSmoothingEnabled(true)
257 , m_textAlign(StartTextAlign) 257 , m_textAlign(StartTextAlign)
258 , m_textBaseline(AlphabeticTextBaseline) 258 , m_textBaseline(AlphabeticTextBaseline)
259 , m_unparsedFont(defaultFont) 259 , m_unparsedFont(defaultFont)
260 , m_realizedFont(false) 260 , m_realizedFont(false)
261 , m_hasClip(false)
261 { 262 {
262 } 263 }
263 264
264 CanvasRenderingContext2D::State::State(const State& other) 265 CanvasRenderingContext2D::State::State(const State& other)
265 : CSSFontSelectorClient() 266 : CSSFontSelectorClient()
266 , m_unrealizedSaveCount(other.m_unrealizedSaveCount) 267 , m_unrealizedSaveCount(other.m_unrealizedSaveCount)
267 , m_unparsedStrokeColor(other.m_unparsedStrokeColor) 268 , m_unparsedStrokeColor(other.m_unparsedStrokeColor)
268 , m_unparsedFillColor(other.m_unparsedFillColor) 269 , m_unparsedFillColor(other.m_unparsedFillColor)
269 , m_strokeStyle(other.m_strokeStyle) 270 , m_strokeStyle(other.m_strokeStyle)
270 , m_fillStyle(other.m_fillStyle) 271 , m_fillStyle(other.m_fillStyle)
271 , m_lineWidth(other.m_lineWidth) 272 , m_lineWidth(other.m_lineWidth)
272 , m_lineCap(other.m_lineCap) 273 , m_lineCap(other.m_lineCap)
273 , m_lineJoin(other.m_lineJoin) 274 , m_lineJoin(other.m_lineJoin)
274 , m_miterLimit(other.m_miterLimit) 275 , m_miterLimit(other.m_miterLimit)
275 , m_shadowOffset(other.m_shadowOffset) 276 , m_shadowOffset(other.m_shadowOffset)
276 , m_shadowBlur(other.m_shadowBlur) 277 , m_shadowBlur(other.m_shadowBlur)
277 , m_shadowColor(other.m_shadowColor) 278 , m_shadowColor(other.m_shadowColor)
278 , m_globalAlpha(other.m_globalAlpha) 279 , m_globalAlpha(other.m_globalAlpha)
279 , m_globalComposite(other.m_globalComposite) 280 , m_globalComposite(other.m_globalComposite)
280 , m_globalBlend(other.m_globalBlend) 281 , m_globalBlend(other.m_globalBlend)
281 , m_transform(other.m_transform) 282 , m_transform(other.m_transform)
282 , m_invertibleCTM(other.m_invertibleCTM) 283 , m_invertibleCTM(other.m_invertibleCTM)
283 , m_lineDashOffset(other.m_lineDashOffset) 284 , m_lineDashOffset(other.m_lineDashOffset)
284 , m_imageSmoothingEnabled(other.m_imageSmoothingEnabled) 285 , m_imageSmoothingEnabled(other.m_imageSmoothingEnabled)
285 , m_textAlign(other.m_textAlign) 286 , m_textAlign(other.m_textAlign)
286 , m_textBaseline(other.m_textBaseline) 287 , m_textBaseline(other.m_textBaseline)
287 , m_unparsedFont(other.m_unparsedFont) 288 , m_unparsedFont(other.m_unparsedFont)
288 , m_font(other.m_font) 289 , m_font(other.m_font)
289 , m_realizedFont(other.m_realizedFont) 290 , m_realizedFont(other.m_realizedFont)
291 , m_hasClip(other.m_hasClip)
290 { 292 {
291 if (m_realizedFont) 293 if (m_realizedFont)
292 static_cast<CSSFontSelector*>(m_font.fontSelector())->registerForInvalid ationCallbacks(this); 294 static_cast<CSSFontSelector*>(m_font.fontSelector())->registerForInvalid ationCallbacks(this);
293 } 295 }
294 296
295 CanvasRenderingContext2D::State& CanvasRenderingContext2D::State::operator=(cons t State& other) 297 CanvasRenderingContext2D::State& CanvasRenderingContext2D::State::operator=(cons t State& other)
296 { 298 {
297 if (this == &other) 299 if (this == &other)
298 return *this; 300 return *this;
299 301
(...skipping 18 matching lines...) Expand all
318 m_globalComposite = other.m_globalComposite; 320 m_globalComposite = other.m_globalComposite;
319 m_globalBlend = other.m_globalBlend; 321 m_globalBlend = other.m_globalBlend;
320 m_transform = other.m_transform; 322 m_transform = other.m_transform;
321 m_invertibleCTM = other.m_invertibleCTM; 323 m_invertibleCTM = other.m_invertibleCTM;
322 m_imageSmoothingEnabled = other.m_imageSmoothingEnabled; 324 m_imageSmoothingEnabled = other.m_imageSmoothingEnabled;
323 m_textAlign = other.m_textAlign; 325 m_textAlign = other.m_textAlign;
324 m_textBaseline = other.m_textBaseline; 326 m_textBaseline = other.m_textBaseline;
325 m_unparsedFont = other.m_unparsedFont; 327 m_unparsedFont = other.m_unparsedFont;
326 m_font = other.m_font; 328 m_font = other.m_font;
327 m_realizedFont = other.m_realizedFont; 329 m_realizedFont = other.m_realizedFont;
330 m_hasClip = other.m_hasClip;
328 331
329 if (m_realizedFont) 332 if (m_realizedFont)
330 static_cast<CSSFontSelector*>(m_font.fontSelector())->registerForInvalid ationCallbacks(this); 333 static_cast<CSSFontSelector*>(m_font.fontSelector())->registerForInvalid ationCallbacks(this);
331 334
332 return *this; 335 return *this;
333 } 336 }
334 337
335 CanvasRenderingContext2D::State::~State() 338 CanvasRenderingContext2D::State::~State()
336 { 339 {
337 #if !ENABLE(OILPAN) 340 #if !ENABLE(OILPAN)
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 GraphicsContext* c = drawingContext(); 1092 GraphicsContext* c = drawingContext();
1090 if (!c) { 1093 if (!c) {
1091 return; 1094 return;
1092 } 1095 }
1093 if (!state().m_invertibleCTM) { 1096 if (!state().m_invertibleCTM) {
1094 return; 1097 return;
1095 } 1098 }
1096 1099
1097 realizeSaves(); 1100 realizeSaves();
1098 c->canvasClip(path, parseWinding(windingRuleString)); 1101 c->canvasClip(path, parseWinding(windingRuleString));
1102 modifiableState().m_hasClip = true;
1099 } 1103 }
1100 1104
1101 void CanvasRenderingContext2D::clip(const String& windingRuleString) 1105 void CanvasRenderingContext2D::clip(const String& windingRuleString)
1102 { 1106 {
1103 clipInternal(m_path, windingRuleString); 1107 clipInternal(m_path, windingRuleString);
1104 } 1108 }
1105 1109
1106 void CanvasRenderingContext2D::clip(Path2D* domPath, const String& windingRuleSt ring) 1110 void CanvasRenderingContext2D::clip(Path2D* domPath, const String& windingRuleSt ring)
1107 { 1111 {
1108 clipInternal(domPath->path(), windingRuleString); 1112 clipInternal(domPath->path(), windingRuleString);
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after
2378 2382
2379 if (m_path.isEmpty() || !context || !state().m_invertibleCTM 2383 if (m_path.isEmpty() || !context || !state().m_invertibleCTM
2380 || !context->getTransformedClipBounds(&clipBounds)) { 2384 || !context->getTransformedClipBounds(&clipBounds)) {
2381 exceptionState.throwDOMException(NotSupportedError, "The specified path has no pixels."); 2385 exceptionState.throwDOMException(NotSupportedError, "The specified path has no pixels.");
2382 return; 2386 return;
2383 } 2387 }
2384 2388
2385 Path specifiedPath = m_path; 2389 Path specifiedPath = m_path;
2386 specifiedPath.transform(state().m_transform); 2390 specifiedPath.transform(state().m_transform);
2387 2391
2388 if (context->isClipMode()) { 2392 if (hasClip()) {
2389 // FIXME: The hit regions should take clipping region into account. 2393 // FIXME: The hit regions should take clipping region into account.
2390 // However, we have no way to get the region from canvas state stack by now. 2394 // However, we have no way to get the region from canvas state stack by now.
2391 // See http://crbug.com/387057 2395 // See http://crbug.com/387057
2392 exceptionState.throwDOMException(NotSupportedError, "The specified path has no pixels."); 2396 exceptionState.throwDOMException(NotSupportedError, "The specified path has no pixels.");
2393 return; 2397 return;
2394 } 2398 }
2395 2399
2396 passOptions.path = specifiedPath; 2400 passOptions.path = specifiedPath;
2397 2401
2398 String fillRuleString; 2402 String fillRuleString;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2441 2445
2442 unsigned CanvasRenderingContext2D::hitRegionsCount() const 2446 unsigned CanvasRenderingContext2D::hitRegionsCount() const
2443 { 2447 {
2444 if (m_hitRegionManager) 2448 if (m_hitRegionManager)
2445 return m_hitRegionManager->getHitRegionsCount(); 2449 return m_hitRegionManager->getHitRegionsCount();
2446 2450
2447 return 0; 2451 return 0;
2448 } 2452 }
2449 2453
2450 } // namespace WebCore 2454 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/canvas/CanvasRenderingContext2D.h ('k') | Source/platform/graphics/GraphicsContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698