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

Side by Side Diff: Source/core/accessibility/AccessibilitySlider.cpp

Issue 14740025: Simplify and add caching for accessible bounding box calculation. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update comment Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 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 29 matching lines...) Expand all
40 AccessibilitySlider::AccessibilitySlider(RenderObject* renderer) 40 AccessibilitySlider::AccessibilitySlider(RenderObject* renderer)
41 : AccessibilityRenderObject(renderer) 41 : AccessibilityRenderObject(renderer)
42 { 42 {
43 } 43 }
44 44
45 PassRefPtr<AccessibilitySlider> AccessibilitySlider::create(RenderObject* render er) 45 PassRefPtr<AccessibilitySlider> AccessibilitySlider::create(RenderObject* render er)
46 { 46 {
47 return adoptRef(new AccessibilitySlider(renderer)); 47 return adoptRef(new AccessibilitySlider(renderer));
48 } 48 }
49 49
50 AccessibilityOrientation AccessibilitySlider::orientation() const 50 AccessibilityOrientation AccessibilitySlider::orientation()
51 { 51 {
52 // Default to horizontal in the unknown case. 52 // Default to horizontal in the unknown case.
53 if (!m_renderer) 53 if (!m_renderer)
54 return AccessibilityOrientationHorizontal; 54 return AccessibilityOrientationHorizontal;
55 55
56 RenderStyle* style = m_renderer->style(); 56 RenderStyle* style = m_renderer->style();
57 if (!style) 57 if (!style)
58 return AccessibilityOrientationHorizontal; 58 return AccessibilityOrientationHorizontal;
59 59
60 ControlPart styleAppearance = style->appearance(); 60 ControlPart styleAppearance = style->appearance();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 cache->remove(thumb->axObjectID()); 92 cache->remove(thumb->axObjectID());
93 else 93 else
94 m_children.append(thumb); 94 m_children.append(thumb);
95 } 95 }
96 96
97 const AtomicString& AccessibilitySlider::getAttribute(const QualifiedName& attri bute) const 97 const AtomicString& AccessibilitySlider::getAttribute(const QualifiedName& attri bute) const
98 { 98 {
99 return element()->getAttribute(attribute); 99 return element()->getAttribute(attribute);
100 } 100 }
101 101
102 AccessibilityObject* AccessibilitySlider::elementAccessibilityHitTest(const IntP oint& point) const 102 AccessibilityObject* AccessibilitySlider::elementAccessibilityHitTest(const IntP oint& point)
103 { 103 {
104 if (m_children.size()) { 104 if (m_children.size()) {
105 ASSERT(m_children.size() == 1); 105 ASSERT(m_children.size() == 1);
106 if (m_children[0]->elementRect().contains(point)) 106 if (m_children[0]->elementRect().contains(point))
107 return m_children[0].get(); 107 return m_children[0].get();
108 } 108 }
109 109
110 return axObjectCache()->getOrCreate(m_renderer); 110 return axObjectCache()->getOrCreate(m_renderer);
111 } 111 }
112 112
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 AccessibilitySliderThumb::AccessibilitySliderThumb() 147 AccessibilitySliderThumb::AccessibilitySliderThumb()
148 { 148 {
149 } 149 }
150 150
151 PassRefPtr<AccessibilitySliderThumb> AccessibilitySliderThumb::create() 151 PassRefPtr<AccessibilitySliderThumb> AccessibilitySliderThumb::create()
152 { 152 {
153 return adoptRef(new AccessibilitySliderThumb()); 153 return adoptRef(new AccessibilitySliderThumb());
154 } 154 }
155 155
156 LayoutRect AccessibilitySliderThumb::elementRect() const 156 LayoutRect AccessibilitySliderThumb::elementRect()
157 { 157 {
158 if (!m_parent) 158 if (!m_parent)
159 return LayoutRect(); 159 return LayoutRect();
160 160
161 RenderObject* sliderRenderer = m_parent->renderer(); 161 RenderObject* sliderRenderer = m_parent->renderer();
162 if (!sliderRenderer || !sliderRenderer->isSlider()) 162 if (!sliderRenderer || !sliderRenderer->isSlider())
163 return LayoutRect(); 163 return LayoutRect();
164 return sliderThumbElementOf(sliderRenderer->node())->boundingBox(); 164 return sliderThumbElementOf(sliderRenderer->node())->boundingBox();
165 } 165 }
166 166
167 bool AccessibilitySliderThumb::computeAccessibilityIsIgnored() const 167 bool AccessibilitySliderThumb::computeAccessibilityIsIgnored() const
168 { 168 {
169 return accessibilityIsIgnoredByDefault(); 169 return accessibilityIsIgnoredByDefault();
170 } 170 }
171 171
172 } // namespace WebCore 172 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698