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 28 matching lines...) Expand all Loading... |
39 #include "core/CSSPropertyNames.h" | 39 #include "core/CSSPropertyNames.h" |
40 #include "core/css/StylePropertySet.h" | 40 #include "core/css/StylePropertySet.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/events/MouseEvent.h" |
46 #include "core/frame/Settings.h" | 46 #include "core/frame/Settings.h" |
47 #include "core/html/TextMetrics.h" | 47 #include "core/html/TextMetrics.h" |
48 #include "core/html/canvas/CanvasFontCache.h" | 48 #include "core/html/canvas/CanvasFontCache.h" |
| 49 #include "core/layout/HitTestCanvasResult.h" |
49 #include "core/layout/LayoutBox.h" | 50 #include "core/layout/LayoutBox.h" |
50 #include "core/layout/LayoutTheme.h" | 51 #include "core/layout/LayoutTheme.h" |
51 #include "modules/canvas2d/CanvasStyle.h" | 52 #include "modules/canvas2d/CanvasStyle.h" |
52 #include "modules/canvas2d/HitRegion.h" | 53 #include "modules/canvas2d/HitRegion.h" |
53 #include "modules/canvas2d/Path2D.h" | 54 #include "modules/canvas2d/Path2D.h" |
54 #include "platform/fonts/FontCache.h" | 55 #include "platform/fonts/FontCache.h" |
55 #include "platform/graphics/DrawLooperBuilder.h" | 56 #include "platform/graphics/DrawLooperBuilder.h" |
56 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" | 57 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" |
57 #include "platform/graphics/ImageBuffer.h" | 58 #include "platform/graphics/ImageBuffer.h" |
58 #include "platform/graphics/StrokeData.h" | 59 #include "platform/graphics/StrokeData.h" |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 ImageBuffer* CanvasRenderingContext2D::imageBuffer() const | 583 ImageBuffer* CanvasRenderingContext2D::imageBuffer() const |
583 { | 584 { |
584 return canvas()->buffer(); | 585 return canvas()->buffer(); |
585 } | 586 } |
586 | 587 |
587 bool CanvasRenderingContext2D::parseColorOrCurrentColor(Color& color, const Stri
ng& colorString) const | 588 bool CanvasRenderingContext2D::parseColorOrCurrentColor(Color& color, const Stri
ng& colorString) const |
588 { | 589 { |
589 return ::blink::parseColorOrCurrentColor(color, colorString, canvas()); | 590 return ::blink::parseColorOrCurrentColor(color, colorString, canvas()); |
590 } | 591 } |
591 | 592 |
592 std::pair<Element*, String> CanvasRenderingContext2D::getControlAndIdIfHitRegion
Exists(const LayoutPoint& location) | 593 HitTestCanvasResult* CanvasRenderingContext2D::getControlAndIdIfHitRegionExists(
const LayoutPoint& location) |
593 { | 594 { |
594 if (hitRegionsCount() <= 0) | 595 if (hitRegionsCount() <= 0) |
595 return std::make_pair(nullptr, String()); | 596 return HitTestCanvasResult::create(String(), nullptr); |
596 | 597 |
597 LayoutBox* box = canvas()->layoutBox(); | 598 LayoutBox* box = canvas()->layoutBox(); |
598 FloatPoint localPos = box->absoluteToLocal(FloatPoint(location), UseTransfor
ms); | 599 FloatPoint localPos = box->absoluteToLocal(FloatPoint(location), UseTransfor
ms); |
599 if (box->hasBorderOrPadding()) | 600 if (box->hasBorderOrPadding()) |
600 localPos.move(-box->contentBoxOffset()); | 601 localPos.move(-box->contentBoxOffset()); |
601 localPos.scale(canvas()->width() / box->contentWidth(), canvas()->height() /
box->contentHeight()); | 602 localPos.scale(canvas()->width() / box->contentWidth(), canvas()->height() /
box->contentHeight()); |
602 | 603 |
603 HitRegion* hitRegion = hitRegionAtPoint(localPos); | 604 HitRegion* hitRegion = hitRegionAtPoint(localPos); |
604 if (hitRegion) { | 605 if (hitRegion) { |
605 Element* control = hitRegion->control(); | 606 Element* control = hitRegion->control(); |
606 if (control && canvas()->isSupportedInteractiveCanvasFallback(*control)) | 607 if (control && canvas()->isSupportedInteractiveCanvasFallback(*control)) |
607 return std::make_pair(hitRegion->control(), hitRegion->id()); | 608 return HitTestCanvasResult::create(hitRegion->id(), hitRegion->contr
ol()); |
608 return std::make_pair(nullptr, hitRegion->id()); | 609 return HitTestCanvasResult::create(hitRegion->id(), nullptr); |
609 } | 610 } |
610 return std::make_pair(nullptr, String()); | 611 return HitTestCanvasResult::create(String(), nullptr); |
611 } | 612 } |
612 | 613 |
613 String CanvasRenderingContext2D::getIdFromControl(const Element* element) | 614 String CanvasRenderingContext2D::getIdFromControl(const Element* element) |
614 { | 615 { |
615 if (hitRegionsCount() <= 0) | 616 if (hitRegionsCount() <= 0) |
616 return String(); | 617 return String(); |
617 | 618 |
618 if (HitRegion* hitRegion = m_hitRegionManager->getHitRegionByControl(element
)) | 619 if (HitRegion* hitRegion = m_hitRegionManager->getHitRegionByControl(element
)) |
619 return hitRegion->id(); | 620 return hitRegion->id(); |
620 return String(); | 621 return String(); |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 return true; | 1090 return true; |
1090 } | 1091 } |
1091 | 1092 |
1092 void CanvasRenderingContext2D::resetUsageTracking() | 1093 void CanvasRenderingContext2D::resetUsageTracking() |
1093 { | 1094 { |
1094 UsageCounters newCounters; | 1095 UsageCounters newCounters; |
1095 m_usageCounters = newCounters; | 1096 m_usageCounters = newCounters; |
1096 } | 1097 } |
1097 | 1098 |
1098 } // namespace blink | 1099 } // namespace blink |
OLD | NEW |