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

Side by Side Diff: third_party/WebKit/Source/modules/accessibility/AXInlineTextBox.cpp

Issue 2372823002: Fix a case where the accessible bounding box of an inline text box was wrong. (Closed)
Patch Set: Fix bug in bounds calc uncovered by windows test Created 4 years, 2 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
« no previous file with comments | « third_party/WebKit/LayoutTests/accessibility/inline-text-bounds-for-range-br.html ('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) 2013, Google Inc. All rights reserved. 2 * Copyright (C) 2013, 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 AXObject::detach(); 59 AXObject::detach();
60 m_inlineTextBox = nullptr; 60 m_inlineTextBox = nullptr;
61 } 61 }
62 62
63 void AXInlineTextBox::getRelativeBounds(AXObject** outContainer, FloatRect& outB oundsInContainer, SkMatrix44& outContainerTransform) const 63 void AXInlineTextBox::getRelativeBounds(AXObject** outContainer, FloatRect& outB oundsInContainer, SkMatrix44& outContainerTransform) const
64 { 64 {
65 *outContainer = nullptr; 65 *outContainer = nullptr;
66 outBoundsInContainer = FloatRect(); 66 outBoundsInContainer = FloatRect();
67 outContainerTransform.setIdentity(); 67 outContainerTransform.setIdentity();
68 68
69 if (!m_inlineTextBox) 69 if (!m_inlineTextBox || !parentObject() || !parentObject()->getLayoutObject( ))
70 return; 70 return;
71 71
72 *outContainer = parentObject(); 72 *outContainer = parentObject();
73 outBoundsInContainer = FloatRect(m_inlineTextBox->localBounds()); 73 outBoundsInContainer = FloatRect(m_inlineTextBox->localBounds());
74
75 // Subtract the local bounding box of the parent because they're
76 // both in the same coordinate system.
77 LayoutObject* parentLayoutObject = parentObject()->getLayoutObject();
78 FloatRect parentBoundingBox = parentLayoutObject->localBoundingBoxRectForAcc essibility();
79 outBoundsInContainer.moveBy(-parentBoundingBox.location());
74 } 80 }
75 81
76 bool AXInlineTextBox::computeAccessibilityIsIgnored(IgnoredReasons* ignoredReaso ns) const 82 bool AXInlineTextBox::computeAccessibilityIsIgnored(IgnoredReasons* ignoredReaso ns) const
77 { 83 {
78 AXObject* parent = parentObject(); 84 AXObject* parent = parentObject();
79 if (!parent) 85 if (!parent)
80 return false; 86 return false;
81 87
82 if (!parent->accessibilityIsIgnored()) 88 if (!parent->accessibilityIsIgnored())
83 return false; 89 return false;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 if (previousOnLine) 182 if (previousOnLine)
177 return m_axObjectCache->getOrCreate(previousOnLine.get()); 183 return m_axObjectCache->getOrCreate(previousOnLine.get());
178 184
179 if (!m_inlineTextBox->isFirst()) 185 if (!m_inlineTextBox->isFirst())
180 return 0; 186 return 0;
181 187
182 return parentObject()->previousOnLine(); 188 return parentObject()->previousOnLine();
183 } 189 }
184 190
185 } // namespace blink 191 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/accessibility/inline-text-bounds-for-range-br.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698