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

Side by Side Diff: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp

Issue 1654653002: Canvas2d: Implement rerouting event by hit region's control. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 24 matching lines...) Expand all
35 #include "bindings/core/v8/ExceptionMessages.h" 35 #include "bindings/core/v8/ExceptionMessages.h"
36 #include "bindings/core/v8/ExceptionState.h" 36 #include "bindings/core/v8/ExceptionState.h"
37 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 37 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
38 #include "core/CSSPropertyNames.h" 38 #include "core/CSSPropertyNames.h"
39 #include "core/css/StylePropertySet.h" 39 #include "core/css/StylePropertySet.h"
40 #include "core/css/parser/CSSParser.h" 40 #include "core/css/parser/CSSParser.h"
41 #include "core/css/resolver/StyleResolver.h" 41 #include "core/css/resolver/StyleResolver.h"
42 #include "core/dom/AXObjectCache.h" 42 #include "core/dom/AXObjectCache.h"
43 #include "core/dom/StyleEngine.h" 43 #include "core/dom/StyleEngine.h"
44 #include "core/events/Event.h" 44 #include "core/events/Event.h"
45 #include "core/events/MouseEvent.h"
45 #include "core/frame/ImageBitmap.h" 46 #include "core/frame/ImageBitmap.h"
46 #include "core/frame/Settings.h" 47 #include "core/frame/Settings.h"
47 #include "core/html/HTMLVideoElement.h" 48 #include "core/html/HTMLVideoElement.h"
48 #include "core/html/ImageData.h" 49 #include "core/html/ImageData.h"
49 #include "core/html/TextMetrics.h" 50 #include "core/html/TextMetrics.h"
50 #include "core/html/canvas/CanvasFontCache.h" 51 #include "core/html/canvas/CanvasFontCache.h"
51 #include "core/layout/LayoutBox.h" 52 #include "core/layout/LayoutBox.h"
52 #include "core/layout/LayoutTheme.h" 53 #include "core/layout/LayoutTheme.h"
53 #include "modules/canvas2d/CanvasGradient.h" 54 #include "modules/canvas2d/CanvasGradient.h"
54 #include "modules/canvas2d/CanvasPattern.h" 55 #include "modules/canvas2d/CanvasPattern.h"
(...skipping 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after
1811 if (oldStyle && oldStyle->font() == newStyle.font()) 1812 if (oldStyle && oldStyle->font() == newStyle.font())
1812 return; 1813 return;
1813 pruneLocalFontCache(0); 1814 pruneLocalFontCache(0);
1814 } 1815 }
1815 1816
1816 void CanvasRenderingContext2D::filterNeedsInvalidation() 1817 void CanvasRenderingContext2D::filterNeedsInvalidation()
1817 { 1818 {
1818 state().clearResolvedFilter(); 1819 state().clearResolvedFilter();
1819 } 1820 }
1820 1821
1822 std::pair<Element*, String> CanvasRenderingContext2D::getControlAndIdIfHitRegion Exists(const LayoutPoint& location)
1823 {
1824 LayoutBox* box = canvas()->layoutBox();
1825 FloatPoint localPos = box->absoluteToLocal(FloatPoint(location), UseTransfor ms);
1826 if (box->hasBorderOrPadding())
1827 localPos.move(-box->contentBoxOffset());
1828 localPos.scale(canvas()->width() / box->contentWidth(), canvas()->height() / box->contentHeight());
1829
1830 HitRegion* hitRegion = hitRegionAtPoint(localPos);
1831 if (hitRegion)
1832 return std::make_pair(hitRegion->control(), hitRegion->id());
1833 return std::make_pair(nullptr, String());
1834 }
1835
1821 String CanvasRenderingContext2D::textAlign() const 1836 String CanvasRenderingContext2D::textAlign() const
1822 { 1837 {
1823 return textAlignName(state().textAlign()); 1838 return textAlignName(state().textAlign());
1824 } 1839 }
1825 1840
1826 void CanvasRenderingContext2D::setTextAlign(const String& s) 1841 void CanvasRenderingContext2D::setTextAlign(const String& s)
1827 { 1842 {
1828 TextAlign align; 1843 TextAlign align;
1829 if (!parseTextAlign(s, align)) 1844 if (!parseTextAlign(s, align))
1830 return; 1845 return;
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
2360 if (imageType == CanvasRenderingContext2DState::NonOpaqueImage) 2375 if (imageType == CanvasRenderingContext2DState::NonOpaqueImage)
2361 return; 2376 return;
2362 if (alpha < 0xFF) 2377 if (alpha < 0xFF)
2363 return; 2378 return;
2364 } 2379 }
2365 2380
2366 canvas()->buffer()->willOverwriteCanvas(); 2381 canvas()->buffer()->willOverwriteCanvas();
2367 } 2382 }
2368 2383
2369 } // namespace blink 2384 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698