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 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 std::pair<Element*, String> CanvasRenderingContext2D::getControlAndIDIfHitRegion Exists(const LayoutPoint& location) | |
| 1801 { | |
| 1802 Document& document = canvas()->document(); | |
| 1803 document.updateLayoutTreeForNodeIfNeeded(canvas()); | |
|
Justin Novosad
2016/02/05 15:22:53
Updating layout... Is this the right thing to do?
Rick Byers
2016/02/05 16:01:20
I agree we absolutely don't want to force any extr
zino
2016/02/12 15:26:19
Probably done.
Justin Novosad
2016/02/12 15:41:59
I think this is correct (layout "IfNeeded"). But I
| |
| 1804 | |
| 1805 LayoutBox* box = canvas()->layoutBox(); | |
| 1806 FloatPoint localPos = box->absoluteToLocal(FloatPoint(location), UseTransfor ms); | |
| 1807 if (box->hasBorderOrPadding()) | |
| 1808 localPos.move(-box->contentBoxOffset()); | |
| 1809 localPos.scale(canvas()->width() / box->contentWidth(), canvas()->height() / box->contentHeight()); | |
| 1810 | |
| 1811 HitRegion* hitRegion = hitRegionAtPoint(localPos); | |
| 1812 if (hitRegion) | |
| 1813 return std::make_pair(hitRegion->control(), hitRegion->id()); | |
| 1814 return std::make_pair(nullptr, String()); | |
| 1815 } | |
| 1816 | |
| 1799 String CanvasRenderingContext2D::textAlign() const | 1817 String CanvasRenderingContext2D::textAlign() const |
| 1800 { | 1818 { |
| 1801 return textAlignName(state().textAlign()); | 1819 return textAlignName(state().textAlign()); |
| 1802 } | 1820 } |
| 1803 | 1821 |
| 1804 void CanvasRenderingContext2D::setTextAlign(const String& s) | 1822 void CanvasRenderingContext2D::setTextAlign(const String& s) |
| 1805 { | 1823 { |
| 1806 TextAlign align; | 1824 TextAlign align; |
| 1807 if (!parseTextAlign(s, align)) | 1825 if (!parseTextAlign(s, align)) |
| 1808 return; | 1826 return; |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2326 if (imageType == CanvasRenderingContext2DState::NonOpaqueImage) | 2344 if (imageType == CanvasRenderingContext2DState::NonOpaqueImage) |
| 2327 return; | 2345 return; |
| 2328 if (alpha < 0xFF) | 2346 if (alpha < 0xFF) |
| 2329 return; | 2347 return; |
| 2330 } | 2348 } |
| 2331 | 2349 |
| 2332 canvas()->buffer()->willOverwriteCanvas(); | 2350 canvas()->buffer()->willOverwriteCanvas(); |
| 2333 } | 2351 } |
| 2334 | 2352 |
| 2335 } // namespace blink | 2353 } // namespace blink |
| OLD | NEW |