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

Side by Side Diff: Source/core/accessibility/AXRenderObject.cpp

Issue 216343002: Add a test that confirms there's no crash on accessing properties of AccesibilityObject at the init… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: dmazzoni's review Created 6 years, 9 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 | « LayoutTests/fast/dom/Window/resources/window-property-collector.js ('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) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 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 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 String AXRenderObject::text() const 790 String AXRenderObject::text() const
791 { 791 {
792 if (isPasswordField()) 792 if (isPasswordField())
793 return String(); 793 return String();
794 794
795 return AXNodeObject::text(); 795 return AXNodeObject::text();
796 } 796 }
797 797
798 int AXRenderObject::textLength() const 798 int AXRenderObject::textLength() const
799 { 799 {
800 ASSERT(isTextControl()); 800 if (!isTextControl())
801 return -1;
801 802
802 if (isPasswordField()) 803 if (isPasswordField())
803 return -1; // need to return something distinct from 0 804 return -1; // need to return something distinct from 0
804 805
805 return text().length(); 806 return text().length();
806 } 807 }
807 808
808 KURL AXRenderObject::url() const 809 KURL AXRenderObject::url() const
809 { 810 {
810 if (isAnchor() && isHTMLAnchorElement(m_renderer->node())) { 811 if (isAnchor() && isHTMLAnchorElement(m_renderer->node())) {
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
1561 return 0; 1562 return 0;
1562 return toRenderWidget(m_renderer)->widget(); 1563 return toRenderWidget(m_renderer)->widget();
1563 } 1564 }
1564 1565
1565 // 1566 //
1566 // Selected text. 1567 // Selected text.
1567 // 1568 //
1568 1569
1569 AXObject::PlainTextRange AXRenderObject::selectedTextRange() const 1570 AXObject::PlainTextRange AXRenderObject::selectedTextRange() const
1570 { 1571 {
1571 ASSERT(isTextControl()); 1572 if (!isTextControl())
1573 return PlainTextRange();
1572 1574
1573 if (isPasswordField()) 1575 if (isPasswordField())
1574 return PlainTextRange(); 1576 return PlainTextRange();
1575 1577
1576 AccessibilityRole ariaRole = ariaRoleAttribute(); 1578 AccessibilityRole ariaRole = ariaRoleAttribute();
1577 if (isNativeTextControl() && ariaRole == UnknownRole && m_renderer->isTextCo ntrol()) { 1579 if (isNativeTextControl() && ariaRole == UnknownRole && m_renderer->isTextCo ntrol()) {
1578 HTMLTextFormControlElement* textControl = toRenderTextControl(m_renderer )->textFormControlElement(); 1580 HTMLTextFormControlElement* textControl = toRenderTextControl(m_renderer )->textFormControlElement();
1579 return PlainTextRange(textControl->selectionStart(), textControl->select ionEnd() - textControl->selectionStart()); 1581 return PlainTextRange(textControl->selectionStart(), textControl->select ionEnd() - textControl->selectionStart());
1580 } 1582 }
1581 1583
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
2342 if (label && label->renderer()) { 2344 if (label && label->renderer()) {
2343 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect(); 2345 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect();
2344 result.unite(labelRect); 2346 result.unite(labelRect);
2345 } 2347 }
2346 } 2348 }
2347 2349
2348 return result; 2350 return result;
2349 } 2351 }
2350 2352
2351 } // namespace WebCore 2353 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/Window/resources/window-property-collector.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698