Bug 476927. Pad out the glyph extents of Quartz text to account for possible antialiased pixels outside the regular bounds. r=roc

--HG--
extra : rebase_source : 7f5d7111ed0eb0e89f13c91e94d363739a60973e
This commit is contained in:
Jonathan Kew 2009-06-15 10:00:12 +12:00
parent 5b324ecb50
commit 310e2bcc62
13 changed files with 71 additions and 13 deletions

View File

@ -84,6 +84,12 @@ public:
virtual void SetupGlyphExtents(gfxContext *aContext, PRUint32 aGlyphID,
PRBool aNeedTight, gfxGlyphExtents *aExtents);
virtual RunMetrics Measure(gfxTextRun *aTextRun,
PRUint32 aStart, PRUint32 aEnd,
BoundingBoxType aBoundingBoxType,
gfxContext *aContextForTightBoundingBox,
Spacing *aSpacing);
PRBool TestCharacterMap(PRUint32 aCh);
MacOSFontEntry* GetFontEntry();

View File

@ -98,6 +98,12 @@ public:
return mSpaceGlyph;
}
virtual RunMetrics Measure(gfxTextRun *aTextRun,
PRUint32 aStart, PRUint32 aEnd,
BoundingBoxType aBoundingBoxType,
gfxContext *aContextForTightBoundingBox,
Spacing *aSpacing);
PRBool TestCharacterMap(PRUint32 aCh);
MacOSFontEntry* GetFontEntry();

View File

@ -483,6 +483,28 @@ gfxAtsuiFont::SetupGlyphExtents(gfxContext *aContext, PRUint32 aGlyphID,
aExtents->SetTightGlyphExtents(aGlyphID, bounds);
}
gfxFont::RunMetrics
gfxAtsuiFont::Measure(gfxTextRun *aTextRun,
PRUint32 aStart, PRUint32 aEnd,
BoundingBoxType aBoundingBoxType,
gfxContext *aRefContext,
Spacing *aSpacing)
{
gfxFont::RunMetrics metrics =
gfxFont::Measure(aTextRun, aStart, aEnd,
aBoundingBoxType, aRefContext, aSpacing);
// if aBoundingBoxType is not TIGHT_HINTED_OUTLINE_EXTENTS then we need to add
// a pixel column each side of the bounding box in case of antialiasing "bleed"
if (aBoundingBoxType != TIGHT_HINTED_OUTLINE_EXTENTS &&
metrics.mBoundingBox.size.width > 0) {
metrics.mBoundingBox.pos.x -= aTextRun->GetAppUnitsPerDevUnit();
metrics.mBoundingBox.size.width += aTextRun->GetAppUnitsPerDevUnit()*2;
}
return metrics;
}
PRBool
gfxAtsuiFont::HasMirroringInfo()
{

View File

@ -231,6 +231,28 @@ gfxCoreTextFont::GetCharHeight(PRUnichar aUniChar)
return 0;
}
gfxFont::RunMetrics
gfxCoreTextFont::Measure(gfxTextRun *aTextRun,
PRUint32 aStart, PRUint32 aEnd,
BoundingBoxType aBoundingBoxType,
gfxContext *aRefContext,
Spacing *aSpacing)
{
gfxFont::RunMetrics metrics =
gfxFont::Measure(aTextRun, aStart, aEnd,
aBoundingBoxType, aRefContext, aSpacing);
// if aBoundingBoxType is not TIGHT_HINTED_OUTLINE_EXTENTS then we need to add
// a pixel column each side of the bounding box in case of antialiasing "bleed"
if (aBoundingBoxType != TIGHT_HINTED_OUTLINE_EXTENTS &&
metrics.mBoundingBox.size.width > 0) {
metrics.mBoundingBox.pos.x -= aTextRun->GetAppUnitsPerDevUnit();
metrics.mBoundingBox.size.width += aTextRun->GetAppUnitsPerDevUnit()*2;
}
return metrics;
}
gfxCoreTextFont::~gfxCoreTextFont()
{
cairo_scaled_font_destroy(mScaledFont);

View File

@ -8,12 +8,12 @@ select { width: 100%; -moz-box-sizing: border-box }
<body>
<div>
<select>
<option>This is option one</option>
<option>Here is option one</option>
</select>
</div>
<div>
<select size="3">
<option style="visibility: hidden">This is option one</option>
<option style="visibility: hidden">Here is option one</option>
</select>
<div>
</body>

View File

@ -7,12 +7,12 @@ option { padding-left: 100%; }
</head>
<body>
<select>
<option>This is option one</option>
<option>Here is option one</option>
</select>
</div>
<div>
<select size="3">
<option>This is option one</option>
<option>Here is option one</option>
</select>
<div>
</body>

View File

@ -7,12 +7,12 @@ select { width: -moz-available; }
</head>
<body>
<select>
<option>This is option one</option>
<option>Here is option one</option>
</select>
</div>
<div>
<select size="3">
<option style="visibility: hidden">This is option one</option>
<option style="visibility: hidden">Here is option one</option>
</select>
<div>
</body>

View File

@ -9,12 +9,12 @@ select { width: 100%; -moz-box-sizing: border-box }
<body>
<div>
<select>
<option>This is option one</option>
<option>Here is option one</option>
</select>
</div>
<div>
<select size="3">
<option style="visibility: hidden">This is option one</option>
<option style="visibility: hidden">Here is option one</option>
</select>
<div>
</body>

View File

@ -8,12 +8,12 @@ option { padding-left: 100%; }
</head>
<body>
<select>
<option>This is option one</option>
<option>Here is option one</option>
</select>
</div>
<div>
<select size="3">
<option>This is option one</option>
<option>Here is option one</option>
</select>
<div>
</body>

View File

@ -8,12 +8,12 @@ select { width: -moz-available; }
</head>
<body>
<select>
<option>This is option one</option>
<option>Here is option one</option>
</select>
</div>
<div>
<select size="3">
<option style="visibility: hidden">This is option one</option>
<option style="visibility: hidden">Here is option one</option>
</select>
<div>
</body>

View File

@ -7,6 +7,7 @@
<div style="-moz-column-width: 30px;
-moz-column-gap: 0px;
height: 0px;
font-family: sans-serif;
">
<div id="weirdDiv"
style="background: yellow;">ab</div>

View File

@ -13,6 +13,7 @@
<div style="-moz-column-width: 30px;
-moz-column-gap: 0px;
height: 0px;
font-family: sans-serif;
">
<div id="weirdDiv"
style="background: yellow;">a</div>

View File

@ -682,7 +682,7 @@ fails == 386147-1.html 386147-1-ref.html # bug 447460
== 387201-3.html about:blank # Really an assertion test rather than a rendering test
== 387344-1.html 387344-1-ref.html
== 387876-1.html 387876-1-ref.html
random == 387876-2.html 387876-2-ref.html # bug 471630
== 387876-2.html 387876-2-ref.html
== 387876-3a.html 387876-3-ref.html
== 387876-3b.html 387876-3-ref.html
== 388026-1.html 388026-1-ref.html