[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
cfleizach at apple.com
cfleizach at apple.com
Wed Dec 22 13:26:34 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 59dc4358b1855cde908cde466384ba4727ac8438
Author: cfleizach at apple.com <cfleizach at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Sep 15 17:07:46 2010 +0000
AX: when text is auto-truncated, accessibility bounds are wrong
https://bugs.webkit.org/show_bug.cgi?id=45793
Reviewed by Simon Fraser.
WebCore:
Allow accessibility to retrieve the absoluteQuads of a text node that
clips to the ellipsis.
Test: accessibility/ellipsis-text.html
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::boundingBoxRect):
* rendering/RenderText.cpp:
(WebCore::ellipsisRectForBox):
Make a common method to retrieve the ellipsis rect.
(WebCore::RenderText::absoluteQuads):
Default into the absoluteQuads method that allows for ellipsis clipping.
(WebCore::RenderText::selectionRectForRepaint):
Use the common method for retrieving the ellipsis.
* rendering/RenderText.h:
LayoutTests:
* accessibility/ellipsis-text-expected.txt: Added.
* accessibility/ellipsis-text.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67561 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index e8fcb27..7fcf0ed 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-09-15 Chris Fleizach <cfleizach at apple.com>
+
+ Reviewed by Simon Fraser.
+
+ AX: when text is auto-truncated, accessibility bounds are wrong
+ https://bugs.webkit.org/show_bug.cgi?id=45793
+
+ * accessibility/ellipsis-text-expected.txt: Added.
+ * accessibility/ellipsis-text.html: Added.
+
2010-09-15 Ariya Hidayat <ariya at sencha.com>
[Qt] Improve the speed of blur shadow
diff --git a/LayoutTests/accessibility/ellipsis-text-expected.txt b/LayoutTests/accessibility/ellipsis-text-expected.txt
new file mode 100644
index 0000000..4e6de21
--- /dev/null
+++ b/LayoutTests/accessibility/ellipsis-text-expected.txt
@@ -0,0 +1,14 @@
+text
+My Writing Nook for iPad. More text, more text, more text.
+My Writing Nook for iPad. More text, more text, more text.
+text
+This test makes sure that the bounds of text that overflows with ellipsis is correct (shortened to the ellipsis that is).
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS clippedWidth < fullWidth is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/accessibility/ellipsis-text.html b/LayoutTests/accessibility/ellipsis-text.html
new file mode 100644
index 0000000..c409a33
--- /dev/null
+++ b/LayoutTests/accessibility/ellipsis-text.html
@@ -0,0 +1,43 @@
+<html>
+<html>
+<head>
+<link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
+<script>
+var successfullyParsed = false;
+</script>
+<script src="../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+text
+<div id="text-ellipsis" tabindex="0" style="width:50px; text-overflow:ellipsis; overflow:hidden; white-space: nowrap;" class="name">My Writing Nook for iPad. More text, more text, more text.</div>
+<div id="text-noellipsis" tabindex="0" style="width:50px; white-space: nowrap;" class="name">My Writing Nook for iPad. More text, more text, more text.</div>
+text
+
+ <p id="description"></p>
+ <div id="console"></div>
+
+ <script>
+ if (window.accessibilityController) {
+ description("This test makes sure that the bounds of text that overflows with ellipsis is correct (shortened to the ellipsis that is).");
+
+ // The width of the ellipsis text should be short.
+ document.getElementById("text-ellipsis").focus();
+ var textContainer = accessibilityController.focusedElement;
+ var textNode = textContainer.childAtIndex(0);
+ var clippedWidth = textNode.width;
+
+ // The width of non-ellipsis'd text should be longer.
+ document.getElementById("text-noellipsis").focus();
+ textContainer = accessibilityController.focusedElement;
+ textNode = textContainer.childAtIndex(0);
+ var fullWidth = textNode.width;
+
+ shouldBeTrue("clippedWidth < fullWidth");
+ }
+ successfullyParsed = true;
+ </script>
+
+<script src="../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 375ad1c..e6920e0 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,26 @@
+2010-09-15 Chris Fleizach <cfleizach at apple.com>
+
+ Reviewed by Simon Fraser.
+
+ AX: when text is auto-truncated, accessibility bounds are wrong
+ https://bugs.webkit.org/show_bug.cgi?id=45793
+
+ Allow accessibility to retrieve the absoluteQuads of a text node that
+ clips to the ellipsis.
+
+ Test: accessibility/ellipsis-text.html
+
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::boundingBoxRect):
+ * rendering/RenderText.cpp:
+ (WebCore::ellipsisRectForBox):
+ Make a common method to retrieve the ellipsis rect.
+ (WebCore::RenderText::absoluteQuads):
+ Default into the absoluteQuads method that allows for ellipsis clipping.
+ (WebCore::RenderText::selectionRectForRepaint):
+ Use the common method for retrieving the ellipsis.
+ * rendering/RenderText.h:
+
2010-09-15 Ariya Hidayat <ariya at sencha.com>
[Qt] Improve the speed of blur shadow
diff --git a/WebCore/accessibility/AccessibilityRenderObject.cpp b/WebCore/accessibility/AccessibilityRenderObject.cpp
index acb9051..b2c5023 100644
--- a/WebCore/accessibility/AccessibilityRenderObject.cpp
+++ b/WebCore/accessibility/AccessibilityRenderObject.cpp
@@ -1392,7 +1392,9 @@ IntRect AccessibilityRenderObject::boundingBoxRect() const
// absoluteFocusRingQuads will query the hierarchy below this element, which for large webpages can be very slow.
// For a web area, which will have the most elements of any element, absoluteQuads should be used.
Vector<FloatQuad> quads;
- if (obj->isText() || isWebArea())
+ if (obj->isText())
+ toRenderText(obj)->absoluteQuads(quads, RenderText::ClipToEllipsis);
+ else if (isWebArea())
obj->absoluteQuads(quads);
else
obj->absoluteFocusRingQuads(quads);
diff --git a/WebCore/rendering/RenderText.cpp b/WebCore/rendering/RenderText.cpp
index da152b0..d786e6a 100644
--- a/WebCore/rendering/RenderText.cpp
+++ b/WebCore/rendering/RenderText.cpp
@@ -310,10 +310,46 @@ void RenderText::absoluteRectsForRange(Vector<IntRect>& rects, unsigned start, u
}
}
+static IntRect ellipsisRectForBox(InlineTextBox* box, unsigned startPos, unsigned endPos)
+{
+ if (!box)
+ return IntRect();
+
+ unsigned short truncation = box->truncation();
+ if (truncation == cNoTruncation)
+ return IntRect();
+
+ IntRect rect;
+ if (EllipsisBox* ellipsis = box->root()->ellipsisBox()) {
+ int ellipsisStartPosition = max<int>(startPos - box->start(), 0);
+ int ellipsisEndPosition = min<int>(endPos - box->start(), box->len());
+
+ // The ellipsis should be considered to be selected if the end of
+ // the selection is past the beginning of the truncation and the
+ // beginning of the selection is before or at the beginning of the truncation.
+ if (ellipsisEndPosition >= truncation && ellipsisStartPosition <= truncation)
+ return ellipsis->selectionRect(0, 0);
+ }
+
+ return IntRect();
+}
+
+void RenderText::absoluteQuads(Vector<FloatQuad>& quads, ClippingOption option)
+{
+ for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) {
+ IntRect boundaries = box->calculateBoundaries();
+
+ // Shorten the width of this text box if it ends in an ellipsis.
+ IntRect ellipsisRect = (option == ClipToEllipsis) ? ellipsisRectForBox(box, 0, textLength()) : IntRect();
+ if (!ellipsisRect.isEmpty())
+ boundaries.setWidth(ellipsisRect.right() - boundaries.x());
+ quads.append(localToAbsoluteQuad(FloatRect(boundaries)));
+ }
+}
+
void RenderText::absoluteQuads(Vector<FloatQuad>& quads)
{
- for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox())
- quads.append(localToAbsoluteQuad(FloatRect(box->calculateBoundaries())));
+ absoluteQuads(quads, NoClipping);
}
void RenderText::absoluteQuadsForRange(Vector<FloatQuad>& quads, unsigned start, unsigned end, bool useSelectionHeight)
@@ -1270,7 +1306,7 @@ IntRect RenderText::selectionRectForRepaint(RenderBoxModelObject* repaintContain
if (selectionState() == SelectionNone)
return IntRect();
- RenderBlock* cb = containingBlock();
+ RenderBlock* cb = containingBlock();
if (!cb)
return IntRect();
@@ -1295,21 +1331,7 @@ IntRect RenderText::selectionRectForRepaint(RenderBoxModelObject* repaintContain
IntRect rect;
for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) {
rect.unite(box->selectionRect(0, 0, startPos, endPos));
-
- // Check if there are ellipsis which fall within the selection.
- unsigned short truncation = box->truncation();
- if (truncation != cNoTruncation) {
- if (EllipsisBox* ellipsis = box->root()->ellipsisBox()) {
- int ePos = min<int>(endPos - box->start(), box->len());
- int sPos = max<int>(startPos - box->start(), 0);
- // The ellipsis should be considered to be selected if the end of
- // the selection is past the beginning of the truncation and the
- // beginning of the selection is before or at the beginning of the
- // truncation.
- if (ePos >= truncation && sPos <= truncation)
- rect.unite(ellipsis->selectionRect(0, 0));
- }
- }
+ rect.unite(ellipsisRectForBox(box, startPos, endPos));
}
if (clipToVisibleContent)
diff --git a/WebCore/rendering/RenderText.h b/WebCore/rendering/RenderText.h
index 5d289d7..6ab73f6 100644
--- a/WebCore/rendering/RenderText.h
+++ b/WebCore/rendering/RenderText.h
@@ -62,6 +62,9 @@ public:
virtual void absoluteQuads(Vector<FloatQuad>&);
void absoluteQuadsForRange(Vector<FloatQuad>&, unsigned startOffset = 0, unsigned endOffset = UINT_MAX, bool useSelectionHeight = false);
+ enum ClippingOption { NoClipping, ClipToEllipsis };
+ void absoluteQuads(Vector<FloatQuad>&, ClippingOption option = NoClipping);
+
virtual VisiblePosition positionForPoint(const IntPoint&);
const UChar* characters() const { return m_text.characters(); }
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list