| OLD | NEW |
| 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 #include "content/renderer/accessibility/blink_ax_tree_source.h" | 5 #include "content/renderer/accessibility/blink_ax_tree_source.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 blink::WebAXObject BlinkAXTreeSource::GetNull() const { | 217 blink::WebAXObject BlinkAXTreeSource::GetNull() const { |
| 218 return blink::WebAXObject(); | 218 return blink::WebAXObject(); |
| 219 } | 219 } |
| 220 | 220 |
| 221 void BlinkAXTreeSource::SerializeNode(blink::WebAXObject src, | 221 void BlinkAXTreeSource::SerializeNode(blink::WebAXObject src, |
| 222 ui::AXNodeData* dst) const { | 222 ui::AXNodeData* dst) const { |
| 223 dst->role = AXRoleFromBlink(src.role()); | 223 dst->role = AXRoleFromBlink(src.role()); |
| 224 dst->state = AXStateFromBlink(src); | 224 dst->state = AXStateFromBlink(src); |
| 225 dst->location = src.boundingBoxRect(); | 225 dst->location = src.boundingBoxRect(); |
| 226 dst->id = src.axID(); | 226 dst->id = src.axID(); |
| 227 std::string name = UTF16ToUTF8(src.deprecatedTitle()); | 227 std::string name = UTF16ToUTF8(base::StringPiece16(src.deprecatedTitle())); |
| 228 | 228 |
| 229 std::string value; | 229 std::string value; |
| 230 if (src.valueDescription().length()) { | 230 if (src.valueDescription().length()) { |
| 231 dst->AddStringAttribute(ui::AX_ATTR_VALUE, | 231 dst->AddStringAttribute(ui::AX_ATTR_VALUE, |
| 232 UTF16ToUTF8(src.valueDescription())); | 232 UTF16ToUTF8(base::StringPiece16( |
| 233 src.valueDescription()))); |
| 233 } else { | 234 } else { |
| 234 dst->AddStringAttribute(ui::AX_ATTR_VALUE, UTF16ToUTF8(src.stringValue())); | 235 dst->AddStringAttribute( |
| 236 ui::AX_ATTR_VALUE, |
| 237 UTF16ToUTF8(base::StringPiece16(src.stringValue()))); |
| 235 } | 238 } |
| 236 | 239 |
| 237 if (dst->role == ui::AX_ROLE_COLOR_WELL) | 240 if (dst->role == ui::AX_ROLE_COLOR_WELL) |
| 238 dst->AddIntAttribute(ui::AX_ATTR_COLOR_VALUE, src.colorValue()); | 241 dst->AddIntAttribute(ui::AX_ATTR_COLOR_VALUE, src.colorValue()); |
| 239 | 242 |
| 240 | 243 |
| 241 // Text attributes. | 244 // Text attributes. |
| 242 if (src.backgroundColor()) | 245 if (src.backgroundColor()) |
| 243 dst->AddIntAttribute(ui::AX_ATTR_BACKGROUND_COLOR, src.backgroundColor()); | 246 dst->AddIntAttribute(ui::AX_ATTR_BACKGROUND_COLOR, src.backgroundColor()); |
| 244 | 247 |
| 245 if (src.color()) | 248 if (src.color()) |
| 246 dst->AddIntAttribute(ui::AX_ATTR_COLOR, src.color()); | 249 dst->AddIntAttribute(ui::AX_ATTR_COLOR, src.color()); |
| 247 | 250 |
| 248 // Font size is in pixels. | 251 // Font size is in pixels. |
| 249 if (src.fontSize()) | 252 if (src.fontSize()) |
| 250 dst->AddFloatAttribute(ui::AX_ATTR_FONT_SIZE, src.fontSize()); | 253 dst->AddFloatAttribute(ui::AX_ATTR_FONT_SIZE, src.fontSize()); |
| 251 | 254 |
| 252 if (src.invalidState()) { | 255 if (src.invalidState()) { |
| 253 dst->AddIntAttribute(ui::AX_ATTR_INVALID_STATE, | 256 dst->AddIntAttribute(ui::AX_ATTR_INVALID_STATE, |
| 254 AXInvalidStateFromBlink(src.invalidState())); | 257 AXInvalidStateFromBlink(src.invalidState())); |
| 255 } | 258 } |
| 256 if (src.invalidState() == blink::WebAXInvalidStateOther) { | 259 if (src.invalidState() == blink::WebAXInvalidStateOther) { |
| 257 dst->AddStringAttribute(ui::AX_ATTR_ARIA_INVALID_VALUE, | 260 dst->AddStringAttribute( |
| 258 UTF16ToUTF8(src.ariaInvalidValue())); | 261 ui::AX_ATTR_ARIA_INVALID_VALUE, |
| 262 UTF16ToUTF8(base::StringPiece16(src.ariaInvalidValue()))); |
| 259 } | 263 } |
| 260 | 264 |
| 261 if (src.textDirection()) { | 265 if (src.textDirection()) { |
| 262 dst->AddIntAttribute(ui::AX_ATTR_TEXT_DIRECTION, | 266 dst->AddIntAttribute(ui::AX_ATTR_TEXT_DIRECTION, |
| 263 AXTextDirectionFromBlink(src.textDirection())); | 267 AXTextDirectionFromBlink(src.textDirection())); |
| 264 } | 268 } |
| 265 | 269 |
| 266 if (src.textStyle()) { | 270 if (src.textStyle()) { |
| 267 dst->AddIntAttribute(ui::AX_ATTR_TEXT_STYLE, | 271 dst->AddIntAttribute(ui::AX_ATTR_TEXT_STYLE, |
| 268 AXTextStyleFromBlink(src.textStyle())); | 272 AXTextStyleFromBlink(src.textStyle())); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 288 for (size_t i = 0; i < src_word_starts.size(); ++i) { | 292 for (size_t i = 0; i < src_word_starts.size(); ++i) { |
| 289 word_starts.push_back(src_word_starts[i]); | 293 word_starts.push_back(src_word_starts[i]); |
| 290 word_ends.push_back(src_word_ends[i]); | 294 word_ends.push_back(src_word_ends[i]); |
| 291 } | 295 } |
| 292 dst->AddIntListAttribute(ui::AX_ATTR_WORD_STARTS, word_starts); | 296 dst->AddIntListAttribute(ui::AX_ATTR_WORD_STARTS, word_starts); |
| 293 dst->AddIntListAttribute(ui::AX_ATTR_WORD_ENDS, word_ends); | 297 dst->AddIntListAttribute(ui::AX_ATTR_WORD_ENDS, word_ends); |
| 294 } | 298 } |
| 295 | 299 |
| 296 if (src.accessKey().length()) { | 300 if (src.accessKey().length()) { |
| 297 dst->AddStringAttribute(ui::AX_ATTR_ACCESS_KEY, | 301 dst->AddStringAttribute(ui::AX_ATTR_ACCESS_KEY, |
| 298 UTF16ToUTF8(src.accessKey())); | 302 UTF16ToUTF8(base::StringPiece16(src.accessKey()))); |
| 299 } | 303 } |
| 300 | 304 |
| 301 if (src.actionVerb().length()) | 305 if (src.actionVerb().length()) |
| 302 dst->AddStringAttribute(ui::AX_ATTR_ACTION, UTF16ToUTF8(src.actionVerb())); | 306 dst->AddStringAttribute( |
| 307 ui::AX_ATTR_ACTION, |
| 308 UTF16ToUTF8(base::StringPiece16(src.actionVerb()))); |
| 303 if (src.ariaAutoComplete().length()) | 309 if (src.ariaAutoComplete().length()) |
| 304 dst->AddStringAttribute(ui::AX_ATTR_AUTO_COMPLETE, | 310 dst->AddStringAttribute( |
| 305 UTF16ToUTF8(src.ariaAutoComplete())); | 311 ui::AX_ATTR_AUTO_COMPLETE, |
| 312 UTF16ToUTF8(base::StringPiece16(src.ariaAutoComplete()))); |
| 306 if (src.isAriaReadOnly()) | 313 if (src.isAriaReadOnly()) |
| 307 dst->AddBoolAttribute(ui::AX_ATTR_ARIA_READONLY, true); | 314 dst->AddBoolAttribute(ui::AX_ATTR_ARIA_READONLY, true); |
| 308 if (src.isButtonStateMixed()) | 315 if (src.isButtonStateMixed()) |
| 309 dst->AddBoolAttribute(ui::AX_ATTR_BUTTON_MIXED, true); | 316 dst->AddBoolAttribute(ui::AX_ATTR_BUTTON_MIXED, true); |
| 310 if (src.canSetValueAttribute()) | 317 if (src.canSetValueAttribute()) |
| 311 dst->AddBoolAttribute(ui::AX_ATTR_CAN_SET_VALUE, true); | 318 dst->AddBoolAttribute(ui::AX_ATTR_CAN_SET_VALUE, true); |
| 312 if (src.deprecatedAccessibilityDescription().length()) { | 319 if (src.deprecatedAccessibilityDescription().length()) { |
| 313 dst->AddStringAttribute( | 320 dst->AddStringAttribute( |
| 314 ui::AX_ATTR_DESCRIPTION, | 321 ui::AX_ATTR_DESCRIPTION, |
| 315 UTF16ToUTF8(src.deprecatedAccessibilityDescription())); | 322 UTF16ToUTF8(base::StringPiece16( |
| 323 src.deprecatedAccessibilityDescription()))); |
| 316 } | 324 } |
| 317 if (src.hasComputedStyle()) { | 325 if (src.hasComputedStyle()) { |
| 318 dst->AddStringAttribute(ui::AX_ATTR_DISPLAY, | 326 dst->AddStringAttribute( |
| 319 UTF16ToUTF8(src.computedStyleDisplay())); | 327 ui::AX_ATTR_DISPLAY, |
| 328 UTF16ToUTF8(base::StringPiece16(src.computedStyleDisplay()))); |
| 320 } | 329 } |
| 321 if (src.deprecatedHelpText().length()) | 330 if (src.deprecatedHelpText().length()) |
| 322 dst->AddStringAttribute(ui::AX_ATTR_HELP, | 331 dst->AddStringAttribute( |
| 323 UTF16ToUTF8(src.deprecatedHelpText())); | 332 ui::AX_ATTR_HELP, |
| 333 UTF16ToUTF8(base::StringPiece16((src.deprecatedHelpText())))); |
| 324 if (src.deprecatedPlaceholder().length()) { | 334 if (src.deprecatedPlaceholder().length()) { |
| 325 dst->AddStringAttribute(ui::AX_ATTR_PLACEHOLDER, | 335 dst->AddStringAttribute( |
| 326 UTF16ToUTF8(src.deprecatedPlaceholder())); | 336 ui::AX_ATTR_PLACEHOLDER, |
| 337 UTF16ToUTF8(base::StringPiece16(src.deprecatedPlaceholder()))); |
| 327 } | 338 } |
| 328 if (src.keyboardShortcut().length()) { | 339 if (src.keyboardShortcut().length()) { |
| 329 dst->AddStringAttribute(ui::AX_ATTR_SHORTCUT, | 340 dst->AddStringAttribute( |
| 330 UTF16ToUTF8(src.keyboardShortcut())); | 341 ui::AX_ATTR_SHORTCUT, |
| 342 UTF16ToUTF8(base::StringPiece16(src.keyboardShortcut()))); |
| 331 } | 343 } |
| 332 if (!src.deprecatedTitleUIElement().isDetached()) { | 344 if (!src.deprecatedTitleUIElement().isDetached()) { |
| 333 dst->AddIntAttribute(ui::AX_ATTR_TITLE_UI_ELEMENT, | 345 dst->AddIntAttribute(ui::AX_ATTR_TITLE_UI_ELEMENT, |
| 334 src.deprecatedTitleUIElement().axID()); | 346 src.deprecatedTitleUIElement().axID()); |
| 335 } | 347 } |
| 336 if (!src.ariaActiveDescendant().isDetached()) { | 348 if (!src.ariaActiveDescendant().isDetached()) { |
| 337 dst->AddIntAttribute(ui::AX_ATTR_ACTIVEDESCENDANT_ID, | 349 dst->AddIntAttribute(ui::AX_ATTR_ACTIVEDESCENDANT_ID, |
| 338 src.ariaActiveDescendant().axID()); | 350 src.ariaActiveDescendant().axID()); |
| 339 } | 351 } |
| 340 | 352 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 370 | 382 |
| 371 if (!node.isNull() && node.isElementNode()) { | 383 if (!node.isNull() && node.isElementNode()) { |
| 372 WebElement element = node.to<WebElement>(); | 384 WebElement element = node.to<WebElement>(); |
| 373 is_iframe = (element.tagName() == ASCIIToUTF16("IFRAME")); | 385 is_iframe = (element.tagName() == ASCIIToUTF16("IFRAME")); |
| 374 | 386 |
| 375 // TODO(ctguil): The tagName in WebKit is lower cased but | 387 // TODO(ctguil): The tagName in WebKit is lower cased but |
| 376 // HTMLElement::nodeName calls localNameUpper. Consider adding | 388 // HTMLElement::nodeName calls localNameUpper. Consider adding |
| 377 // a WebElement method that returns the original lower cased tagName. | 389 // a WebElement method that returns the original lower cased tagName. |
| 378 dst->AddStringAttribute( | 390 dst->AddStringAttribute( |
| 379 ui::AX_ATTR_HTML_TAG, | 391 ui::AX_ATTR_HTML_TAG, |
| 380 base::StringToLowerASCII(UTF16ToUTF8(element.tagName()))); | 392 base::StringToLowerASCII(UTF16ToUTF8( |
| 393 base::StringPiece16(element.tagName())))); |
| 381 for (unsigned i = 0; i < element.attributeCount(); ++i) { | 394 for (unsigned i = 0; i < element.attributeCount(); ++i) { |
| 382 std::string name = base::StringToLowerASCII(UTF16ToUTF8( | 395 std::string name = base::StringToLowerASCII(UTF16ToUTF8( |
| 383 element.attributeLocalName(i))); | 396 base::StringPiece16(element.attributeLocalName(i)))); |
| 384 std::string value = UTF16ToUTF8(element.attributeValue(i)); | 397 std::string value = |
| 398 UTF16ToUTF8(base::StringPiece16(element.attributeValue(i))); |
| 385 dst->html_attributes.push_back(std::make_pair(name, value)); | 399 dst->html_attributes.push_back(std::make_pair(name, value)); |
| 386 } | 400 } |
| 387 | 401 |
| 388 if (!src.isReadOnly() || dst->role == ui::AX_ROLE_TEXT_FIELD) { | 402 if (!src.isReadOnly() || dst->role == ui::AX_ROLE_TEXT_FIELD) { |
| 389 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, src.selectionStart()); | 403 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, src.selectionStart()); |
| 390 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, src.selectionEnd()); | 404 dst->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, src.selectionEnd()); |
| 391 | 405 |
| 392 WebVector<int> src_line_breaks; | 406 WebVector<int> src_line_breaks; |
| 393 src.lineBreaks(src_line_breaks); | 407 src.lineBreaks(src_line_breaks); |
| 394 if (src_line_breaks.size() > 0) { | 408 if (src_line_breaks.size() > 0) { |
| 395 std::vector<int32> line_breaks; | 409 std::vector<int32> line_breaks; |
| 396 line_breaks.reserve(src_line_breaks.size()); | 410 line_breaks.reserve(src_line_breaks.size()); |
| 397 for (size_t i = 0; i < src_line_breaks.size(); ++i) | 411 for (size_t i = 0; i < src_line_breaks.size(); ++i) |
| 398 line_breaks.push_back(src_line_breaks[i]); | 412 line_breaks.push_back(src_line_breaks[i]); |
| 399 dst->AddIntListAttribute(ui::AX_ATTR_LINE_BREAKS, line_breaks); | 413 dst->AddIntListAttribute(ui::AX_ATTR_LINE_BREAKS, line_breaks); |
| 400 } | 414 } |
| 401 } | 415 } |
| 402 | 416 |
| 403 // ARIA role. | 417 // ARIA role. |
| 404 if (element.hasAttribute("role")) { | 418 if (element.hasAttribute("role")) { |
| 405 dst->AddStringAttribute(ui::AX_ATTR_ROLE, | 419 dst->AddStringAttribute( |
| 406 UTF16ToUTF8(element.getAttribute("role"))); | 420 ui::AX_ATTR_ROLE, |
| 421 UTF16ToUTF8(base::StringPiece16(element.getAttribute("role")))); |
| 407 } else { | 422 } else { |
| 408 std::string role = GetEquivalentAriaRoleString(dst->role); | 423 std::string role = GetEquivalentAriaRoleString(dst->role); |
| 409 if (!role.empty()) | 424 if (!role.empty()) |
| 410 dst->AddStringAttribute(ui::AX_ATTR_ROLE, role); | 425 dst->AddStringAttribute(ui::AX_ATTR_ROLE, role); |
| 411 else if (dst->role == ui::AX_ROLE_TIME) | 426 else if (dst->role == ui::AX_ROLE_TIME) |
| 412 dst->AddStringAttribute(ui::AX_ATTR_ROLE, "time"); | 427 dst->AddStringAttribute(ui::AX_ATTR_ROLE, "time"); |
| 413 } | 428 } |
| 414 | 429 |
| 415 // Browser plugin (used in a <webview>). | 430 // Browser plugin (used in a <webview>). |
| 416 if (node_to_browser_plugin_instance_id_map_) { | 431 if (node_to_browser_plugin_instance_id_map_) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 437 } | 452 } |
| 438 } | 453 } |
| 439 } | 454 } |
| 440 | 455 |
| 441 if (src.isInLiveRegion()) { | 456 if (src.isInLiveRegion()) { |
| 442 dst->AddBoolAttribute(ui::AX_ATTR_LIVE_ATOMIC, src.liveRegionAtomic()); | 457 dst->AddBoolAttribute(ui::AX_ATTR_LIVE_ATOMIC, src.liveRegionAtomic()); |
| 443 dst->AddBoolAttribute(ui::AX_ATTR_LIVE_BUSY, src.liveRegionBusy()); | 458 dst->AddBoolAttribute(ui::AX_ATTR_LIVE_BUSY, src.liveRegionBusy()); |
| 444 if (src.liveRegionBusy()) | 459 if (src.liveRegionBusy()) |
| 445 dst->state |= (1 << ui::AX_STATE_BUSY); | 460 dst->state |= (1 << ui::AX_STATE_BUSY); |
| 446 if (!src.liveRegionStatus().isEmpty()) { | 461 if (!src.liveRegionStatus().isEmpty()) { |
| 447 dst->AddStringAttribute(ui::AX_ATTR_LIVE_STATUS, | 462 dst->AddStringAttribute( |
| 448 UTF16ToUTF8(src.liveRegionStatus())); | 463 ui::AX_ATTR_LIVE_STATUS, |
| 464 UTF16ToUTF8(base::StringPiece16(src.liveRegionStatus()))); |
| 449 } | 465 } |
| 450 dst->AddStringAttribute(ui::AX_ATTR_LIVE_RELEVANT, | 466 dst->AddStringAttribute( |
| 451 UTF16ToUTF8(src.liveRegionRelevant())); | 467 ui::AX_ATTR_LIVE_RELEVANT, |
| 468 UTF16ToUTF8(base::StringPiece16(src.liveRegionRelevant()))); |
| 452 dst->AddBoolAttribute(ui::AX_ATTR_CONTAINER_LIVE_ATOMIC, | 469 dst->AddBoolAttribute(ui::AX_ATTR_CONTAINER_LIVE_ATOMIC, |
| 453 src.containerLiveRegionAtomic()); | 470 src.containerLiveRegionAtomic()); |
| 454 dst->AddBoolAttribute(ui::AX_ATTR_CONTAINER_LIVE_BUSY, | 471 dst->AddBoolAttribute(ui::AX_ATTR_CONTAINER_LIVE_BUSY, |
| 455 src.containerLiveRegionBusy()); | 472 src.containerLiveRegionBusy()); |
| 456 dst->AddStringAttribute(ui::AX_ATTR_CONTAINER_LIVE_STATUS, | 473 dst->AddStringAttribute( |
| 457 UTF16ToUTF8(src.containerLiveRegionStatus())); | 474 ui::AX_ATTR_CONTAINER_LIVE_STATUS, |
| 458 dst->AddStringAttribute(ui::AX_ATTR_CONTAINER_LIVE_RELEVANT, | 475 UTF16ToUTF8(base::StringPiece16(src.containerLiveRegionStatus()))); |
| 459 UTF16ToUTF8(src.containerLiveRegionRelevant())); | 476 dst->AddStringAttribute( |
| 477 ui::AX_ATTR_CONTAINER_LIVE_RELEVANT, |
| 478 UTF16ToUTF8(base::StringPiece16(src.containerLiveRegionRelevant()))); |
| 460 } | 479 } |
| 461 | 480 |
| 462 if (dst->role == ui::AX_ROLE_PROGRESS_INDICATOR || | 481 if (dst->role == ui::AX_ROLE_PROGRESS_INDICATOR || |
| 463 dst->role == ui::AX_ROLE_METER || | 482 dst->role == ui::AX_ROLE_METER || |
| 464 dst->role == ui::AX_ROLE_SCROLL_BAR || | 483 dst->role == ui::AX_ROLE_SCROLL_BAR || |
| 465 dst->role == ui::AX_ROLE_SLIDER || | 484 dst->role == ui::AX_ROLE_SLIDER || |
| 466 dst->role == ui::AX_ROLE_SPIN_BUTTON) { | 485 dst->role == ui::AX_ROLE_SPIN_BUTTON) { |
| 467 dst->AddFloatAttribute(ui::AX_ATTR_VALUE_FOR_RANGE, src.valueForRange()); | 486 dst->AddFloatAttribute(ui::AX_ATTR_VALUE_FOR_RANGE, src.valueForRange()); |
| 468 dst->AddFloatAttribute(ui::AX_ATTR_MAX_VALUE_FOR_RANGE, | 487 dst->AddFloatAttribute(ui::AX_ATTR_MAX_VALUE_FOR_RANGE, |
| 469 src.maxValueForRange()); | 488 src.maxValueForRange()); |
| 470 dst->AddFloatAttribute(ui::AX_ATTR_MIN_VALUE_FOR_RANGE, | 489 dst->AddFloatAttribute(ui::AX_ATTR_MIN_VALUE_FOR_RANGE, |
| 471 src.minValueForRange()); | 490 src.minValueForRange()); |
| 472 } | 491 } |
| 473 | 492 |
| 474 if (dst->role == ui::AX_ROLE_WEB_AREA) { | 493 if (dst->role == ui::AX_ROLE_WEB_AREA) { |
| 475 dst->AddStringAttribute(ui::AX_ATTR_HTML_TAG, "#document"); | 494 dst->AddStringAttribute(ui::AX_ATTR_HTML_TAG, "#document"); |
| 476 const WebDocument& document = src.document(); | 495 const WebDocument& document = src.document(); |
| 477 if (name.empty()) | 496 if (name.empty()) |
| 478 name = UTF16ToUTF8(document.title()); | 497 name = UTF16ToUTF8(base::StringPiece16(document.title())); |
| 479 dst->AddStringAttribute(ui::AX_ATTR_DOC_TITLE, | 498 dst->AddStringAttribute( |
| 480 UTF16ToUTF8(document.title())); | 499 ui::AX_ATTR_DOC_TITLE, |
| 500 UTF16ToUTF8(base::StringPiece16(document.title()))); |
| 481 dst->AddStringAttribute(ui::AX_ATTR_DOC_URL, document.url().spec()); | 501 dst->AddStringAttribute(ui::AX_ATTR_DOC_URL, document.url().spec()); |
| 482 dst->AddStringAttribute( | 502 dst->AddStringAttribute( |
| 483 ui::AX_ATTR_DOC_MIMETYPE, | 503 ui::AX_ATTR_DOC_MIMETYPE, |
| 484 document.isXHTMLDocument() ? "text/xhtml" : "text/html"); | 504 document.isXHTMLDocument() ? "text/xhtml" : "text/html"); |
| 485 dst->AddBoolAttribute(ui::AX_ATTR_DOC_LOADED, src.isLoaded()); | 505 dst->AddBoolAttribute(ui::AX_ATTR_DOC_LOADED, src.isLoaded()); |
| 486 dst->AddFloatAttribute(ui::AX_ATTR_DOC_LOADING_PROGRESS, | 506 dst->AddFloatAttribute(ui::AX_ATTR_DOC_LOADING_PROGRESS, |
| 487 src.estimatedLoadingProgress()); | 507 src.estimatedLoadingProgress()); |
| 488 | 508 |
| 489 const WebDocumentType& doctype = document.doctype(); | 509 const WebDocumentType& doctype = document.doctype(); |
| 490 if (!doctype.isNull()) { | 510 if (!doctype.isNull()) { |
| 491 dst->AddStringAttribute(ui::AX_ATTR_DOC_DOCTYPE, | 511 dst->AddStringAttribute( |
| 492 UTF16ToUTF8(doctype.name())); | 512 ui::AX_ATTR_DOC_DOCTYPE, |
| 513 UTF16ToUTF8(base::StringPiece16(doctype.name()))); |
| 493 } | 514 } |
| 494 | 515 |
| 495 } | 516 } |
| 496 | 517 |
| 497 if (dst->role == ui::AX_ROLE_TABLE) { | 518 if (dst->role == ui::AX_ROLE_TABLE) { |
| 498 int column_count = src.columnCount(); | 519 int column_count = src.columnCount(); |
| 499 int row_count = src.rowCount(); | 520 int row_count = src.rowCount(); |
| 500 if (column_count > 0 && row_count > 0) { | 521 if (column_count > 0 && row_count > 0) { |
| 501 std::set<int32> unique_cell_id_set; | 522 std::set<int32> unique_cell_id_set; |
| 502 std::vector<int32> cell_ids; | 523 std::vector<int32> cell_ids; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 } | 635 } |
| 615 } | 636 } |
| 616 | 637 |
| 617 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { | 638 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { |
| 618 if (render_frame_ && render_frame_->GetWebFrame()) | 639 if (render_frame_ && render_frame_->GetWebFrame()) |
| 619 return render_frame_->GetWebFrame()->document(); | 640 return render_frame_->GetWebFrame()->document(); |
| 620 return WebDocument(); | 641 return WebDocument(); |
| 621 } | 642 } |
| 622 | 643 |
| 623 } // namespace content | 644 } // namespace content |
| OLD | NEW |