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

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

Issue 1071873004: Changing slider values do not work properly when percent change of a step is less than one. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « LayoutTests/accessibility/input-slider-change-value-by-percent-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012, Google Inc. All rights reserved. 2 * Copyright (C) 2012, Google 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 2063 matching lines...) Expand 10 before | Expand all | Expand 10 after
2074 RefPtr<AXObject> axElement = axObjectCache()->getOrCreate(element); 2074 RefPtr<AXObject> axElement = axObjectCache()->getOrCreate(element);
2075 textOrder.append(AccessibilityText(ariaLabeledBy, AlternativeText, a xElement)); 2075 textOrder.append(AccessibilityText(ariaLabeledBy, AlternativeText, a xElement));
2076 } 2076 }
2077 } 2077 }
2078 } 2078 }
2079 2079
2080 void AXNodeObject::changeValueByPercent(float percentChange) 2080 void AXNodeObject::changeValueByPercent(float percentChange)
2081 { 2081 {
2082 float range = maxValueForRange() - minValueForRange(); 2082 float range = maxValueForRange() - minValueForRange();
2083 float value = valueForRange(); 2083 float value = valueForRange();
2084 float step = range * (percentChange / 100);
2084 2085
2085 value += range * (percentChange / 100); 2086 if (fabs(step) < 1)
dmazzoni 2015/04/09 15:11:24 i'm not sure I quite understand why this code didn
2087 step = percentChange > 0 ? 1 : -1;
2088
2089 value += step;
2086 setValue(String::number(value)); 2090 setValue(String::number(value));
2087 2091
2088 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged) ; 2092 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged) ;
2089 } 2093 }
2090 2094
2091 } // namespace blink 2095 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/accessibility/input-slider-change-value-by-percent-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698