| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/html/canvas/HitRegion.h" | 6 #include "core/html/canvas/HitRegion.h" |
| 7 | 7 |
| 8 #include "core/accessibility/AXObjectCache.h" | 8 #include "core/accessibility/AXObjectCache.h" |
| 9 #include "core/rendering/RenderBoxModelObject.h" | 9 #include "core/rendering/RenderBoxModelObject.h" |
| 10 | 10 |
| 11 namespace WebCore { | 11 namespace WebCore { |
| 12 | 12 |
| 13 HitRegion::HitRegion(const HitRegionOptions& options) | 13 HitRegion::HitRegion(const HitRegionOptions& options) |
| 14 : m_id(options.id) | 14 : m_id(options.id) |
| 15 , m_control(options.control) | 15 , m_control(options.control) |
| 16 , m_path(options.path) | 16 , m_path(options.path) |
| 17 , m_fillRule(options.fillRule) |
| 17 { | 18 { |
| 18 } | 19 } |
| 19 | 20 |
| 20 void HitRegion::updateAccessibility(Element* canvas) | 21 void HitRegion::updateAccessibility(Element* canvas) |
| 21 { | 22 { |
| 22 if (!m_control || !canvas || !canvas->renderer() || !m_control->isDescendant
Of(canvas)) | 23 if (!m_control || !canvas || !canvas->renderer() || !m_control->isDescendant
Of(canvas)) |
| 23 return; | 24 return; |
| 24 | 25 |
| 25 AXObjectCache* axObjectCache = m_control->document().existingAXObjectCache()
; | 26 AXObjectCache* axObjectCache = m_control->document().existingAXObjectCache()
; |
| 26 if (!axObjectCache) | 27 if (!axObjectCache) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 37 elementRect.moveBy(canvasRect.location()); | 38 elementRect.moveBy(canvasRect.location()); |
| 38 | 39 |
| 39 axObjectCache->setCanvasObjectBounds(m_control.get(), elementRect); | 40 axObjectCache->setCanvasObjectBounds(m_control.get(), elementRect); |
| 40 } | 41 } |
| 41 | 42 |
| 42 bool HitRegion::contains(const LayoutPoint& point) const | 43 bool HitRegion::contains(const LayoutPoint& point) const |
| 43 { | 44 { |
| 44 if (!m_path.boundingRect().contains(point)) | 45 if (!m_path.boundingRect().contains(point)) |
| 45 return false; | 46 return false; |
| 46 | 47 |
| 47 return m_path.contains(point, RULE_NONZERO); | 48 return m_path.contains(point, m_fillRule); |
| 48 } | 49 } |
| 49 | 50 |
| 50 void HitRegion::removePixels(const Path& clearArea) | 51 void HitRegion::removePixels(const Path& clearArea) |
| 51 { | 52 { |
| 52 m_path.subtractPath(clearArea); | 53 m_path.subtractPath(clearArea); |
| 53 } | 54 } |
| 54 | 55 |
| 55 void HitRegion::trace(Visitor* visitor) | 56 void HitRegion::trace(Visitor* visitor) |
| 56 { | 57 { |
| 57 visitor->trace(m_control); | 58 visitor->trace(m_control); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 void HitRegionManager::trace(Visitor* visitor) | 152 void HitRegionManager::trace(Visitor* visitor) |
| 152 { | 153 { |
| 153 visitor->trace(m_hitRegionList); | 154 visitor->trace(m_hitRegionList); |
| 154 visitor->trace(m_hitRegionIdMap); | 155 visitor->trace(m_hitRegionIdMap); |
| 155 visitor->trace(m_hitRegionControlMap); | 156 visitor->trace(m_hitRegionControlMap); |
| 156 } | 157 } |
| 157 | 158 |
| 158 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(HitRegionManager) | 159 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(HitRegionManager) |
| 159 | 160 |
| 160 } // namespace WebCore | 161 } // namespace WebCore |
| OLD | NEW |