| 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 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 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/resolver/StyleResolver.h" | 40 #include "core/css/resolver/StyleResolver.h" |
| 41 #include "core/dom/AXObjectCache.h" | 41 #include "core/dom/AXObjectCache.h" |
| 42 #include "core/dom/StyleEngine.h" | 42 #include "core/dom/StyleEngine.h" |
| 43 #include "core/events/Event.h" | 43 #include "core/events/Event.h" |
| 44 #include "core/events/MouseEvent.h" |
| 44 #include "core/frame/Settings.h" | 45 #include "core/frame/Settings.h" |
| 45 #include "core/html/TextMetrics.h" | 46 #include "core/html/TextMetrics.h" |
| 46 #include "core/html/canvas/CanvasFontCache.h" | 47 #include "core/html/canvas/CanvasFontCache.h" |
| 47 #include "core/layout/LayoutBox.h" | 48 #include "core/layout/LayoutBox.h" |
| 48 #include "core/layout/LayoutTheme.h" | 49 #include "core/layout/LayoutTheme.h" |
| 49 #include "modules/canvas2d/CanvasStyle.h" | 50 #include "modules/canvas2d/CanvasStyle.h" |
| 50 #include "modules/canvas2d/HitRegion.h" | 51 #include "modules/canvas2d/HitRegion.h" |
| 51 #include "modules/canvas2d/Path2D.h" | 52 #include "modules/canvas2d/Path2D.h" |
| 52 #include "platform/fonts/FontCache.h" | 53 #include "platform/fonts/FontCache.h" |
| 53 #include "platform/graphics/DrawLooperBuilder.h" | 54 #include "platform/graphics/DrawLooperBuilder.h" |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 ImageBuffer* CanvasRenderingContext2D::imageBuffer() const | 572 ImageBuffer* CanvasRenderingContext2D::imageBuffer() const |
| 572 { | 573 { |
| 573 return canvas()->buffer(); | 574 return canvas()->buffer(); |
| 574 } | 575 } |
| 575 | 576 |
| 576 bool CanvasRenderingContext2D::parseColorOrCurrentColor(Color& color, const Stri
ng& colorString) const | 577 bool CanvasRenderingContext2D::parseColorOrCurrentColor(Color& color, const Stri
ng& colorString) const |
| 577 { | 578 { |
| 578 return ::blink::parseColorOrCurrentColor(color, colorString, canvas()); | 579 return ::blink::parseColorOrCurrentColor(color, colorString, canvas()); |
| 579 } | 580 } |
| 580 | 581 |
| 582 std::pair<Element*, String> CanvasRenderingContext2D::getControlAndIdIfHitRegion
Exists(const LayoutPoint& location) |
| 583 { |
| 584 if (hitRegionsCount() <= 0) |
| 585 return std::make_pair(nullptr, String()); |
| 586 |
| 587 LayoutBox* box = canvas()->layoutBox(); |
| 588 FloatPoint localPos = box->absoluteToLocal(FloatPoint(location), UseTransfor
ms); |
| 589 if (box->hasBorderOrPadding()) |
| 590 localPos.move(-box->contentBoxOffset()); |
| 591 localPos.scale(canvas()->width() / box->contentWidth(), canvas()->height() /
box->contentHeight()); |
| 592 |
| 593 HitRegion* hitRegion = hitRegionAtPoint(localPos); |
| 594 if (hitRegion) { |
| 595 Element* control = hitRegion->control(); |
| 596 if (control && canvas()->isSupportedInteractiveCanvasFallback(*control)) |
| 597 return std::make_pair(hitRegion->control(), hitRegion->id()); |
| 598 return std::make_pair(nullptr, hitRegion->id()); |
| 599 } |
| 600 return std::make_pair(nullptr, String()); |
| 601 } |
| 602 |
| 581 String CanvasRenderingContext2D::textAlign() const | 603 String CanvasRenderingContext2D::textAlign() const |
| 582 { | 604 { |
| 583 return textAlignName(state().getTextAlign()); | 605 return textAlignName(state().getTextAlign()); |
| 584 } | 606 } |
| 585 | 607 |
| 586 void CanvasRenderingContext2D::setTextAlign(const String& s) | 608 void CanvasRenderingContext2D::setTextAlign(const String& s) |
| 587 { | 609 { |
| 588 TextAlign align; | 610 TextAlign align; |
| 589 if (!parseTextAlign(s, align)) | 611 if (!parseTextAlign(s, align)) |
| 590 return; | 612 return; |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1015 | 1037 |
| 1016 unsigned CanvasRenderingContext2D::hitRegionsCount() const | 1038 unsigned CanvasRenderingContext2D::hitRegionsCount() const |
| 1017 { | 1039 { |
| 1018 if (m_hitRegionManager) | 1040 if (m_hitRegionManager) |
| 1019 return m_hitRegionManager->getHitRegionsCount(); | 1041 return m_hitRegionManager->getHitRegionsCount(); |
| 1020 | 1042 |
| 1021 return 0; | 1043 return 0; |
| 1022 } | 1044 } |
| 1023 | 1045 |
| 1024 } // namespace blink | 1046 } // namespace blink |
| OLD | NEW |