Commit 8f64980d authored by mitz@apple.com's avatar mitz@apple.com

WebCore: Complete the fix for hit-testing and selection highlighting in ligatures for the ATSUI

code path.

Reviewed by Sam Weinig.

* platform/graphics/mac/ComplexTextController.h: Added m_ltr member to ComplexTextRun.
* platform/graphics/mac/ComplexTextControllerATSUI.cpp:
(WebCore::ComplexTextController::ComplexTextRun::overrideLayoutOperation): Skip over deleted
glyphs, but update indexes and advances correctly.
(WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): Initialize m_ltr.

LayoutTests: Updated a test to account for font metric differences between Mac OS X versions. Removed
Leopard-specific results for another test now that Leopard matches current behavior.

Reviewed by Sam Weinig.

* platform/mac-leopard/fast/text/atsui-multiple-renderers-expected.checksum: Removed.
* platform/mac-leopard/fast/text/atsui-multiple-renderers-expected.png: Removed.
* platform/mac-leopard/fast/text/atsui-multiple-renderers-expected.txt: Removed.
* platform/mac/fast/text/ligature-subdivision-expected.txt:
* platform/mac/fast/text/script-tests/ligature-subdivision.js:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50312 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 803481d3
2009-10-29 Dan Bernstein <mitz@apple.com>
Reviewed by Sam Weinig.
Updated a test to account for font metric differences between Mac OS X versions. Removed
Leopard-specific results for another test now that Leopard matches current behavior.
* platform/mac-leopard/fast/text/atsui-multiple-renderers-expected.checksum: Removed.
* platform/mac-leopard/fast/text/atsui-multiple-renderers-expected.png: Removed.
* platform/mac-leopard/fast/text/atsui-multiple-renderers-expected.txt: Removed.
* platform/mac/fast/text/ligature-subdivision-expected.txt:
* platform/mac/fast/text/script-tests/ligature-subdivision.js:
2009-10-29 Enrica Casucci <enrica@apple.com>
REGRESSION(3.2.3 - 4.0.2): Message composing: when I undo a color change to text in Mail, undo/redo behaves strangely
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x576
RenderBlock {P} at (0,0) size 784x36
RenderText {#text} at (0,0) size 104x18
text run at (0,0) width 104: "This is a test for "
RenderInline {I} at (0,0) size 757x36
RenderText {#text} at (104,0) size 757x36
text run at (104,0) width 653: "http://bugzilla.opendarwin.org/show_bug.cgi?id=6139 ATSUI code path should implement small caps,"
text run at (0,18) width 403: "synthetic bold and oblique and correct metrics for fallback fonts"
RenderText {#text} at (403,18) size 4x18
text run at (403,18) width 4: "."
RenderBlock {HR} at (0,52) size 784x2 [border: (1px inset #000000)]
RenderBlock {P} at (0,70) size 784x18
RenderText {#text} at (0,0) size 600x18
text run at (0,0) width 600: "The two columns should be identical except for the accent over the e and the umlaut over the u."
RenderTable {TABLE} at (0,104) size 264x147 [border: none]
RenderTableSection {TBODY} at (0,0) size 263x146
RenderTableRow {TR} at (0,0) size 263x30
RenderTableCell {TD} at (0,0) size 132x30 [border: (1px solid #008000)] [r=0 c=0 rs=1 cs=1]
RenderText {#text} at (2,3) size 69x25
text run at (2,3) width 69: "Lore\x{300}m "
RenderInline {SPAN} at (0,0) size 50x23
RenderText {#text} at (71,5) size 50x23
text run at (71,5) width 50: "ipsu\x{308}m"
RenderText {#text} at (0,0) size 0x0
RenderTableCell {TD} at (132,0) size 131x30 [border: (1px solid #008000)] [r=0 c=1 rs=1 cs=1]
RenderText {#text} at (2,3) size 69x25
text run at (2,3) width 69: "Lorem "
RenderInline {SPAN} at (0,0) size 50x23
RenderText {#text} at (71,5) size 50x23
text run at (71,5) width 50: "ipsum"
RenderText {#text} at (0,0) size 0x0
RenderTableRow {TR} at (0,30) size 263x30
RenderTableCell {TD} at (0,30) size 132x30 [border: (1px solid #008000)] [r=1 c=0 rs=1 cs=1]
RenderText {#text} at (2,3) size 76x25
text run at (2,3) width 76: "Lore\x{300}m "
RenderInline {SPAN} at (0,0) size 53x23
RenderText {#text} at (78,5) size 53x23
text run at (78,5) width 53: "ipsu\x{308}m"
RenderText {#text} at (0,0) size 0x0
RenderTableCell {TD} at (132,30) size 131x30 [border: (1px solid #008000)] [r=1 c=1 rs=1 cs=1]
RenderText {#text} at (2,3) size 75x25
text run at (2,3) width 75: "Lorem "
RenderInline {SPAN} at (0,0) size 53x23
RenderText {#text} at (77,5) size 53x23
text run at (77,5) width 53: "ipsum"
RenderText {#text} at (0,0) size 0x0
RenderTableRow {TR} at (0,60) size 263x30
RenderTableCell {TD} at (0,60) size 132x30 [border: (1px solid #008000)] [r=2 c=0 rs=1 cs=1]
RenderText {#text} at (2,3) size 69x25
text run at (2,3) width 69: "Lore\x{300}m "
RenderInline {SPAN} at (0,0) size 48x23
RenderText {#text} at (71,5) size 48x23
text run at (71,5) width 48: "ipsu\x{308}m"
RenderText {#text} at (0,0) size 0x0
RenderTableCell {TD} at (132,60) size 131x30 [border: (1px solid #008000)] [r=2 c=1 rs=1 cs=1]
RenderText {#text} at (2,3) size 69x25
text run at (2,3) width 69: "Lorem "
RenderInline {SPAN} at (0,0) size 48x23
RenderText {#text} at (71,5) size 48x23
text run at (71,5) width 48: "ipsum"
RenderText {#text} at (0,0) size 0x0
RenderTableRow {TR} at (0,90) size 263x30
RenderTableCell {TD} at (0,90) size 132x30 [border: (1px solid #008000)] [r=3 c=0 rs=1 cs=1]
RenderText {#text} at (2,3) size 76x25
text run at (2,3) width 76: "Lore\x{300}m "
RenderInline {SPAN} at (0,0) size 51x23
RenderText {#text} at (78,5) size 51x23
text run at (78,5) width 51: "ipsu\x{308}m"
RenderText {#text} at (0,0) size 0x0
RenderTableCell {TD} at (132,90) size 131x30 [border: (1px solid #008000)] [r=3 c=1 rs=1 cs=1]
RenderText {#text} at (2,3) size 75x25
text run at (2,3) width 75: "Lorem "
RenderInline {SPAN} at (0,0) size 51x23
RenderText {#text} at (77,5) size 51x23
text run at (77,5) width 51: "ipsum"
RenderText {#text} at (0,0) size 0x0
RenderTableRow {TR} at (0,120) size 263x26
RenderTableCell {TD} at (0,120) size 132x26 [border: (1px solid #008000)] [r=4 c=0 rs=1 cs=1]
RenderText {#text} at (2,2) size 100x23
text run at (2,2) width 100: "Lore\x{300}m ipsu\x{308}m"
RenderTableCell {TD} at (132,120) size 131x26 [border: (1px solid #008000)] [r=4 c=1 rs=1 cs=1]
RenderText {#text} at (2,2) size 100x23
text run at (2,2) width 100: "Lorem ipsum"
RenderBlock {HR} at (0,259) size 784x2 [border: (1px inset #000000)]
RenderBlock {P} at (0,277) size 784x18
RenderText {#text} at (0,0) size 277x18
text run at (0,0) width 277: "The following two lines should be identical."
RenderBlock {P} at (0,311) size 784x24
RenderInline {SPAN} at (0,0) size 334x24 [border: (1px solid #008000)]
RenderText {#text} at (1,2) size 332x22
text run at (1,2) width 332: "\x{E01}\x{E02}\x{E03}\x{E04}\x{E05}\x{E06}\x{E07}\x{E08}\x{E01}\x{E02}\x{E03}\x{E04}\x{E05}\x{E06}\x{E07}\x{E08}\x{E01}\x{E02}\x{E03}\x{E04}\x{E05}\x{E06}\x{E07}\x{E08}\x{E01}\x{E02}\x{E03}\x{E04}\x{E05}\x{E06}\x{E07}\x{E08}"
RenderText {#text} at (0,0) size 0x0
RenderBlock {P} at (0,351) size 784x23
RenderInline {SPAN} at (0,0) size 334x23 [border: (1px solid #008000)]
RenderText {#text} at (1,2) size 332x21
text run at (1,2) width 332: "\x{E01}\x{E02}\x{E03}\x{E04}\x{E05}\x{E06}\x{E07}\x{E08}\x{E01}\x{E02}\x{E03}\x{E04}\x{E05}\x{E06}\x{E07}\x{E08}\x{E01}\x{E02}\x{E03}\x{E04}\x{E05}\x{E06}\x{E07}\x{E08}\x{E01}\x{E02}\x{E03}\x{E04}\x{E05}\x{E06}\x{E07}\x{E08}"
RenderText {#text} at (0,0) size 0x0
......@@ -14,7 +14,7 @@ PASS document.caretRangeFromPoint(x - 20, y).startOffset is 0
PASS document.caretRangeFromPoint(x - 50, y).startOffset is 1
PASS document.caretRangeFromPoint(x - 64, y).startOffset is 2
PASS document.caretRangeFromPoint(x - 90, y).startOffset is 3
PASS range.getBoundingClientRect().width is 65
PASS w === 65 || w === 61 is true
PASS successfullyParsed is true
TEST COMPLETE
......
......@@ -47,7 +47,9 @@ shouldBe('document.caretRangeFromPoint(x - 90, y).startOffset', '3');
range.setStart(arabic.firstChild, 0);
range.setEnd(arabic.firstChild, 2);
shouldBe('range.getBoundingClientRect().width', '65');
var w = range.getBoundingClientRect().width;
// Widths vary between Mac OS X Leopard and current Mac OS X.
shouldBeTrue('w === 65 || w === 61');
document.body.removeChild(arabic);
......
2009-10-29 Dan Bernstein <mitz@apple.com>
Reviewed by Sam Weinig.
Complete the fix for hit-testing and selection highlighting in ligatures for the ATSUI
code path.
* platform/graphics/mac/ComplexTextController.h: Added m_ltr member to ComplexTextRun.
* platform/graphics/mac/ComplexTextControllerATSUI.cpp:
(WebCore::ComplexTextController::ComplexTextRun::overrideLayoutOperation): Skip over deleted
glyphs, but update indexes and advances correctly.
(WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): Initialize m_ltr.
2009-10-29 Enrica Casucci <enrica@apple.com>
Reviewed by Darin Adler.
......@@ -118,7 +118,10 @@ private:
const CGGlyph* m_glyphs;
Vector<CGSize, 64> m_advancesVector;
const CGSize* m_advances;
#if USE(ATSUI)
bool m_ltr;
bool m_directionalOverride;
#endif
};
void collectComplexTextRuns();
......
......@@ -64,22 +64,34 @@ OSStatus ComplexTextController::ComplexTextRun::overrideLayoutOperation(ATSULayo
}
complexTextRun->m_glyphCount = count;
complexTextRun->m_glyphsVector.grow(count);
complexTextRun->m_glyphs = complexTextRun->m_glyphsVector.data();
complexTextRun->m_advancesVector.grow(count);
complexTextRun->m_advances = complexTextRun->m_advancesVector.data();
complexTextRun->m_indices.grow(count);
complexTextRun->m_glyphsVector.reserveCapacity(count);
complexTextRun->m_advancesVector.reserveCapacity(count);
complexTextRun->m_indices.reserveCapacity(count);
CGFloat lastX = FixedToFloat(layoutRecords[j].realPos);
bool atBeginning = true;
CGFloat lastX = 0;
for (ItemCount i = 0; i < count; ++i, ++j) {
complexTextRun->m_glyphsVector[i] = layoutRecords[j].glyphID;
complexTextRun->m_indices[i] = layoutRecords[j].originalOffset / 2 + indexOffset;
CGFloat x = FixedToFloat(layoutRecords[j + 1].realPos);
complexTextRun->m_advancesVector[i] = CGSizeMake(x - lastX, 0);
if (layoutRecords[j].glyphID == kATSDeletedGlyphcode) {
if (!complexTextRun->m_ltr && !(layoutRecords[j].flags & 0x800))
complexTextRun->m_indices[complexTextRun->m_indices.size() - 1] = layoutRecords[j].originalOffset / 2 + indexOffset;
complexTextRun->m_glyphCount--;
continue;
}
complexTextRun->m_glyphsVector.uncheckedAppend(layoutRecords[j].glyphID);
complexTextRun->m_indices.uncheckedAppend(layoutRecords[j].originalOffset / 2 + indexOffset);
CGFloat x = FixedToFloat(layoutRecords[j].realPos);
if (!atBeginning)
complexTextRun->m_advancesVector.uncheckedAppend(CGSizeMake(x - lastX, 0));
lastX = x;
atBeginning = false;
}
complexTextRun->m_advancesVector.uncheckedAppend(CGSizeMake(FixedToFloat(layoutRecords[j].realPos) - lastX, 0));
complexTextRun->m_glyphs = complexTextRun->m_glyphsVector.data();
complexTextRun->m_advances = complexTextRun->m_advancesVector.data();
status = ATSUDirectReleaseLayoutDataArrayPtr(atsuLineRef, kATSUDirectDataLayoutRecordATSLayoutRecordCurrent, reinterpret_cast<void**>(&layoutRecords));
*callbackStatus = kATSULayoutOperationCallbackStatusContinue;
return noErr;
......@@ -135,6 +147,7 @@ ComplexTextController::ComplexTextRun::ComplexTextRun(ATSUTextLayout atsuTextLay
, m_characters(characters)
, m_stringLocation(stringLocation)
, m_stringLength(stringLength)
, m_ltr(ltr)
, m_directionalOverride(directionalOverride)
{
OSStatus status;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment