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

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

Issue 926193003: Move rendering/RenderBox to layout/LayoutBox. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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
« no previous file with comments | « Source/core/testing/Internals.cpp ('k') | Source/modules/accessibility/AXRenderObject.cpp » ('j') | 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 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 return false; 1281 return false;
1282 1282
1283 // Skip big container elements like lists, tables, etc. 1283 // Skip big container elements like lists, tables, etc.
1284 if (obj->isList() || obj->isAXTable() || obj->isTree() || obj->isCanvas()) 1284 if (obj->isList() || obj->isAXTable() || obj->isTree() || obj->isCanvas())
1285 return false; 1285 return false;
1286 1286
1287 return true; 1287 return true;
1288 } 1288 }
1289 1289
1290 // Returns true if |r1| and |r2| are both non-null and are contained within the 1290 // Returns true if |r1| and |r2| are both non-null and are contained within the
1291 // same RenderBox. 1291 // same LayoutBox.
1292 static bool isSameRenderBox(LayoutObject* r1, LayoutObject* r2) 1292 static bool isSameLayoutBox(LayoutObject* r1, LayoutObject* r2)
1293 { 1293 {
1294 if (!r1 || !r2) 1294 if (!r1 || !r2)
1295 return false; 1295 return false;
1296 RenderBox* b1 = r1->enclosingBox(); 1296 LayoutBox* b1 = r1->enclosingBox();
1297 RenderBox* b2 = r2->enclosingBox(); 1297 LayoutBox* b2 = r2->enclosingBox();
1298 return b1 && b2 && b1 == b2; 1298 return b1 && b2 && b1 == b2;
1299 } 1299 }
1300 1300
1301 String AXNodeObject::textUnderElement(TextUnderElementMode mode) const 1301 String AXNodeObject::textUnderElement(TextUnderElementMode mode) const
1302 { 1302 {
1303 Node* node = this->node(); 1303 Node* node = this->node();
1304 if (node && node->isTextNode()) 1304 if (node && node->isTextNode())
1305 return toText(node)->wholeText(); 1305 return toText(node)->wholeText();
1306 1306
1307 StringBuilder builder; 1307 StringBuilder builder;
1308 AXObject* previous = nullptr; 1308 AXObject* previous = nullptr;
1309 for (AXObject* child = firstChild(); child; child = child->nextSibling()) { 1309 for (AXObject* child = firstChild(); child; child = child->nextSibling()) {
1310 if (!shouldUseAccessibilityObjectInnerText(child)) 1310 if (!shouldUseAccessibilityObjectInnerText(child))
1311 continue; 1311 continue;
1312 1312
1313 if (child->isAXNodeObject()) { 1313 if (child->isAXNodeObject()) {
1314 Vector<AccessibilityText> textOrder; 1314 Vector<AccessibilityText> textOrder;
1315 toAXNodeObject(child)->alternativeText(textOrder); 1315 toAXNodeObject(child)->alternativeText(textOrder);
1316 if (textOrder.size() > 0) { 1316 if (textOrder.size() > 0) {
1317 builder.append(textOrder[0].text); 1317 builder.append(textOrder[0].text);
1318 if (mode == TextUnderElementAny) 1318 if (mode == TextUnderElementAny)
1319 break; 1319 break;
1320 continue; 1320 continue;
1321 } 1321 }
1322 } 1322 }
1323 1323
1324 // If we're going between two renderers that are in separate RenderBoxes , add 1324 // If we're going between two renderers that are in separate LayoutBoxes , add
1325 // whitespace if it wasn't there already. Intuitively if you have 1325 // whitespace if it wasn't there already. Intuitively if you have
1326 // <span>Hello</span><span>World</span>, those are part of the same Rend erBox 1326 // <span>Hello</span><span>World</span>, those are part of the same Layo utBox
1327 // so we should return "HelloWorld", but given <div>Hello</div><div>Worl d</div> the 1327 // so we should return "HelloWorld", but given <div>Hello</div><div>Worl d</div> the
1328 // strings are in separate boxes so we should return "Hello World". 1328 // strings are in separate boxes so we should return "Hello World".
1329 if (previous && builder.length() && !isHTMLSpace(builder[builder.length( ) - 1])) { 1329 if (previous && builder.length() && !isHTMLSpace(builder[builder.length( ) - 1])) {
1330 if (!isSameRenderBox(child->renderer(), previous->renderer())) 1330 if (!isSameLayoutBox(child->renderer(), previous->renderer()))
1331 builder.append(' '); 1331 builder.append(' ');
1332 } 1332 }
1333 1333
1334 builder.append(child->textUnderElement(mode)); 1334 builder.append(child->textUnderElement(mode));
1335 previous = child; 1335 previous = child;
1336 1336
1337 if (mode == TextUnderElementAny && !builder.isEmpty()) 1337 if (mode == TextUnderElementAny && !builder.isEmpty())
1338 break; 1338 break;
1339 } 1339 }
1340 1340
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
1992 float range = maxValueForRange() - minValueForRange(); 1992 float range = maxValueForRange() - minValueForRange();
1993 float value = valueForRange(); 1993 float value = valueForRange();
1994 1994
1995 value += range * (percentChange / 100); 1995 value += range * (percentChange / 100);
1996 setValue(String::number(value)); 1996 setValue(String::number(value));
1997 1997
1998 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged, true); 1998 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged, true);
1999 } 1999 }
2000 2000
2001 } // namespace blink 2001 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/testing/Internals.cpp ('k') | Source/modules/accessibility/AXRenderObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698