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

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

Issue 300223009: Implement basic parts of hit regions on canvas2d. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add clip tests Created 6 years, 6 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
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 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 1240
1241 return String(); 1241 return String();
1242 } 1242 }
1243 1243
1244 LayoutRect AXNodeObject::elementRect() const 1244 LayoutRect AXNodeObject::elementRect() const
1245 { 1245 {
1246 // First check if it has a custom rect, for example if this element is tied to a canvas path. 1246 // First check if it has a custom rect, for example if this element is tied to a canvas path.
1247 if (!m_explicitElementRect.isEmpty()) 1247 if (!m_explicitElementRect.isEmpty())
1248 return m_explicitElementRect; 1248 return m_explicitElementRect;
1249 1249
1250 if (node()->parentElement()->isInCanvasSubtree()) {
dmazzoni 2014/06/09 07:27:26 OK for now, but add a FIXME indicating that this i
zino 2014/06/10 10:09:34 Done.
1251 LayoutRect rect;
1252
1253 for (Node* child = node()->firstChild(); child; child = child->nextSibli ng()) {
1254 if (child->isHTMLElement()) {
1255 if (AXObject* obj = axObjectCache()->get(child)) {
1256 if (rect.isEmpty())
1257 rect = obj->elementRect();
1258 else
1259 rect.unite(obj->elementRect());
1260 }
1261 }
1262 }
1263
1264 return rect;
dmazzoni 2014/06/09 07:27:26 If the resulting rect is still empty, fall through
zino 2014/06/10 10:09:34 Done.
1265 }
1266
1250 // AXNodeObjects have no mechanism yet to return a size or position. 1267 // AXNodeObjects have no mechanism yet to return a size or position.
dmazzoni 2014/06/09 07:27:26 Delete this first bit of the comment and change it
zino 2014/06/10 10:09:34 Done.
1251 // For now, let's return the position of the ancestor that does have a posit ion, 1268 // For now, let's return the position of the ancestor that does have a posit ion,
1252 // and make it the width of that parent, and about the height of a line of t ext, so that it's clear the object is a child of the parent. 1269 // and make it the width of that parent, and about the height of a line of t ext, so that it's clear the object is a child of the parent.
1253 1270
1254 LayoutRect boundingBox; 1271 LayoutRect boundingBox;
1255 1272
1256 for (AXObject* positionProvider = parentObject(); positionProvider; position Provider = positionProvider->parentObject()) { 1273 for (AXObject* positionProvider = parentObject(); positionProvider; position Provider = positionProvider->parentObject()) {
1257 if (positionProvider->isAXRenderObject()) { 1274 if (positionProvider->isAXRenderObject()) {
1258 LayoutRect parentRect = positionProvider->elementRect(); 1275 LayoutRect parentRect = positionProvider->elementRect();
1259 boundingBox.setSize(LayoutSize(parentRect.width(), LayoutUnit(std::m in(10.0f, parentRect.height().toFloat())))); 1276 boundingBox.setSize(LayoutSize(parentRect.width(), LayoutUnit(std::m in(10.0f, parentRect.height().toFloat()))));
1260 boundingBox.setLocation(parentRect.location()); 1277 boundingBox.setLocation(parentRect.location());
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
1681 float range = maxValueForRange() - minValueForRange(); 1698 float range = maxValueForRange() - minValueForRange();
1682 float value = valueForRange(); 1699 float value = valueForRange();
1683 1700
1684 value += range * (percentChange / 100); 1701 value += range * (percentChange / 100);
1685 setValue(String::number(value)); 1702 setValue(String::number(value));
1686 1703
1687 axObjectCache()->postNotification(node(), AXObjectCache::AXValueChanged, tru e); 1704 axObjectCache()->postNotification(node(), AXObjectCache::AXValueChanged, tru e);
1688 } 1705 }
1689 1706
1690 } // namespace WebCore 1707 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698