OLD | NEW |
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 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1526 { | 1526 { |
1527 // First check if it has a custom rect, for example if this element is tied
to a canvas path. | 1527 // First check if it has a custom rect, for example if this element is tied
to a canvas path. |
1528 if (!m_explicitElementRect.isEmpty()) | 1528 if (!m_explicitElementRect.isEmpty()) |
1529 return m_explicitElementRect; | 1529 return m_explicitElementRect; |
1530 | 1530 |
1531 // FIXME: If there are a lot of elements in the canvas, it will be inefficie
nt. | 1531 // FIXME: If there are a lot of elements in the canvas, it will be inefficie
nt. |
1532 // We can avoid the inefficient calculations by using AXComputedObjectAttrib
uteCache. | 1532 // We can avoid the inefficient calculations by using AXComputedObjectAttrib
uteCache. |
1533 if (node()->parentElement()->isInCanvasSubtree()) { | 1533 if (node()->parentElement()->isInCanvasSubtree()) { |
1534 LayoutRect rect; | 1534 LayoutRect rect; |
1535 | 1535 |
1536 for (Node* child = node()->firstChild(); child; child = child->nextSibli
ng()) { | 1536 for (Node& child : NodeTraversal::childrenOf(*node())) { |
1537 if (child->isHTMLElement()) { | 1537 if (child.isHTMLElement()) { |
1538 if (AXObject* obj = axObjectCache()->get(child)) { | 1538 if (AXObject* obj = axObjectCache()->get(&child)) { |
1539 if (rect.isEmpty()) | 1539 if (rect.isEmpty()) |
1540 rect = obj->elementRect(); | 1540 rect = obj->elementRect(); |
1541 else | 1541 else |
1542 rect.unite(obj->elementRect()); | 1542 rect.unite(obj->elementRect()); |
1543 } | 1543 } |
1544 } | 1544 } |
1545 } | 1545 } |
1546 | 1546 |
1547 if (!rect.isEmpty()) | 1547 if (!rect.isEmpty()) |
1548 return rect; | 1548 return rect; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1623 | 1623 |
1624 if (!m_node) | 1624 if (!m_node) |
1625 return; | 1625 return; |
1626 | 1626 |
1627 m_haveChildren = true; | 1627 m_haveChildren = true; |
1628 | 1628 |
1629 // The only time we add children from the DOM tree to a node with a layoutOb
ject is when it's a canvas. | 1629 // The only time we add children from the DOM tree to a node with a layoutOb
ject is when it's a canvas. |
1630 if (layoutObject() && !isHTMLCanvasElement(*m_node)) | 1630 if (layoutObject() && !isHTMLCanvasElement(*m_node)) |
1631 return; | 1631 return; |
1632 | 1632 |
1633 for (Node* child = m_node->firstChild(); child; child = child->nextSibling()
) | 1633 for (Node& child : NodeTraversal::childrenOf(*m_node)) |
1634 addChild(axObjectCache()->getOrCreate(child)); | 1634 addChild(axObjectCache()->getOrCreate(&child)); |
1635 | 1635 |
1636 for (unsigned i = 0; i < m_children.size(); ++i) | 1636 for (unsigned i = 0; i < m_children.size(); ++i) |
1637 m_children[i].get()->setParent(this); | 1637 m_children[i].get()->setParent(this); |
1638 } | 1638 } |
1639 | 1639 |
1640 void AXNodeObject::addChild(AXObject* child) | 1640 void AXNodeObject::addChild(AXObject* child) |
1641 { | 1641 { |
1642 insertChild(child, m_children.size()); | 1642 insertChild(child, m_children.size()); |
1643 } | 1643 } |
1644 | 1644 |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |