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 24 matching lines...) Expand all Loading... | |
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 1734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1789 } | 1790 } |
1790 } | 1791 } |
1791 | 1792 |
1792 void CanvasRenderingContext2D::styleDidChange(const ComputedStyle* oldStyle, con st ComputedStyle& newStyle) | 1793 void CanvasRenderingContext2D::styleDidChange(const ComputedStyle* oldStyle, con st ComputedStyle& newStyle) |
1793 { | 1794 { |
1794 if (oldStyle && oldStyle->font() == newStyle.font()) | 1795 if (oldStyle && oldStyle->font() == newStyle.font()) |
1795 return; | 1796 return; |
1796 pruneLocalFontCache(0); | 1797 pruneLocalFontCache(0); |
1797 } | 1798 } |
1798 | 1799 |
1800 Node* CanvasRenderingContext2D::getControlAndUpdateEvent(Event& event) | |
1801 { | |
1802 if (!event.isMouseEvent()) | |
1803 return nullptr; | |
1804 | |
1805 MouseEvent& e = toMouseEvent(event); | |
philipj_slow
2016/02/01 04:05:20
https://www.chromium.org/blink/coding-style#TOC-Na
zino
2016/02/05 06:59:48
Done.
| |
1806 | |
1807 Document& document = canvas()->document(); | |
1808 document.updateLayoutTreeForNodeIfNeeded(canvas()); | |
Justin Novosad
2016/02/01 16:51:43
Don't forget write a test that requires this updat
| |
1809 | |
1810 LayoutBox* box = canvas()->layoutBox(); | |
1811 FloatPoint localPos = box->absoluteToLocal(FloatPoint(e.absoluteLocation()), UseTransforms); | |
1812 if (box->hasBorderOrPadding()) | |
1813 localPos.move(-box->contentBoxOffset()); | |
1814 localPos.scale(canvas()->width() / box->contentWidth(), canvas()->height() / box->contentHeight()); | |
Justin Novosad
2016/02/01 16:51:42
don't forget test cases that cover CSS zooming and
| |
1815 | |
1816 HitRegion* hitRegion = hitRegionAtPoint(localPos); | |
1817 if (hitRegion) { | |
1818 e.setRegion(hitRegion->id()); | |
1819 if (hitRegion->control()) { | |
1820 e.preventDefault(); | |
1821 e.setCancelBubble(true); | |
1822 return hitRegion->control(); | |
1823 } | |
1824 } | |
1825 return nullptr; | |
1826 } | |
1827 | |
1799 String CanvasRenderingContext2D::textAlign() const | 1828 String CanvasRenderingContext2D::textAlign() const |
1800 { | 1829 { |
1801 return textAlignName(state().textAlign()); | 1830 return textAlignName(state().textAlign()); |
1802 } | 1831 } |
1803 | 1832 |
1804 void CanvasRenderingContext2D::setTextAlign(const String& s) | 1833 void CanvasRenderingContext2D::setTextAlign(const String& s) |
1805 { | 1834 { |
1806 TextAlign align; | 1835 TextAlign align; |
1807 if (!parseTextAlign(s, align)) | 1836 if (!parseTextAlign(s, align)) |
1808 return; | 1837 return; |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2328 if (imageType == CanvasRenderingContext2DState::NonOpaqueImage) | 2357 if (imageType == CanvasRenderingContext2DState::NonOpaqueImage) |
2329 return; | 2358 return; |
2330 if (alpha < 0xFF) | 2359 if (alpha < 0xFF) |
2331 return; | 2360 return; |
2332 } | 2361 } |
2333 | 2362 |
2334 canvas()->buffer()->willOverwriteCanvas(); | 2363 canvas()->buffer()->willOverwriteCanvas(); |
2335 } | 2364 } |
2336 | 2365 |
2337 } // namespace blink | 2366 } // namespace blink |
OLD | NEW |