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

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

Issue 495763005: Switch to using accessibilityEnabled and inlineTextBoxAccessibilityEnabled from settings (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: logspam Created 6 years, 4 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
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 26 matching lines...) Expand all
37 #include "core/accessibility/AXSpinButton.h" 37 #include "core/accessibility/AXSpinButton.h"
38 #include "core/accessibility/AXTable.h" 38 #include "core/accessibility/AXTable.h"
39 #include "core/dom/ElementTraversal.h" 39 #include "core/dom/ElementTraversal.h"
40 #include "core/dom/shadow/ShadowRoot.h" 40 #include "core/dom/shadow/ShadowRoot.h"
41 #include "core/editing/FrameSelection.h" 41 #include "core/editing/FrameSelection.h"
42 #include "core/editing/RenderedPosition.h" 42 #include "core/editing/RenderedPosition.h"
43 #include "core/editing/TextIterator.h" 43 #include "core/editing/TextIterator.h"
44 #include "core/editing/VisibleUnits.h" 44 #include "core/editing/VisibleUnits.h"
45 #include "core/editing/htmlediting.h" 45 #include "core/editing/htmlediting.h"
46 #include "core/frame/LocalFrame.h" 46 #include "core/frame/LocalFrame.h"
47 #include "core/frame/Settings.h"
47 #include "core/html/HTMLImageElement.h" 48 #include "core/html/HTMLImageElement.h"
48 #include "core/html/HTMLLabelElement.h" 49 #include "core/html/HTMLLabelElement.h"
49 #include "core/html/HTMLOptionElement.h" 50 #include "core/html/HTMLOptionElement.h"
50 #include "core/html/HTMLSelectElement.h" 51 #include "core/html/HTMLSelectElement.h"
51 #include "core/html/HTMLTextAreaElement.h" 52 #include "core/html/HTMLTextAreaElement.h"
52 #include "core/html/shadow/ShadowElementNames.h" 53 #include "core/html/shadow/ShadowElementNames.h"
53 #include "core/loader/ProgressTracker.h" 54 #include "core/loader/ProgressTracker.h"
54 #include "core/page/Page.h" 55 #include "core/page/Page.h"
55 #include "core/rendering/HitTestResult.h" 56 #include "core/rendering/HitTestResult.h"
56 #include "core/rendering/RenderFieldset.h" 57 #include "core/rendering/RenderFieldset.h"
(...skipping 1622 matching lines...) Expand 10 before | Expand all | Expand 10 after
1679 // Post that the specific row either collapsed or expanded. 1680 // Post that the specific row either collapsed or expanded.
1680 if (roleValue() == RowRole || roleValue() == TreeItemRole) 1681 if (roleValue() == RowRole || roleValue() == TreeItemRole)
1681 axObjectCache()->postNotification(this, document(), isExpanded() ? AXObj ectCache::AXRowExpanded : AXObjectCache::AXRowCollapsed, true); 1682 axObjectCache()->postNotification(this, document(), isExpanded() ? AXObj ectCache::AXRowExpanded : AXObjectCache::AXRowCollapsed, true);
1682 } 1683 }
1683 1684
1684 void AXRenderObject::textChanged() 1685 void AXRenderObject::textChanged()
1685 { 1686 {
1686 if (!m_renderer) 1687 if (!m_renderer)
1687 return; 1688 return;
1688 1689
1689 if (AXObjectCache::inlineTextBoxAccessibility() && roleValue() == StaticText Role) 1690 if (document()->settings() && document()->settings()->inlineTextBoxAccessibi lityEnabled() && roleValue() == StaticTextRole)
1690 childrenChanged(); 1691 childrenChanged();
1691 1692
1692 // Do this last - AXNodeObject::textChanged posts live region announcements, 1693 // Do this last - AXNodeObject::textChanged posts live region announcements,
1693 // and we should update the inline text boxes first. 1694 // and we should update the inline text boxes first.
1694 AXNodeObject::textChanged(); 1695 AXNodeObject::textChanged();
1695 } 1696 }
1696 1697
1697 // 1698 //
1698 // Text metrics. Most of these should be deprecated, needs major cleanup. 1699 // Text metrics. Most of these should be deprecated, needs major cleanup.
1699 // 1700 //
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1756 1757
1757 RefPtrWillBeRawPtr<Range> range = Range::create(m_renderer->document()); 1758 RefPtrWillBeRawPtr<Range> range = Range::create(m_renderer->document());
1758 range->setStart(node, 0, IGNORE_EXCEPTION); 1759 range->setStart(node, 0, IGNORE_EXCEPTION);
1759 range->setEnd(indexPosition, IGNORE_EXCEPTION); 1760 range->setEnd(indexPosition, IGNORE_EXCEPTION);
1760 1761
1761 return TextIterator::rangeLength(range.get()); 1762 return TextIterator::rangeLength(range.get());
1762 } 1763 }
1763 1764
1764 void AXRenderObject::addInlineTextBoxChildren() 1765 void AXRenderObject::addInlineTextBoxChildren()
1765 { 1766 {
1766 if (!axObjectCache()->inlineTextBoxAccessibility()) 1767 fprintf(stderr, "addInlineTextBoxChildren\n");
1768 if (!document()->settings() || !document()->settings()->inlineTextBoxAccessi bilityEnabled()) {
1769 fprintf(stderr, "document->settings(): %p; document->settings()->inlineTex tBoxAccessibilityEnabled(): %d\n", document()->settings(), document()->settings( ) ? document()->settings()->inlineTextBoxAccessibilityEnabled() : 0);
1767 return; 1770 return;
1771 }
1768 1772
1769 if (!renderer() || !renderer()->isText()) 1773 if (!renderer() || !renderer()->isText()) {
1774 fprintf(stderr, "!renderer() %p || !renderer()->isText()\n", renderer()) ;
1770 return; 1775 return;
1771 1776 }
1772 if (renderer()->needsLayout()) { 1777 if (renderer()->needsLayout()) {
1778 fprintf(stderr, "needsLayout\n");
1773 // If a RenderText needs layout, its inline text boxes are either 1779 // If a RenderText needs layout, its inline text boxes are either
1774 // nonexistent or invalid, so defer until the layout happens and 1780 // nonexistent or invalid, so defer until the layout happens and
1775 // the renderer calls AXObjectCache::inlineTextBoxesUpdated. 1781 // the renderer calls AXObjectCache::inlineTextBoxesUpdated.
1776 return; 1782 return;
1777 } 1783 }
1778 1784
1779 RenderText* renderText = toRenderText(renderer()); 1785 RenderText* renderText = toRenderText(renderer());
1780 for (RefPtr<AbstractInlineTextBox> box = renderText->firstAbstractInlineText Box(); box.get(); box = box->nextInlineTextBox()) { 1786 for (RefPtr<AbstractInlineTextBox> box = renderText->firstAbstractInlineText Box(); box.get(); box = box->nextInlineTextBox()) {
1781 AXObject* axObject = axObjectCache()->getOrCreate(box.get()); 1787 AXObject* axObject = axObjectCache()->getOrCreate(box.get());
1788 fprintf(stderr, "found textbox\n");
1782 if (!axObject->accessibilityIsIgnored()) 1789 if (!axObject->accessibilityIsIgnored())
1783 m_children.append(axObject); 1790 m_children.append(axObject);
1791 else
1792 fprintf(stderr, "accessibilityIsIgnored\n");
1784 } 1793 }
1785 } 1794 }
1786 1795
1787 void AXRenderObject::lineBreaks(Vector<int>& lineBreaks) const 1796 void AXRenderObject::lineBreaks(Vector<int>& lineBreaks) const
1788 { 1797 {
1789 if (!isTextControl()) 1798 if (!isTextControl())
1790 return; 1799 return;
1791 1800
1792 VisiblePosition visiblePos = visiblePositionForIndex(0); 1801 VisiblePosition visiblePos = visiblePositionForIndex(0);
1793 VisiblePosition savedVisiblePos = visiblePos; 1802 VisiblePosition savedVisiblePos = visiblePos;
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
2314 if (label && label->renderer()) { 2323 if (label && label->renderer()) {
2315 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect(); 2324 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect();
2316 result.unite(labelRect); 2325 result.unite(labelRect);
2317 } 2326 }
2318 } 2327 }
2319 2328
2320 return result; 2329 return result;
2321 } 2330 }
2322 2331
2323 } // namespace blink 2332 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698