Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(550)

Side by Side Diff: Source/modules/accessibility/AXImageMapLink.cpp

Issue 1175533004: Refactor: Clear m_axObjectCache when AXObject detaches (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added ASSERT Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 18 matching lines...) Expand all
29 #include "config.h" 29 #include "config.h"
30 #include "modules/accessibility/AXImageMapLink.h" 30 #include "modules/accessibility/AXImageMapLink.h"
31 31
32 #include "modules/accessibility/AXLayoutObject.h" 32 #include "modules/accessibility/AXLayoutObject.h"
33 #include "modules/accessibility/AXObjectCacheImpl.h" 33 #include "modules/accessibility/AXObjectCacheImpl.h"
34 34
35 namespace blink { 35 namespace blink {
36 36
37 using namespace HTMLNames; 37 using namespace HTMLNames;
38 38
39 AXImageMapLink::AXImageMapLink(AXObjectCacheImpl* axObjectCache) 39 AXImageMapLink::AXImageMapLink(AXObjectCacheImpl& axObjectCache)
40 : AXMockObject(axObjectCache) 40 : AXMockObject(axObjectCache)
41 , m_areaElement(nullptr) 41 , m_areaElement(nullptr)
42 , m_mapElement(nullptr) 42 , m_mapElement(nullptr)
43 { 43 {
44 } 44 }
45 45
46 AXImageMapLink::~AXImageMapLink() 46 AXImageMapLink::~AXImageMapLink()
47 { 47 {
48 } 48 }
49 49
50 void AXImageMapLink::detachFromParent() 50 void AXImageMapLink::detachFromParent()
51 { 51 {
52 AXMockObject::detachFromParent(); 52 AXMockObject::detachFromParent();
53 m_areaElement = nullptr; 53 m_areaElement = nullptr;
54 m_mapElement = nullptr; 54 m_mapElement = nullptr;
55 } 55 }
56 56
57 PassRefPtr<AXImageMapLink> AXImageMapLink::create(AXObjectCacheImpl* axObjectCac he) 57 PassRefPtr<AXImageMapLink> AXImageMapLink::create(AXObjectCacheImpl& axObjectCac he)
58 { 58 {
59 return adoptRef(new AXImageMapLink(axObjectCache)); 59 return adoptRef(new AXImageMapLink(axObjectCache));
60 } 60 }
61 61
62 AXObject* AXImageMapLink::computeParent() const 62 AXObject* AXImageMapLink::computeParent() const
63 { 63 {
64 if (m_parent) 64 if (m_parent)
65 return m_parent; 65 return m_parent;
66 66
67 if (!m_mapElement.get() || !m_mapElement->layoutObject()) 67 if (!m_mapElement.get() || !m_mapElement->layoutObject())
68 return 0; 68 return 0;
69 69
70 return axObjectCache()->getOrCreate(m_mapElement->layoutObject()); 70 return axObjectCache().getOrCreate(m_mapElement->layoutObject());
71 } 71 }
72 72
73 AccessibilityRole AXImageMapLink::roleValue() const 73 AccessibilityRole AXImageMapLink::roleValue() const
74 { 74 {
75 if (!m_areaElement) 75 if (!m_areaElement)
76 return LinkRole; 76 return LinkRole;
77 77
78 const AtomicString& ariaRole = getAttribute(roleAttr); 78 const AtomicString& ariaRole = getAttribute(roleAttr);
79 if (!ariaRole.isEmpty()) 79 if (!ariaRole.isEmpty())
80 return AXObject::ariaRoleToWebCoreRole(ariaRole); 80 return AXObject::ariaRoleToWebCoreRole(ariaRole);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 else 135 else
136 layoutObject = m_mapElement->layoutObject(); 136 layoutObject = m_mapElement->layoutObject();
137 137
138 if (!layoutObject) 138 if (!layoutObject)
139 return LayoutRect(); 139 return LayoutRect();
140 140
141 return m_areaElement->computeRect(layoutObject); 141 return m_areaElement->computeRect(layoutObject);
142 } 142 }
143 143
144 } // namespace blink 144 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/accessibility/AXImageMapLink.h ('k') | Source/modules/accessibility/AXInlineTextBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698