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

Side by Side Diff: Source/core/accessibility/AccessibilitySpinButton.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) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 AccessibilityObject* AccessibilitySpinButton::decrementButton() 58 AccessibilityObject* AccessibilitySpinButton::decrementButton()
59 { 59 {
60 if (!m_haveChildren) 60 if (!m_haveChildren)
61 addChildren(); 61 addChildren();
62 62
63 ASSERT(m_children.size() == 2); 63 ASSERT(m_children.size() == 2);
64 64
65 return m_children[1].get(); 65 return m_children[1].get();
66 } 66 }
67 67
68 LayoutRect AccessibilitySpinButton::elementRect() const 68 LayoutRect AccessibilitySpinButton::elementRect()
69 { 69 {
70 ASSERT(m_spinButtonElement); 70 ASSERT(m_spinButtonElement);
71 71
72 if (!m_spinButtonElement || !m_spinButtonElement->renderer()) 72 if (!m_spinButtonElement || !m_spinButtonElement->renderer())
73 return LayoutRect(); 73 return LayoutRect();
74 74
75 Vector<FloatQuad> quads; 75 Vector<FloatQuad> quads;
76 m_spinButtonElement->renderer()->absoluteFocusRingQuads(quads); 76 m_spinButtonElement->renderer()->absoluteFocusRingQuads(quads);
77 77
78 return boundingBoxForQuads(m_spinButtonElement->renderer(), quads); 78 return boundingBoxForQuads(m_spinButtonElement->renderer(), quads);
(...skipping 28 matching lines...) Expand all
107 AccessibilitySpinButtonPart::AccessibilitySpinButtonPart() 107 AccessibilitySpinButtonPart::AccessibilitySpinButtonPart()
108 : m_isIncrementor(false) 108 : m_isIncrementor(false)
109 { 109 {
110 } 110 }
111 111
112 PassRefPtr<AccessibilitySpinButtonPart> AccessibilitySpinButtonPart::create() 112 PassRefPtr<AccessibilitySpinButtonPart> AccessibilitySpinButtonPart::create()
113 { 113 {
114 return adoptRef(new AccessibilitySpinButtonPart); 114 return adoptRef(new AccessibilitySpinButtonPart);
115 } 115 }
116 116
117 LayoutRect AccessibilitySpinButtonPart::elementRect() const 117 LayoutRect AccessibilitySpinButtonPart::elementRect()
118 { 118 {
119 // FIXME: This logic should exist in the render tree or elsewhere, but there is no 119 // FIXME: This logic should exist in the render tree or elsewhere, but there is no
120 // relationship that exists that can be queried. 120 // relationship that exists that can be queried.
121 121
122 LayoutRect parentRect = parentObject()->elementRect(); 122 LayoutRect parentRect = parentObject()->elementRect();
123 if (m_isIncrementor) 123 if (m_isIncrementor)
124 parentRect.setHeight(parentRect.height() / 2); 124 parentRect.setHeight(parentRect.height() / 2);
125 else { 125 else {
126 parentRect.setY(parentRect.y() + parentRect.height() / 2); 126 parentRect.setY(parentRect.y() + parentRect.height() / 2);
127 parentRect.setHeight(parentRect.height() / 2); 127 parentRect.setHeight(parentRect.height() / 2);
(...skipping 10 matching lines...) Expand all
138 AccessibilitySpinButton* spinButton = toAccessibilitySpinButton(parentObject ()); 138 AccessibilitySpinButton* spinButton = toAccessibilitySpinButton(parentObject ());
139 if (m_isIncrementor) 139 if (m_isIncrementor)
140 spinButton->step(1); 140 spinButton->step(1);
141 else 141 else
142 spinButton->step(-1); 142 spinButton->step(-1);
143 143
144 return true; 144 return true;
145 } 145 }
146 146
147 } // namespace WebCore 147 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698