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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/walkers/layout_line_walker.js

Issue 2939273002: DO NOT SUBMIT: what chrome/browser/resources/ could eventually look like with clang-format (Closed)
Patch Set: Created 3 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 // 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 /** 5 /**
6 * @fileoverview A JavaScript class for walking lines consisting of one or more 6 * @fileoverview A JavaScript class for walking lines consisting of one or more
7 * clickable nodes. 7 * clickable nodes.
8 */ 8 */
9 9
10 10
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 if (this.wantsOwnLine_(lSel.end.node) || 146 if (this.wantsOwnLine_(lSel.end.node) ||
147 this.wantsOwnLine_(rSel.start.node)) { 147 this.wantsOwnLine_(rSel.start.node)) {
148 return true; 148 return true;
149 } 149 }
150 var lRect = lSel.getRange().getBoundingClientRect(); 150 var lRect = lSel.getRange().getBoundingClientRect();
151 var rRect = rSel.getRange().getBoundingClientRect(); 151 var rRect = rSel.getRange().getBoundingClientRect();
152 152
153 // Some ranges from the browser give us 0-sized rects (such as in the case of 153 // Some ranges from the browser give us 0-sized rects (such as in the case of
154 // select's). Detect these cases and use a more reliable method (take the 154 // select's). Detect these cases and use a more reliable method (take the
155 // bounding rect of the actual element rather than the range). 155 // bounding rect of the actual element rather than the range).
156 if (lRect.width == 0 && 156 if (lRect.width == 0 && lRect.height == 0 &&
157 lRect.height == 0 &&
158 lSel.end.node.nodeType == Node.ELEMENT_NODE) { 157 lSel.end.node.nodeType == Node.ELEMENT_NODE) {
159 lRect = lSel.end.node.getBoundingClientRect(); 158 lRect = lSel.end.node.getBoundingClientRect();
160 } 159 }
161 160
162 if (rRect.width == 0 && 161 if (rRect.width == 0 && rRect.height == 0 &&
163 rRect.height == 0 &&
164 rSel.start.node.nodeType == Node.ELEMENT_NODE) { 162 rSel.start.node.nodeType == Node.ELEMENT_NODE) {
165 rRect = rSel.start.node.getBoundingClientRect(); 163 rRect = rSel.start.node.getBoundingClientRect();
166 } 164 }
167 return lRect.bottom != rRect.bottom; 165 return lRect.bottom != rRect.bottom;
168 }; 166 };
169 167
170 168
171 /** 169 /**
172 * Determines if node should force a line break. 170 * Determines if node should force a line break.
173 * This is used for elements with unusual semantics, such as multi-line 171 * This is used for elements with unusual semantics, such as multi-line
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 if (sel && cur.absEquals(sel)) { 237 if (sel && cur.absEquals(sel)) {
240 if (valueSelectionSpan) { 238 if (valueSelectionSpan) {
241 braille.startIndex = nodeStart + item.getSpanStart(valueSelectionSpan); 239 braille.startIndex = nodeStart + item.getSpanStart(valueSelectionSpan);
242 braille.endIndex = nodeStart + item.getSpanEnd(valueSelectionSpan); 240 braille.endIndex = nodeStart + item.getSpanEnd(valueSelectionSpan);
243 } else { 241 } else {
244 braille.startIndex = nodeStart; 242 braille.startIndex = nodeStart;
245 braille.endIndex = nodeStart + 1; 243 braille.endIndex = nodeStart + 1;
246 } 244 }
247 } 245 }
248 }; 246 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698